TabLayout
This commit is contained in:
parent
ba2f96713d
commit
f53abe2b23
@ -17,7 +17,13 @@ public class ActivityMainTabLayout extends TabActivity
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main_tab_layout);
|
||||
|
||||
Settings.readFromPersistentStorage(ActivityMainTabLayout.this);
|
||||
|
||||
if(Settings.tabsPlacement == 1)
|
||||
setContentView(R.layout.main_tab_layout_tabs_at_bottom);
|
||||
else
|
||||
setContentView(R.layout.main_tab_layout_tabs_at_top);
|
||||
|
||||
TabHost tabHost = getTabHost();
|
||||
|
||||
|
@ -60,6 +60,7 @@ public class Settings implements SharedPreferences
|
||||
public static int activityDetectionRequiredProbability;
|
||||
public static boolean privacyLocationing;
|
||||
public static int startScreen;
|
||||
public static int tabsPlacement;
|
||||
public static boolean executeRulesAndProfilesWithSingleClick;
|
||||
public static boolean displayNewsOnMainScreen;
|
||||
public static boolean automaticUpdateCheck;
|
||||
@ -116,6 +117,7 @@ public class Settings implements SharedPreferences
|
||||
protected static final int default_activityDetectionRequiredProbability = 75;
|
||||
protected static final boolean default_privacyLocationing = false;
|
||||
protected static final int default_startScreen = 0;
|
||||
protected static final int default_tabsPlacement = 0;
|
||||
protected static final boolean default_executeRulesAndProfilesWithSingleClick = false;
|
||||
protected static final boolean default_displayNewsOnMainScreen = false;
|
||||
protected static final boolean default_automaticUpdateCheck = false;
|
||||
@ -253,6 +255,7 @@ public class Settings implements SharedPreferences
|
||||
|
||||
privacyLocationing = prefs.getBoolean("privacyLocationing", default_privacyLocationing);
|
||||
startScreen = Integer.parseInt(prefs.getString("startScreen", String.valueOf(default_startScreen)));
|
||||
tabsPlacement = Integer.parseInt(prefs.getString("tabsPlacement", String.valueOf(default_tabsPlacement)));
|
||||
|
||||
executeRulesAndProfilesWithSingleClick = prefs.getBoolean("executeRulesAndProfilesWithSingleClick", default_executeRulesAndProfilesWithSingleClick);
|
||||
automaticUpdateCheck = prefs.getBoolean("automaticUpdateCheck", default_automaticUpdateCheck);
|
||||
@ -440,6 +443,9 @@ public class Settings implements SharedPreferences
|
||||
if(!prefs.contains("startScreen") | force)
|
||||
editor.putString("startScreen", String.valueOf(default_startScreen));
|
||||
|
||||
if(!prefs.contains("tabsPlacement") | force)
|
||||
editor.putString("tabsPlacement", String.valueOf(default_tabsPlacement));
|
||||
|
||||
if(!prefs.contains("executeRulesAndProfilesWithSingleClick") | force)
|
||||
editor.putBoolean("executeRulesAndProfilesWithSingleClick", default_executeRulesAndProfilesWithSingleClick);
|
||||
|
||||
@ -524,6 +530,7 @@ public class Settings implements SharedPreferences
|
||||
editor.putString("activityDetectionRequiredProbability", String.valueOf(activityDetectionRequiredProbability));
|
||||
editor.putBoolean("privacyLocationing", privacyLocationing);
|
||||
editor.putString("startScreen", String.valueOf(startScreen));
|
||||
editor.putString("tabsPlacement", String.valueOf(tabsPlacement));
|
||||
editor.putBoolean("executeRulesAndProfilesWithSingleClick", executeRulesAndProfilesWithSingleClick);
|
||||
editor.putBoolean("automaticUpdateCheck", automaticUpdateCheck);
|
||||
editor.putBoolean("displayNewsOnMainScreen", displayNewsOnMainScreen);
|
||||
@ -575,4 +582,4 @@ public class Settings implements SharedPreferences
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -52,6 +52,13 @@
|
||||
android:entries="@array/startScreenOptions"
|
||||
android:entryValues="@array/startScreenOptionsValues" />
|
||||
|
||||
<ListPreference
|
||||
android:key="tabsPlacement"
|
||||
android:title="@string/tabsPlacement"
|
||||
android:summary="@string/tabsPlacementSummary"
|
||||
android:entries="@array/tabsPlacementOptions"
|
||||
android:entryValues="@array/tabsPlacementOptionsValues" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="executeRulesAndProfilesWithSingleClick"
|
||||
android:title="@string/executeRulesAndProfilesWithSingleClickTitle" />
|
||||
|
@ -3,20 +3,25 @@
|
||||
android:id="@android:id/tabhost"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@android:id/tabcontent"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TabWidget
|
||||
android:id="@android:id/tabs"
|
||||
android:layout_weight="0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true" />
|
||||
<FrameLayout
|
||||
android:id="@android:id/tabcontent"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</TabHost>
|
27
app/src/main/res/layout/main_tab_layout_tabs_at_top.xml
Normal file
27
app/src/main/res/layout/main_tab_layout_tabs_at_top.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/tabhost"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TabWidget
|
||||
android:id="@android:id/tabs"
|
||||
android:layout_weight="0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@android:id/tabcontent"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</TabHost>
|
@ -21,4 +21,16 @@
|
||||
<item name="2">2</item>
|
||||
<item name="3">3</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="tabsPlacementOptions">
|
||||
<item name="0">@string/top</item>
|
||||
<item name="1">@string/bottom</item>
|
||||
</string-array>
|
||||
<string-array name="tabsPlacementOptionsValues">
|
||||
<item name="0">0</item>
|
||||
<item name="1">1</item>
|
||||
<item name="2">2</item>
|
||||
<item name="3">3</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
@ -686,4 +686,8 @@
|
||||
<string name="VibrateExplanation">Enter a vibration duration, followed by a comma, then a pause duration. You can concatenate as many vibrations as you like. Separate them by commas again.\nE.g. the pattern 100,500,500,1000,100 will vibrate 100, wait 500, vibrate 500, wait 1000, vibrate 100.\nIf you think a vibration is dropped try increasing the pause before them.</string>
|
||||
<string name="pleaseEnterValidVibrationPattern">Please enter a valid vibration pattern.</string>
|
||||
<string name="newsOptIn">Would you like to receive (only important) news about this app on the main screen? Those are downloaded from the developer\'s website. There will be no intrusive notification, just a text on the main screen when you open the app.</string>
|
||||
<string name="top">Top</string>
|
||||
<string name="bottom">Bottom</string>
|
||||
<string name="tabsPlacement">Position of tabs</string>
|
||||
<string name="tabsPlacementSummary">Choose where the tabs bar should be placed.</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user