Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16020ba2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Evenly space theme options." into ub-launcher3-qt-dev

parents db8b883c a262fbc7
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -15,10 +15,10 @@
     limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_marginHorizontal="6dp"
    android:paddingHorizontal="4dp">
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:padding="4dp">

    <ImageView
        android:id="@+id/option_tile"
+0 −1
Original line number Diff line number Diff line
@@ -57,7 +57,6 @@
    <dimen name="theme_option_title_font_text_size">12sp</dimen>

    <dimen name="option_tile_margin_horizontal">4dp</dimen>
    <dimen name="option_tile_margin_horizontal_ends">10dp</dimen>
    <dimen name="theme_option_label_margin">4dp</dimen>

    <dimen name="preview_card_corner_radius">8dp</dimen>
+19 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2019 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.
-->
<resources>
    <integer name="options_grid_num_columns">4</integer>
</resources>
+2 −1
Original line number Diff line number Diff line
@@ -339,7 +339,8 @@ public class CustomThemeActivity extends FragmentActivity implements
            return CustomThemeComponentFragment.newInstance(
                    CustomThemeActivity.this.getString(R.string.custom_theme_fragment_title),
                    position,
                    titleResId);
                    titleResId,
                    true);
        }
    }

+11 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import com.android.wallpaper.picker.ToolbarFragment;
public class CustomThemeComponentFragment extends ToolbarFragment {
    private static final String ARG_KEY_POSITION = "CustomThemeComponentFragment.position";
    private static final String ARG_KEY_TITLE_RES_ID = "CustomThemeComponentFragment.title_res";
    private static final String ARG_USE_GRID_LAYOUT = "CustomThemeComponentFragment.use_grid";;
    private CustomThemeComponentFragmentHost mHost;

    public interface CustomThemeComponentFragmentHost {
@@ -55,10 +56,16 @@ public class CustomThemeComponentFragment extends ToolbarFragment {

    public static CustomThemeComponentFragment newInstance(CharSequence toolbarTitle, int position,
            int titleResId) {
        return newInstance(toolbarTitle, position, titleResId, false);
    }

    public static CustomThemeComponentFragment newInstance(CharSequence toolbarTitle, int position,
            int titleResId, boolean allowGridLayout) {
        CustomThemeComponentFragment fragment = new CustomThemeComponentFragment();
        Bundle arguments = ToolbarFragment.createArguments(toolbarTitle);
        arguments.putInt(ARG_KEY_POSITION, position);
        arguments.putInt(ARG_KEY_TITLE_RES_ID, titleResId);
        arguments.putBoolean(ARG_USE_GRID_LAYOUT, allowGridLayout);
        fragment.setArguments(arguments);
        return fragment;
    }
@@ -67,6 +74,7 @@ public class CustomThemeComponentFragment extends ToolbarFragment {
    private CustomThemeManager mCustomThemeManager;
    private int mPosition;
    @StringRes private int mTitleResId;
    private boolean mUseGridLayout;

    private RecyclerView mOptionsContainer;
    private OptionSelectorController<ThemeComponentOption> mOptionsController;
@@ -79,6 +87,7 @@ public class CustomThemeComponentFragment extends ToolbarFragment {
        super.onCreate(savedInstanceState);
        mPosition = getArguments().getInt(ARG_KEY_POSITION);
        mTitleResId = getArguments().getInt(ARG_KEY_TITLE_RES_ID);
        mUseGridLayout = getArguments().getBoolean(ARG_USE_GRID_LAYOUT);
        mProvider = mHost.getComponentOptionProvider(mPosition);
        mCustomThemeManager = mHost.getCustomThemeManager();
    }
@@ -144,7 +153,8 @@ public class CustomThemeComponentFragment extends ToolbarFragment {

    private void setUpOptions() {
        mProvider.fetch(options -> {
            mOptionsController = new OptionSelectorController(mOptionsContainer, options);
            mOptionsController = new OptionSelectorController(
                    mOptionsContainer, options, mUseGridLayout, false);

            mOptionsController.addListener(selected -> {
                mSelectedOption = (ThemeComponentOption) selected;
Loading