diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml
index 41e03fc..fbbd448 100644
--- a/.idea/assetWizardSettings.xml
+++ b/.idea/assetWizardSettings.xml
@@ -18,7 +18,7 @@
@@ -28,7 +28,7 @@
diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index dbd31c0..db8b17b 100644
Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ
diff --git a/app/build.gradle b/app/build.gradle
index d27faeb..73cf1c4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,13 +1,53 @@
//noinspection GradleCompatible
apply plugin: 'com.android.application'
+def compile_sdk_version = 27
+def min_sdk_version = 21
+def support_library_version = "27.1.1"
+def build_tools_version = "27.0.3"
+def play_services_version = "15.0.0"
+def firebase_version = "15.0.0"
+def support_test_version = "1.0.1"
+def gson_version = "2.8.2"
+def glide_version = "3.8.0"
+
+
+
+configurations.all {
+ resolutionStrategy.eachDependency { DependencyResolveDetails details ->
+ // Skip multidex because it follows a different versioning pattern.
+ if (!details.requested.name.startsWith("multidex")) {
+ switch (details.requested.group) {
+ case 'com.android.support':
+ details.useVersion "$support_library_version"
+ break
+ case 'com.google.android.gms':
+ details.useVersion "$play_services_version"
+ break
+ case 'com.google.firebase':
+ details.useVersion "$firebase_version"
+ break
+ case 'com.android.support.test':
+ details.useVersion "$support_test_version"
+ break
+ case 'com.google.code.gson':
+ details.useVersion "$gson_version"
+ break
+ case 'com.github.bumptech.glide':
+ details.useVersion "$glide_version"
+ break
+ }
+ }
+ }
+}
+
android {
- compileSdkVersion 27
- buildToolsVersion '27.0.3'
+ compileSdkVersion compile_sdk_version
+ buildToolsVersion build_tools_version
defaultConfig {
applicationId "com.android.mycax.floatingvolume"
- minSdkVersion 21
- targetSdkVersion 27
+ minSdkVersion min_sdk_version
+ targetSdkVersion compile_sdk_version
versionCode 6
versionName "1.0.5 beta"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -22,13 +62,13 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'com.android.support:appcompat-v7:27.1.1'
- implementation 'com.android.support.constraint:constraint-layout:1.1.0'
- implementation 'com.android.support:cardview-v7:27.1.1'
- implementation 'com.android.support:support-v4:27.1.1'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
+ implementation "com.android.support:appcompat-v7:${support_library_version}"
+ implementation "com.android.support.constraint:constraint-layout:1.1.0"
+ implementation "com.android.support:cardview-v7:${support_library_version}"
+ implementation "com.android.support:support-v4:${support_library_version}"
+ androidTestImplementation 'junit:junit:4.12'
+ androidTestImplementation "com.android.support.test:runner:${support_test_version}"
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
- compile 'com.github.BaselHorany:DualButton:1.1.1'
- compile 'com.github.recruit-lifestyle:FloatingView:2.3.1'
+ implementation 'com.github.BaselHorany:DualButton:1.1.1'
+ implementation 'com.github.recruit-lifestyle:FloatingView:2.3.1'
}
diff --git a/app/src/main/java/com/android/mycax/floatingvolume/MainActivity.java b/app/src/main/java/com/android/mycax/floatingvolume/MainActivity.java
index 7a32fd9..f7233c3 100644
--- a/app/src/main/java/com/android/mycax/floatingvolume/MainActivity.java
+++ b/app/src/main/java/com/android/mycax/floatingvolume/MainActivity.java
@@ -15,6 +15,7 @@
import android.widget.Toast;
import com.android.mycax.floatingvolume.utils.AppUtils;
+import com.android.mycax.floatingvolume.utils.Constants;
import com.basel.DualButton.DualButton;
import java.util.Objects;
@@ -23,18 +24,13 @@
public class MainActivity extends AppCompatPreferenceActivity implements SwitchPreference.OnPreferenceChangeListener, DualButton.OnDualClickListener {
private DualButton FloatingService;
private SwitchPreference bounceEffect;
- private static final String PREF_ENABLE_DARK_MODE = "enable_dark_mode_switch";
- private static final String PREF_ENABLE_BOUNCE = "enable_bounce_effect";
- private static final String PREF_DISABLE_FIXED_UI = "disable_fixed_ui";
- private static final int OVERLAY_PERMISSION_REQUEST = 1;
- private static final int NOTIFICATION_POLICY_PERMISSION_REQUEST = 2;
private AppUtils utils;
private NotificationManager notificationManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(PreferenceManager.getDefaultSharedPreferences(this)
- .getBoolean(PREF_ENABLE_DARK_MODE, false) ? R.style.AppTheme_Dark : R.style.AppTheme);
+ .getBoolean(Constants.PREF_ENABLE_DARK_MODE, false) ? R.style.AppTheme_Dark : R.style.AppTheme);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
utils = new AppUtils(this);
@@ -51,14 +47,14 @@ protected void onCreate(Bundle savedInstanceState) {
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_main);
- SwitchPreference darkMode = (SwitchPreference) findPreference(PREF_ENABLE_DARK_MODE);
+ SwitchPreference darkMode = (SwitchPreference) findPreference(Constants.PREF_ENABLE_DARK_MODE);
darkMode.setOnPreferenceChangeListener(this);
- bounceEffect = (SwitchPreference) findPreference(PREF_ENABLE_BOUNCE);
+ bounceEffect = (SwitchPreference) findPreference(Constants.PREF_ENABLE_BOUNCE);
if (!PreferenceManager.getDefaultSharedPreferences(this)
- .getBoolean(PREF_DISABLE_FIXED_UI, false)) {
+ .getBoolean(Constants.PREF_DISABLE_FIXED_UI, false)) {
bounceEffect.setEnabled(false);
}
- SwitchPreference disableFixedUI = (SwitchPreference) findPreference(PREF_DISABLE_FIXED_UI);
+ SwitchPreference disableFixedUI = (SwitchPreference) findPreference(Constants.PREF_DISABLE_FIXED_UI);
disableFixedUI.setOnPreferenceChangeListener(this);
}
@@ -78,14 +74,14 @@ public void onClickSecond(Button btn) {
@Override
public boolean onPreferenceChange(Preference preference, Object object) {
- if (preference == findPreference(PREF_ENABLE_DARK_MODE)) {
+ if (preference == findPreference(Constants.PREF_ENABLE_DARK_MODE)) {
finish();
final Intent intent = getIntent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
- } else if (preference == findPreference(PREF_DISABLE_FIXED_UI)) {
+ } else if (preference == findPreference(Constants.PREF_DISABLE_FIXED_UI)) {
bounceEffect.setEnabled(!PreferenceManager.getDefaultSharedPreferences(this)
- .getBoolean(PREF_DISABLE_FIXED_UI, false));
+ .getBoolean(Constants.PREF_DISABLE_FIXED_UI, false));
}
return true;
}
@@ -99,14 +95,14 @@ private void checkPermissions() {
if (!Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
- startActivityForResult(intent, OVERLAY_PERMISSION_REQUEST);
+ startActivityForResult(intent, Constants.OVERLAY_PERMISSION_REQUEST);
}
if (!Objects.requireNonNull(notificationManager).isNotificationPolicyAccessGranted()) {
Intent intent = new Intent(
android.provider.Settings
.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
- startActivityForResult(intent, NOTIFICATION_POLICY_PERMISSION_REQUEST);
+ startActivityForResult(intent, Constants.NOTIFICATION_POLICY_PERMISSION_REQUEST);
}
}
}
@@ -114,7 +110,7 @@ private void checkPermissions() {
@TargetApi(Build.VERSION_CODES.M)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == OVERLAY_PERMISSION_REQUEST || requestCode == NOTIFICATION_POLICY_PERMISSION_REQUEST) {
+ if (requestCode == Constants.OVERLAY_PERMISSION_REQUEST || requestCode == Constants.NOTIFICATION_POLICY_PERMISSION_REQUEST) {
if (Settings.canDrawOverlays(this) && Objects.requireNonNull(notificationManager).isNotificationPolicyAccessGranted()) {
initializeView();
} else {
diff --git a/app/src/main/java/com/android/mycax/floatingvolume/services/FloatingVolumeService.java b/app/src/main/java/com/android/mycax/floatingvolume/services/FloatingVolumeService.java
index 382580e..8c31471 100644
--- a/app/src/main/java/com/android/mycax/floatingvolume/services/FloatingVolumeService.java
+++ b/app/src/main/java/com/android/mycax/floatingvolume/services/FloatingVolumeService.java
@@ -10,6 +10,7 @@
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.graphics.Point;
+import android.media.AudioManager;
import android.os.Build;
import android.os.CountDownTimer;
import android.os.IBinder;
@@ -26,16 +27,16 @@
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
-import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;
-import android.media.AudioManager;
import com.android.mycax.floatingvolume.R;
import com.android.mycax.floatingvolume.audio.AudioVolumeObserver;
import com.android.mycax.floatingvolume.audio.OnAudioVolumeChangedListener;
+import com.android.mycax.floatingvolume.utils.Constants;
import java.util.Objects;
+import java.util.Set;
import jp.co.recruit_lifestyle.android.floatingview.FloatingViewListener;
import jp.co.recruit_lifestyle.android.floatingview.FloatingViewManager;
@@ -48,16 +49,13 @@ public class FloatingVolumeService extends Service implements FloatingViewListen
private FloatingViewManager mFloatingViewManager;
private AudioVolumeObserver mAudioVolumeObserverMedia, mAudioVolumeObserverVoiceCall, mAudioVolumeObserverRinger, mAudioVolumeObserverAlarm;
private SeekBar mediaControl, ringerControl, alarmControl, voiceCallControl;
- private static final String PREF_KEY_LAST_POSITION_X = "last_position_x";
- private static final String PREF_KEY_LAST_POSITION_Y = "last_position_y";
- private static final String PREF_KEY_LAST_POSITION_X_EXPANDED = "last_position_x_expanded";
- private static final String PREF_KEY_LAST_POSITION_Y_EXPANDED = "last_position_y_expanded";
private BroadcastReceiver RingerModeReceiver;
private boolean isDarkThemeEnabled, isDisableStaticUiEnabled, isUseLastPosition, isBounceEnabled;
private int x_init_cord, y_init_cord, x_init_margin, y_init_margin;
private final Point szWindow = new Point();
private SharedPreferences.Editor editor;
private SharedPreferences sharedPref;
+ private Set seekbarSelections;
private static int OVERLAY_TYPE;
static {
@@ -120,6 +118,7 @@ private void expandView(LayoutInflater inflater, DisplayMetrics displayMetrics)
isDisableStaticUiEnabled = sharedPref.getBoolean("disable_fixed_ui", false);
isUseLastPosition = sharedPref.getBoolean("settings_save_last_position", false);
isBounceEnabled = sharedPref.getBoolean("enable_bounce_effect", false);
+ seekbarSelections = sharedPref.getStringSet("items_to_show_in_dialog_pref", null);
addFloatingWidgetView(inflater, displayMetrics);
if (isDisableStaticUiEnabled) implementTouchListenerToFloatingWidgetView(this);
@@ -157,18 +156,6 @@ private void expandView(LayoutInflater inflater, DisplayMetrics displayMetrics)
implementVolumeFeatures();
- mAudioVolumeObserverRinger = new AudioVolumeObserver(this);
- mAudioVolumeObserverRinger.register(AudioManager.STREAM_RING, this);
-
- mAudioVolumeObserverMedia = new AudioVolumeObserver(this);
- mAudioVolumeObserverMedia.register(AudioManager.STREAM_MUSIC, this);
-
- mAudioVolumeObserverVoiceCall = new AudioVolumeObserver(this);
- mAudioVolumeObserverVoiceCall.register(AudioManager.STREAM_VOICE_CALL, this);
-
- mAudioVolumeObserverAlarm = new AudioVolumeObserver(this);
- mAudioVolumeObserverAlarm.register(AudioManager.STREAM_ALARM, this);
-
mFloatingWidgetView.findViewById(R.id.close_expanded_view).setOnClickListener(this);
iconView.setVisibility(View.GONE);
}
@@ -176,7 +163,7 @@ private void expandView(LayoutInflater inflater, DisplayMetrics displayMetrics)
@SuppressLint("InflateParams")
private void addFloatingWidgetView(LayoutInflater inflater, DisplayMetrics displayMetrics) {
getWindowManagerDefaultDisplay();
- mFloatingWidgetView = inflater.inflate(R.layout.floating_layout, null, false);
+ mFloatingWidgetView = inflater.inflate(getDialogLayout(), null, false);
final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
@@ -187,8 +174,8 @@ private void addFloatingWidgetView(LayoutInflater inflater, DisplayMetrics displ
if (isDisableStaticUiEnabled) {
params.gravity = Gravity.TOP | Gravity.START;
if (isUseLastPosition) {
- params.x = sharedPref.getInt(PREF_KEY_LAST_POSITION_X_EXPANDED, 0);
- params.y = sharedPref.getInt(PREF_KEY_LAST_POSITION_Y_EXPANDED, 0);
+ params.x = sharedPref.getInt(Constants.PREF_KEY_LAST_POSITION_X_EXPANDED, 0);
+ params.y = sharedPref.getInt(Constants.PREF_KEY_LAST_POSITION_Y_EXPANDED, 0);
} else {
int height = displayMetrics.heightPixels;
params.x = displayMetrics.widthPixels - mFloatingWidgetView.getWidth();
@@ -205,33 +192,56 @@ private void addFloatingWidgetView(LayoutInflater inflater, DisplayMetrics displ
}
private void implementVolumeFeatures() {
- mediaControl = mFloatingWidgetView.findViewById(R.id.SeekBarMedia);
- mediaControl.setMax(Objects.requireNonNull(audioManager).getStreamMaxVolume(AudioManager.STREAM_MUSIC));
- mediaControl.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_MUSIC));
- mediaControl.setOnSeekBarChangeListener(this);
-
- ringerControl = mFloatingWidgetView.findViewById(R.id.SeekBarRinger);
- ringerControl.setMax(audioManager.getStreamMaxVolume(AudioManager.STREAM_RING));
- ringerControl.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_RING));
- ringerControl.setOnSeekBarChangeListener(this);
-
- alarmControl = mFloatingWidgetView.findViewById(R.id.SeekBarAlarm);
- alarmControl.setMax(audioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM));
- alarmControl.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_ALARM));
- alarmControl.setOnSeekBarChangeListener(this);
-
- LinearLayout linearLayoutInCall = mFloatingWidgetView.findViewById(R.id.linearLayoutVoiceCall);
- TextView textViewInCall = mFloatingWidgetView.findViewById(R.id.textViewVoiceCall);
- if (audioManager.getMode() == AudioManager.MODE_IN_CALL) {
- linearLayoutInCall.setVisibility(View.VISIBLE);
- textViewInCall.setVisibility(View.VISIBLE);
- voiceCallControl = mFloatingWidgetView.findViewById(R.id.SeekBarVoiceCall);
- voiceCallControl.setMax(audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL));
- voiceCallControl.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL));
- voiceCallControl.setOnSeekBarChangeListener(this);
+ if (seekbarSelections.contains("1")) {
+ mediaControl = mFloatingWidgetView.findViewById(R.id.SeekBarMedia);
+ mediaControl.setMax(Objects.requireNonNull(audioManager).getStreamMaxVolume(AudioManager.STREAM_MUSIC));
+ mediaControl.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_MUSIC));
+ mediaControl.setOnSeekBarChangeListener(this);
+ mAudioVolumeObserverMedia = new AudioVolumeObserver(this);
+ mAudioVolumeObserverMedia.register(AudioManager.STREAM_MUSIC, this);
+ } else {
+ mFloatingWidgetView.findViewById(R.id.textViewMedia).setVisibility(View.GONE);
+ mFloatingWidgetView.findViewById(R.id.linearLayoutMedia).setVisibility(View.GONE);
+ }
+
+ if (seekbarSelections.contains("2")) {
+ ringerControl = mFloatingWidgetView.findViewById(R.id.SeekBarRinger);
+ ringerControl.setMax(audioManager.getStreamMaxVolume(AudioManager.STREAM_RING));
+ ringerControl.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_RING));
+ ringerControl.setOnSeekBarChangeListener(this);
+ mAudioVolumeObserverRinger = new AudioVolumeObserver(this);
+ mAudioVolumeObserverRinger.register(AudioManager.STREAM_RING, this);
+ } else {
+ mFloatingWidgetView.findViewById(R.id.textViewRinger).setVisibility(View.GONE);
+ mFloatingWidgetView.findViewById(R.id.linearLayoutRinger).setVisibility(View.GONE);
+ }
+
+ if (seekbarSelections.contains("3")) {
+ alarmControl = mFloatingWidgetView.findViewById(R.id.SeekBarAlarm);
+ alarmControl.setMax(audioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM));
+ alarmControl.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_ALARM));
+ alarmControl.setOnSeekBarChangeListener(this);
+ mAudioVolumeObserverAlarm = new AudioVolumeObserver(this);
+ mAudioVolumeObserverAlarm.register(AudioManager.STREAM_ALARM, this);
} else {
- linearLayoutInCall.setVisibility(View.GONE);
- textViewInCall.setVisibility(View.GONE);
+ mFloatingWidgetView.findViewById(R.id.textViewAlarm).setVisibility(View.GONE);
+ mFloatingWidgetView.findViewById(R.id.linearLayoutAlarm).setVisibility(View.GONE);
+ }
+
+ if (seekbarSelections.contains("4")) {
+ mAudioVolumeObserverVoiceCall = new AudioVolumeObserver(this);
+ mAudioVolumeObserverVoiceCall.register(AudioManager.STREAM_VOICE_CALL, this);
+ if (audioManager.getMode() == AudioManager.MODE_IN_CALL) {
+ mFloatingWidgetView.findViewById(R.id.linearLayoutVoiceCall).setVisibility(View.VISIBLE);
+ mFloatingWidgetView.findViewById(R.id.textViewVoiceCall).setVisibility(View.VISIBLE);
+ voiceCallControl = mFloatingWidgetView.findViewById(R.id.SeekBarVoiceCall);
+ voiceCallControl.setMax(audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL));
+ voiceCallControl.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL));
+ voiceCallControl.setOnSeekBarChangeListener(this);
+ } else {
+ mFloatingWidgetView.findViewById(R.id.linearLayoutVoiceCall).setVisibility(View.GONE);
+ mFloatingWidgetView.findViewById(R.id.textViewVoiceCall).setVisibility(View.GONE);
+ }
}
change_ringer_mode = mFloatingWidgetView.findViewById(R.id.imageViewModeSwitch);
@@ -347,10 +357,18 @@ public void onClick(View v) {
case R.id.close_expanded_view:
removeExpandedView();
iconView.setVisibility(View.VISIBLE);
- mAudioVolumeObserverRinger.unregister();
- mAudioVolumeObserverMedia.unregister();
- mAudioVolumeObserverVoiceCall.unregister();
- mAudioVolumeObserverAlarm.unregister();
+ if (seekbarSelections.contains("1")) {
+ mAudioVolumeObserverMedia.unregister();
+ }
+ if (seekbarSelections.contains("2")) {
+ mAudioVolumeObserverRinger.unregister();
+ }
+ if (seekbarSelections.contains("3")) {
+ mAudioVolumeObserverAlarm.unregister();
+ }
+ if (seekbarSelections.contains("4")) {
+ mAudioVolumeObserverVoiceCall.unregister();
+ }
unregisterReceiver(RingerModeReceiver);
break;
case R.id.imageViewModeSwitch:
@@ -368,8 +386,8 @@ public void onFinishFloatingView() {
public void onTouchFinished(boolean isFinishing, int x, int y) {
if (!isFinishing) {
editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
- editor.putInt(PREF_KEY_LAST_POSITION_X, x);
- editor.putInt(PREF_KEY_LAST_POSITION_Y, y);
+ editor.putInt(Constants.PREF_KEY_LAST_POSITION_X, x);
+ editor.putInt(Constants.PREF_KEY_LAST_POSITION_Y, y);
editor.apply();
}
}
@@ -410,14 +428,16 @@ private FloatingViewManager.Options loadOptions(DisplayMetrics metrics) {
if (isUseLastPosition) {
final int defaultX = options.floatingViewX;
final int defaultY = options.floatingViewY;
- options.floatingViewX = sharedPref.getInt(PREF_KEY_LAST_POSITION_X, defaultX);
- options.floatingViewY = sharedPref.getInt(PREF_KEY_LAST_POSITION_Y, defaultY);
+ options.floatingViewX = sharedPref.getInt(Constants.PREF_KEY_LAST_POSITION_X, defaultX);
+ options.floatingViewY = sharedPref.getInt(Constants.PREF_KEY_LAST_POSITION_Y, defaultY);
} else {
int height = metrics.heightPixels;
options.floatingViewX = metrics.widthPixels;
options.floatingViewY = height - (height / 2);
}
+ options.moveDirection=FloatingViewManager.MOVE_DIRECTION_NONE;
+
return options;
}
@@ -475,8 +495,8 @@ else if (y_cord_Destination + (mFloatingWidgetView.getHeight() + barHeight) > sz
mWindowManager.updateViewLayout(mFloatingWidgetView, layoutParams);
editor = PreferenceManager.getDefaultSharedPreferences(context).edit();
- editor.putInt(PREF_KEY_LAST_POSITION_X_EXPANDED, layoutParams.x);
- editor.putInt(PREF_KEY_LAST_POSITION_Y_EXPANDED, layoutParams.y);
+ editor.putInt(Constants.PREF_KEY_LAST_POSITION_X_EXPANDED, layoutParams.x);
+ editor.putInt(Constants.PREF_KEY_LAST_POSITION_Y_EXPANDED, layoutParams.y);
editor.apply();
return true;
}
@@ -549,22 +569,35 @@ private double bounceValue(long step, long scale) {
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
- getWindowManagerDefaultDisplay();
+ if (mFloatingWidgetView != null) {
+ getWindowManagerDefaultDisplay();
- WindowManager.LayoutParams layoutParams = (WindowManager.LayoutParams) mFloatingWidgetView.getLayoutParams();
+ WindowManager.LayoutParams layoutParams = (WindowManager.LayoutParams) mFloatingWidgetView.getLayoutParams();
- if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
- if (layoutParams.y + (mFloatingWidgetView.getHeight() + getStatusBarHeight()) > szWindow.y) {
- layoutParams.y = szWindow.y - (mFloatingWidgetView.getHeight() + getStatusBarHeight());
- mWindowManager.updateViewLayout(mFloatingWidgetView, layoutParams);
+ if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
+ if (layoutParams.y + (mFloatingWidgetView.getHeight() + getStatusBarHeight()) > szWindow.y) {
+ layoutParams.y = szWindow.y - (mFloatingWidgetView.getHeight() + getStatusBarHeight());
+ mWindowManager.updateViewLayout(mFloatingWidgetView, layoutParams);
+ }
+ if (layoutParams.x != 0 && layoutParams.x < szWindow.x) resetPosition(szWindow.x);
+ } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
+ if (layoutParams.x > szWindow.x) resetPosition(szWindow.x);
}
- if (layoutParams.x != 0 && layoutParams.x < szWindow.x) resetPosition(szWindow.x);
- } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
- if (layoutParams.x > szWindow.x) resetPosition(szWindow.x);
}
}
private void getWindowManagerDefaultDisplay() {
mWindowManager.getDefaultDisplay().getSize(szWindow);
}
+
+ private int getDialogLayout() {
+ try {
+ if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(Constants.USE_SLIM_DIALOG, false))
+ return R.layout.floating_layout_slim;
+ } catch (Exception e) {
+ e.printStackTrace();
+
+ }
+ return R.layout.floating_layout;
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/android/mycax/floatingvolume/utils/Constants.java b/app/src/main/java/com/android/mycax/floatingvolume/utils/Constants.java
new file mode 100644
index 0000000..eed28a6
--- /dev/null
+++ b/app/src/main/java/com/android/mycax/floatingvolume/utils/Constants.java
@@ -0,0 +1,14 @@
+package com.android.mycax.floatingvolume.utils;
+
+public interface Constants {
+ String PREF_KEY_LAST_POSITION_X = "last_position_x";
+ String PREF_KEY_LAST_POSITION_Y = "last_position_y";
+ String PREF_KEY_LAST_POSITION_X_EXPANDED = "last_position_x_expanded";
+ String PREF_KEY_LAST_POSITION_Y_EXPANDED = "last_position_y_expanded";
+ String USE_SLIM_DIALOG = "use_slim_dialog";
+ String PREF_ENABLE_DARK_MODE = "enable_dark_mode_switch";
+ String PREF_ENABLE_BOUNCE = "enable_bounce_effect";
+ String PREF_DISABLE_FIXED_UI = "disable_fixed_ui";
+ int OVERLAY_PERMISSION_REQUEST = 1;
+ int NOTIFICATION_POLICY_PERMISSION_REQUEST = 2;
+}
diff --git a/app/src/main/res/drawable/ic_slim_dialog_black_24dp.xml b/app/src/main/res/drawable/ic_slim_dialog_black_24dp.xml
new file mode 100644
index 0000000..380e4b3
--- /dev/null
+++ b/app/src/main/res/drawable/ic_slim_dialog_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_slim_dialog_white_24dp.xml b/app/src/main/res/drawable/ic_slim_dialog_white_24dp.xml
new file mode 100644
index 0000000..ce0abd2
--- /dev/null
+++ b/app/src/main/res/drawable/ic_slim_dialog_white_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index e34723a..3094822 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,17 +1,17 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/floating_layout.xml b/app/src/main/res/layout/floating_layout.xml
index fe174f2..eee29cd 100644
--- a/app/src/main/res/layout/floating_layout.xml
+++ b/app/src/main/res/layout/floating_layout.xml
@@ -179,7 +179,8 @@
app:layout_constraintStart_toEndOf="@+id/imageViewModeSwitch"
app:layout_constraintTop_toTopOf="@+id/linearLayoutAlarm"
card_view:layout_constraintBottom_toBottomOf="parent"
- tools:ignore="ContentDescription" />
+ tools:ignore="ContentDescription"
+ tools:padding="4dp" />
+ tools:ignore="ContentDescription"
+ tools:padding="4dp" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/floating_layout_slim.xml b/app/src/main/res/layout/floating_layout_slim.xml
new file mode 100644
index 0000000..9acc8d4
--- /dev/null
+++ b/app/src/main/res/layout/floating_layout_slim.xml
@@ -0,0 +1,197 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
new file mode 100644
index 0000000..18bcd9e
--- /dev/null
+++ b/app/src/main/res/values/arrays.xml
@@ -0,0 +1,21 @@
+
+
+
+ - @string/show_media_bar
+ - @string/show_ringer_bar
+ - @string/show_alarm_bar
+ - @string/show_voicecall_bar
+
+
+ - 1
+ - 2
+ - 3
+ - 4
+
+
+ - 1
+ - 2
+ - 3
+ - 4
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
index c363235..400237c 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -12,5 +12,6 @@
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 7cb2a7a..857dac1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -15,4 +15,14 @@
Enable to make volume control interface movable
Enable window bounce effect
Volume control interface will bounce off the edge when dropped
+ Show Media Bar
+ Show Ringer Bar
+ Show Alarm Bar
+ Show Voice Call Bar
+ Items to show in floating dialog
+ Select which seek bars to show in the floating dialog
+ Floating Dialog Settings
+ Use slim dialog
+ Use slim dialog with small icons nested of the default dialog
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 559292e..34ce5b7 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -14,6 +14,7 @@
- @drawable/ic_save_black_24dp
- @drawable/ic_touch_app_black_24dp
- @drawable/ic_bounce_black_24dp
+ - @drawable/ic_slim_dialog_black_24dp
+
+
+
+
+
+
diff --git a/app/src/main/res/xml/pref_main.xml b/app/src/main/res/xml/pref_main.xml
index 45d2938..b343773 100644
--- a/app/src/main/res/xml/pref_main.xml
+++ b/app/src/main/res/xml/pref_main.xml
@@ -1,23 +1,36 @@
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/app/src/test/java/com/android/mycax/floatingvolume/ExampleUnitTest.java b/app/src/test/java/com/android/mycax/floatingvolume/ExampleUnitTest.java
deleted file mode 100644
index 0d16a7c..0000000
--- a/app/src/test/java/com/android/mycax/floatingvolume/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.android.mycax.floatingvolume;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file