Cherish: AOKP custom system animations [2/2]

This commit is contained in:
Stevespear426
2019-11-06 21:12:19 +07:00
committed by Hung Phan
parent 86f075f743
commit 464fcd9c34
9 changed files with 402 additions and 89 deletions

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path android:fillColor="#000000" android:pathData="M4,2A2,2 0 0,0 2,4V14H4V4H14V2H4M8,6A2,2 0 0,0 6,8V18H8V8H18V6H8M20,12V20H12V12H20M20,10H12A2,2 0 0,0 10,12V20A2,2 0 0,0 12,22H20A2,2 0 0,0 22,20V12A2,2 0 0,0 20,10M14,13V19L18,16L14,13Z" />
</vector>

View File

@@ -1,7 +0,0 @@
<vector android:height="24dp" android:viewportHeight="2400.0"
android:viewportWidth="2400.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="?android:attr/colorControlNormal"
android:pathData="M940,2365c-106,-24 -159,-43 -275,-100 -289,-143 -498,-382 -604,-691 -40,-118 -55,-257 -48,-449 7,-205 50,-366 135,-504 18,-28 32,-54 32,-57 0,-16 128,-170 196,-234 195,-186 424,-291 682,-312 396,-33 692,68 960,326 263,254 388,596 354,970 -44,488 -381,890 -872,1038 -88,27 -460,35 -560,13zM1425,2180c359,-94 620,-345 731,-705 26,-84 28,-102 29,-270 0,-156 -3,-191 -23,-265 -84,-318 -319,-578 -622,-690 -373,-137 -791,-44 -1068,239 -306,313 -374,807 -165,1191 160,292 429,474 778,524 67,10 262,-4 340,-24z" android:strokeColor="#00000000"/>
<path android:fillColor="?android:attr/colorControlNormal"
android:pathData="M680,1953c-27,-10 -71,-57 -86,-92 -12,-28 -14,-141 -14,-656 0,-683 -1,-667 60,-719 54,-45 80,-47 578,-44 461,3 467,3 502,25 20,12 46,40 58,61l22,40 0,636c0,696 3,661 -60,721l-31,30 -507,2c-279,1 -514,-1 -522,-4zM1628,1053l2,-443 -440,0 -440,0 0,438c0,241 3,442 7,445 3,4 200,6 437,5l431,-3 3,-442z" android:strokeColor="#00000000"/>
</vector>

View File

@@ -18,7 +18,7 @@
<string name="gestures_title">Cử chỉ</string>
<string name="lockscreen_title">Màn hình khoá</string>
<string name="misc_title">Khác</string>
<string name="navbar_title">Thanh điều hướng</string>
<string name="animations_title">Hiệu ứng</string>
<string name="powermenu_title">Trình đơn nguồn</string>
<string name="quicksettings_title">Cài đặt nhanh</string>
<string name="recents_title">Ứng dụng gần đây</string>

View File

@@ -19,7 +19,7 @@
<string name="gestures_title">Gestures</string>
<string name="lockscreen_title">Lock screen</string>
<string name="misc_title">Miscellaneous</string>
<string name="navbar_title">Navigation bar</string>
<string name="animations_title">Animations</string>
<string name="powermenu_title">Power menu</string>
<string name="theme_title">Themes</string>
<string name="quicksettings_title">Quick Settings</string>
@@ -399,5 +399,23 @@
<!-- R Notification headers -->
<string name="notification_headers_title">Show notification headers</string>
<string name="notification_headers_summary">Whether to show R style notification headers (Requires a SystemUI restart)</string>
<!-- AOKP custom system animations -->
<string name="system_animation_title">System</string>
<string name="activity_open_title">Activity open animation</string>
<string name="activity_close_title">Activity close animation</string>
<string name="task_open_title">Task open animation</string>
<string name="task_open_behind_title">Task open behind animation</string>
<string name="task_close_title">Task close animation</string>
<string name="task_move_to_front_title">Move to front animation</string>
<string name="task_move_to_back_title">Move to back animation</string>
<string name="wallpaper_open_title">Wallpaper open animation</string>
<string name="wallpaper_close_title">Wallpaper close animation</string>
<string name="wallpaper_intra_open_title">Wallpaper intra open animation</string>
<string name="wallpaper_intra_close_title">Wallpaper intra close animation</string>
<string name="animation_duration_title">Animation duration</string>
<string name="title_animation_no_override">Prevent app overrides</string>
<string name="summary_animation_no_override">Prevent apps from overriding transitions</string>
<string name="animation_duration_default">Default</string>
</resources>

