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

Commit 50ae6070 authored by Michael W's avatar Michael W
Browse files

LatinIME: Remove dividers everywhere

* Instead of removing the dividers per fragment,
  create a custom fragment which does the job

Test:
* Go to every setting and verify that there are no
  divider lines between every preference

Change-Id: Id76dfa2e3ce3999242c8dd09a531ab06ccacd203
parent 69a70a23
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceGroup;
import android.text.TextUtils;
import android.util.Log;
@@ -44,6 +43,7 @@ import android.view.ViewGroup;
import android.view.animation.AnimationUtils;

import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.settings.CustomPreferenceFragment;

import java.util.ArrayList;
import java.util.Collection;
@@ -53,7 +53,7 @@ import java.util.TreeMap;
/**
 * Preference screen.
 */
public final class DictionarySettingsFragment extends PreferenceFragment
public final class DictionarySettingsFragment extends CustomPreferenceFragment
        implements UpdateHandler.UpdateEventListener {
    private static final String TAG = DictionarySettingsFragment.class.getSimpleName();

+1 −2
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceGroup;
import androidx.core.view.ViewCompat;
import android.text.TextUtils;
@@ -47,7 +46,7 @@ import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;

import java.util.ArrayList;

public final class CustomInputStyleSettingsFragment extends PreferenceFragment
public final class CustomInputStyleSettingsFragment extends CustomPreferenceFragment
        implements CustomInputStylePreference.Listener {
    private static final String TAG = CustomInputStyleSettingsFragment.class.getSimpleName();
    // Note: We would like to turn this debug flag true in order to see what input styles are
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The LineageOS 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.inputmethod.latin.settings;

import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.view.View;
import android.widget.ListView;

/**
 * A base abstract class for a {@link PreferenceFragment} that removes divider lines
 */
public abstract class CustomPreferenceFragment extends PreferenceFragment {
    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        // remove dividers
        View rootView = getView();
        ListView list = (ListView) rootView.findViewById(android.R.id.list);
        list.setDivider(null);
    }
}
+1 −9
Original line number Diff line number Diff line
@@ -24,17 +24,14 @@ import android.content.res.Resources;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
import android.util.Log;
import android.view.View;
import android.widget.ListView;

/**
 * A base abstract class for a {@link PreferenceFragment} that implements a nested
 * {@link PreferenceScreen} of the main preference screen.
 */
public abstract class SubScreenFragment extends PreferenceFragment
public abstract class SubScreenFragment extends CustomPreferenceFragment
        implements OnSharedPreferenceChangeListener {
    private OnSharedPreferenceChangeListener mSharedPreferenceChangeListener;

@@ -102,11 +99,6 @@ public abstract class SubScreenFragment extends PreferenceFragment
    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        // remove dividers
        View rootView = getView();
        ListView list = (ListView) rootView.findViewById(android.R.id.list);
        list.setDivider(null);
    }

    @Override
+2 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceGroup;
import android.provider.UserDictionary;
import android.text.TextUtils;
@@ -32,6 +31,7 @@ import android.view.inputmethod.InputMethodSubtype;

import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.common.LocaleUtils;
import com.android.inputmethod.latin.settings.CustomPreferenceFragment;

import java.util.List;
import java.util.Locale;
@@ -43,7 +43,7 @@ import javax.annotation.Nullable;
// packages/apps/Settings/src/com/android/settings/inputmethod/UserDictionaryList.java
// in order to deal with some devices that have issues with the user dictionary handling

public class UserDictionaryList extends PreferenceFragment {
public class UserDictionaryList extends CustomPreferenceFragment {

    public static final String USER_DICTIONARY_SETTINGS_INTENT_ACTION =
            "android.settings.USER_DICTIONARY_SETTINGS";
Loading