LineageAction: add Kernel Profiles toggle [Spectrum]
Co-authored-by: andr68rus <ashtmb@gmail.com> Co-authored-by: sai4041412 <sai404142@gmail.com> Signed-off-by: ronaxdevil <pratabidya.007@gmail.com>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
android:allowBackup="true"
|
||||
android:label="@string/moto_actions_title"
|
||||
android:icon="@drawable/ic_gesture"
|
||||
android:summary="@string/moto_actions_summary"
|
||||
android:persistent="true">
|
||||
|
||||
<provider
|
||||
@@ -72,7 +73,7 @@
|
||||
<activity
|
||||
android:name=".ActionsPreferenceActivity"
|
||||
android:label="@string/moto_actions_title"
|
||||
android:summary="@string/device_gestures_summary"
|
||||
android:summary="@string/moto_actions_summary"
|
||||
android:theme="@style/LineageActions">
|
||||
<intent-filter>
|
||||
<action android:name="com.android.settings.action.IA_SETTINGS" />
|
||||
|
||||
26
LineageActions/res/drawable/ic_settings_gesturess.xml
Normal file
26
LineageActions/res/drawable/ic_settings_gesturess.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="32.0"
|
||||
android:viewportHeight="32.0"
|
||||
android:tint="?android:attr/colorAccent">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M20,20.2V24H6V5.3h8.7l2.4,-4H7.6c-2.2,0 -4,1.8 -4,4v21.3c0,2.2 1.8,4 4,4h10.7c2.2,0 4,-1.8 4,-4V14.9L20,20.2zM15.6,28h-5.3v-1.3h5.3V28z"/>
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M28.5,7l1.1,-2.4L32,3.5l-2.4,-1.1L28.5,0l-1.1,2.4L25,3.5l2.4,1.1L28.5,7zM21,7.4l-2.2,-4.8l-2.2,4.8l-4.8,2.2l4.8,2.2l2.2,4.8l2.2,-4.8l4.8,-2.2L21,7.4zM28.5,12.2l-1.1,2.4L25,15.6l2.4,1.1l1.1,2.4l1.1,-2.4l2.4,-1.1l-2.4,-1.1L28.5,12.2z"/>
|
||||
</vector>
|
||||
31
LineageActions/res/drawable/ic_settings_spectrum.xml
Normal file
31
LineageActions/res/drawable/ic_settings_spectrum.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<!--
|
||||
Copyright (C) 2016 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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?android:attr/colorAccent">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M21.4 14.2l-1.94-1.45c.03-.25 .04 -.5 .04 -.76s-.01-.51-.04-.76L21.4 9.8c.42-.31
|
||||
.52 -.94 .24 -1.41l-1.6-2.76c-.28-.48-.88-.7-1.36-.5l-2.14 .91
|
||||
c-.48-.37-1.01-.68-1.57-.92l-.27-2.2c-.06-.52-.56-.92-1.11-.92h-3.18c-.55 0-1.05
|
||||
.4 -1.11 .92 l-.26 2.19c-.57 .24 -1.1 .55 -1.58 .92 l-2.14-.91c-.48-.2-1.08 .02
|
||||
-1.36 .5 l-1.6 2.76c-.28 .48 -.18 1.1 .24 1.42l1.94 1.45c-.03 .24 -.04 .49 -.04
|
||||
.75 s.01 .51 .04 .76 L2.6 14.2c-.42 .31 -.52 .94 -.24 1.41l1.6 2.76c.28 .48 .88
|
||||
.7 1.36 .5 l2.14-.91c.48 .37 1.01 .68 1.57 .92 l.27 2.19c.06 .53 .56 .93 1.11
|
||||
.93 h3.18c.55 0 1.04-.4 1.11-.92l.27-2.19c.56-.24 1.09-.55 1.57-.92l2.14 .91
|
||||
c.48 .2 1.08-.02 1.36-.5l1.6-2.76c.28-.48 .18 -1.1-.24-1.42zM12 15.5c-1.93
|
||||
0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"/>
|
||||
</vector>
|
||||
@@ -92,4 +92,20 @@
|
||||
<item>"0,4,2,0,-2,-2,4"</item>
|
||||
<item>"2,0,0,-2,-4,0,0"</item>
|
||||
</string-array>
|
||||
|
||||
<!-- spectrum profiles -->
|
||||
<string-array name="spectrum_profiles">
|
||||
<item>Balance</item>
|
||||
<item>Battery</item>
|
||||
<item>Performance</item>
|
||||
<item>Gaming</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="spectrum_values">
|
||||
<item>0</item>
|
||||
<item>2</item>
|
||||
<item>1</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<!-- Title and summary -->
|
||||
<string name="moto_actions_title">Moto Actions</string>
|
||||
|
||||
<string name="moto_actions_summary">extra shit for your moto</string>
|
||||
<!-- Device gestures -->
|
||||
<string name="device_gestures_title">Device gestures</string>
|
||||
<string name="device_gestures_summary">Manage device gestures</string>
|
||||
@@ -145,4 +145,8 @@
|
||||
<!-- QS tile title -->
|
||||
<string name="dirac_qs_tile_title">Dirac Sound</string>
|
||||
|
||||
<!-- Spectrum Profiles -->
|
||||
<string name="spectrum_title">Kernel Profile</string>
|
||||
<string name="spectrum_summary">Choose your kernel profile</string>
|
||||
<string name="spectrum_dialogTitle">Choose your kernel profile</string>
|
||||
</resources>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
android:key="gestures"
|
||||
android:title="@string/device_gestures_title"
|
||||
android:summary="@string/device_gestures_summary"
|
||||
android:icon="@drawable/ic_settings_gestures">
|
||||
android:icon="@drawable/ic_settings_gesturess">
|
||||
<intent
|
||||
android:targetPackage="org.lineageos.settings.device"
|
||||
android:targetClass="org.lineageos.settings.device.GestureSettingsActivity" />
|
||||
@@ -71,4 +71,17 @@
|
||||
android:targetClass="org.lineageos.settings.dirac.DiracActivity" />
|
||||
</Preference>
|
||||
</PreferenceCategory>
|
||||
|
||||
<ListPreference
|
||||
android:key="spectrum"
|
||||
android:title="@string/spectrum_title"
|
||||
android:summary="@string/spectrum_summary"
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/spectrum_profiles"
|
||||
android:entryValues="@array/spectrum_values"
|
||||
android:dialogTitle="@string/spectrum_dialogTitle"
|
||||
android:icon="@drawable/ic_settings_spectrum"/>
|
||||
<intent
|
||||
android:targetPackage="org.lineageos.settings.device"
|
||||
android:targetClass="org.lineageos.settings.device.ShitPanelSettings" />
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
|
||||
/*
|
||||
* 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 org.lineageos.settings;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.res.Resources;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemProperties;
|
||||
import android.provider.Settings;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.Preference.OnPreferenceChangeListener;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.preference.TwoStatePreference;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ListView;
|
||||
import android.util.Log;
|
||||
|
||||
import org.lineageos.settings.R;
|
||||
|
||||
public class ShitPanelSettings extends PreferenceActivity implements
|
||||
Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String SPECTRUM_KEY = "spectrum";
|
||||
private static final String SPECTRUM_SYSTEM_PROPERTY = "persist.spectrum.profile";
|
||||
|
||||
private ListPreference mSpectrum;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.main_panel);
|
||||
|
||||
mSpectrum = (ListPreference) findPreference(SPECTRUM_KEY);
|
||||
if( mSpectrum != null ) {
|
||||
mSpectrum.setValue(SystemProperties.get(SPECTRUM_SYSTEM_PROPERTY, "0"));
|
||||
mSpectrum.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
final String key = preference.getKey();
|
||||
boolean value;
|
||||
String strvalue;
|
||||
if (SPECTRUM_KEY.equals(key)) {
|
||||
strvalue = (String) newValue;
|
||||
SystemProperties.set(SPECTRUM_SYSTEM_PROPERTY, strvalue);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user