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

Commit f275fc43 authored by stofstik's avatar stofstik Committed by Michael Bestas
Browse files

Added show volume panel tile to QS

Change-Id: Ic583c24e304d1edc903127237fc9eb5c7eeb7e4d
JIRA: CYAN-6721
parent 84729121
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ public class QSConstants {
    public static final String TILE_LOCKSCREEN = "lockscreen";
    public static final String TILE_LTE = "lte";
    public static final String TILE_VISUALIZER = "visualizer";
    public static final String TILE_VOLUME = "volume_panel";
    public static final String TILE_SCREEN_TIMEOUT = "screen_timeout";
    public static final String TILE_LIVE_DISPLAY = "live_display";
    public static final String TILE_USB_TETHER = "usb_tether";
@@ -84,6 +85,7 @@ public class QSConstants {
        STATIC_TILES_AVAILABLE.add(TILE_LOCKSCREEN);
        STATIC_TILES_AVAILABLE.add(TILE_LTE);
        STATIC_TILES_AVAILABLE.add(TILE_VISUALIZER);
        STATIC_TILES_AVAILABLE.add(TILE_VOLUME);
        STATIC_TILES_AVAILABLE.add(TILE_SCREEN_TIMEOUT);
        STATIC_TILES_AVAILABLE.add(TILE_LIVE_DISPLAY);
        STATIC_TILES_AVAILABLE.add(TILE_USB_TETHER);
+11 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="64dp"
    android:height="64dp"
    android:viewportWidth="48"
    android:viewportHeight="48">

    <path
        android:fillColor="#FFFFFF"
        android:pathData="M6.0,18.0l0.0,12.0l8.0,0.0l10.0,10.0L24.0,8.0L14.0,18.0L6.0,18.0zm27.0,6.0c0.0,-3.53 -2.04,-6.58 -5.0,-8.05l0.0,16.11c2.96,-1.48 5.0,-4.53 5.0,-8.06zM28.0,6.46l0.0,4.13c5.78,1.72 10.0,7.07 10.0,13.41s-4.22,11.69 -10.0,13.41l0.0,4.13c8.01,-1.82 14.0,-8.97 14.0,-17.54S36.01,8.28 28.0,6.46z"/> <!--TODO Needs own icon-->
</vector>
+1 −0
Original line number Diff line number Diff line
@@ -241,6 +241,7 @@
    <string name="quick_settings_network_adb_label">ADB over network</string>
    <string name="quick_settings_lte_label">LTE</string>
    <string name="quick_settings_visualizer_label" translatable="false">AudioFX</string>
    <string name="quick_settings_volume_panel_label">Volume panel</string>
    <string name="quick_settings_screen_timeout_detail_title">Screen timeout</string>
    <string name="quick_settings_usb_tether_label">USB tethering</string>
    <string name="quick_settings_heads_up_label">Heads up</string>
+62 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 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.
 */

package com.android.systemui.qs.tiles;

import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.provider.Settings;

import com.android.systemui.R;
import com.android.systemui.qs.QSTile;

public class VolumeTile extends QSTile<QSTile.BooleanState> {

    private static final Intent SOUND_SETTINGS = new Intent("android.settings.SOUND_SETTINGS");

    public VolumeTile(Host host) {
        super(host);
    }

    @Override
    protected void handleClick() {
        AudioManager am = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
        am.adjustVolume(AudioManager.ADJUST_SAME, AudioManager.FLAG_SHOW_UI);
    }

    @Override
    protected void handleLongClick() {
        mHost.startSettingsActivity(SOUND_SETTINGS);
    }

    @Override
    protected void handleUpdateState(BooleanState state, Object arg) {
        state.visible = true;
        state.label = mContext.getString(R.string.quick_settings_volume_panel_label);
        state.icon = ResourceIcon.get(R.drawable.ic_qs_volume_panel); // TODO needs own icon
    }

    @Override
    protected BooleanState newTileState() {
        return new BooleanState();
    }

    @Override
    public void setListening(boolean listening) {
        // Do nothing
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ import com.android.systemui.qs.tiles.RotationLockTile;
import com.android.systemui.qs.tiles.SyncTile;
import com.android.systemui.qs.tiles.UsbTetherTile;
import com.android.systemui.qs.tiles.VisualizerTile;
import com.android.systemui.qs.tiles.VolumeTile;
import com.android.systemui.qs.tiles.ScreenTimeoutTile;
import com.android.systemui.qs.tiles.WifiTile;
import com.android.systemui.settings.CurrentUserTracker;
@@ -366,6 +367,8 @@ public class QSTileHost implements QSTile.Host {
                return new LteTile(this);
            case QSConstants.TILE_VISUALIZER:
                return new VisualizerTile(this);
            case QSConstants.TILE_VOLUME:
                return new VolumeTile(this);
            case QSConstants.TILE_SCREEN_TIMEOUT:
                return new ScreenTimeoutTile(this);
            case QSConstants.TILE_LIVE_DISPLAY: