/*
- * Copyright © 2016-2019 Soren Stoutner <soren@stoutner.com>.
+ * Copyright © 2016-2020 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
*
import android.content.Context;
+import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import com.stoutner.privacybrowser.fragments.AboutTabFragment;
public class AboutPagerAdapter extends FragmentPagerAdapter {
- // Define the class variable to store the blocklist versions.
+ // Define the class variables.
private Context context;
private String[] blocklistVersions;
public AboutPagerAdapter(FragmentManager fragmentManager, Context context, String[] blocklistVersions) {
// Run the default commands.
- super(fragmentManager);
+ super(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
- // Store the context in a class variable.
+ // Store the class variables.
this.context = context;
-
- // Store the blocklist versions in a class variable.
this.blocklistVersions = blocklistVersions;
}
public CharSequence getPageTitle(int tab) {
switch (tab) {
case 0:
- return context.getResources().getString(R.string.version);
+ return context.getString(R.string.version);
case 1:
- return context.getResources().getString(R.string.permissions);
+ return context.getString(R.string.permissions);
case 2:
- return context.getResources().getString(R.string.privacy_policy);
+ return context.getString(R.string.privacy_policy);
case 3:
- return context.getResources().getString(R.string.changelog);
+ return context.getString(R.string.changelog);
case 4:
- return context.getResources().getString(R.string.licenses);
+ return context.getString(R.string.licenses);
case 5:
- return context.getResources().getString(R.string.contributors);
+ return context.getString(R.string.contributors);
case 6:
- return context.getResources().getString(R.string.links);
+ return context.getString(R.string.links);
default:
return "";
}
@Override
+ @NonNull
// Setup each tab.
public Fragment getItem(int tabNumber) {
return AboutTabFragment.createTab(tabNumber, blocklistVersions);