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

Commit bdb84e40 authored by Roman Birg's avatar Roman Birg Committed by Luca Stefani
Browse files

SystemUI: Add Profiles tile



Author: Roman Birg <roman@cyngn.com>
Date:   Thu Jan 22 11:21:56 2015 -0800

    System Profiles in QS Tiles

    Change-Id: I2a438af301212241533b969bf2c6c8390ef09cbc

Author: Joey Rizzoli <joey@lineageos.org>
Date:   Fri Oct 13 20:18:03 2017 +0200

    SystemUI: Profiles tile should require authentication

    A profile with the option to disable secure lockscreen could be
    used to bypass the lockscreen security.
    Require the user to unlock their device when tapping on the profile
    quick tile.

    BUGBASH-1095

    Change-Id: I9d63fcd9b1e3f47c9ca3374806d5ef05fe9ff32b
    Signed-off-by: default avatarJoey Rizzoli <joey@lineageos.org>

Author: Michael W <baddaemon87@gmail.com>
Date:   Sat Aug 4 18:00:34 2018 +0200

    Tiles: SystemProfiles: Adapt behaviour

    * Opening the detail view should enable profiles
    * Disabling the switch should also close the details
    * The tile's title should just be "System profiles"
      when disabled, we also don't say "Wifi off" on wifi tile
    * Set dualTarget to true so the tile indicates expandability

    Change-Id: I4eb463bc84ad78fcabb8acef1829c990ab04f19b

Author: Bruno Martins <bgcngm@gmail.com>
Date:   Mon Sep 10 11:21:58 2018 +0100
Edit:   Port and revamp to match P style

Change-Id: If561205566128d91d5ba1aa894a3463c64f4aa25
parent 052e9327
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (c) 2015 The CyanogenMod Project
    Copyright (C) 2017-2018 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="48dp"
    android:height="48dp"
    android:viewportWidth="24"
    android:viewportHeight="24">

    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M19,5v14H5V5H19
M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3L19,3z
M17,8 c0-0.6-0.4-1-1-1c-0.6,0-1,0.4-1,1s0.4,1,1,1C16.6,9,17,8.6,17,8z
M13,8c0-0.6-0.4-1-1-1c-0.6,0-1,0.4-1,1s0.4,1,1,1 C12.6,9,13,8.6,13,8z
M9,8c0-0.6-0.4-1-1-1S7,7.4,7,8s0.4,1,1,1S9,8.6,9,8z
M17,13h-6v-2H9v2H7v2h2v2h2v-2h6V13z" />
</vector>
+55 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2015 The CyanogenMod Open Source Project
     Copyright (C) 2017-2018 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.
-->
<!-- extends LinearLayout -->
<com.android.systemui.qs.QSDetailItemsList xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:minHeight="100dp"
    android:paddingTop="16dp"
    android:paddingStart="16dp"
    android:paddingEnd="16dp">

    <ListView
        android:id="@android:id/list"
        android:divider="@null"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" />

    <LinearLayout
            android:id="@android:id/empty"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:gravity="center"
            android:orientation="vertical" >

        <ImageView
                android:id="@android:id/icon"
                android:layout_width="56dp"
                android:layout_height="56dp" />

        <TextView
                android:id="@android:id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:textAppearance="@style/TextAppearance.QS.DetailEmpty" />
    </LinearLayout>

</com.android.systemui.qs.QSDetailItemsList>
+7 −0
Original line number Diff line number Diff line
@@ -77,6 +77,13 @@
    <string name="accessibility_quick_settings_sync_changed_off">Sync turned off.</string>
    <string name="accessibility_quick_settings_sync_changed_on">Sync turned on.</string>

    <!-- System Profiles QS tile -->
    <string name="quick_settings_profiles_label">System profiles</string>
    <string name="accessibility_quick_settings_profiles_off">Profiles off.</string>
    <string name="accessibility_quick_settings_profiles">Profile: <xliff:g id="profile" example="Default">%s</xliff:g>.</string>
    <string name="accessibility_quick_settings_profiles_changed_off">Profiles turned off.</string>
    <string name="accessibility_quick_settings_profiles_changed">Profile changed to <xliff:g id="profile" example="Default">%s</xliff:g>.</string>

    <!-- USB tethering QS tile -->
    <string name="quick_settings_usb_tether_label">USB tethering</string>

+1 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@

    <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
    <string name="quick_settings_tiles_stock" translatable="false">
        wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,nfc,location,hotspot,inversion,saver,work,cast,night,adb_network,ambient_display,caffeine,heads_up,livedisplay,reading_mode,sync,usb_tether,volume_panel
        wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,nfc,location,hotspot,inversion,saver,work,cast,night,adb_network,ambient_display,caffeine,heads_up,livedisplay,reading_mode,sync,usb_tether,volume_panel,profiles
    </string>

    <!-- The tiles to display in QuickSettings -->
+90 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 * Copyright (C) 2017-2018 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.systemui.qs;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;

import android.widget.TextView;
import com.android.systemui.R;

/**
 * Quick settings common detail list view with line items.
 */
public class QSDetailItemsList extends FrameLayout {
    private static final String TAG = "QSDetailItemsList";

    private ListView mListView;
    private View mEmpty;
    private TextView mEmptyText;
    private ImageView mEmptyIcon;

    public QSDetailItemsList(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public static QSDetailItemsList convertOrInflate(Context context,
            View convertView, ViewGroup parent) {
        if (convertView instanceof QSDetailItemsList) {
            return (QSDetailItemsList) convertView;
        }
        LayoutInflater inflater = LayoutInflater.from(context);
        return (QSDetailItemsList) inflater.inflate(R.layout.qs_detail_items_list, parent, false);
    }

    public void setAdapter(ListAdapter adapter) {
        mListView.setAdapter(adapter);
    }

    public ListView getListView() {
        return mListView;
    }

    public void setEmptyState(int icon, int text) {
        mEmptyIcon.setImageResource(icon);
        mEmptyText.setText(text);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        mListView = (ListView) findViewById(android.R.id.list);
        mListView.setOnTouchListener(new OnTouchListener() {
            // Setting on Touch Listener for handling the touch inside ScrollView
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                // Disallow the touch request for parent scroll on touch of child view
                v.getParent().requestDisallowInterceptTouchEvent(true);
                return false;
            }
        });
        mEmpty = findViewById(android.R.id.empty);
        mEmpty.setVisibility(GONE);
        mEmptyText = (TextView) mEmpty.findViewById(android.R.id.title);
        mEmptyIcon = (ImageView) mEmpty.findViewById(android.R.id.icon);
        mListView.setEmptyView(mEmpty);
    }
}
Loading