コード例 #1
0
ファイル: Dashboard.java プロジェクト: dreab8/eCard
  @Override
  protected void onResume() {
    super.onResume();
    final Cursor cursor =
        getContentResolver()
            .query(EcardDao.ECARD_URI, null, "personal = ?", new String[] {"1"}, null);
    if (cursor.getCount() > 0) {
      add.setText(R.string.dashboard_myecards);
      add.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              cursor.moveToFirst();
              startActivity(new EcardIntent(cursor, Dashboard.this).getIntent());
            }
          });

    } else {
      add.setText(R.string.dashboard_add);
      add.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              startActivity(new Intent(Dashboard.this, Add.class));
            }
          });
    }
  }
コード例 #2
0
ファイル: Dashboard.java プロジェクト: dreab8/eCard
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dashboard);

    add = (Button) findViewById(R.id.add_button);

    ((Button) findViewById(R.id.ecards))
        .setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                startActivity(EcardIntent.getEcardActivityIntent(Dashboard.this));
              }
            });

    ((Button) findViewById(R.id.scan))
        .setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                IntentIntegrator.initiateScan(
                    Dashboard.this,
                    getString(R.string.zx_title),
                    getString(R.string.zx_message),
                    getString(R.string.zx_pos),
                    getString(R.string.zx_neg),
                    IntentIntegrator.PRODUCT_CODE_TYPES);
              }
            });

    setAdmobViewIfEnabled();
  }