Fix preferences saving of nav drawer and bottom bar shortcuts
Preferences for the Nav Drawer and Bottom Bar shortcuts weren't being properly saved. This fixes that and also fixes the order or the Navigation Drawer items, after the addition of the Local Files option.
This commit is contained in:
parent
b14524963f
commit
5d0969c66e
|
@ -83,11 +83,11 @@ public class NavigationDrawerFragment extends Fragment {
|
||||||
ACTIVITY_TVSHOWS = 3,
|
ACTIVITY_TVSHOWS = 3,
|
||||||
ACTIVITY_MUSIC = 4,
|
ACTIVITY_MUSIC = 4,
|
||||||
ACTIVITY_PVR = 5,
|
ACTIVITY_PVR = 5,
|
||||||
ACTIVITY_LOCAL_FILES = 6,
|
ACTIVITY_FILES = 6,
|
||||||
ACTIVITY_ADDONS = 7,
|
ACTIVITY_ADDONS = 7,
|
||||||
ACTIVITY_SETTINGS = 8,
|
ACTIVITY_SETTINGS = 8,
|
||||||
ACTIVITY_FAVOURITES = 9,
|
ACTIVITY_FAVOURITES = 9,
|
||||||
ACTIVITY_FILES = 10;
|
ACTIVITY_LOCAL_FILES = 10;
|
||||||
|
|
||||||
|
|
||||||
// The current selected item id (based on the activity)
|
// The current selected item id (based on the activity)
|
||||||
|
|
|
@ -85,20 +85,22 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
||||||
Class iterClass = sideMenuItems.getClass();
|
Class iterClass = sideMenuItems.getClass();
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Method m = iterClass.getDeclaredMethod("onSetInitialValue", boolean.class, Object.class);
|
Method m = iterClass.getDeclaredMethod("onSetInitialValue", Object.class);
|
||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
m.invoke(sideMenuItems, true, null);
|
m.invoke(sideMenuItems, (Object)null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
LogUtils.LOGD(TAG, "Error while setting default Nav Drawer shortcuts: " + e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getPreferenceManager().getSharedPreferences().getStringSet(Settings.getRemoteBarItemsPrefKey(hostId), null) != null) {
|
if (getPreferenceManager().getSharedPreferences().getStringSet(Settings.getRemoteBarItemsPrefKey(hostId), null) != null) {
|
||||||
Class iterClass = remoteBarItems.getClass();
|
Class iterClass = remoteBarItems.getClass();
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Method m = iterClass.getDeclaredMethod("onSetInitialValue", boolean.class, Object.class);
|
Method m = iterClass.getDeclaredMethod("onSetInitialValue", Object.class);
|
||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
m.invoke(remoteBarItems, true, null);
|
m.invoke(remoteBarItems, (Object)null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
LogUtils.LOGD(TAG, "Error while setting default bottom bar shortcuts: " + e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,19 @@
|
||||||
<item>@string/system</item>
|
<item>@string/system</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array translatable="false" name="entry_values_remote_bar_items">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
<item>3</item>
|
||||||
|
<item>4</item>
|
||||||
|
<item>5</item>
|
||||||
|
<item>6</item>
|
||||||
|
<item>7</item>
|
||||||
|
<item>8</item>
|
||||||
|
<item>9</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<!-- Navigation Drawer items -->
|
<!-- Navigation Drawer items -->
|
||||||
<string-array name="entries_nav_drawer_items">
|
<string-array name="entries_nav_drawer_items">
|
||||||
<item>@string/movies</item>
|
<item>@string/movies</item>
|
||||||
|
@ -68,6 +81,18 @@
|
||||||
<item>@string/addons</item>
|
<item>@string/addons</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<!-- CAUTION: Keep this synced with the entries ids in NavigationDrawerFragment.java -->
|
||||||
|
<string-array translatable="false" name="entry_values_nav_drawer_items">
|
||||||
|
<item>2</item>
|
||||||
|
<item>3</item>
|
||||||
|
<item>4</item>
|
||||||
|
<item>5</item>
|
||||||
|
<item>9</item>
|
||||||
|
<item>6</item>
|
||||||
|
<item>10</item>
|
||||||
|
<item>7</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<!-- Download connection types -->
|
<!-- Download connection types -->
|
||||||
<string-array name="entries_download_media_items">
|
<string-array name="entries_download_media_items">
|
||||||
<item>WiFi</item>
|
<item>WiFi</item>
|
||||||
|
@ -85,19 +110,6 @@
|
||||||
<item>0</item>
|
<item>0</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array translatable="false" name="entry_values_remote_bar_items">
|
|
||||||
<item>0</item>
|
|
||||||
<item>1</item>
|
|
||||||
<item>2</item>
|
|
||||||
<item>3</item>
|
|
||||||
<item>4</item>
|
|
||||||
<item>5</item>
|
|
||||||
<item>6</item>
|
|
||||||
<item>7</item>
|
|
||||||
<item>8</item>
|
|
||||||
<item>9</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="default_values_remote_bar_items">
|
<string-array name="default_values_remote_bar_items">
|
||||||
<item>0</item>
|
<item>0</item>
|
||||||
<item>1</item>
|
<item>1</item>
|
||||||
|
@ -106,16 +118,4 @@
|
||||||
<item>5</item>
|
<item>5</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<!-- CAUTION: Keep this synced with the entries ids in NavigationDrawerFragment.java -->
|
|
||||||
<string-array translatable="false" name="entry_values_nav_drawer_items">
|
|
||||||
<item>2</item>
|
|
||||||
<item>3</item>
|
|
||||||
<item>4</item>
|
|
||||||
<item>5</item>
|
|
||||||
<item>9</item>
|
|
||||||
<item>6</item>
|
|
||||||
<item>10</item>
|
|
||||||
<item>7</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue