make main page changes display emediatly

This commit is contained in:
Christian Schabesberger 2017-10-13 13:49:31 +02:00
parent 8e8d74b5b7
commit 23eeb4353d
5 changed files with 12 additions and 1 deletions

View file

@ -119,6 +119,12 @@ public class MainActivity extends AppCompatActivity implements HistoryListener {
});
}
if(sharedPreferences.getBoolean(Constants.KEY_MAIN_PAGE_CHANGE, false)) {
if (DEBUG) Log.d(TAG, "main page has changed, recreating main fragment...");
sharedPreferences.edit().putBoolean(Constants.KEY_MAIN_PAGE_CHANGE, false).apply();
NavigationHelper.openMainActivity(this);
}
}
@Override

View file

@ -30,6 +30,7 @@ import org.schabi.newpipe.fragments.list.kiosk.KioskFragment;
import org.schabi.newpipe.fragments.subscription.SubscriptionFragment;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.NavigationHelper;

View file

@ -11,6 +11,7 @@ import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.KioskTranslator;
public class ContentSettingsFragment extends BasePreferenceFragment {
@ -88,6 +89,8 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
mainPageContentPref.setSummary(getMainPageSummeryByKey(newValue));
}
defaultPreferences.edit().putBoolean(Constants.KEY_MAIN_PAGE_CHANGE, true).apply();
return true;
}
});

View file

@ -9,4 +9,5 @@ public class Constants {
public static final String KEY_QUERY = "key_query";
public static final String KEY_THEME_CHANGE = "key_theme_change";
public static final String KEY_MAIN_PAGE_CHANGE = "key_main_page_change";
}

View file

@ -94,7 +94,7 @@ public class NavigationHelper {
if (!popped) openMainFragment(fragmentManager);
}
private static void openMainFragment(FragmentManager fragmentManager) {
public static void openMainFragment(FragmentManager fragmentManager) {
InfoCache.getInstance().trimCache();
fragmentManager.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);