|
@ -59,11 +59,14 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared |
|
|
public SettingsFragment() { |
|
|
public SettingsFragment() { |
|
|
defaultHomeTabEntries.add("Recent"); |
|
|
defaultHomeTabEntries.add("Recent"); |
|
|
defaultHomeTabEntries.add("Forum"); |
|
|
defaultHomeTabEntries.add("Forum"); |
|
|
defaultHomeTabEntries.add("Unread"); |
|
|
|
|
|
|
|
|
|
|
|
defaultHomeTabValues.add("0"); |
|
|
defaultHomeTabValues.add("0"); |
|
|
defaultHomeTabValues.add("1"); |
|
|
defaultHomeTabValues.add("1"); |
|
|
defaultHomeTabValues.add("2"); |
|
|
|
|
|
|
|
|
if(isLoggedIn = BaseApplication.getInstance().getSessionManager().isLoggedIn()){ |
|
|
|
|
|
defaultHomeTabEntries.add("Unread"); |
|
|
|
|
|
defaultHomeTabValues.add("2"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -94,7 +97,6 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared |
|
|
if(isLoggedIn&&(prefs_type==PREFS_TYPE.GUEST||prefs_type==PREFS_TYPE.NOT_SET)){ |
|
|
if(isLoggedIn&&(prefs_type==PREFS_TYPE.GUEST||prefs_type==PREFS_TYPE.NOT_SET)){ |
|
|
prefs_type = PREFS_TYPE.USER; |
|
|
prefs_type = PREFS_TYPE.USER; |
|
|
addPreferencesFromResource(R.xml.app_preferences_user); |
|
|
addPreferencesFromResource(R.xml.app_preferences_user); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else if(!isLoggedIn&&(prefs_type==PREFS_TYPE.USER||prefs_type==PREFS_TYPE.NOT_SET)){ |
|
|
else if(!isLoggedIn&&(prefs_type==PREFS_TYPE.USER||prefs_type==PREFS_TYPE.NOT_SET)){ |
|
|
prefs_type = PREFS_TYPE.GUEST; |
|
|
prefs_type = PREFS_TYPE.GUEST; |
|
@ -165,14 +167,12 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void updatePreferenceVisibility(){ |
|
|
private void updatePreferenceVisibility(){ |
|
|
boolean updateHomeTabs=false; |
|
|
|
|
|
if(isLoggedIn&& prefs_type==PREFS_TYPE.GUEST) { |
|
|
if(isLoggedIn&& prefs_type==PREFS_TYPE.GUEST) { |
|
|
prefs_type = PREFS_TYPE.USER; |
|
|
prefs_type = PREFS_TYPE.USER; |
|
|
setPreferencesFromResource(R.xml.app_preferences_user, getPreferenceScreen().getKey()); |
|
|
setPreferencesFromResource(R.xml.app_preferences_user, getPreferenceScreen().getKey()); |
|
|
if(!defaultHomeTabEntries.contains("Unread")){ |
|
|
if(!defaultHomeTabEntries.contains("Unread")){ |
|
|
defaultHomeTabEntries.add("Unread"); |
|
|
defaultHomeTabEntries.add("Unread"); |
|
|
defaultHomeTabValues.add("2"); |
|
|
defaultHomeTabValues.add("2"); |
|
|
updateHomeTabs=true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else if(!isLoggedIn&&prefs_type==PREFS_TYPE.USER){ |
|
|
else if(!isLoggedIn&&prefs_type==PREFS_TYPE.USER){ |
|
@ -181,17 +181,14 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared |
|
|
if(defaultHomeTabEntries.contains("Unread")){ |
|
|
if(defaultHomeTabEntries.contains("Unread")){ |
|
|
defaultHomeTabEntries.remove("Unread"); |
|
|
defaultHomeTabEntries.remove("Unread"); |
|
|
defaultHomeTabValues.remove("2"); |
|
|
defaultHomeTabValues.remove("2"); |
|
|
updateHomeTabs=true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(updateHomeTabs){ |
|
|
CharSequence[] tmpCs = defaultHomeTabEntries.toArray(new CharSequence[defaultHomeTabEntries.size()]); |
|
|
CharSequence[] tmpCs = defaultHomeTabEntries.toArray(new CharSequence[defaultHomeTabEntries.size()]); |
|
|
((ListPreference) findPreference(DEFAULT_HOME_TAB)).setEntries(tmpCs); |
|
|
((ListPreference) findPreference(DEFAULT_HOME_TAB)).setEntries(tmpCs); |
|
|
|
|
|
|
|
|
|
|
|
tmpCs = defaultHomeTabValues.toArray(new CharSequence[defaultHomeTabValues.size()]); |
|
|
tmpCs = defaultHomeTabValues.toArray(new CharSequence[defaultHomeTabValues.size()]); |
|
|
((ListPreference) findPreference(DEFAULT_HOME_TAB)).setEntryValues(tmpCs); |
|
|
((ListPreference) findPreference(DEFAULT_HOME_TAB)).setEntryValues(tmpCs); |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|