Fix issue #620
This commit is contained in:
parent
f071e6631f
commit
64c4161d41
|
@ -2364,81 +2364,15 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
}else if( position == 1) {
|
||||
notificationsFragment = new DisplayNotificationsFragment();
|
||||
return notificationsFragment;
|
||||
}else if( position == 2 && display_direct) {
|
||||
}else {
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
String instanceVersion = sharedpreferences.getString(Helper.INSTANCE_VERSION + userId + instance, null);
|
||||
boolean old_direct_timeline = sharedpreferences.getBoolean(Helper.SET_OLD_DIRECT_TIMELINE, false);
|
||||
if (instanceVersion != null) {
|
||||
Version currentVersion = new Version(instanceVersion);
|
||||
Version minVersion = new Version("2.6");
|
||||
if( old_direct_timeline)
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.DIRECT);
|
||||
else if (currentVersion.compareTo(minVersion) == 1 || currentVersion.equals(minVersion)) {
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.CONVERSATION);
|
||||
} else {
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.DIRECT);
|
||||
}
|
||||
}else{
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.DIRECT);
|
||||
bundle.putSerializable("type", Helper.timelineType(getApplicationContext(), position));
|
||||
if( Helper.timelineType(getApplicationContext(), position) == RetrieveFeedsAsyncTask.Type.TAG){
|
||||
if( tabLayout.getTabAt(position) != null && tabLayout.getTabAt(position).getText() != null)
|
||||
bundle.putString("tag", tabLayout.getTabAt(position).getText().toString());
|
||||
}
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
}else if(position == 2 && display_local ){
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.LOCAL);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
}else if(position == 2 && display_global ){
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.PUBLIC);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
}else if(position == 2 && display_art ){
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.ART);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
} else if (position == 3 && display_local && display_direct){
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.LOCAL);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
}else if (position == 3 && display_global && (display_direct && !display_local) || (!display_direct && display_local)){
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.PUBLIC);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
} else if (position == 3 && display_art){
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.ART);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
}
|
||||
else if (position == 4 && display_global && display_local && display_direct){
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.PUBLIC);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
} else if (position == 4 && display_art){
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.ART);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
} else if (position == 5 && countPage == 6){
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.ART);
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
}
|
||||
else{ //Here it's a search fragment
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.TAG);
|
||||
if( tabLayout.getTabAt(position) != null && tabLayout.getTabAt(position).getText() != null)
|
||||
bundle.putString("tag", tabLayout.getTabAt(position).getText().toString());
|
||||
statusFragment.setArguments(bundle);
|
||||
return statusFragment;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2943,6 +2943,60 @@ public class Helper {
|
|||
|
||||
}
|
||||
|
||||
public static RetrieveFeedsAsyncTask.Type timelineType(Context context, int position){
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
boolean display_direct = sharedpreferences.getBoolean(Helper.SET_DISPLAY_DIRECT, true);
|
||||
boolean display_local = sharedpreferences.getBoolean(Helper.SET_DISPLAY_LOCAL, true);
|
||||
boolean display_global = sharedpreferences.getBoolean(Helper.SET_DISPLAY_GLOBAL, true);
|
||||
boolean display_art = sharedpreferences.getBoolean(Helper.SET_DISPLAY_ART, true);
|
||||
if (position == 0) {
|
||||
return RetrieveFeedsAsyncTask.Type.HOME;
|
||||
}else if(position == 2) {
|
||||
if( display_direct) {
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||
String instanceVersion = sharedpreferences.getString(Helper.INSTANCE_VERSION + userId + instance, null);
|
||||
|
||||
if (instanceVersion != null) {
|
||||
Version currentVersion = new Version(instanceVersion);
|
||||
Version minVersion = new Version("2.6");
|
||||
if (currentVersion.compareTo(minVersion) == 1 || currentVersion.equals(minVersion)) {
|
||||
boolean old_direct_timeline = sharedpreferences.getBoolean(Helper.SET_OLD_DIRECT_TIMELINE, false);
|
||||
if( !old_direct_timeline)
|
||||
return RetrieveFeedsAsyncTask.Type.CONVERSATION;
|
||||
else
|
||||
return RetrieveFeedsAsyncTask.Type.DIRECT;
|
||||
} else {
|
||||
return RetrieveFeedsAsyncTask.Type.DIRECT;
|
||||
}
|
||||
}else{
|
||||
return RetrieveFeedsAsyncTask.Type.DIRECT;
|
||||
}
|
||||
}if( display_local)
|
||||
return RetrieveFeedsAsyncTask.Type.LOCAL;
|
||||
if( display_global)
|
||||
return RetrieveFeedsAsyncTask.Type.PUBLIC;
|
||||
if( display_art)
|
||||
return RetrieveFeedsAsyncTask.Type.ART;
|
||||
}else if( position == 3){
|
||||
if( display_direct && display_local)
|
||||
return RetrieveFeedsAsyncTask.Type.LOCAL;
|
||||
if( display_global)
|
||||
return RetrieveFeedsAsyncTask.Type.PUBLIC;
|
||||
if( display_art)
|
||||
return RetrieveFeedsAsyncTask.Type.ART;
|
||||
}else if (position == 4){
|
||||
if( display_direct && display_local && display_global)
|
||||
return RetrieveFeedsAsyncTask.Type.PUBLIC;
|
||||
if( display_art)
|
||||
return RetrieveFeedsAsyncTask.Type.ART;
|
||||
}else if (position == 5){
|
||||
if( display_direct && display_local && display_global && display_art)
|
||||
return RetrieveFeedsAsyncTask.Type.ART;
|
||||
}
|
||||
return RetrieveFeedsAsyncTask.Type.TAG;
|
||||
}
|
||||
|
||||
public static boolean containsCaseInsensitive(String s, List<String> l){
|
||||
for (String string : l){
|
||||
if (string.equalsIgnoreCase(s)){
|
||||
|
|
Loading…
Reference in New Issue