View File

@@ -44,6 +44,13 @@
android:title="@string/button_title"
android:icon="@drawable/ic_settings_buttons"
android:fragment="com.android.settings.custom.buttons.ButtonSettings"/>
<!-- Animations -->
<Preference
android:key="animations_category"
android:title="@string/animations_title"
android:icon="@drawable/ic_settings_animations"
android:fragment="com.cherish.settings.fragments.AnimationsSettings"/>
<!-- Lock Screen -->
<Preference

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012-2014 The TeamEos 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.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/animations_title"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" >
<PreferenceCategory
android:title="@string/system_animation_title">
<com.cherish.settings.preferences.CustomSeekBarPreference
android:key="animation_controls_duration"
android:title="@string/animation_duration_title"
android:max="400"
settings:min="0"
settings:interval="10"
android:defaultValue="0"
android:persistent="false" />
<ListPreference
android:key="activity_open"
android:title="@string/activity_open_title" />
<ListPreference
android:key="activity_close"
android:title="@string/activity_close_title" />
<ListPreference
android:key="task_open"
android:title="@string/task_open_title" />
<ListPreference
android:key="task_open_behind"
android:title="@string/task_open_behind_title" />
<ListPreference
android:key="task_close"
android:title="@string/task_close_title" />
<ListPreference
android:key="task_move_to_front"
android:title="@string/task_move_to_front_title" />
<ListPreference
android:key="task_move_to_back"
android:title="@string/task_move_to_back_title" />
<ListPreference
android:key="wallpaper_open"
android:title="@string/wallpaper_open_title" />
<ListPreference
android:key="wallpaper_close"
android:title="@string/wallpaper_close_title" />
<ListPreference
android:key="wallpaper_intra_open"
android:title="@string/wallpaper_intra_open_title" />
<ListPreference
android:key="wallpaper_intra_close"
android:title="@string/wallpaper_intra_close_title" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012-2014 The TeamEos 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.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/navbar_title"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" >
</PreferenceScreen>

View File

