am edb55982: Fix Terminal Preferences, Resolution
Merge commit 'edb55982e1c86b99718bb7ccfd4e1d4cd33d5bd0' * commit 'edb55982e1c86b99718bb7ccfd4e1d4cd33d5bd0': Fix Terminal Preferences, Resolution
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
<string name="text_preferences">Text</string>
|
||||
|
||||
<string name="title_fontsize_preference">Font size</string>
|
||||
<string name="summary_fontsize_preference">Choose character height in pixels.</string>
|
||||
<string name="summary_fontsize_preference">Choose character height in points.</string>
|
||||
<string name="dialog_title_fontsize_preference">Font size</string>
|
||||
|
||||
<string name="title_color_preference">Colors</string>
|
||||
|
||||
@@ -45,6 +45,7 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.KeyEvent;
|
||||
@@ -158,14 +159,6 @@ public class Term extends Activity {
|
||||
super.onCreate(icicle);
|
||||
Log.e(Term.LOG_TAG, "onCreate");
|
||||
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
mPrefs.registerOnSharedPreferenceChangeListener(
|
||||
new SharedPreferences.OnSharedPreferenceChangeListener(){
|
||||
|
||||
public void onSharedPreferenceChanged(
|
||||
SharedPreferences sharedPreferences, String key) {
|
||||
readPrefs();
|
||||
updatePrefs();
|
||||
}});
|
||||
readPrefs();
|
||||
|
||||
setContentView(R.layout.term_activity);
|
||||
@@ -227,7 +220,7 @@ public class Term extends Activity {
|
||||
|
||||
private void sendInitialCommand() {
|
||||
String initialCommand = mInitialCommand;
|
||||
if (initialCommand == null) {
|
||||
if (initialCommand == null || initialCommand.equals("")) {
|
||||
initialCommand = DEFAULT_INITIAL_COMMAND;
|
||||
}
|
||||
if (initialCommand.length() > 0) {
|
||||
@@ -253,7 +246,7 @@ public class Term extends Activity {
|
||||
|
||||
private void createSubprocess(int[] processId) {
|
||||
String shell = mShell;
|
||||
if (shell == null) {
|
||||
if (shell == null || shell.equals("")) {
|
||||
shell = DEFAULT_SHELL;
|
||||
}
|
||||
ArrayList<String> args = parse(shell);
|
||||
@@ -347,7 +340,9 @@ public class Term extends Activity {
|
||||
}
|
||||
|
||||
private void updatePrefs() {
|
||||
mEmulatorView.setTextSize(mFontSize);
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
mEmulatorView.setTextSize((int) (mFontSize * metrics.density));
|
||||
setColors();
|
||||
mControlKeyCode = CONTROL_KEY_SCHEMES[mControlKeyId];
|
||||
}
|
||||
@@ -369,17 +364,10 @@ public class Term extends Activity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
SharedPreferences.Editor e = mPrefs.edit();
|
||||
e.clear();
|
||||
e.putString(FONTSIZE_KEY, Integer.toString(mFontSize));
|
||||
e.putString(COLOR_KEY, Integer.toString(mColorId));
|
||||
e.putString(CONTROLKEY_KEY, Integer.toString(mControlKeyId));
|
||||
e.putString(SHELL_KEY, mShell);
|
||||
e.putString(INITIALCOMMAND_KEY, mInitialCommand);
|
||||
e.commit();
|
||||
|
||||
super.onPause();
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
readPrefs();
|
||||
updatePrefs();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user