コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    processor = new SubscriptionProcessor(this);
    preferences = Preferences.getPreferences(this);

    super.onCreate(savedInstanceState);

    if (preferences.isFirstLaunch() || processor.fetchAllSubscriptions().getCount() == 0) {
      Dialogs.showOkConfirmation(this, R.string.initial_setup, R.string.msg_create_sub, null);
    }
  }
コード例 #2
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case MENU_ITEM_QUICK_HELP:
       Dialogs.showOkConfirmation(this, R.string.help, R.string.msg_create_sub_help, null);
       return true;
     case MENU_ITEM_HELP:
       Intent browserIntent =
           new Intent(
               "android.intent.action.VIEW",
               Uri.parse("http://code.google.com/p/smsbanking/wiki/Help"));
       startActivity(browserIntent);
       return true;
   }
   return false;
 }
コード例 #3
0
  protected boolean validateData() {
    String body = getBodyEditText().getText().toString();
    if (body == null || body.trim().length() == 0) {
      Dialogs.showToast(this, R.string.msg_empty_body);
      return false;
    }

    String title = getTitleEditText().getText().toString();
    if (title == null || title.trim().length() == 0) {
      title = body.length() >= 20 ? body.substring(0, 20) : body;
      getTitleEditText().setText(title);
    }

    if (!body.contains("%")) {
      Dialogs.showOkConfirmation(this, R.string.add_sub, R.string.msg_no_pin_placeholder, null);
      return false;
    }

    return true;
  }