设置单卡可刷卡

时间:2013-09-21 21:36:38

标签: android

我正在使用Nadav Fima's CardUILib,我想要从卡片组合中刷出一张卡片。有没有办法做到这一点。

这就是我到目前为止所做的事情:

public class MainActivity extends Activity {

private CardUI mCardViewSwipe;
private CardUI mCardView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // init CardView
    mCardViewSwipe = (CardUI) findViewById(R.id.cardsview);
    mCardViewSwipe.setSwipeable(true);

    String installed_player  =   "com.adobe.flashplayer";  

    boolean installed  =   appInstalledOrNot("com.adobe.flashplayer");  
    if(installed)
    {

             Log.w("Flash-Playre Intalled _ ", installed_player);


    }
    else
    {
        mCardViewSwipe.addCard(new MyImageCard("No Adobe Flash Found", "Adobe Flash is required to use some of the features in this app.\nPress Here to Download Adobe Flash", 0));  //card to make swipeable


    mCardViewSwipe.refresh();

    }
    // init CardView
    mCardView = (CardUI) findViewById(R.id.cardsview);
    mCardView.setSwipeable(false);


    CardStack Links=new CardStack();
    MyImageCard Schedule = new MyImageCard("Schedules and Notices","Tap Here To Visit Schedules and Notices", R.drawable.siteshot);
    Schedule.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("http://dpsrkp.net/notices/?categ=notices"));
            startActivity(intent);

        }
    });
    Links.add(Schedule);

    MyImageCard OfficialWeb = new MyImageCard("Visit Official Website","Tap Here To Visit the Official Website", R.drawable.siteshot);
    OfficialWeb.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("http://www.dpsrkp.net/"));
            startActivity(intent);

        }
    });
    Links.add(OfficialWeb);

    mCardViewSwipe.addStack(Links);

    TitleOnlyCard About = new TitleOnlyCard("About App");
    About.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v){
            Intent AboutIntent = new Intent(getBaseContext(), AboutApp.class);
            startActivity(AboutIntent);
        }

    });
    mCardView.addCard(About);       


    // draw cards

    mCardView.refresh();

}



@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}




private boolean appInstalledOrNot(String uri)
{
    PackageManager pm = getPackageManager();
    boolean app_installed = false;
    try
    {
           pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
           app_installed = true;
    }
    catch (PackageManager.NameNotFoundException e)
    {
           app_installed = false;
    }
    return app_installed ;}}

任何帮助都会受到极大的赞赏。

谢谢你 阿维

0 个答案:

没有答案