Loading src/com/android/settings/dashboard/SupportFragment.java +8 −2 Original line number Diff line number Diff line Loading @@ -88,8 +88,8 @@ public final class SupportFragment extends InstrumentedFragment implements View. mAccountManager = AccountManager.get(mActivity); mSupportFeatureProvider = FeatureFactory.getFactory(mActivity).getSupportFeatureProvider(mActivity); mSupportItemAdapter = new SupportItemAdapter(mActivity, mSupportFeatureProvider, this /* itemClickListener */); mSupportItemAdapter = new SupportItemAdapter(mActivity, savedInstanceState, mSupportFeatureProvider, this /* itemClickListener */); mConnectivityManager = (ConnectivityManager) mActivity.getSystemService(Context.CONNECTIVITY_SERVICE); } Loading Loading @@ -129,6 +129,12 @@ public final class SupportFragment extends InstrumentedFragment implements View. mConnectivityManager.unregisterNetworkCallback(mNetworkCallback); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mSupportItemAdapter.onSaveInstanceState(outState); } @Override public void onAccountsUpdated(Account[] accounts) { // Account changed, update support items. Loading src/com/android/settings/dashboard/SupportItemAdapter.java +11 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.app.Activity; import android.app.DialogFragment; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.LayoutInflater; Loading Loading @@ -53,6 +54,7 @@ import static com.android.settings.overlay.SupportFeatureProvider.SupportType.PH */ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAdapter.ViewHolder> { private static final String STATE_SELECTED_COUNTRY = "STATE_SELECTED_COUNTRY"; private static final int TYPE_TITLE = R.layout.support_item_title; private static final int TYPE_ESCALATION_OPTIONS = R.layout.support_escalation_options; private static final int TYPE_ESCALATION_OPTIONS_OFFLINE = Loading @@ -71,8 +73,8 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd private boolean mHasInternet; private Account mAccount; public SupportItemAdapter(Activity activity, SupportFeatureProvider supportFeatureProvider, View.OnClickListener itemClickListener) { public SupportItemAdapter(Activity activity, Bundle savedInstanceState, SupportFeatureProvider supportFeatureProvider, View.OnClickListener itemClickListener) { mActivity = activity; mSupportFeatureProvider = supportFeatureProvider; mItemClickListener = itemClickListener; Loading @@ -81,6 +83,9 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd mSupportData = new ArrayList<>(); // Optimistically assume we have Internet access. It will be updated later to correct value. mHasInternet = true; if (savedInstanceState != null) { mSelectedCountry = savedInstanceState.getString(STATE_SELECTED_COUNTRY); } setAccount(mSupportFeatureProvider.getSupportEligibleAccount(mActivity)); refreshData(); } Loading Loading @@ -149,6 +154,10 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd } } public void onSaveInstanceState(Bundle outState) { outState.putString(STATE_SELECTED_COUNTRY, mSelectedCountry); } /** * Create data for the adapter. If there is already data in the adapter, they will be * destroyed and recreated. Loading Loading
src/com/android/settings/dashboard/SupportFragment.java +8 −2 Original line number Diff line number Diff line Loading @@ -88,8 +88,8 @@ public final class SupportFragment extends InstrumentedFragment implements View. mAccountManager = AccountManager.get(mActivity); mSupportFeatureProvider = FeatureFactory.getFactory(mActivity).getSupportFeatureProvider(mActivity); mSupportItemAdapter = new SupportItemAdapter(mActivity, mSupportFeatureProvider, this /* itemClickListener */); mSupportItemAdapter = new SupportItemAdapter(mActivity, savedInstanceState, mSupportFeatureProvider, this /* itemClickListener */); mConnectivityManager = (ConnectivityManager) mActivity.getSystemService(Context.CONNECTIVITY_SERVICE); } Loading Loading @@ -129,6 +129,12 @@ public final class SupportFragment extends InstrumentedFragment implements View. mConnectivityManager.unregisterNetworkCallback(mNetworkCallback); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mSupportItemAdapter.onSaveInstanceState(outState); } @Override public void onAccountsUpdated(Account[] accounts) { // Account changed, update support items. Loading
src/com/android/settings/dashboard/SupportItemAdapter.java +11 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.app.Activity; import android.app.DialogFragment; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.LayoutInflater; Loading Loading @@ -53,6 +54,7 @@ import static com.android.settings.overlay.SupportFeatureProvider.SupportType.PH */ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAdapter.ViewHolder> { private static final String STATE_SELECTED_COUNTRY = "STATE_SELECTED_COUNTRY"; private static final int TYPE_TITLE = R.layout.support_item_title; private static final int TYPE_ESCALATION_OPTIONS = R.layout.support_escalation_options; private static final int TYPE_ESCALATION_OPTIONS_OFFLINE = Loading @@ -71,8 +73,8 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd private boolean mHasInternet; private Account mAccount; public SupportItemAdapter(Activity activity, SupportFeatureProvider supportFeatureProvider, View.OnClickListener itemClickListener) { public SupportItemAdapter(Activity activity, Bundle savedInstanceState, SupportFeatureProvider supportFeatureProvider, View.OnClickListener itemClickListener) { mActivity = activity; mSupportFeatureProvider = supportFeatureProvider; mItemClickListener = itemClickListener; Loading @@ -81,6 +83,9 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd mSupportData = new ArrayList<>(); // Optimistically assume we have Internet access. It will be updated later to correct value. mHasInternet = true; if (savedInstanceState != null) { mSelectedCountry = savedInstanceState.getString(STATE_SELECTED_COUNTRY); } setAccount(mSupportFeatureProvider.getSupportEligibleAccount(mActivity)); refreshData(); } Loading Loading @@ -149,6 +154,10 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd } } public void onSaveInstanceState(Bundle outState) { outState.putString(STATE_SELECTED_COUNTRY, mSelectedCountry); } /** * Create data for the adapter. If there is already data in the adapter, they will be * destroyed and recreated. Loading