@@ -0,0 +1,285 @@
/*
* Copyright (C) 2014 TeamEos
*
* 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.cherish.settings.fragments;
import android.content.Context;
import android.content.ContentResolver;
import android.database.ContentObserver;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
import android.os.UserHandle;
import android.provider.Settings;
import android.view.View;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.SwitchPreference;
import com.android.internal.logging.nano.MetricsProto;
import com.android.internal.util.cherish.AwesomeAnimationHelper;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
import com.cherish.settings.preferences.CustomSeekBarPreference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
public class AnimationsSettings extends SettingsPreferenceFragment implements OnPreferenceChangeListener {
private static final String ANIMATION_DURATION = "animation_controls_duration";
private static final String ACTIVITY_OPEN = "activity_open";
private static final String ACTIVITY_CLOSE = "activity_close";
private static final String TASK_OPEN = "task_open";
private static final String TASK_OPEN_BEHIND = "task_open_behind";
private static final String TASK_CLOSE = "task_close";
private static final String TASK_MOVE_TO_FRONT = "task_move_to_front";
private static final String TASK_MOVE_TO_BACK = "task_move_to_back";
private static final String WALLPAPER_OPEN = "wallpaper_open";
private static final String WALLPAPER_CLOSE = "wallpaper_close";
private static final String WALLPAPER_INTRA_OPEN = "wallpaper_intra_open";
private static final String WALLPAPER_INTRA_CLOSE = "wallpaper_intra_close";
private CustomSeekBarPreference mAnimDuration;
ListPreference mActivityOpenPref;
ListPreference mActivityClosePref;
ListPreference mTaskOpenPref;
ListPreference mTaskOpenBehind;
ListPreference mTaskClosePref;
ListPreference mTaskMoveToFrontPref;
ListPreference mTaskMoveToBackPref;
ListPreference mWallpaperOpen;
ListPreference mWallpaperClose;
ListPreference mWallpaperIntraOpen;
ListPreference mWallpaperIntraClose;
private int[] mAnimations;
private String[] mAnimationsStrings;
private String[] mAnimationsNum;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.cherish_settings_animations);
ContentResolver resolver = getActivity().getContentResolver();
mAnimDuration = (CustomSeekBarPreference) findPreference(ANIMATION_DURATION);
int animdef = Settings.Global.getInt(resolver,
Settings.Global.ANIMATION_CONTROLS_DURATION, 0);
mAnimDuration.setValue(animdef);
mAnimDuration.setOnPreferenceChangeListener(this);
mAnimations = AwesomeAnimationHelper.getAnimationsList();
int animqty = mAnimations.length;
mAnimationsStrings = new String[animqty];
mAnimationsNum = new String[animqty];
for (int i = 0; i < animqty; i++) {
mAnimationsStrings[i] = AwesomeAnimationHelper.getProperName(getActivity().getApplicationContext(), mAnimations[i]);
mAnimationsNum[i] = String.valueOf(mAnimations[i]);
}
mActivityOpenPref = (ListPreference) findPreference(ACTIVITY_OPEN);
mActivityOpenPref.setSummary(getProperSummary(mActivityOpenPref));
mActivityOpenPref.setEntries(mAnimationsStrings);
mActivityOpenPref.setEntryValues(mAnimationsNum);
mActivityOpenPref.setOnPreferenceChangeListener(this);
mActivityClosePref = (ListPreference) findPreference(ACTIVITY_CLOSE);
mActivityClosePref.setSummary(getProperSummary(mActivityClosePref));
mActivityClosePref.setEntries(mAnimationsStrings);
mActivityClosePref.setEntryValues(mAnimationsNum);
mActivityClosePref.setOnPreferenceChangeListener(this);
mTaskOpenPref = (ListPreference) findPreference(TASK_OPEN);
mTaskOpenPref.setSummary(getProperSummary(mTaskOpenPref));
mTaskOpenPref.setEntries(mAnimationsStrings);
mTaskOpenPref.setEntryValues(mAnimationsNum);
mTaskOpenPref.setOnPreferenceChangeListener(this);
mTaskOpenBehind = (ListPreference) findPreference(TASK_OPEN_BEHIND);
mTaskOpenBehind.setSummary(getProperSummary(mTaskOpenBehind));
mTaskOpenBehind.setEntries(mAnimationsStrings);
mTaskOpenBehind.setEntryValues(mAnimationsNum);
mTaskOpenBehind.setOnPreferenceChangeListener(this);
mTaskClosePref = (ListPreference) findPreference(TASK_CLOSE);
mTaskClosePref.setSummary(getProperSummary(mTaskClosePref));
mTaskClosePref.setEntries(mAnimationsStrings);
mTaskClosePref.setEntryValues(mAnimationsNum);
mTaskClosePref.setOnPreferenceChangeListener(this);
mTaskMoveToFrontPref = (ListPreference) findPreference(TASK_MOVE_TO_FRONT);
mTaskMoveToFrontPref.setSummary(getProperSummary(mTaskMoveToFrontPref));
mTaskMoveToFrontPref.setEntries(mAnimationsStrings);
mTaskMoveToFrontPref.setEntryValues(mAnimationsNum);
mTaskMoveToFrontPref.setOnPreferenceChangeListener(this);
mTaskMoveToBackPref = (ListPreference) findPreference(TASK_MOVE_TO_BACK);
mTaskMoveToBackPref.setSummary(getProperSummary(mTaskMoveToBackPref));
mTaskMoveToBackPref.setEntries(mAnimationsStrings);
mTaskMoveToBackPref.setEntryValues(mAnimationsNum);
mTaskMoveToBackPref.setOnPreferenceChangeListener(this);
mWallpaperOpen = (ListPreference) findPreference(WALLPAPER_OPEN);
mWallpaperOpen.setSummary(getProperSummary(mWallpaperOpen));
mWallpaperOpen.setEntries(mAnimationsStrings);
mWallpaperOpen.setEntryValues(mAnimationsNum);
mWallpaperOpen.setOnPreferenceChangeListener(this);
mWallpaperClose = (ListPreference) findPreference(WALLPAPER_CLOSE);
mWallpaperClose.setSummary(getProperSummary(mWallpaperClose));
mWallpaperClose.setEntries(mAnimationsStrings);
mWallpaperClose.setEntryValues(mAnimationsNum);
mWallpaperClose.setOnPreferenceChangeListener(this);
mWallpaperIntraOpen = (ListPreference) findPreference(WALLPAPER_INTRA_OPEN);
mWallpaperIntraOpen.setSummary(getProperSummary(mWallpaperIntraOpen));
mWallpaperIntraOpen.setEntries(mAnimationsStrings);
mWallpaperIntraOpen.setEntryValues(mAnimationsNum);
mWallpaperIntraOpen.setOnPreferenceChangeListener(this);
mWallpaperIntraClose = (ListPreference) findPreference(WALLPAPER_INTRA_CLOSE);
mWallpaperIntraClose.setSummary(getProperSummary(mWallpaperIntraClose));
mWallpaperIntraClose.setEntries(mAnimationsStrings);
mWallpaperIntraClose.setEntryValues(mAnimationsNum);
mWallpaperIntraClose.setOnPreferenceChangeListener(this);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
ContentResolver resolver = getActivity().getContentResolver();
if (preference == mAnimDuration) {
int value = (Integer) newValue;
Settings.Global.putInt(resolver,
Settings.Global.ANIMATION_CONTROLS_DURATION, value);
return true;
} else if (preference == mActivityOpenPref) {
int val = Integer.parseInt((String) newValue);
Settings.Global.putInt(resolver,
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[0], val);
preference.setSummary(getProperSummary(preference));
return true;
} else if (preference == mActivityClosePref) {
int val = Integer.parseInt((String) newValue);
Settings.Global.putInt(resolver,
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[1], val);
preference.setSummary(getProperSummary(preference));
return true;
} else if (preference == mTaskOpenPref) {
int val = Integer.parseInt((String) newValue);
Settings.Global.putInt(resolver,
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[2], val);
preference.setSummary(getProperSummary(preference));
return true;
} else if (preference == mTaskClosePref) {
int val = Integer.parseInt((String) newValue);
Settings.Global.putInt(resolver,
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[3], val);
preference.setSummary(getProperSummary(preference));
return true;
} else if (preference == mTaskMoveToFrontPref) {
int val = Integer.parseInt((String) newValue);
Settings.Global.putInt(resolver,
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[4], val);
preference.setSummary(getProperSummary(preference));
return true;
} else if (preference == mTaskMoveToBackPref) {
int val = Integer.parseInt((String) newValue);
Settings.Global.putInt(resolver,
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[5], val);
preference.setSummary(getProperSummary(preference));
return true;
} else if (preference == mWallpaperOpen) {
int val = Integer.parseInt((String) newValue);
Settings.Global.putInt(resolver,
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[6], val);
preference.setSummary(getProperSummary(preference));
return true;
} else if (preference == mWallpaperClose) {
int val = Integer.parseInt((String) newValue);
Settings.Global.putInt(resolver,
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[7], val);
preference.setSummary(getProperSummary(preference));
return true;
} else if (preference == mWallpaperIntraOpen) {
int val = Integer.parseInt((String) newValue);
Settings.Global.putInt(resolver,
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[8], val);
preference.setSummary(getProperSummary(preference));
return true;
} else if (preference == mWallpaperIntraClose) {
int val = Integer.parseInt((String) newValue);
Settings.Global.putInt(resolver,
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[9], val);
preference.setSummary(getProperSummary(preference));
return true;
} else if (preference == mTaskOpenBehind) {
int val = Integer.parseInt((String) newValue);
Settings.Global.putInt(resolver,
Settings.Global.ACTIVITY_ANIMATION_CONTROLS[10], val);
preference.setSummary(getProperSummary(preference));
return true;
}
return false;
}
private String getProperSummary(Preference preference) {
String mString = "";
if (preference == mActivityOpenPref) {
mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[0];
} else if (preference == mActivityClosePref) {
mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[1];
} else if (preference == mTaskOpenPref) {
mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[2];
} else if (preference == mTaskClosePref) {
mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[3];
} else if (preference == mTaskMoveToFrontPref) {
mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[4];
} else if (preference == mTaskMoveToBackPref) {
mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[5];
} else if (preference == mWallpaperOpen) {
mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[6];
} else if (preference == mWallpaperClose) {
mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[7];
} else if (preference == mWallpaperIntraOpen) {
mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[8];
} else if (preference == mWallpaperIntraClose) {
mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[9];
} else if (preference == mTaskOpenBehind) {
mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[10];
}
int mNum = Settings.Global.getInt(getActivity().getContentResolver(),
mString, 0);
return mAnimationsStrings[mNum];
}
@Override
public int getMetricsCategory() {
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
}
}

View File

@@ -1,57 +0,0 @@
/*
* Copyright (C) 2014 TeamEos
*
* 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.cherish.settings.fragments;
import java.util.ArrayList;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
import android.os.UserHandle;
import androidx.preference.ListPreference;
import androidx.preference.SwitchPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import androidx.preference.Preference.OnPreferenceChangeListener;
import android.provider.Settings;
import com.android.settings.SettingsPreferenceFragment;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
public class NavbarSettings extends SettingsPreferenceFragment implements OnPreferenceChangeListener {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.cherish_settings_navigation);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
return false;
}
@Override
public int getMetricsCategory() {
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
}
}