Skip to content
This repository was archived by the owner on Apr 21, 2023. It is now read-only.

Commit fa7d39b

Browse files
committed
Merge pull request jackpal#414 from jspricke/hide_material_design_action_bar
Allow hiding of Material Design ActionBar
2 parents e14d358 + 351257f commit fa7d39b

File tree

4 files changed

+12
-22
lines changed

4 files changed

+12
-22
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,16 +345,18 @@ public void onCreate(Bundle icicle) {
345345
Log.w(TermDebug.LOG_TAG, "bind to service failed!");
346346
}
347347

348-
if (AndroidCompat.V11ToV20) {
348+
if (AndroidCompat.SDK >= 11) {
349349
int actionBarMode = mSettings.actionBarMode();
350350
mActionBarMode = actionBarMode;
351-
switch (actionBarMode) {
352-
case TermSettings.ACTION_BAR_MODE_ALWAYS_VISIBLE:
353-
setTheme(R.style.Theme_Holo);
354-
break;
355-
case TermSettings.ACTION_BAR_MODE_HIDES:
356-
setTheme(R.style.Theme_Holo_ActionBarOverlay);
357-
break;
351+
if (AndroidCompat.V11ToV20) {
352+
switch (actionBarMode) {
353+
case TermSettings.ACTION_BAR_MODE_ALWAYS_VISIBLE:
354+
setTheme(R.style.Theme_Holo);
355+
break;
356+
case TermSettings.ACTION_BAR_MODE_HIDES:
357+
setTheme(R.style.Theme_Holo_ActionBarOverlay);
358+
break;
359+
}
358360
}
359361
} else {
360362
mActionBarMode = TermSettings.ACTION_BAR_MODE_ALWAYS_VISIBLE;

term/src/main/java/jackpal/androidterm/TermPreferences.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ protected void onCreate(Bundle savedInstanceState) {
3636
// Load the preferences from an XML resource
3737
addPreferencesFromResource(R.xml.preferences);
3838

39-
// Remove the action bar pref on non-Holo platforms.
40-
// On pre and post holo platforms there is no action bar.
41-
if (!AndroidCompat.V11ToV20) {
39+
// Remove the action bar pref on older platforms without an action bar
40+
if (AndroidCompat.SDK < 11) {
4241
Preference actionBarPref = findPreference(ACTIONBAR_KEY);
4342
PreferenceCategory screenCategory =
4443
(PreferenceCategory) findPreference(CATEGORY_SCREEN_KEY);

term/src/main/java/jackpal/androidterm/compat/AndroidCompat.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ public class AndroidCompat {
2323
V11ToV20 = (SDK >= 11) && (SDK <= 20);
2424
}
2525

26-
// The era of Material Design
27-
public final static boolean V21Up;
28-
29-
static {
30-
V21Up = SDK >= 21;
31-
}
32-
3326
private final static int getSDK() {
3427
int result;
3528
try {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,6 @@ public void readPrefs(SharedPreferences prefs) {
188188
mPrefs = prefs;
189189
mStatusBar = readIntPref(STATUSBAR_KEY, mStatusBar, 1);
190190
mActionBarMode = readIntPref(ACTIONBAR_KEY, mActionBarMode, ACTION_BAR_MODE_MAX);
191-
if (AndroidCompat.V21Up) {
192-
// ActionBar replaced by Taskbar in Material Design. TODO: Implement scroll hiding.
193-
mActionBarMode = ACTION_BAR_MODE_ALWAYS_VISIBLE;
194-
}
195191
mOrientation = readIntPref(ORIENTATION_KEY, mOrientation, 2);
196192
// mCursorStyle = readIntPref(CURSORSTYLE_KEY, mCursorStyle, 2);
197193
// mCursorBlink = readIntPref(CURSORBLINK_KEY, mCursorBlink, 1);

0 commit comments

Comments
 (0)