diff options
Diffstat (limited to 'src/com/android/tv/onboarding/SetupSourcesFragment.java')
-rw-r--r-- | src/com/android/tv/onboarding/SetupSourcesFragment.java | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/com/android/tv/onboarding/SetupSourcesFragment.java b/src/com/android/tv/onboarding/SetupSourcesFragment.java index 23145503..ebf32d00 100644 --- a/src/com/android/tv/onboarding/SetupSourcesFragment.java +++ b/src/com/android/tv/onboarding/SetupSourcesFragment.java @@ -30,6 +30,7 @@ import android.support.v17.leanback.widget.GuidanceStylist.Guidance; import android.support.v17.leanback.widget.GuidedAction; import android.support.v17.leanback.widget.GuidedActionsStylist; import android.support.v17.leanback.widget.VerticalGridView; +import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -59,14 +60,16 @@ import java.util.List; * A fragment for channel source info/setup. */ public class SetupSourcesFragment extends SetupMultiPaneFragment { - private static final String TAG = "SetupSourcesFragment"; - public static final String ACTION_CATEGORY = "com.android.tv.onboarding.SetupSourcesFragment"; public static final int ACTION_PLAY_STORE = 1; + public static final int DEFAULT_THEME = -1; + private static final String SETUP_TRACKER_LABEL = "Setup fragment"; + private static int sTheme = DEFAULT_THEME; + private InputSetupRunnable mInputSetupRunnable; private ContentFragment mContentFragment; @@ -74,7 +77,12 @@ public class SetupSourcesFragment extends SetupMultiPaneFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = super.onCreateView(inflater, container, savedInstanceState); + LayoutInflater localInflater = inflater; + if (sTheme != -1) { + ContextThemeWrapper themeWrapper = new ContextThemeWrapper(getActivity(), sTheme); + localInflater = inflater.cloneInContext(themeWrapper); + } + View view = super.onCreateView(localInflater, container, savedInstanceState); TvApplication.getSingletons(getActivity()).getTracker().sendScreenView(SETUP_TRACKER_LABEL); return view; } @@ -89,10 +97,10 @@ public class SetupSourcesFragment extends SetupMultiPaneFragment { @Override protected SetupGuidedStepFragment onCreateContentFragment() { mContentFragment = new ContentFragment(); - mContentFragment.setParentFragment(this); Bundle arguments = new Bundle(); arguments.putBoolean(SetupGuidedStepFragment.KEY_THREE_PANE, true); mContentFragment.setArguments(arguments); + mContentFragment.setParentFragment(this); return mContentFragment; } @@ -102,6 +110,13 @@ public class SetupSourcesFragment extends SetupMultiPaneFragment { } /** + * Sets the custom theme dynamically. + */ + public static void setTheme(int theme) { + sTheme = theme; + } + + /** * Call this method to run customized input setup. * * @param runnable runnable to be called when the input setup is necessary. @@ -158,11 +173,6 @@ public class SetupSourcesFragment extends SetupMultiPaneFragment { handleInputChanged(); } - @Override - public void onInputUpdated(String inputId) { - handleInputChanged(); - } - private void handleInputChanged() { // The actions created while enter transition is running will not be included in the // fragment transition. @@ -385,6 +395,11 @@ public class SetupSourcesFragment extends SetupMultiPaneFragment { updateActions(); } + @Override + public int onProvideTheme() { + return sTheme == DEFAULT_THEME ? super.onProvideTheme() : sTheme; + } + void executePendingAction() { switch (mPendingAction) { case PENDING_ACTION_INPUT_CHANGED: |