Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cf65b55

Browse files
committedApr 14, 2015
Revert "Merge branch 'dvhh-TV-Mode'"
This reverts commit 8bcf2e3, reversing changes made to 310ad8f.
1 parent 8bcf2e3 commit cf65b55

File tree

9 files changed

+11
-118
lines changed

9 files changed

+11
-118
lines changed
 

‎emulatorview/src/main/java/jackpal/androidterm/emulatorview/EmulatorView.java

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import android.view.KeyEvent;
4444
import android.view.MotionEvent;
4545
import android.view.View;
46-
import android.view.ViewParent;
4746
import android.view.inputmethod.BaseInputConnection;
4847
import android.view.inputmethod.CompletionInfo;
4948
import android.view.inputmethod.CorrectionInfo;
@@ -1102,7 +1101,7 @@ private void sendMouseEventCode(MotionEvent e, int button_code) {
11021101
x > 255-32 || y > 255-32;
11031102
//Log.d(TAG, "mouse button "+x+","+y+","+button_code+",oob="+out_of_bounds);
11041103
if(button_code < 0 || button_code > 255-32) {
1105-
Log.e(TAG, "mouse button_code out of range: " + button_code);
1104+
Log.e(TAG, "mouse button_code out of range: "+button_code);
11061105
return;
11071106
}
11081107
if(!out_of_bounds) {
@@ -1469,8 +1468,8 @@ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
14691468
}
14701469

14711470
private void updateSize(int w, int h) {
1472-
mColumns = Math.max(1, (int) Math.floor(((float) w) / mCharacterWidth));
1473-
mVisibleColumns = Math.max(1, (int) Math.floor(((float) mVisibleWidth) / mCharacterWidth));
1471+
mColumns = Math.max(1, (int) (((float) w) / mCharacterWidth));
1472+
mVisibleColumns = Math.max(1, (int) (((float) mVisibleWidth) / mCharacterWidth));
14741473

14751474
mTopOfScreenMargin = mTextRenderer.getTopMargin();
14761475
mRows = Math.max(1, (h - mTopOfScreenMargin) / mCharacterHeight);
@@ -1494,18 +1493,9 @@ public void updateSize(boolean force) {
14941493
//Need to clear saved links on each display refresh
14951494
mLinkLayer.clear();
14961495
if (mKnownSize) {
1497-
1498-
int w = getWidth() - getPaddingLeft() -getPaddingRight();
1499-
int h = getHeight() -getPaddingTop() -getPaddingBottom();
1500-
ViewParent parent=getParent();
1501-
while(parent instanceof View) {
1502-
w -= ((View) parent).getPaddingLeft() + ((View) parent).getPaddingRight();
1503-
h -= ((View) parent).getPaddingTop() + ((View) parent).getPaddingBottom();
1504-
parent = ((View)parent).getParent();
1505-
}
1506-
1507-
//Log.w("Term", "(" + w + ", " + h + ")");
1508-
1496+
int w = getWidth();
1497+
int h = getHeight();
1498+
// Log.w("Term", "(" + w + ", " + h + ")");
15091499
if (force || w != mVisibleWidth || h != mVisibleHeight) {
15101500
mVisibleWidth = w;
15111501
mVisibleHeight = h;
@@ -1721,5 +1711,4 @@ public String getURLat(float x, float y)
17211711
else
17221712
return null;
17231713
}
1724-
17251714
}

‎term/src/main/java/jackpal/androidterm/RemoteInterface.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected void onCreate(Bundle savedInstanceState) {
6565
super.onCreate(savedInstanceState);
6666

6767
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
68-
mSettings = new TermSettings(this, prefs);
68+
mSettings = new TermSettings(getResources(), prefs);
6969

7070
Intent TSIntent = new Intent(this, TermService.class);
7171
mTSIntent = TSIntent;

‎term/src/main/java/jackpal/androidterm/Term.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import jackpal.androidterm.compat.ActivityCompat;
2222
import jackpal.androidterm.compat.AndroidCompat;
2323
import jackpal.androidterm.compat.MenuItemCompat;
24-
import jackpal.androidterm.compat.UIModeCompat;
2524
import jackpal.androidterm.emulatorview.EmulatorView;
2625
import jackpal.androidterm.emulatorview.TermSession;
2726
import jackpal.androidterm.emulatorview.UpdateCallback;
@@ -39,7 +38,6 @@
3938

4039
import android.app.Activity;
4140
import android.app.AlertDialog;
42-
import android.app.UiModeManager;
4341
import android.content.ActivityNotFoundException;
4442
import android.content.BroadcastReceiver;
4543
import android.content.ComponentName;
@@ -62,7 +60,6 @@
6260
import android.preference.PreferenceManager;
6361
import android.util.DisplayMetrics;
6462
import android.util.Log;
65-
import android.util.TypedValue;
6663
import android.view.ContextMenu;
6764
import android.view.ContextMenu.ContextMenuInfo;
6865
import android.view.GestureDetector.SimpleOnGestureListener;
@@ -333,15 +330,15 @@ public void onCreate(Bundle icicle) {
333330

334331
Log.v(TermDebug.LOG_TAG, "onCreate");
335332

336-
final SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
337-
mSettings = new TermSettings(this, mPrefs);
338-
mPrefs.registerOnSharedPreferenceChangeListener(this);
339-
340333
mPrivateAlias = new ComponentName(this, RemoteInterface.PRIVACT_ACTIVITY_ALIAS);
341334

342335
if (icicle == null)
343336
onNewIntent(getIntent());
344337

338+
final SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
339+
mSettings = new TermSettings(getResources(), mPrefs);
340+
mPrefs.registerOnSharedPreferenceChangeListener(this);
341+
345342
Intent broadcast = new Intent(ACTION_PATH_BROADCAST);
346343
if (AndroidCompat.SDK >= 12) {
347344
broadcast.addFlags(FLAG_INCLUDE_STOPPED_PACKAGES);
@@ -402,7 +399,6 @@ public void onCreate(Bundle icicle) {
402399
mAlreadyStarted = true;
403400
}
404401

405-
406402
private String makePathFromBundle(Bundle extras) {
407403
if (extras == null || extras.size() == 0) {
408404
return "";
@@ -528,7 +524,6 @@ private TermSession createTermSession() throws IOException {
528524
private TermView createEmulatorView(TermSession session) {
529525
DisplayMetrics metrics = new DisplayMetrics();
530526
getWindowManager().getDefaultDisplay().getMetrics(metrics);
531-
532527
TermView emulatorView = new TermView(this, session, metrics);
533528

534529
emulatorView.setExtGestureListener(new EmulatorViewGestureListener(emulatorView));
@@ -591,11 +586,6 @@ private void updatePrefs() {
591586
}
592587
}
593588

594-
/*
595-
EmulatorView v = (EmulatorView) mViewFlipper.getCurrentView();
596-
if(v!=null)
597-
v.updateSize(true);
598-
*/
599589
int orientation = mSettings.getScreenOrientation();
600590
int o = 0;
601591
if (orientation == 0) {
@@ -607,7 +597,6 @@ private void updatePrefs() {
607597
} else {
608598
/* Shouldn't be happened. */
609599
}
610-
611600
setRequestedOrientation(o);
612601
}
613602

‎term/src/main/java/jackpal/androidterm/TermViewFlipper.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020
import java.util.LinkedList;
2121

2222
import android.content.Context;
23-
import android.content.res.Resources;
2423
import android.graphics.Canvas;
2524
import android.graphics.Rect;
2625
import android.os.Handler;
2726
import android.util.AttributeSet;
28-
import android.util.TypedValue;
2927
import android.view.Gravity;
3028
import android.view.View;
3129
import android.widget.Toast;
@@ -102,33 +100,11 @@ private void commonConstructor(Context context) {
102100
Gravity.TOP|Gravity.LEFT);
103101
}
104102

105-
protected int dpToPixel(int input) {
106-
Resources r = getResources();
107-
int px = (int) TypedValue.applyDimension(
108-
TypedValue.COMPLEX_UNIT_DIP,
109-
input,
110-
r.getDisplayMetrics()
111-
);
112-
return px;
113-
}
114-
115103
public void updatePrefs(TermSettings settings) {
116104
boolean statusBarVisible = settings.showStatusBar();
117105
int[] colorScheme = settings.getColorScheme();
118106
setBackgroundColor(colorScheme[1]);
119107
mStatusBarVisible = statusBarVisible;
120-
if(settings.getSafeMargins()) {
121-
setPadding(
122-
dpToPixel(48), dpToPixel(27),
123-
dpToPixel(48), dpToPixel(27)
124-
);
125-
}else{
126-
setPadding(0, 0, 0, 0);
127-
}
128-
EmulatorView view = (EmulatorView) getCurrentView();
129-
if (view != null) {
130-
view.updateSize(true);
131-
}
132108
}
133109

134110
public Iterator<View> iterator() {

‎term/src/main/java/jackpal/androidterm/compat/UIModeCompat.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎term/src/main/java/jackpal/androidterm/util/TermSettings.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818

1919
import jackpal.androidterm.R;
2020
import jackpal.androidterm.compat.AndroidCompat;
21-
import jackpal.androidterm.compat.UIModeCompat;
2221

23-
import android.content.Context;
2422
import android.content.SharedPreferences;
2523
import android.content.res.Resources;
2624
import android.view.KeyEvent;
@@ -34,7 +32,6 @@ public class TermSettings {
3432
private int mStatusBar;
3533
private int mActionBarMode;
3634
private int mOrientation;
37-
private boolean mSafeMargins;
3835
private int mCursorStyle;
3936
private int mCursorBlink;
4037
private int mFontSize;
@@ -66,7 +63,6 @@ public class TermSettings {
6663
private static final String STATUSBAR_KEY = "statusbar";
6764
private static final String ACTIONBAR_KEY = "actionbar";
6865
private static final String ORIENTATION_KEY = "orientation";
69-
private static final String SAFE_MARGINS_KEY = "safe_margins";
7066
private static final String FONTSIZE_KEY = "fontsize";
7167
private static final String COLOR_KEY = "color";
7268
private static final String UTF8_KEY = "utf8_by_default";
@@ -161,15 +157,6 @@ public TermSettings(Resources res, SharedPreferences prefs) {
161157
readPrefs(prefs);
162158
}
163159

164-
public TermSettings(Context context, SharedPreferences prefs) {
165-
readDefaultPrefs(context);
166-
readPrefs(prefs);
167-
}
168-
private void readDefaultPrefs(Context context) {
169-
Resources res=context.getResources();
170-
readDefaultPrefs(res);
171-
mSafeMargins = UIModeCompat.isUIModeTV(context);
172-
}
173160
private void readDefaultPrefs(Resources res) {
174161
mStatusBar = Integer.parseInt(res.getString(R.string.pref_statusbar_default));
175162
mActionBarMode = res.getInteger(R.integer.pref_actionbar_default);
@@ -195,15 +182,13 @@ private void readDefaultPrefs(Resources res) {
195182
mAltSendsEsc = res.getBoolean(R.bool.pref_alt_sends_esc_default);
196183
mMouseTracking = res.getBoolean(R.bool.pref_mouse_tracking_default);
197184
mUseKeyboardShortcuts = res.getBoolean(R.bool.pref_use_keyboard_shortcuts_default);
198-
mSafeMargins = res.getBoolean(R.bool.pref_safe_margins_default);
199185
}
200186

201187
public void readPrefs(SharedPreferences prefs) {
202188
mPrefs = prefs;
203189
mStatusBar = readIntPref(STATUSBAR_KEY, mStatusBar, 1);
204190
mActionBarMode = readIntPref(ACTIONBAR_KEY, mActionBarMode, ACTION_BAR_MODE_MAX);
205191
mOrientation = readIntPref(ORIENTATION_KEY, mOrientation, 2);
206-
mSafeMargins = readBooleanPref(SAFE_MARGINS_KEY,mSafeMargins);
207192
// mCursorStyle = readIntPref(CURSORSTYLE_KEY, mCursorStyle, 2);
208193
// mCursorBlink = readIntPref(CURSORBLINK_KEY, mCursorBlink, 1);
209194
mFontSize = readIntPref(FONTSIZE_KEY, mFontSize, 288);
@@ -262,8 +247,6 @@ public int getScreenOrientation() {
262247
return mOrientation;
263248
}
264249

265-
public boolean getSafeMargins() {return mSafeMargins; }
266-
267250
public int getCursorStyle() {
268251
return mCursorStyle;
269252
}
@@ -387,5 +370,4 @@ public void setHomePath(String homePath) {
387370
public String getHomePath() {
388371
return mHomePath;
389372
}
390-
391373
}

‎term/src/main/res/values/defaults.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<string name="pref_statusbar_default" translatable="false">1</string>
55
<integer name="pref_actionbar_default">1</integer>
66
<integer name="pref_orientation_default">0</integer>
7-
<bool name="pref_safe_margins_default">false</bool>
87
<string name="pref_cursorstyle_default" translatable="false">0</string>
98
<string name="pref_cursorblink_default" translatable="false">0</string>
109
<string name="pref_fontsize_default" translatable="false">10</string>

‎term/src/main/res/values/strings.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@
6262
<string name="summary_orientation_preference">Choose the screen orientation behavior.</string>
6363
<string name="dialog_title_orientation_preference">Screen orientation behavior</string>
6464

65-
<string name="title_safe_margins_preference">Safe margins</string>
66-
<string name="summary_safe_margins_preference">Add overscan margins to the terminal screen.</string>
67-
6865
<string name="title_cursorstyle_preference">Cursor style</string>
6966
<string name="summary_cursorstyle_preference">Choose cursor style.</string>
7067
<string name="dialog_title_cursorstyle_preference">Cursor style</string>

‎term/src/main/res/xml/preferences.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@
4848
android:entryValues="@array/entryvalues_orientation_preference"
4949
android:dialogTitle="@string/dialog_title_orientation_preference" />
5050

51-
<CheckBoxPreference
52-
android:key="safe_margins"
53-
android:defaultValue="@bool/pref_safe_margins_default"
54-
android:title="@string/title_safe_margins_preference"
55-
android:summary="@string/summary_safe_margins_preference"
56-
/>
5751
<!--
5852
<ListPreference
5953
android:key="cursorstyle"

0 commit comments

Comments
 (0)
Failed to load comments.