Example #1
0
 @Override
 public void onReceive(Context context, Intent intent) {
   if (intent != null) {
     if (intent.getAction().compareTo(FileManagerSettings.INTENT_THEME_CHANGED) == 0) {
       applyTheme();
       return;
     }
     if (intent.getAction().compareTo(FileManagerSettings.INTENT_SETTING_CHANGED) == 0) {
       // The settings has changed
       String key = intent.getStringExtra(FileManagerSettings.EXTRA_SETTING_CHANGED_KEY);
       if (key != null) {
         // Word wrap
         if (key.compareTo(FileManagerSettings.SETTINGS_EDITOR_WORD_WRAP.getId()) == 0) {
           // Do we have a different setting?
           boolean wordWrapSetting =
               Preferences.getSharedPreferences()
                   .getBoolean(
                       FileManagerSettings.SETTINGS_EDITOR_WORD_WRAP.getId(),
                       ((Boolean)
                               FileManagerSettings.SETTINGS_EDITOR_WORD_WRAP
                                   .getDefaultValue())
                           .booleanValue());
           if (wordWrapSetting != EditorActivity.this.mWordWrap) {
             toggleWordWrap();
           }
         }
       }
       return;
     }
   }
 }
Example #2
0
  /** Method that initializes the layout and components of the activity. */
  private void initLayout() {
    this.mEditor = (EditText) findViewById(R.id.editor);
    this.mEditor.setText(null);
    this.mEditor.addTextChangedListener(this);
    this.mEditor.setEnabled(false);
    this.mWordWrapView = (ViewGroup) findViewById(R.id.editor_word_wrap_view);
    this.mNoWordWrapView = (ViewGroup) findViewById(R.id.editor_no_word_wrap_view);
    this.mWordWrap = true;
    this.mWordWrapView.setVisibility(View.VISIBLE);
    this.mNoWordWrapView.setVisibility(View.GONE);

    // Load the word wrap setting
    boolean wordWrapSetting =
        Preferences.getSharedPreferences()
            .getBoolean(
                FileManagerSettings.SETTINGS_EDITOR_WORD_WRAP.getId(),
                ((Boolean) FileManagerSettings.SETTINGS_EDITOR_WORD_WRAP.getDefaultValue())
                    .booleanValue());
    if (wordWrapSetting != this.mWordWrap) {
      toggleWordWrap();
    }

    this.mProgress = findViewById(R.id.editor_progress);
    this.mProgressBar = (ProgressBar) findViewById(R.id.editor_progress_bar);
  }