huaxunhuang
10/23/2017 - 2:23 PM

KISS #01

commit 82f112007066f1b369fd1fa47fd44a1ec243c5d7

      @SuppressLint("CommitPrefEdits")
      protected void onResume() {
          if (prefs.getBoolean("require-layout-update", false)) {
              // Restart current activity to refresh view, since some preferences
             // may require using a new UI
             prefs.edit().putBoolean("require-layout-update", false).commit();
             Intent i = new Intent(this, getClass());
             i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
                     | Intent.FLAG_ACTIVITY_NO_ANIMATION);
             finish();
             overridePendingTransition(0, 0);
             startActivity(i);
             overridePendingTransition(0, 0);
         }
 
         if (kissBar.getVisibility() != View.VISIBLE) {
             updateRecords(searchEditText.getText().toString());
             displayClearOnInput();
         } else {
             displayKissBar(false);
         }
 
         // Activity manifest specifies stateAlwaysHidden as windowSoftInputMode
         // so the keyboard will be hidden by default
         // we may want to display it if the setting is set
         if (prefs.getBoolean("display-keyboard", false)) {
             // Display keyboard
             showKeyboard();
 
             new Handler().postDelayed(displayKeyboardRunnable, 10);
             // For some weird reasons, keyboard may be hidden by the system
             // So we have to run this multiple time at different time
             // See https://github.com/Neamar/KISS/issues/119
             new Handler().postDelayed(displayKeyboardRunnable, 100);
             new Handler().postDelayed(displayKeyboardRunnable, 500);
         } else {
             // Not used (thanks windowSoftInputMode)
             // unless coming back from KISS settings
             hideKeyboard();
         }
 
         super.onResume();
     }