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

Commit 943763d7 authored by Flavio Fiszman's avatar Flavio Fiszman Committed by Android (Google) Code Review
Browse files

Merge "Creates a widget for People Space."

parents 4d8ef8f2 bf47d90a
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -586,6 +586,24 @@
            </intent-filter>
        </activity>

        <!-- People Space Widget -->
        <receiver
            android:name=".people.widget.PeopleSpaceWidgetProvider"
            android:label="People Space"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>
            <meta-data android:name="android.appwidget.provider"
                android:resource="@xml/people_space_widget_info" />
        </receiver>

        <!-- Widget service -->
        <service android:name=".people.widget.PeopleSpaceWidgetService"
            android:permission="android.permission.BIND_REMOTEVIEWS"
            android:exported="false" />

        <!-- a gallery of delicious treats -->
        <service
            android:name=".DessertCaseDream"
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ 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.
  -->
<ListView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/widget_list_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/holo_blue_light"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:padding="5dp"
    android:divider="@null"
    android:dividerHeight="0dp"/>
 No newline at end of file
+59 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ 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.
  -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/item"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <LinearLayout
        android:background="@drawable/people_space_tile_view_card"
        android:orientation="vertical"
        android:padding="6dp"
        android:layout_marginBottom="6dp"
        android:elevation="4dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="start">
        <ImageView
            android:id="@+id/package_icon"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_gravity="end" />
        <ImageView
            android:id="@+id/person_icon"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_gravity="start" />
        <TextView
            android:id="@+id/name"
            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
            android:textSize="18sp"
            android:textColor="?android:attr/textColorPrimary"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="start" />
        <TextView
            android:id="@+id/status"
            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
            android:paddingVertical="2dp"
            android:textSize="14sp"
            android:textColor="?android:attr/textColorSecondary"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="start" />
    </LinearLayout>
</LinearLayout>
+24 −0
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.
  -->

<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
    android:minWidth="72dp"
    android:minHeight="150dp"
    android:updatePeriodMillis="60000"
    android:previewImage="@drawable/cloud"
    android:resizeMode="horizontal|vertical"
    android:initialLayout="@layout/people_space_widget">
</appwidget-provider>
+17 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.systemui.dagger.GlobalRootComponent;
import com.android.systemui.dagger.SysUIComponent;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.people.PeopleSpaceActivity;
import com.android.systemui.people.widget.PeopleSpaceWidgetProvider;
import com.android.systemui.util.NotificationChannels;

import java.lang.reflect.Constructor;
@@ -109,6 +110,7 @@ public class SystemUIApplication extends Application implements
                        }
                    }
                    // If flag SHOW_PEOPLE_SPACE is true, enable People Space launcher icon.
                    // TODO(b/170396074): Remove this when we don't need an icon anymore.
                    try {
                        int showPeopleSpace = Settings.Global.getInt(context.getContentResolver(),
                                Settings.Global.SHOW_PEOPLE_SPACE);
@@ -121,6 +123,21 @@ public class SystemUIApplication extends Application implements
                    } catch (Exception e) {
                        Log.w(TAG, "Error enabling People Space launch icon:", e);
                    }

                    // If SHOW_PEOPLE_SPACE is true, enable People Space widget provider.
                    // TODO(b/170396074): Remove this when we don't need a widget anymore.
                    try {
                        int showPeopleSpace = Settings.Global.getInt(context.getContentResolver(),
                                Settings.Global.SHOW_PEOPLE_SPACE);
                        context.getPackageManager().setComponentEnabledSetting(
                                new ComponentName(context, PeopleSpaceWidgetProvider.class),
                                showPeopleSpace == 1
                                        ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
                                        : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                                PackageManager.DONT_KILL_APP);
                    } catch (Exception e) {
                        Log.w(TAG, "Error enabling People Space widget:", e);
                    }
                }
            }, bootCompletedFilter);

Loading