private TextLayout textLayout() { String string = SettingsManager.sharedPreferences(this).getString(TextLayoutSetting.KEY, null); for (TextLayout textLayout : TextLayout.VALUES) { if (textLayout.toString().equals(string)) { return textLayout; } } return TextLayoutSetting.DEFAULT; }
private boolean onTextLayoutClick() { TextLayout textLayout = textLayout() instanceof LineWrapTextLayout ? TextLayout.WORD_WRAP : TextLayout.LINE_WRAP; sourceView.setTextLayout(textLayout); SharedPreferences.Editor editor = SettingsManager.sharedPreferences(TypeInActivity.this).edit(); editor.putString(TextLayoutSetting.KEY, textLayout.toString()); editor.commit(); return true; }