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

Commit b5aa73f4 authored by Jason Monk's avatar Jason Monk
Browse files

Fix loading screens for manage and running apps

Also add loading screen to manage permissions as this can take a
long time to load in some circumstances. Build loading screens into
Utils and SettingsPreferenceFragment so that it can be easily used
other places in the future.

Change-Id: I7febd06695487e02ced793a9fd418051b5f0eab8
parent 5f937152
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 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.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/loading_container"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="gone"
    android:gravity="center">

    <ProgressBar style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text="@string/settings_safetylegal_activity_loading"
        android:paddingTop="4dip"
        android:singleLine="true" />

</LinearLayout>
+1 −19
Original line number Diff line number Diff line
@@ -52,25 +52,7 @@

        </LinearLayout>

        <LinearLayout android:id="@+id/loading_container"
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:visibility="gone"
                android:gravity="center">

            <ProgressBar style="?android:attr/progressBarStyleLarge"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

            <TextView android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/settings_safetylegal_activity_loading"
                    android:paddingTop="4dip"
                    android:singleLine="true" />

        </LinearLayout>
        <include layout="@layout/loading_container" />

    </FrameLayout>

+1 −19
Original line number Diff line number Diff line
@@ -29,25 +29,7 @@
                android:layout_height="match_parent"
                android:visibility="gone" />

        <LinearLayout android:id="@+id/loading_container"
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:visibility="gone"
                android:gravity="center">

            <ProgressBar style="?android:attr/progressBarStyleLarge"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

            <TextView android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:text="@string/settings_safetylegal_activity_loading"
                    android:paddingTop="4dip"
                    android:singleLine="true" />

        </LinearLayout>
        <include layout="@layout/loading_container" />

    </FrameLayout>

+21 −14
Original line number Diff line number Diff line
@@ -29,11 +29,14 @@
                 android:layout_height="wrap_content"
                 android:visibility="gone" />

    <FrameLayout android:layout_height="0px"
                 android:layout_weight="1"
                 android:layout_width="match_parent">

        <ListView android:id="@android:id/list"
                  style="@style/PreferenceFragmentListSinglePane"
                  android:layout_width="match_parent"
              android:layout_height="0px"
              android:layout_weight="1"
                  android:layout_height="wrap_content"
                  android:paddingStart="@dimen/settings_side_margin"
                  android:paddingEnd="@dimen/settings_side_margin"
                  android:paddingTop="@dimen/dashboard_padding_top"
@@ -44,6 +47,10 @@
                  android:elevation="@dimen/dashboard_category_elevation"
                  android:scrollbarAlwaysDrawVerticalTrack="true" />

        <include layout="@layout/loading_container" />

    </FrameLayout>

    <TextView android:id="@android:id/empty"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
+5 −0
Original line number Diff line number Diff line
@@ -158,6 +158,11 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
        unregisterObserverIfNeeded();
    }

    public void showLoadingWhenEmpty() {
        View loading = getView().findViewById(R.id.loading_container);
        getListView().setEmptyView(loading);
    }

    public void registerObserverIfNeeded() {
        if (!mIsDataSetObserverRegistered) {
            if (mCurrentRootAdapter != null) {
Loading