Loading AndroidManifest.xml +0 −4 Original line number Diff line number Diff line Loading @@ -66,9 +66,5 @@ </intent-filter> </activity-alias> <activity android:name="com.android.customization.picker.ViewOnlyFullPreviewActivity" android:resizeableActivity="false" android:theme="@style/CustomizationTheme.NoActionBar"/> </application> </manifest> src/com/android/customization/picker/ViewOnlyFullPreviewActivity.javadeleted 100644 → 0 +0 −95 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.customization.picker; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import com.android.customization.picker.grid.GridFullPreviewFragment; import com.android.wallpaper.R; import com.android.wallpaper.picker.AppbarFragment.AppbarFragmentHost; import com.android.wallpaper.widget.BottomActionBar; import com.android.wallpaper.widget.BottomActionBar.BottomActionBarHost; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** Activity for full preview. */ public class ViewOnlyFullPreviewActivity extends FragmentActivity implements AppbarFragmentHost, BottomActionBarHost { private static final String EXTRA_PREVIEW_SECTION = "preview_section"; private static final String EXTRA_PREVIEW_BUNDLE = "preview_bundle"; public static final int SECTION_STYLE = 0; public static final int SECTION_GRID = 1; public static final int SECTION_CLOCK = 2; @Override public void onUpArrowPressed() { onBackPressed(); } @Override public boolean isUpArrowSupported() { return true; } @IntDef({SECTION_STYLE, SECTION_GRID, SECTION_CLOCK}) @Retention(RetentionPolicy.SOURCE) private @interface Section {} /** Returns a new Intent with the provided data in the extra. */ public static Intent newIntent(Context packageContext, @Section int section, Bundle bundle) { Intent intent = new Intent(packageContext, ViewOnlyFullPreviewActivity.class); intent.putExtra(EXTRA_PREVIEW_SECTION, section); intent.putExtra(EXTRA_PREVIEW_BUNDLE, bundle); return intent; } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_full_preview); final Intent intent = getIntent(); @Section final int section = intent.getIntExtra(EXTRA_PREVIEW_SECTION, 0); final Bundle bundle = intent.getBundleExtra(EXTRA_PREVIEW_BUNDLE); if (section == SECTION_GRID) { showFragment(GridFullPreviewFragment.newInstance( getString(R.string.grid_title), bundle)); } } @Override public BottomActionBar getBottomActionBar() { return findViewById(R.id.bottom_actionbar); } private void showFragment(Fragment fragment) { getSupportFragmentManager() .beginTransaction() .replace(R.id.preview_fragment_container, fragment) .commitNow(); } } src/com/android/customization/picker/grid/GridFragment.java +1 −29 Original line number Diff line number Diff line Loading @@ -15,14 +15,8 @@ */ package com.android.customization.picker.grid; import static android.app.Activity.RESULT_OK; import static com.android.customization.picker.ViewOnlyFullPreviewActivity.SECTION_GRID; import static com.android.customization.picker.grid.GridFullPreviewFragment.EXTRA_GRID_OPTION; import static com.android.customization.picker.grid.GridFullPreviewFragment.EXTRA_WALLPAPER_INFO; import static com.android.wallpaper.widget.BottomActionBar.BottomAction.APPLY_TEXT; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; Loading @@ -42,7 +36,6 @@ import com.android.customization.model.CustomizationOption; import com.android.customization.model.grid.GridOption; import com.android.customization.model.grid.GridOptionsManager; import com.android.customization.module.ThemesUserEventLogger; import com.android.customization.picker.ViewOnlyFullPreviewActivity; import com.android.customization.picker.WallpaperPreviewer; import com.android.customization.widget.OptionSelectorController; import com.android.customization.widget.OptionSelectorController.CheckmarkStyle; Loading @@ -63,13 +56,11 @@ import java.util.List; */ public class GridFragment extends AppbarFragment { private static final int FULL_PREVIEW_REQUEST_CODE = 1000; private static final String TAG = "GridFragment"; private static final String KEY_STATE_SELECTED_OPTION = "GridFragment.selectedOption"; private static final String KEY_STATE_BOTTOM_ACTION_BAR_VISIBLE = "GridFragment.bottomActionBarVisible"; private static final String TAG = "GridFragment"; public static GridFragment newInstance(CharSequence title) { GridFragment fragment = new GridFragment(); fragment.setArguments(AppbarFragment.createArguments(title)); Loading @@ -86,7 +77,6 @@ public class GridFragment extends AppbarFragment { private View mError; private BottomActionBar mBottomActionBar; private ThemesUserEventLogger mEventLogger; private GridOptionPreviewer mGridOptionPreviewer; private final Callback mApplyGridCallback = new Callback() { Loading Loading @@ -153,7 +143,6 @@ public class GridFragment extends AppbarFragment { mGridOptionPreviewer = new GridOptionPreviewer(mGridManager, view.findViewById(R.id.grid_preview_container)); view.findViewById(R.id.grid_preview_card).setOnClickListener(v -> showFullPreview()); return view; } Loading @@ -176,15 +165,6 @@ public class GridFragment extends AppbarFragment { } } @Override public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == FULL_PREVIEW_REQUEST_CODE && resultCode == RESULT_OK) { applyGridOption(data.getParcelableExtra(EXTRA_GRID_OPTION)); } } @Override protected void onBottomActionBarReady(BottomActionBar bottomActionBar) { super.onBottomActionBarReady(bottomActionBar); Loading Loading @@ -281,12 +261,4 @@ public class GridFragment extends AppbarFragment { mBottomActionBar.hide(); } } private void showFullPreview() { Bundle bundle = new Bundle(); bundle.putParcelable(EXTRA_WALLPAPER_INFO, mHomeWallpaper); bundle.putParcelable(EXTRA_GRID_OPTION, mSelectedOption); Intent intent = ViewOnlyFullPreviewActivity.newIntent(getContext(), SECTION_GRID, bundle); startActivityForResult(intent, FULL_PREVIEW_REQUEST_CODE); } } src/com/android/customization/picker/grid/GridFullPreviewFragment.javadeleted 100644 → 0 +0 −128 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.customization.picker.grid; import static android.app.Activity.RESULT_OK; import static com.android.wallpaper.widget.BottomActionBar.BottomAction.APPLY_TEXT; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.SurfaceView; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.customization.model.grid.GridOption; import com.android.customization.model.grid.GridOptionsManager; import com.android.customization.picker.WallpaperPreviewer; import com.android.wallpaper.R; import com.android.wallpaper.model.WallpaperInfo; import com.android.wallpaper.picker.AppbarFragment; import com.android.wallpaper.widget.BottomActionBar; import com.bumptech.glide.Glide; /** A Fragment for grid full preview page. */ public class GridFullPreviewFragment extends AppbarFragment { static final String EXTRA_WALLPAPER_INFO = "wallpaper_info"; static final String EXTRA_GRID_OPTION = "grid_option"; private WallpaperInfo mWallpaper; private GridOption mGridOption; private WallpaperPreviewer mWallpaperPreviewer; private GridOptionPreviewer mGridOptionPreviewer; /** * Returns a new {@link GridFullPreviewFragment} with the provided title and bundle arguments * set. */ public static GridFullPreviewFragment newInstance(CharSequence title, Bundle intentBundle) { GridFullPreviewFragment fragment = new GridFullPreviewFragment(); Bundle bundle = new Bundle(); bundle.putAll(AppbarFragment.createArguments(title)); bundle.putAll(intentBundle); fragment.setArguments(bundle); return fragment; } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mWallpaper = getArguments().getParcelable(EXTRA_WALLPAPER_INFO); mGridOption = getArguments().getParcelable(EXTRA_GRID_OPTION); } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate( R.layout.fragment_grid_full_preview, container, /* attachToRoot */ false); setUpToolbar(view); // Clear memory cache whenever grid fragment view is being loaded. Glide.get(getContext()).clearMemory(); ImageView wallpaperPreviewImage = view.findViewById(R.id.wallpaper_preview_image); SurfaceView wallpaperSurface = view.findViewById(R.id.wallpaper_preview_surface); mWallpaperPreviewer = new WallpaperPreviewer( getLifecycle(), getActivity(), wallpaperPreviewImage, wallpaperSurface); mGridOptionPreviewer = new GridOptionPreviewer(GridOptionsManager.getInstance(getContext()), view.findViewById(R.id.grid_preview_container)); return view; } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mWallpaperPreviewer.setWallpaper(mWallpaper, /* listener= */ null); mGridOptionPreviewer.setGridOption(mGridOption); } @Override public void onDestroy() { super.onDestroy(); if (mGridOptionPreviewer != null) { mGridOptionPreviewer.release(); } } @Override protected void onBottomActionBarReady(BottomActionBar bottomActionBar) { super.onBottomActionBarReady(bottomActionBar); bottomActionBar.showActionsOnly(APPLY_TEXT); bottomActionBar.setActionClickListener(APPLY_TEXT, v -> finishActivityWithResultOk()); bottomActionBar.show(); } private void finishActivityWithResultOk() { Activity activity = requireActivity(); activity.overridePendingTransition(R.anim.fade_in, R.anim.fade_out); Intent intent = new Intent(); intent.putExtra(EXTRA_GRID_OPTION, mGridOption); activity.setResult(RESULT_OK, intent); activity.finish(); } } src/com/android/customization/picker/theme/CustomThemeNameFragment.java +0 −23 Original line number Diff line number Diff line Loading @@ -15,12 +15,6 @@ */ package com.android.customization.picker.theme; import static com.android.customization.picker.ViewOnlyFullPreviewActivity.SECTION_STYLE; import static com.android.customization.picker.theme.ThemeFullPreviewFragment.EXTRA_THEME_OPTION; import static com.android.customization.picker.theme.ThemeFullPreviewFragment.EXTRA_THEME_OPTION_TITLE; import static com.android.customization.picker.theme.ThemeFullPreviewFragment.EXTRA_WALLPAPER_INFO; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; Loading @@ -37,10 +31,8 @@ import com.android.customization.model.theme.ThemeBundle.PreviewInfo; import com.android.customization.model.theme.custom.CustomTheme; import com.android.customization.module.CustomizationInjector; import com.android.customization.module.CustomizationPreferences; import com.android.customization.picker.ViewOnlyFullPreviewActivity; import com.android.customization.picker.WallpaperPreviewer; import com.android.wallpaper.R; import com.android.wallpaper.model.WallpaperInfo; import com.android.wallpaper.module.CurrentWallpaperInfoFactory; import com.android.wallpaper.module.InjectorProvider; import com.android.wallpaper.picker.AppbarFragment; Loading @@ -66,7 +58,6 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { private EditText mNameEditor; private ImageView mWallpaperImage; private WallpaperInfo mCurrentHomeWallpaper; private ThemeOptionPreviewer mThemeOptionPreviewer; private CustomizationPreferences mCustomizationPreferences; Loading Loading @@ -98,7 +89,6 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { view.findViewById(R.id.wallpaper_preview_surface)); currentWallpaperFactory.createCurrentWallpaperInfos( (homeWallpaper, lockWallpaper, presentationMode) -> { mCurrentHomeWallpaper = homeWallpaper; wallpaperPreviewer.setWallpaper(homeWallpaper, mThemeOptionPreviewer::updateColorForLauncherWidgets); }, false); Loading @@ -106,8 +96,6 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { // Set theme default name. mNameEditor = view.findViewById(R.id.custom_theme_name); mNameEditor.setText(getOriginalThemeName()); view.findViewById(R.id.theme_preview_card).setOnClickListener(v -> showFullPreview()); return view; } Loading Loading @@ -141,15 +129,4 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { public String getThemeName() { return mNameEditor.getText().toString(); } private void showFullPreview() { CustomTheme themeToFullPreview = mCustomThemeManager.buildPartialCustomTheme( getContext(), /* id= */ "", getThemeName()); Bundle bundle = new Bundle(); bundle.putParcelable(EXTRA_WALLPAPER_INFO, mCurrentHomeWallpaper); bundle.putString(EXTRA_THEME_OPTION, themeToFullPreview.getSerializedPackages()); bundle.putString(EXTRA_THEME_OPTION_TITLE, themeToFullPreview.getTitle()); Intent intent = ViewOnlyFullPreviewActivity.newIntent(getContext(), SECTION_STYLE, bundle); startActivity(intent); } } Loading
AndroidManifest.xml +0 −4 Original line number Diff line number Diff line Loading @@ -66,9 +66,5 @@ </intent-filter> </activity-alias> <activity android:name="com.android.customization.picker.ViewOnlyFullPreviewActivity" android:resizeableActivity="false" android:theme="@style/CustomizationTheme.NoActionBar"/> </application> </manifest>
src/com/android/customization/picker/ViewOnlyFullPreviewActivity.javadeleted 100644 → 0 +0 −95 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.customization.picker; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import com.android.customization.picker.grid.GridFullPreviewFragment; import com.android.wallpaper.R; import com.android.wallpaper.picker.AppbarFragment.AppbarFragmentHost; import com.android.wallpaper.widget.BottomActionBar; import com.android.wallpaper.widget.BottomActionBar.BottomActionBarHost; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** Activity for full preview. */ public class ViewOnlyFullPreviewActivity extends FragmentActivity implements AppbarFragmentHost, BottomActionBarHost { private static final String EXTRA_PREVIEW_SECTION = "preview_section"; private static final String EXTRA_PREVIEW_BUNDLE = "preview_bundle"; public static final int SECTION_STYLE = 0; public static final int SECTION_GRID = 1; public static final int SECTION_CLOCK = 2; @Override public void onUpArrowPressed() { onBackPressed(); } @Override public boolean isUpArrowSupported() { return true; } @IntDef({SECTION_STYLE, SECTION_GRID, SECTION_CLOCK}) @Retention(RetentionPolicy.SOURCE) private @interface Section {} /** Returns a new Intent with the provided data in the extra. */ public static Intent newIntent(Context packageContext, @Section int section, Bundle bundle) { Intent intent = new Intent(packageContext, ViewOnlyFullPreviewActivity.class); intent.putExtra(EXTRA_PREVIEW_SECTION, section); intent.putExtra(EXTRA_PREVIEW_BUNDLE, bundle); return intent; } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_full_preview); final Intent intent = getIntent(); @Section final int section = intent.getIntExtra(EXTRA_PREVIEW_SECTION, 0); final Bundle bundle = intent.getBundleExtra(EXTRA_PREVIEW_BUNDLE); if (section == SECTION_GRID) { showFragment(GridFullPreviewFragment.newInstance( getString(R.string.grid_title), bundle)); } } @Override public BottomActionBar getBottomActionBar() { return findViewById(R.id.bottom_actionbar); } private void showFragment(Fragment fragment) { getSupportFragmentManager() .beginTransaction() .replace(R.id.preview_fragment_container, fragment) .commitNow(); } }
src/com/android/customization/picker/grid/GridFragment.java +1 −29 Original line number Diff line number Diff line Loading @@ -15,14 +15,8 @@ */ package com.android.customization.picker.grid; import static android.app.Activity.RESULT_OK; import static com.android.customization.picker.ViewOnlyFullPreviewActivity.SECTION_GRID; import static com.android.customization.picker.grid.GridFullPreviewFragment.EXTRA_GRID_OPTION; import static com.android.customization.picker.grid.GridFullPreviewFragment.EXTRA_WALLPAPER_INFO; import static com.android.wallpaper.widget.BottomActionBar.BottomAction.APPLY_TEXT; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; Loading @@ -42,7 +36,6 @@ import com.android.customization.model.CustomizationOption; import com.android.customization.model.grid.GridOption; import com.android.customization.model.grid.GridOptionsManager; import com.android.customization.module.ThemesUserEventLogger; import com.android.customization.picker.ViewOnlyFullPreviewActivity; import com.android.customization.picker.WallpaperPreviewer; import com.android.customization.widget.OptionSelectorController; import com.android.customization.widget.OptionSelectorController.CheckmarkStyle; Loading @@ -63,13 +56,11 @@ import java.util.List; */ public class GridFragment extends AppbarFragment { private static final int FULL_PREVIEW_REQUEST_CODE = 1000; private static final String TAG = "GridFragment"; private static final String KEY_STATE_SELECTED_OPTION = "GridFragment.selectedOption"; private static final String KEY_STATE_BOTTOM_ACTION_BAR_VISIBLE = "GridFragment.bottomActionBarVisible"; private static final String TAG = "GridFragment"; public static GridFragment newInstance(CharSequence title) { GridFragment fragment = new GridFragment(); fragment.setArguments(AppbarFragment.createArguments(title)); Loading @@ -86,7 +77,6 @@ public class GridFragment extends AppbarFragment { private View mError; private BottomActionBar mBottomActionBar; private ThemesUserEventLogger mEventLogger; private GridOptionPreviewer mGridOptionPreviewer; private final Callback mApplyGridCallback = new Callback() { Loading Loading @@ -153,7 +143,6 @@ public class GridFragment extends AppbarFragment { mGridOptionPreviewer = new GridOptionPreviewer(mGridManager, view.findViewById(R.id.grid_preview_container)); view.findViewById(R.id.grid_preview_card).setOnClickListener(v -> showFullPreview()); return view; } Loading @@ -176,15 +165,6 @@ public class GridFragment extends AppbarFragment { } } @Override public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == FULL_PREVIEW_REQUEST_CODE && resultCode == RESULT_OK) { applyGridOption(data.getParcelableExtra(EXTRA_GRID_OPTION)); } } @Override protected void onBottomActionBarReady(BottomActionBar bottomActionBar) { super.onBottomActionBarReady(bottomActionBar); Loading Loading @@ -281,12 +261,4 @@ public class GridFragment extends AppbarFragment { mBottomActionBar.hide(); } } private void showFullPreview() { Bundle bundle = new Bundle(); bundle.putParcelable(EXTRA_WALLPAPER_INFO, mHomeWallpaper); bundle.putParcelable(EXTRA_GRID_OPTION, mSelectedOption); Intent intent = ViewOnlyFullPreviewActivity.newIntent(getContext(), SECTION_GRID, bundle); startActivityForResult(intent, FULL_PREVIEW_REQUEST_CODE); } }
src/com/android/customization/picker/grid/GridFullPreviewFragment.javadeleted 100644 → 0 +0 −128 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.customization.picker.grid; import static android.app.Activity.RESULT_OK; import static com.android.wallpaper.widget.BottomActionBar.BottomAction.APPLY_TEXT; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.SurfaceView; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.customization.model.grid.GridOption; import com.android.customization.model.grid.GridOptionsManager; import com.android.customization.picker.WallpaperPreviewer; import com.android.wallpaper.R; import com.android.wallpaper.model.WallpaperInfo; import com.android.wallpaper.picker.AppbarFragment; import com.android.wallpaper.widget.BottomActionBar; import com.bumptech.glide.Glide; /** A Fragment for grid full preview page. */ public class GridFullPreviewFragment extends AppbarFragment { static final String EXTRA_WALLPAPER_INFO = "wallpaper_info"; static final String EXTRA_GRID_OPTION = "grid_option"; private WallpaperInfo mWallpaper; private GridOption mGridOption; private WallpaperPreviewer mWallpaperPreviewer; private GridOptionPreviewer mGridOptionPreviewer; /** * Returns a new {@link GridFullPreviewFragment} with the provided title and bundle arguments * set. */ public static GridFullPreviewFragment newInstance(CharSequence title, Bundle intentBundle) { GridFullPreviewFragment fragment = new GridFullPreviewFragment(); Bundle bundle = new Bundle(); bundle.putAll(AppbarFragment.createArguments(title)); bundle.putAll(intentBundle); fragment.setArguments(bundle); return fragment; } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mWallpaper = getArguments().getParcelable(EXTRA_WALLPAPER_INFO); mGridOption = getArguments().getParcelable(EXTRA_GRID_OPTION); } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate( R.layout.fragment_grid_full_preview, container, /* attachToRoot */ false); setUpToolbar(view); // Clear memory cache whenever grid fragment view is being loaded. Glide.get(getContext()).clearMemory(); ImageView wallpaperPreviewImage = view.findViewById(R.id.wallpaper_preview_image); SurfaceView wallpaperSurface = view.findViewById(R.id.wallpaper_preview_surface); mWallpaperPreviewer = new WallpaperPreviewer( getLifecycle(), getActivity(), wallpaperPreviewImage, wallpaperSurface); mGridOptionPreviewer = new GridOptionPreviewer(GridOptionsManager.getInstance(getContext()), view.findViewById(R.id.grid_preview_container)); return view; } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mWallpaperPreviewer.setWallpaper(mWallpaper, /* listener= */ null); mGridOptionPreviewer.setGridOption(mGridOption); } @Override public void onDestroy() { super.onDestroy(); if (mGridOptionPreviewer != null) { mGridOptionPreviewer.release(); } } @Override protected void onBottomActionBarReady(BottomActionBar bottomActionBar) { super.onBottomActionBarReady(bottomActionBar); bottomActionBar.showActionsOnly(APPLY_TEXT); bottomActionBar.setActionClickListener(APPLY_TEXT, v -> finishActivityWithResultOk()); bottomActionBar.show(); } private void finishActivityWithResultOk() { Activity activity = requireActivity(); activity.overridePendingTransition(R.anim.fade_in, R.anim.fade_out); Intent intent = new Intent(); intent.putExtra(EXTRA_GRID_OPTION, mGridOption); activity.setResult(RESULT_OK, intent); activity.finish(); } }
src/com/android/customization/picker/theme/CustomThemeNameFragment.java +0 −23 Original line number Diff line number Diff line Loading @@ -15,12 +15,6 @@ */ package com.android.customization.picker.theme; import static com.android.customization.picker.ViewOnlyFullPreviewActivity.SECTION_STYLE; import static com.android.customization.picker.theme.ThemeFullPreviewFragment.EXTRA_THEME_OPTION; import static com.android.customization.picker.theme.ThemeFullPreviewFragment.EXTRA_THEME_OPTION_TITLE; import static com.android.customization.picker.theme.ThemeFullPreviewFragment.EXTRA_WALLPAPER_INFO; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; Loading @@ -37,10 +31,8 @@ import com.android.customization.model.theme.ThemeBundle.PreviewInfo; import com.android.customization.model.theme.custom.CustomTheme; import com.android.customization.module.CustomizationInjector; import com.android.customization.module.CustomizationPreferences; import com.android.customization.picker.ViewOnlyFullPreviewActivity; import com.android.customization.picker.WallpaperPreviewer; import com.android.wallpaper.R; import com.android.wallpaper.model.WallpaperInfo; import com.android.wallpaper.module.CurrentWallpaperInfoFactory; import com.android.wallpaper.module.InjectorProvider; import com.android.wallpaper.picker.AppbarFragment; Loading @@ -66,7 +58,6 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { private EditText mNameEditor; private ImageView mWallpaperImage; private WallpaperInfo mCurrentHomeWallpaper; private ThemeOptionPreviewer mThemeOptionPreviewer; private CustomizationPreferences mCustomizationPreferences; Loading Loading @@ -98,7 +89,6 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { view.findViewById(R.id.wallpaper_preview_surface)); currentWallpaperFactory.createCurrentWallpaperInfos( (homeWallpaper, lockWallpaper, presentationMode) -> { mCurrentHomeWallpaper = homeWallpaper; wallpaperPreviewer.setWallpaper(homeWallpaper, mThemeOptionPreviewer::updateColorForLauncherWidgets); }, false); Loading @@ -106,8 +96,6 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { // Set theme default name. mNameEditor = view.findViewById(R.id.custom_theme_name); mNameEditor.setText(getOriginalThemeName()); view.findViewById(R.id.theme_preview_card).setOnClickListener(v -> showFullPreview()); return view; } Loading Loading @@ -141,15 +129,4 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { public String getThemeName() { return mNameEditor.getText().toString(); } private void showFullPreview() { CustomTheme themeToFullPreview = mCustomThemeManager.buildPartialCustomTheme( getContext(), /* id= */ "", getThemeName()); Bundle bundle = new Bundle(); bundle.putParcelable(EXTRA_WALLPAPER_INFO, mCurrentHomeWallpaper); bundle.putString(EXTRA_THEME_OPTION, themeToFullPreview.getSerializedPackages()); bundle.putString(EXTRA_THEME_OPTION_TITLE, themeToFullPreview.getTitle()); Intent intent = ViewOnlyFullPreviewActivity.newIntent(getContext(), SECTION_STYLE, bundle); startActivity(intent); } }