示例#1
0
  @Override
  protected void onResume() {
    super.onResume();

    SharedPreferences settings = getSharedPreferences("Settings", Context.MODE_PRIVATE);

    // Put the saved URL in the EditText
    String url = settings.getString("url", "http://uinelj.eu/misc/rpgm/");
    ((EditText) findViewById(R.id.editTextURL)).setText(url);

    // Put the saved nickname in the EditText
    String nickname = settings.getString("nickname", "foo");
    ((EditText) findViewById(R.id.editTextNick)).setText(nickname);

    // Put the saved language as default on spinner
    String lang = settings.getString("locale", "en_US");
    String language;
    switch (lang) {
      case "fr_FR":
        language = "Français";
        break;
      case "en_US":
      default:
        language = "English";
        break;
    }
    String[] array = {"English", "Français"};
    ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.activity_options, array);
    langSelect.setSelection(adapter.getPosition(language));

    // Checks or not the notification option according to the saved preference
    SharedPreferences notifSettings = getSharedPreferences("notifications", Context.MODE_PRIVATE);
    allowNotif.setChecked(notifSettings.getBoolean("allow", true));
  }
示例#2
0
  @Override
  protected void onResume() {
    super.onResume();

    EpiTime.getInstance().setCurrentActivity(this);
    EpiTime.getInstance().sendScreen("com.epitime.groupList");
    EpiTime.getInstance().sendEvent("GroupList", this.school, "");
  }
示例#3
0
 @Override
 protected void onResume() {
   super.onResume();
   IntentFilter filter = new IntentFilter(SendServiceHelper.ACTION_REQUEST_RESULT);
   requestReceiver =
       new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
           int resultRequestId = intent.getIntExtra(SendServiceHelper.EXTRA_REQUEST_ID, 0);
           Log.d(
               LOG_TAG,
               "Received intent " + intent.getAction() + ", request ID " + resultRequestId);
           int resultCode = intent.getIntExtra(SendServiceHelper.EXTRA_RESULT_CODE, 0);
           Log.d(LOG_TAG, String.valueOf(resultCode));
           RequestType requestType = requestsIdMap.remove(resultRequestId);
           switch (requestType) {
             case COMMENT_VOTE:
               if (resultCode != 200) {
                 switch (resultCode) {
                   case 406:
                     Toast.makeText(
                             getApplicationContext(),
                             R.string.you_already_vote_for_this_comment,
                             Toast.LENGTH_SHORT)
                         .show();
                     break;
                   default:
                     handleResponseErrors(resultCode);
                     break;
                 }
               }
               break;
             case COMMENT_NEW:
               if (resultCode != 200) {
                 handleResponseErrors(resultCode);
               } else {
                 mMessageTextInput.setText("");
                 mCommentsRecyclerView.smoothScrollToPosition(0);
               }
               break;
             case COMMENT_LIST:
               if (resultCode != 200) {
                 handleResponseErrors(resultCode);
               }
               break;
           }
         }
       };
   if (mAdView != null) {
     mAdView.resume();
   }
   registerReceiver(requestReceiver, filter);
 }