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> res/layout/dark_mode_section_view.xml +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ android:id="@+id/dark_mode_toggle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@null" android:clickable="false" android:focusable="false" style="@style/Switch.SettingsLib" /> Loading res/layout/themed_icon_section_view.xml +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ android:id="@+id/themed_icon_toggle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@null" android:clickable="false" android:focusable="false" style="@style/Switch.SettingsLib"/> Loading 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); } } 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>
res/layout/dark_mode_section_view.xml +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ android:id="@+id/dark_mode_toggle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@null" android:clickable="false" android:focusable="false" style="@style/Switch.SettingsLib" /> Loading
res/layout/themed_icon_section_view.xml +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ android:id="@+id/themed_icon_toggle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@null" android:clickable="false" android:focusable="false" style="@style/Switch.SettingsLib"/> Loading
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); } }