├── settings.gradle ├── app ├── src │ └── main │ │ ├── assets │ │ └── xposed_init │ │ ├── res │ │ ├── drawable │ │ │ ├── movable_done.png │ │ │ ├── blacklist_add.png │ │ │ ├── blacklist_help.png │ │ │ ├── movable_corner.png │ │ │ ├── blacklist_cancel.png │ │ │ ├── blacklist_search.png │ │ │ ├── movable_overflow.png │ │ │ ├── movable_quadrant.png │ │ │ ├── movable_title_max.png │ │ │ ├── movable_title_min.png │ │ │ ├── movable_title_close.png │ │ │ ├── movable_title_more.png │ │ │ ├── movable_title_max_old.png │ │ │ ├── movable_title_min_old.png │ │ │ ├── movable_title_more_old.png │ │ │ ├── multiwindow_tray_close.png │ │ │ ├── multiwindow_tray_reset.png │ │ │ ├── multiwindow_tray_swap.png │ │ │ ├── movable_title_close_old.png │ │ │ ├── movable_title_max_ssnjr.png │ │ │ ├── movable_title_min_ssnjr.png │ │ │ ├── movable_title_more_ssnjr.png │ │ │ ├── multiwindow_tray_recents.png │ │ │ ├── movable_title_close_ssnjr.png │ │ │ ├── round_rect.xml │ │ │ └── bg_card_ui.xml │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── styles.xml │ │ │ └── arrays.xml │ │ ├── layout │ │ │ ├── view_statusbar_taskbar_holder.xml │ │ │ ├── dialog_number_picker.xml │ │ │ ├── view_statusbar_taskbar_icon.xml │ │ │ ├── floatdot_submenu_item.xml │ │ │ ├── activity_viewpager.xml │ │ │ ├── pref_seekbar.xml │ │ │ ├── dialog_blacklist.xml │ │ │ ├── floatdot_launcher_menuitem.xml │ │ │ ├── dialog_floatdot.xml │ │ │ ├── multiwindow_recents_item.xml │ │ │ ├── movable_dialog_transparency.xml │ │ │ ├── view_app_list.xml │ │ │ ├── view_package_list.xml │ │ │ ├── dialog_colorpicker.xml │ │ │ ├── dialog_titlebar_icon_theme_chooser.xml │ │ │ ├── activity_testing.xml │ │ │ └── movable_window.xml │ │ ├── menu │ │ │ └── launcher_popupmenu.xml │ │ └── xml │ │ │ ├── pref_moving.xml │ │ │ ├── pref_movable_titlebar_others.xml │ │ │ ├── pref_floatdot.xml │ │ │ ├── pref_general.xml │ │ │ └── pref_behavior.xml │ │ ├── java │ │ └── com │ │ │ └── zst │ │ │ └── xposed │ │ │ └── halo │ │ │ └── floatingwindow3 │ │ │ ├── floatdot │ │ │ ├── XHFWInterface.aidl │ │ │ ├── BootReceiver.java │ │ │ └── CallReceiver.java │ │ │ ├── prefs │ │ │ ├── WidgetWindowAlphaPicker.java │ │ │ ├── WidgetBackgroundDimPicker.java │ │ │ ├── IntListPreference.java │ │ │ ├── FloatDotFragment.java │ │ │ ├── MovingFragment.java │ │ │ ├── adapters │ │ │ │ ├── PageAdapter.java │ │ │ │ ├── PackageNameAdapter.java │ │ │ │ └── AppAdapter.java │ │ │ ├── WidgetNumberPicker.java │ │ │ ├── OverlayFragment.java │ │ │ ├── colorpicker │ │ │ │ ├── ColorSettingsDialog.java │ │ │ │ ├── AlphaPatternDrawable.java │ │ │ │ └── ColorPanelView.java │ │ │ ├── ColorPicker.java │ │ │ ├── WidgetFloatPercentage.java │ │ │ ├── BehaviorFragment.java │ │ │ ├── FloatDotActivity.java │ │ │ ├── MaximizedActivity.java │ │ │ ├── BlacklistActivity.java │ │ │ ├── WhitelistActivity.java │ │ │ ├── MainFragment.java │ │ │ ├── WidgetGravityChooser.java │ │ │ └── LauncherListActivity.java │ │ │ ├── TestingSettingHook.java │ │ │ ├── RightResizable.java │ │ │ ├── OutlineRightResizable.java │ │ │ ├── Movable.java │ │ │ ├── MainPreference.java │ │ │ ├── OutlineLeftResizable.java │ │ │ ├── Resizable.java │ │ │ ├── Compatibility.java │ │ │ ├── MainXposed.java │ │ │ ├── SystemUIOutliner.java │ │ │ └── AeroSnap.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── .idea ├── inspectionProfiles │ ├── profiles_settings.xml │ └── Project_Default.xml └── libraries │ ├── api_82.xml │ ├── support_annotations_23_3_0.xml │ ├── support_v13_23_3_0.xml │ └── support_v4_23_3_0.xml └── .gitignore /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /app/src/main/assets/xposed_init: -------------------------------------------------------------------------------- 1 | com.zst.xposed.halo.floatingwindow3.MainXposed 2 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/blacklist_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/blacklist_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/blacklist_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/blacklist_help.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_corner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_corner.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/blacklist_cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/blacklist_cancel.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/blacklist_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/blacklist_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_overflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_overflow.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_quadrant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_quadrant.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_title_max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_title_max.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_title_min.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_title_min.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_title_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_title_close.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_title_more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_title_more.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_title_max_old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_title_max_old.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_title_min_old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_title_min_old.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_title_more_old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_title_more_old.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/multiwindow_tray_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/multiwindow_tray_close.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/multiwindow_tray_reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/multiwindow_tray_reset.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/multiwindow_tray_swap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/multiwindow_tray_swap.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_title_close_old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_title_close_old.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_title_max_ssnjr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_title_max_ssnjr.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_title_min_ssnjr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_title_min_ssnjr.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_title_more_ssnjr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_title_more_ssnjr.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/multiwindow_tray_recents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/multiwindow_tray_recents.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/movable_title_close_ssnjr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shooash/XHFW3/HEAD/app/src/main/res/drawable/movable_title_close_ssnjr.png -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/libraries/api_82.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/round_rect.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/floatdot/XHFWInterface.aidl: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3.floatdot; 2 | 3 | interface XHFWInterface { 4 | // Window management 5 | void bringToFront(int taskId); 6 | void toggleDragger(boolean show); 7 | void removeAppTask(int taskId, int flags); 8 | int getLastTaskId(); 9 | int[] getCurrentFloatdotCoordinates(); 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/floatdot/BootReceiver.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3.floatdot; 2 | import android.content.*; 3 | 4 | public class BootReceiver extends BroadcastReceiver { 5 | @Override 6 | public void onReceive(Context context, Intent intent) { 7 | Intent startServiceIntent = new Intent(context, XHFWService.class); 8 | context.startService(startServiceIntent); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/floatdot/CallReceiver.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3.floatdot; 2 | import android.content.*; 3 | 4 | public class CallReceiver extends BroadcastReceiver { 5 | @Override 6 | public void onReceive(Context context, Intent intent) { 7 | Intent startServiceIntent = new Intent(context, XHFWService.class); 8 | context.startService(startServiceIntent); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_statusbar_taskbar_holder.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_23_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | 6 | # Files for the Dalvik VM 7 | *.dex 8 | 9 | # Java class files 10 | *.class 11 | 12 | 13 | # Generated files 14 | bin/ 15 | gen/ 16 | 17 | # Gradle files 18 | .gradle/ 19 | build/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | # Android Studio Navigation editor temp files 31 | .navigation/ 32 | 33 | # Android Studio captures folder 34 | captures/ 35 | 36 | #AIDE 37 | .classpath 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_number_picker.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_statusbar_taskbar_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_card_ui.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\tools\adt-bundle-windows-x86_64-20131030\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion '23.0.3' 6 | defaultConfig { 7 | applicationId "com.zst.xposed.halo.floatingwindow3" 8 | minSdkVersion 17 9 | targetSdkVersion 21 10 | versionCode 318 11 | versionName "3.18" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | zipAlignEnabled false 18 | } 19 | } 20 | productFlavors { 21 | } 22 | } 23 | 24 | dependencies { 25 | compile 'com.android.support:support-v13:23.3.0' 26 | provided 'de.robv.android.xposed:api:82' 27 | } 28 | -------------------------------------------------------------------------------- /.idea/libraries/support_v13_23_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/menu/launcher_popupmenu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 13 | 18 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/prefs/WidgetWindowAlphaPicker.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3.prefs; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.WindowManager; 6 | import android.widget.SeekBar; 7 | 8 | public class WidgetWindowAlphaPicker extends WidgetFloatPercentage { 9 | 10 | public WidgetWindowAlphaPicker(Context context, AttributeSet attrs) { 11 | super(context, attrs); 12 | } 13 | 14 | @Override 15 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { 16 | super.onProgressChanged(seekBar, progress, fromUser); 17 | int realValue = progress + Math.round((mMin * 100)); 18 | if (getDialog() != null) { 19 | WindowManager.LayoutParams lp = getDialog().getWindow().getAttributes(); 20 | lp.alpha = 0.01f * realValue; 21 | getDialog().getWindow().setAttributes(lp); 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/prefs/WidgetBackgroundDimPicker.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3.prefs; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.WindowManager; 6 | import android.widget.SeekBar; 7 | 8 | public class WidgetBackgroundDimPicker extends WidgetFloatPercentage { 9 | 10 | public WidgetBackgroundDimPicker(Context context, AttributeSet attrs) { 11 | super(context, attrs); 12 | } 13 | 14 | @Override 15 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { 16 | super.onProgressChanged(seekBar, progress, fromUser); 17 | int realValue = progress + Math.round((mMin * 100)); 18 | if (getDialog() != null) { 19 | WindowManager.LayoutParams lp = getDialog().getWindow().getAttributes(); 20 | lp.dimAmount = 0.01f * realValue; 21 | getDialog().getWindow().setAttributes(lp); 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_23_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/TestingSettingHook.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3; 2 | 3 | import com.zst.xposed.halo.floatingwindow3.Common; 4 | 5 | import de.robv.android.xposed.XC_MethodHook; 6 | import de.robv.android.xposed.XposedBridge; 7 | import de.robv.android.xposed.XposedHelpers; 8 | import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam; 9 | 10 | public class TestingSettingHook { 11 | 12 | public static void handleLoadPackage(LoadPackageParam lpp) { 13 | if (lpp.packageName.equals(Common.THIS_MOD_PACKAGE_NAME)) { 14 | Class hookClass = XposedHelpers.findClass("com.zst.xposed.halo.floatingwindow3.MainPreference", 15 | lpp.classLoader); 16 | XposedBridge.hookAllMethods(hookClass, "testSettings", new XC_MethodHook() { 17 | @Override 18 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable { 19 | param.args[0] = false; 20 | } 21 | }); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/prefs/IntListPreference.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3.prefs; 2 | 3 | import android.content.Context; 4 | import android.preference.ListPreference; 5 | import android.util.AttributeSet; 6 | 7 | public class IntListPreference extends ListPreference 8 | { 9 | public IntListPreference(Context context, AttributeSet attrs) { 10 | super(context, attrs); 11 | } 12 | 13 | public IntListPreference(Context context) { 14 | super(context); 15 | } 16 | 17 | @Override 18 | protected boolean persistString(String value) { 19 | if(value == null) { 20 | return false; 21 | } else { 22 | return persistInt(Integer.valueOf(value)); 23 | } 24 | } 25 | 26 | @Override 27 | protected String getPersistedString(String defaultReturnValue) { 28 | if(getSharedPreferences().contains(getKey())) { 29 | int intValue = getPersistedInt(0); 30 | return String.valueOf(intValue); 31 | } else { 32 | return defaultReturnValue; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/floatdot_submenu_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/xml/pref_moving.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 11 | 19 | 20 | 21 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_viewpager.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 21 | 22 | 26 | 27 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/prefs/FloatDotFragment.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3.prefs; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Intent; 5 | import android.content.SharedPreferences; 6 | import android.os.Bundle; 7 | import android.preference.Preference; 8 | import android.preference.PreferenceActivity; 9 | import android.preference.PreferenceFragment; 10 | 11 | import com.zst.xposed.halo.floatingwindow3.Common; 12 | import com.zst.xposed.halo.floatingwindow3.R; 13 | 14 | public class FloatDotFragment extends PreferenceFragment { 15 | 16 | static FloatDotFragment mInstance; 17 | SharedPreferences mPref; 18 | 19 | public static FloatDotFragment getInstance() { 20 | if (mInstance == null) { 21 | mInstance = new FloatDotFragment(); 22 | } 23 | return mInstance; 24 | } 25 | @Override 26 | @SuppressWarnings("deprecation") 27 | @SuppressLint("WorldReadableFiles") 28 | public void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | getPreferenceManager().setSharedPreferencesName(Common.PREFERENCE_MAIN_FILE); 31 | getPreferenceManager().setSharedPreferencesMode(PreferenceActivity.MODE_WORLD_READABLE); 32 | addPreferencesFromResource(R.xml.pref_floatdot); 33 | 34 | mPref = getActivity().getSharedPreferences(Common.PREFERENCE_MAIN_FILE, 35 | PreferenceActivity.MODE_WORLD_READABLE); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/RightResizable.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3; 2 | 3 | import android.content.Context; 4 | import android.view.MotionEvent; 5 | import android.view.View; 6 | import android.view.Window; 7 | import android.view.WindowManager.LayoutParams; 8 | 9 | public class RightResizable implements View.OnTouchListener { 10 | 11 | final Window window; 12 | final Context context; 13 | final int minSize; 14 | 15 | LayoutParams param; 16 | int distance_from_left; 17 | int distance_from_top; 18 | 19 | public RightResizable(Window window) { 20 | this.window = window; 21 | this.context = window.getContext(); 22 | // Convert 100dp to px equivalent from the context 23 | final float scale = window.getContext().getResources().getDisplayMetrics().density; 24 | minSize = (int) (100 * scale + 0.5f); 25 | } 26 | 27 | @Override 28 | public boolean onTouch(View v, MotionEvent event) { 29 | switch (event.getAction()) { 30 | 31 | case MotionEvent.ACTION_DOWN: 32 | param = window.getAttributes(); 33 | distance_from_left = param.x; 34 | distance_from_top = param.y; 35 | MovableWindow.unsnap(); 36 | break; 37 | 38 | case MotionEvent.ACTION_MOVE: 39 | final int newX = Math.round(event.getRawX()); 40 | final int newY = Math.round(event.getRawY()); 41 | 42 | int calculatedW = newX - distance_from_left; 43 | int calculatedH = newY - distance_from_top; 44 | 45 | if (calculatedW < minSize) { 46 | calculatedW = minSize; 47 | } 48 | if (calculatedH < minSize) { 49 | calculatedH = minSize; 50 | } 51 | MovableWindow.resize(calculatedW, calculatedH); 52 | break; 53 | } 54 | return false; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/res/xml/pref_movable_titlebar_others.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 14 | 19 | 20 | 28 | 29 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/prefs/MovingFragment.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3.prefs; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Intent; 5 | import android.content.SharedPreferences; 6 | import android.os.Bundle; 7 | import android.preference.Preference; 8 | import android.preference.PreferenceActivity; 9 | import android.preference.PreferenceFragment; 10 | 11 | import com.zst.xposed.halo.floatingwindow3.Common; 12 | import com.zst.xposed.halo.floatingwindow3.R; 13 | 14 | public class MovingFragment extends PreferenceFragment { 15 | 16 | static MovingFragment mInstance; 17 | SharedPreferences mPref; 18 | 19 | public static MovingFragment getInstance() { 20 | if (mInstance == null) { 21 | mInstance = new MovingFragment(); 22 | } 23 | return mInstance; 24 | } 25 | @Override 26 | @SuppressWarnings("deprecation") 27 | @SuppressLint("WorldReadableFiles") 28 | public void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | getPreferenceManager().setSharedPreferencesName(Common.PREFERENCE_MAIN_FILE); 31 | getPreferenceManager().setSharedPreferencesMode(PreferenceActivity.MODE_WORLD_READABLE); 32 | addPreferencesFromResource(R.xml.pref_moving); 33 | // findPreference(Common.KEY_MOVABLE_WINDOW + "_titlebar_screen").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 34 | // @Override 35 | // public boolean onPreferenceClick(Preference preference) { 36 | // getActivity().startActivity(new Intent(getActivity(), TitleBarSettingsActivity.class)); 37 | // return false; 38 | // } 39 | // }); 40 | mPref = getActivity().getSharedPreferences(Common.PREFERENCE_MAIN_FILE, 41 | PreferenceActivity.MODE_WORLD_READABLE); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/pref_seekbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 13 | 18 | 19 | 26 | 27 | 34 | 35 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_blacklist.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 18 | 19 | 20 | 21 | 31 | 32 | 33 | 34 | 40 | 41 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/prefs/adapters/PageAdapter.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3.prefs.adapters; 2 | 3 | import java.util.LinkedList; 4 | 5 | import android.annotation.SuppressLint; 6 | import android.app.Fragment; 7 | import android.app.FragmentManager; 8 | import android.os.Bundle; 9 | import android.support.v13.app.FragmentPagerAdapter; 10 | import android.view.LayoutInflater; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | 14 | 15 | public abstract class PageAdapter extends FragmentPagerAdapter { 16 | final LinkedList mFragmentPages; 17 | 18 | public PageAdapter(FragmentManager fm, LinkedList fragmentPages) { 19 | super(fm); 20 | mFragmentPages = fragmentPages; 21 | } 22 | 23 | @SuppressLint("ValidFragment") 24 | @Override 25 | public Fragment getItem(int position) { 26 | return new PageFragment() { 27 | @Override 28 | public View onCreateView(LayoutInflater inflater, ViewGroup c, 29 | Bundle savedInstanceState) { 30 | return makeView(inflater, c, getPosition()); 31 | } 32 | }.setPosition(mFragmentPages.get(position)); 33 | } 34 | 35 | public abstract View makeView(LayoutInflater inflater, ViewGroup container, int position); 36 | 37 | @Override 38 | public int getCount() { 39 | return mFragmentPages.size(); 40 | } 41 | 42 | 43 | public static abstract class PageFragment extends Fragment { 44 | public static final String FRAGMENT_KEY_POSITION = "position"; 45 | 46 | public PageFragment setPosition(int position) { 47 | // http://stackoverflow.com/questions/9245408 48 | Bundle args = new Bundle(); 49 | args.putInt(FRAGMENT_KEY_POSITION, position); 50 | setArguments(args); 51 | return this; 52 | } 53 | 54 | public int getPosition() { 55 | return getArguments().getInt(FRAGMENT_KEY_POSITION, -1); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/floatdot_launcher_menuitem.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 26 | 27 | 42 | 43 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/prefs/WidgetNumberPicker.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3.prefs; 2 | 3 | import com.zst.xposed.halo.floatingwindow3.R; 4 | 5 | import android.content.Context; 6 | import android.content.DialogInterface; 7 | import android.content.SharedPreferences; 8 | import android.preference.DialogPreference; 9 | import android.util.AttributeSet; 10 | import android.view.View; 11 | import android.widget.NumberPicker; 12 | 13 | public class WidgetNumberPicker extends DialogPreference { 14 | 15 | private NumberPicker picker; 16 | int mDefaultValue; 17 | int mMinValue; 18 | int mMaxValue; 19 | SharedPreferences mPref; 20 | 21 | public WidgetNumberPicker(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | setDialogLayoutResource(R.layout.dialog_number_picker); 24 | mDefaultValue = (Integer.parseInt(attrs.getAttributeValue(null, "defaultValue"))); 25 | mMinValue = (Integer.parseInt(attrs.getAttributeValue(null, "minimum"))); 26 | mMaxValue = (Integer.parseInt(attrs.getAttributeValue(null, "maximum"))); 27 | } 28 | 29 | @Override 30 | protected View onCreateDialogView() { 31 | View view = super.onCreateDialogView(); 32 | mPref = getPreferenceManager().getSharedPreferences(); 33 | picker = (NumberPicker) view.findViewById(R.id.number_picker); 34 | picker.setMaxValue(mMaxValue); 35 | picker.setMinValue(mMinValue); 36 | 37 | return view; 38 | } 39 | 40 | @Override 41 | public void onDismiss(DialogInterface dialog) { 42 | super.onDismiss(dialog); 43 | } 44 | 45 | @Override 46 | protected void onBindDialogView(View view) { 47 | super.onBindDialogView(view); 48 | picker.setValue(mPref.getInt(getKey(), mDefaultValue)); 49 | } 50 | 51 | @Override 52 | protected void onDialogClosed(boolean positiveResult) { 53 | super.onDialogClosed(positiveResult); 54 | if (positiveResult) { 55 | mPref.edit().putInt(getKey(), picker.getValue()).commit(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_floatdot.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 20 | 21 | 28 | 29 | 30 | 31 | 35 | 36 | 44 | 45 | 53 | 54 | 55 | 56 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /app/src/main/res/layout/multiwindow_recents_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 24 | 25 | 37 | 38 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/OutlineRightResizable.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.view.MotionEvent; 6 | import android.view.View; 7 | import android.view.Window; 8 | import android.view.WindowManager.LayoutParams; 9 | 10 | public class OutlineRightResizable implements View.OnTouchListener { 11 | 12 | final Window window; 13 | final Context context; 14 | final int minSize; 15 | 16 | LayoutParams param; 17 | int distance_from_left; 18 | int distance_from_top; 19 | int calculatedW; 20 | int calculatedH; 21 | 22 | public OutlineRightResizable(Window window) { 23 | this.window = window; 24 | this.context = window.getContext(); 25 | // Convert 100dp to px equivalent from the context 26 | final float scale = window.getContext().getResources().getDisplayMetrics().density; 27 | minSize = (int) (100 * scale + 0.5f); 28 | } 29 | 30 | @Override 31 | public boolean onTouch(View v, MotionEvent event) { 32 | switch (event.getAction()) { 33 | 34 | case MotionEvent.ACTION_DOWN: 35 | param = window.getAttributes(); 36 | distance_from_left = param.x; 37 | distance_from_top = param.y; 38 | MovableWindow.unsnap(); 39 | break; 40 | 41 | case MotionEvent.ACTION_MOVE: 42 | final int newX = Math.round(event.getRawX()); 43 | final int newY = Math.round(event.getRawY()); 44 | 45 | calculatedW = newX - distance_from_left; 46 | calculatedH = newY - distance_from_top; 47 | 48 | if (calculatedW < minSize) { 49 | calculatedW = minSize; 50 | } 51 | if (calculatedH < minSize) { 52 | calculatedH = minSize; 53 | } 54 | broadcast(true); 55 | break; 56 | case MotionEvent.ACTION_UP: 57 | broadcast(false); 58 | MovableWindow.resize(calculatedW, calculatedH); 59 | break; 60 | } 61 | return false; 62 | } 63 | 64 | private void broadcast(boolean show) { 65 | Intent i = new Intent(Common.SHOW_OUTLINE); 66 | if (show) { 67 | int[] array = { distance_from_left, distance_from_top, calculatedH, calculatedW }; 68 | i.putExtra(Common.INTENT_APP_PARAMS, array); 69 | } 70 | context.sendBroadcast(i); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/res/layout/movable_dialog_transparency.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 29 | 30 | 39 | 40 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/Movable.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3; 2 | 3 | import android.view.Gravity; 4 | import android.view.MotionEvent; 5 | import android.view.View; 6 | import android.view.Window; 7 | import android.view.WindowManager.LayoutParams; 8 | import java.util.logging.*; 9 | 10 | public class Movable implements View.OnTouchListener { 11 | final Window mWindow; 12 | final LayoutParams param; 13 | final boolean mReturn; 14 | 15 | private static Float screenX ; 16 | private static Float screenY ; 17 | private static Float viewX ; 18 | private static Float viewY ; 19 | private static Float leftFromScreen ; 20 | private static Float topFromScreen ; 21 | private View offsetView; 22 | 23 | public Movable(Window window, boolean return_value) { 24 | mWindow=window; 25 | param = mWindow.getAttributes(); 26 | mReturn = return_value; 27 | } 28 | 29 | public Movable(Window window, View v){ 30 | this(window, false); 31 | offsetView = v; 32 | } 33 | 34 | @Override 35 | public boolean onTouch(View v, MotionEvent event) { 36 | switch (event.getAction()){ 37 | case MotionEvent.ACTION_DOWN: 38 | viewX = event.getX(); 39 | viewY = event.getY(); 40 | if (offsetView != null) { 41 | int[] location = {0,0}; 42 | offsetView.getLocationInWindow(location); 43 | viewX = viewX + location[0]; 44 | viewY = viewY + location[1]; 45 | } 46 | break; 47 | case MotionEvent.ACTION_MOVE: 48 | screenX = event.getRawX(); 49 | screenY = event.getRawY(); 50 | leftFromScreen = (screenX - viewX); 51 | topFromScreen = (screenY - viewY); 52 | //mWindow.setGravity(Gravity.LEFT | Gravity.TOP); 53 | if(MovableWindow.mWindowHolder.isSnapped) 54 | MovableWindow.unsnap(); 55 | else 56 | MovableWindow.move(leftFromScreen.intValue(),topFromScreen.intValue()); 57 | break; 58 | } 59 | if (MovableWindow.mAeroSnap != null) { 60 | MovableWindow.mAeroSnap.dispatchTouchEvent(event); 61 | } 62 | return mReturn; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | @string/option_movable_corner_nothing 7 | @string/option_movable_corner_dnm 8 | @string/option_movable_corner_dnm_wo_corners 9 | @string/option_movable_corner_transparency 10 | @string/option_movable_corner_close 11 | @string/option_movable_corner_hide_app 12 | @string/option_movable_corner_maximize 13 | 14 | 15 | 16 | 0 17 | 1 18 | 5 19 | 3 20 | 2 21 | 4 22 | 6 23 | 24 | 25 | 26 | 27 | @string/option_whiteblacklist_default 28 | @string/option_whiteblacklist_always_only 29 | @string/option_whiteblacklist_never_only 30 | @string/option_whiteblacklist_never_all 31 | 32 | 33 | 34 | 0 35 | 1 36 | 2 37 | 3 38 | 39 | 40 | 41 | @string/option_force_snap_default 42 | @string/option_force_snap_halo_only 43 | @string/option_force_snap_always 44 | 45 | 46 | 47 | 0 48 | 1 49 | 2 50 | 51 | 52 | 53 | Old and classic (0x2000) 54 | New default / Android 5+ (0x2001) 55 | Omni/SlimRom (0x3000) 56 | 57 | 58 | 59 | 8192 60 | 8193 61 | 12288 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /app/src/main/res/xml/pref_floatdot.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 15 | 22 | 27 | 33 | 39 | 46 | 51 | 57 | 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/prefs/OverlayFragment.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3.prefs; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Intent; 5 | import android.content.SharedPreferences; 6 | import android.os.Bundle; 7 | import android.preference.Preference; 8 | import android.preference.PreferenceActivity; 9 | import android.preference.PreferenceFragment; 10 | 11 | import com.zst.xposed.halo.floatingwindow3.Common; 12 | import com.zst.xposed.halo.floatingwindow3.R; 13 | 14 | public class OverlayFragment extends PreferenceFragment { 15 | 16 | static OverlayFragment mInstance; 17 | SharedPreferences mPref; 18 | 19 | public static OverlayFragment getInstance() { 20 | if (mInstance == null) { 21 | mInstance = new OverlayFragment(); 22 | } 23 | return mInstance; 24 | } 25 | @Override 26 | @SuppressWarnings("deprecation") 27 | @SuppressLint("WorldReadableFiles") 28 | public void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | getPreferenceManager().setSharedPreferencesName(Common.PREFERENCE_MAIN_FILE); 31 | getPreferenceManager().setSharedPreferencesMode(PreferenceActivity.MODE_WORLD_READABLE); 32 | addPreferencesFromResource(R.xml.pref_overlay); 33 | findPreference("titlebar_theme").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 34 | @Override 35 | public boolean onPreferenceClick(Preference preference) { 36 | getActivity().startActivity(new Intent(getActivity(), TitleBarSettingsActivity.class)); 37 | return false; 38 | } 39 | }); 40 | findPreference("floatdot_theme").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 41 | @Override 42 | public boolean onPreferenceClick(Preference preference) { 43 | Intent intent = new Intent(); 44 | intent.setClass(getActivity(), FloatDotActivity.class); 45 | startActivityForResult(intent, 0); 46 | 47 | return false; 48 | } 49 | }); 50 | findPreference("launcher_list").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 51 | @Override 52 | public boolean onPreferenceClick(Preference preference) { 53 | getActivity().startActivity(new Intent(getActivity(), LauncherListActivity.class)); 54 | return false; 55 | } 56 | }); 57 | mPref = getActivity().getSharedPreferences(Common.PREFERENCE_MAIN_FILE, 58 | PreferenceActivity.MODE_WORLD_READABLE); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_app_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 32 | 33 | 43 | 44 | 51 | 52 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/MainPreference.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3; 2 | 3 | import com.zst.xposed.halo.floatingwindow3.prefs.MainFragment; 4 | 5 | import android.app.Activity; 6 | import android.app.Fragment; 7 | import android.graphics.Color; 8 | import android.os.Bundle; 9 | import android.support.v13.app.FragmentPagerAdapter; 10 | import android.support.v4.view.PagerTabStrip; 11 | import android.support.v4.view.ViewPager; 12 | import com.zst.xposed.halo.floatingwindow3.prefs.*; 13 | import android.app.*; 14 | import android.graphics.drawable.*; 15 | import android.widget.*; 16 | import android.view.*; 17 | 18 | public class MainPreference extends Activity { 19 | 20 | @Override 21 | protected void onCreate(Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | 24 | setContentView(R.layout.activity_viewpager); 25 | 26 | FragmentPagerAdapter adapter = new FragmentPagerAdapter(getFragmentManager()) { 27 | @Override 28 | public Fragment getItem(int position) { 29 | switch (position) { 30 | case 0: 31 | return MainFragment.getInstance(); 32 | case 1: 33 | return MovingFragment.getInstance(); 34 | case 2: 35 | return BehaviorFragment.getInstance(); 36 | case 3: 37 | return OverlayFragment.getInstance(); 38 | // case 2: 39 | // return TestingActivity.getInstance(); 40 | } 41 | return new Fragment(); 42 | } 43 | 44 | @Override 45 | public String getPageTitle(int pos) { 46 | switch (pos) { 47 | case 0: 48 | return getResources().getString(R.string.pref_main_top_title); 49 | case 1: 50 | return getResources().getString(R.string.pref_movable_top_title); 51 | case 2: 52 | return getResources().getString(R.string.pref_behavior_title); 53 | case 3: 54 | return getResources().getString(R.string.pref_overlay_title); 55 | // case 2: 56 | // return getResources().getString(R.string.pref_testing_top_title); 57 | } 58 | return ""; 59 | } 60 | 61 | @Override 62 | public int getCount() { 63 | return 4; 64 | } 65 | }; 66 | ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager); 67 | viewPager.setAdapter(adapter); 68 | 69 | PagerTabStrip pts = (PagerTabStrip) findViewById(R.id.pager_title_strip); 70 | pts.setTabIndicatorColor(0xFF333333); 71 | pts.setTextColor(0xFF111111); 72 | pts.setBackgroundColor(Color.TRANSPARENT); 73 | 74 | ActionBar bar = getActionBar(); 75 | bar.setBackgroundDrawable(new ColorDrawable(0xFFAA0000)); 76 | 77 | 78 | testSettings(true); 79 | 80 | } 81 | 82 | private void testSettings(boolean mVis){ 83 | TextView notActiveTitle = (TextView) findViewById(R.id.notActiveTitle); 84 | notActiveTitle.setVisibility(mVis?View.VISIBLE:View.GONE); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_package_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 32 | 33 | 43 | 44 | 51 | 52 | 59 | 60 | 61 | 68 | 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/OutlineLeftResizable.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.util.DisplayMetrics; 6 | import android.view.MotionEvent; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.view.Window; 10 | import android.view.WindowManager.LayoutParams; 11 | 12 | public class OutlineLeftResizable implements View.OnTouchListener { 13 | 14 | Window window; 15 | Context context; 16 | LayoutParams param; 17 | 18 | final int minSize; 19 | 20 | int oldX, oldY, oldW, oldH; 21 | int futureX, futureW, futureH; 22 | int distance_from_top; 23 | 24 | public OutlineLeftResizable(Context context, Window window) { 25 | this.context = context; 26 | this.window = window; 27 | final float scale = context.getResources().getDisplayMetrics().density; 28 | minSize = (int) (100 * scale + 0.5f); 29 | } 30 | 31 | @Override 32 | public boolean onTouch(View v, MotionEvent event) { 33 | switch (event.getAction()) { 34 | 35 | case MotionEvent.ACTION_DOWN: 36 | MovableWindow.unsnap(); 37 | param = window.getAttributes(); 38 | oldX = Math.round(event.getRawX() - event.getX()); 39 | oldY = Math.round(event.getRawY() - event.getY()); 40 | oldW = param.width; 41 | oldH = param.height; 42 | distance_from_top = param.y; 43 | if (oldW == ViewGroup.LayoutParams.MATCH_PARENT 44 | || oldH == ViewGroup.LayoutParams.MATCH_PARENT) { 45 | DisplayMetrics metrics = context.getResources().getDisplayMetrics(); 46 | oldW = (int) (metrics.widthPixels * 0.95f); 47 | oldH = (int) (metrics.heightPixels * 0.95f); 48 | } 49 | break; 50 | 51 | case MotionEvent.ACTION_MOVE: 52 | int newX = Math.round(event.getRawX()); 53 | int newY = Math.round(event.getRawY()); 54 | 55 | int calculatedW = oldW + (oldX - newX); 56 | int calculatedH = newY - distance_from_top; 57 | 58 | if (calculatedW > minSize) { 59 | futureW = calculatedW; 60 | futureX = newX; 61 | } 62 | if (calculatedH > minSize) { 63 | futureH = calculatedH; 64 | } 65 | broadcast(true); 66 | break; 67 | case MotionEvent.ACTION_UP: 68 | param.x = futureX; 69 | param.y = distance_from_top; 70 | param.width = futureW; 71 | param.height = futureH; 72 | broadcast(false); 73 | if(!MovableWindow.mWindowHolder.isSnapped&&!MovableWindow.mWindowHolder.isMaximized) 74 | MovableWindow.resize(param.x, param.y, param.width, param.height); 75 | break; 76 | 77 | } 78 | return false; 79 | } 80 | 81 | private void broadcast(boolean show) { 82 | Intent i = new Intent(Common.SHOW_OUTLINE); 83 | if (show) { 84 | int[] array = { futureX, distance_from_top, futureH, futureW }; 85 | i.putExtra(Common.INTENT_APP_PARAMS, array); 86 | } 87 | context.sendBroadcast(i); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/Resizable.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3; 2 | 3 | 4 | import android.content.Context; 5 | import android.util.DisplayMetrics; 6 | import android.view.MotionEvent; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.view.Window; 10 | import android.view.WindowManager.LayoutParams; 11 | 12 | public class Resizable implements View.OnTouchListener { 13 | 14 | Window window; 15 | Context context; 16 | LayoutParams param; 17 | int oldX; 18 | int oldY; 19 | int oldW; 20 | int oldH; 21 | int distance_from_top; 22 | int minSize; 23 | 24 | public Resizable(Context context, Window window){ 25 | this.context = context; 26 | this.window = window; 27 | // Convert 100dp to px equivalent from the context 28 | final float scale = context.getResources().getDisplayMetrics().density; 29 | minSize = (int) (100 * scale + 0.5f); 30 | } 31 | 32 | 33 | @Override 34 | public boolean onTouch(View v, MotionEvent event) { 35 | switch (event.getAction()){ 36 | 37 | case MotionEvent.ACTION_DOWN: 38 | param = window.getAttributes(); 39 | oldX = Math.round(event.getRawX() - event.getX()); 40 | oldY = Math.round(event.getRawY() - event.getY()); 41 | oldW = param.width; 42 | oldH = param.height; 43 | distance_from_top = param.y; 44 | if (oldW == ViewGroup.LayoutParams.MATCH_PARENT 45 | || oldH == ViewGroup.LayoutParams.MATCH_PARENT) { 46 | DisplayMetrics metrics = context.getResources().getDisplayMetrics(); 47 | oldW = (int) (metrics.widthPixels * 0.95f); 48 | oldH = (int) (metrics.heightPixels * 0.95f); 49 | } 50 | MovableWindow.unsnap(); 51 | return false; 52 | 53 | case MotionEvent.ACTION_MOVE: 54 | int newX = Math.round(event.getRawX()); 55 | int newY = Math.round(event.getRawY()); 56 | 57 | int calculatedW = oldW + (oldX - newX); 58 | int calculatedH = newY - distance_from_top; 59 | 60 | if (calculatedW > minSize){ 61 | param.width = calculatedW; 62 | param.x = newX; 63 | } 64 | if(calculatedH > minSize){ 65 | param.height = calculatedH; 66 | //Commented y because we never change it so no reason to reset it 67 | //param.y = distance_from_top; 68 | } 69 | MovableWindow.resize(param.x, param.y, param.width, param.height); 70 | 71 | //I split the if statements because if say the width is at it's minimum that shouldn't keep the height from adjusting 72 | //which may not be at it's minimum. Basically width and height should be independent 73 | return false; 74 | default: 75 | return false; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/prefs/colorpicker/ColorSettingsDialog.java: -------------------------------------------------------------------------------- 1 | package com.zst.xposed.halo.floatingwindow3.prefs.colorpicker; 2 | 3 | import java.util.Locale; 4 | 5 | import com.zst.xposed.halo.floatingwindow3.R; 6 | import com.zst.xposed.halo.floatingwindow3.prefs.colorpicker.ColorPickerView.OnColorChangedListener; 7 | 8 | import android.app.AlertDialog; 9 | import android.content.Context; 10 | import android.graphics.Color; 11 | import android.graphics.PixelFormat; 12 | import android.view.LayoutInflater; 13 | import android.view.View; 14 | import android.widget.Button; 15 | import android.widget.EditText; 16 | 17 | public class ColorSettingsDialog extends AlertDialog implements 18 | ColorPickerView.OnColorChangedListener { 19 | 20 | private ColorPickerView mColorPicker; 21 | 22 | private ColorPanelView mOldColor; 23 | private ColorPanelView mNewColor; 24 | private EditText mHexColor; 25 | private Button mHexButton; 26 | 27 | private LayoutInflater mInflater; 28 | private OnColorChangedListener mListener; 29 | 30 | public ColorSettingsDialog(Context context, int initialColor, final String defColor) { 31 | super(context); 32 | getWindow().setFormat(PixelFormat.RGBA_8888); 33 | // To fight color banding. 34 | setUp(initialColor, defColor); 35 | } 36 | 37 | private void setUp(int color, final String defColor) { 38 | mInflater = (LayoutInflater) getContext() 39 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 40 | 41 | View layout = mInflater.inflate(R.layout.dialog_colorpicker, null); 42 | 43 | mColorPicker = (ColorPickerView) layout.findViewById(R.id.color_picker_view); 44 | mOldColor = (ColorPanelView) layout.findViewById(R.id.old_color_panel); 45 | mNewColor = (ColorPanelView) layout.findViewById(R.id.new_color_panel); 46 | mHexColor = (EditText) layout.findViewById(R.id.current_hex_text); 47 | 48 | mColorPicker.setOnColorChangedListener(this); 49 | mOldColor.setColor(color); 50 | mColorPicker.setColor(color, true); 51 | 52 | mHexButton = (Button) layout.findViewById(R.id.color_apply); 53 | mHexButton.setOnClickListener(new View.OnClickListener(){ 54 | @Override 55 | public void onClick(View v) { 56 | try{ 57 | int color = Color.parseColor("#" + mHexColor.getText().toString()); 58 | mColorPicker.setColor(color); 59 | colorChange(color); 60 | }catch(Exception e){ 61 | mHexColor.setText("FFFFFF"); 62 | } 63 | } 64 | }); 65 | 66 | setView(layout); 67 | } 68 | 69 | @Override 70 | public void onColorChanged(int color) { 71 | colorChange(color); 72 | } 73 | 74 | private void colorChange(int color){ 75 | mNewColor.setColor(color); 76 | mHexColor.setText(Integer.toHexString(color).toUpperCase(Locale.ENGLISH).substring(2)); 77 | if (mListener != null) { 78 | mListener.onColorChanged(color); 79 | } 80 | } 81 | 82 | public void setAlphaSliderVisible(boolean visible) { 83 | mColorPicker.setAlphaSliderVisible(visible); 84 | } 85 | 86 | public String getColorString() { 87 | return Integer.toHexString(mColorPicker.getColor()); 88 | } 89 | 90 | public int getColor() { 91 | return mColorPicker.getColor(); 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/com/zst/xposed/halo/floatingwindow3/prefs/ColorPicker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 XuiMod 3 | * Copyright (C) 2012 The CyanogenMod Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.zst.xposed.halo.floatingwindow3.prefs; 19 | 20 | 21 | import com.zst.xposed.halo.floatingwindow3.R; 22 | import com.zst.xposed.halo.floatingwindow3.prefs.colorpicker.ColorSettingsDialog; 23 | 24 | import android.app.AlertDialog; 25 | import android.content.Context; 26 | import android.content.DialogInterface; 27 | import android.content.SharedPreferences; 28 | import android.content.res.Resources; 29 | import android.graphics.Color; 30 | import android.preference.Preference; 31 | import android.preference.Preference.OnPreferenceClickListener; 32 | import android.util.AttributeSet; 33 | import android.view.View; 34 | import android.widget.ImageView; 35 | 36 | public class ColorPicker extends Preference implements OnPreferenceClickListener { 37 | 38 | SharedPreferences mPref; 39 | ImageView mColorBox; 40 | Resources mRes; 41 | String mDefaultColor; 42 | 43 | public ColorPicker(Context context, AttributeSet attrs) { 44 | super(context, attrs); 45 | 46 | mDefaultColor = attrs.getAttributeValue(null, "defaultValue"); 47 | } 48 | 49 | @Override 50 | protected void onBindView(View view) { 51 | super.onBindView(view); 52 | mColorBox = (ImageView) view.findViewById(android.R.id.icon); 53 | mPref = getPreferenceManager().getSharedPreferences(); 54 | mRes = getContext().getResources(); 55 | setOnPreferenceClickListener(this); 56 | refreshColorBox(); 57 | } 58 | 59 | @Override 60 | public boolean onPreferenceClick(Preference arg0) { 61 | final ColorSettingsDialog d = new ColorSettingsDialog(getContext(), getColor(), mDefaultColor); 62 | final DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() { 63 | @Override 64 | public void onClick(DialogInterface dialog, int which) { 65 | switch (which){ 66 | case AlertDialog.BUTTON_POSITIVE: 67 | setColor(d.getColorString()); 68 | break; 69 | case AlertDialog.BUTTON_NEUTRAL: 70 | setColor(mDefaultColor); 71 | break; 72 | } 73 | } 74 | }; 75 | d.setButton(AlertDialog.BUTTON_POSITIVE, mRes.getString(android.R.string.ok), listener); 76 | d.setButton(AlertDialog.BUTTON_NEUTRAL, mRes.getString(R.string.default_value), listener); 77 | d.setButton(AlertDialog.BUTTON_NEGATIVE, mRes.getString(android.R.string.cancel), listener); 78 | d.show(); 79 | return true; 80 | } 81 | 82 | public String getColorString() { 83 | return Integer.toHexString(getColor()); 84 | } 85 | 86 | public int getColor() { 87 | String str = mPref.getString(getKey(), mDefaultColor); 88 | return Color.parseColor("#"+str); 89 | } 90 | 91 | private void refreshColorBox(){ 92 | if (mColorBox != null) { 93 | mColorBox.setBackgroundColor(getColor()); 94 | mColorBox.setVisibility(View.VISIBLE); 95 | } 96 | } 97 | public void setColor(String clr) { 98 | mPref.edit().putString(getKey(), clr).commit(); 99 | refreshColorBox(); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_colorpicker.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 26 | 30 | 31 | 37 | 38 | 46 | 47 | 56 | 57 |