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

Commit 2cdb01ee authored by David van Tonder's avatar David van Tonder Committed by Gerrit Code Review
Browse files

Merge changes I35bc11a7,I57f37bc6 into cm-11.0

* changes:
  Check locale when populating DB instead of using separate receiver.
  Improve search UX prior to load being finished.
parents 4c9f9b8c bfb55e16
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -2161,11 +2161,5 @@
        </service>

        <service android:name=".search.SearchPopulator"/>

        <receiver android:name=".search.LocaleChangedReceiver">
            <intent-filter>
                <action android:name="android.intent.action.LOCALE_CHANGED" />
            </intent-filter>
        </receiver>
    </application>
</manifest>
+42 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The CyanogenMod 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.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="?android:attr/listPreferredItemHeightSmall"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"
    android:layout_width="match_parent"
    android:orientation="horizontal">

    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginStart="8dp"
        android:layout_marginEnd="8dp"
        android:gravity="center_vertical"
        android:indeterminate="true"
        android:indeterminateOnly="true"
        style="@android:style/Widget.ProgressBar.Small" />

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_gravity="center_vertical"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/search_match_highlight_foreground"
        android:text="@string/settings_search_loading_text" />

</LinearLayout>
+2 −3
Original line number Diff line number Diff line
@@ -15,10 +15,9 @@
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/textAutoComplete"
    android:layout_height="?android:attr/listPreferredItemHeightSmall"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"
    android:layout_width="fill_parent"
    android:layout_width="match_parent"
    android:orientation="horizontal">

    <ImageView
+1 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@
    <!-- Search -->
    <string name="settings_search_action_bar_button">Search</string>
    <string name="settings_search_autocompleteview_hint">Search settings</string>
    <string name="settings_search_loading_text">Loading search data\u2026</string>

    <!-- Profile Config screen PreferenceGroup titles -->
    <string name="profile_connectionoverrides_title">Connection overrides</string>
+1 −40
Original line number Diff line number Diff line
@@ -40,12 +40,9 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.nfc.NfcAdapter;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.INetworkManagementService;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
@@ -177,7 +174,6 @@ public class Settings extends PreferenceActivity
    private Header mCurrentHeader;
    private Header mParentHeader;
    private boolean mInLocalHeaderSwitch;
    private SettingsSearchFilterAdapter mSearchAdapter;

    // Show only these settings for restricted users
    private int[] SETTINGS_FOR_RESTRICTED = {
@@ -272,8 +268,6 @@ public class Settings extends PreferenceActivity
            }
        });

        new PopulateSearchSettingsTask().execute();

        ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(
                ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.MATCH_PARENT);

@@ -282,37 +276,12 @@ public class Settings extends PreferenceActivity
        mSearchBar.setThreshold(1);
        mSearchBar.setSingleLine(true);
        mSearchBar.setOnItemClickListener(this);
        mSearchBar.setAdapter(new SettingsSearchFilterAdapter(this));

        mSearchItem.setVisible(!mDisableSearchIcon);
        return true;
    }

    private class PopulateSearchSettingsTask extends
            AsyncTask<Void, Void, ArrayList<SearchInfo>> {
        @Override
        protected ArrayList<SearchInfo> doInBackground(Void... param) {
            return SearchPopulator.loadSearchData(Settings.this);
        }

        @Override
        protected void onPostExecute(ArrayList<SearchInfo> infos) {
            mSearchAdapter = new SettingsSearchFilterAdapter(Settings.this,
                    R.layout.settings_search_complete_view, infos);
            mSearchBar.setAdapter(mSearchAdapter);
        }
    };

    private class SearchNotifier extends ResultReceiver {
        public SearchNotifier(Handler handler) {
            super(handler);
        }

        @Override
        protected void onReceiveResult(int resultCode, Bundle resultData) {
            new PopulateSearchSettingsTask().execute();
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if (getIntent().hasExtra(EXTRA_UI_OPTIONS)) {
@@ -323,8 +292,6 @@ public class Settings extends PreferenceActivity
            mDisableSearchIcon = getIntent().getBooleanExtra(EXTRA_DISABLE_SEARCH, false);
        }

        startPopulatingSearchData();

        mAuthenticatorHelper = new AuthenticatorHelper();
        mAuthenticatorHelper.updateAuthDescriptions(this);
        mAuthenticatorHelper.onAccountsUpdated(this, null);
@@ -599,12 +566,6 @@ public class Settings extends PreferenceActivity
        }
    }

    private void startPopulatingSearchData() {
        Intent i = new Intent(this, SearchPopulator.class);
        i.putExtra(SearchPopulator.EXTRA_NOTIFIER, new SearchNotifier(new Handler()));
        startService(i);
    }

    @Override
    public Intent getIntent() {
        Intent superIntent = super.getIntent();
Loading