Skip to content

Commit

Permalink
Merge pull request #1 from Qutayba-Khader/master
Browse files Browse the repository at this point in the history
fix for untouchable bubble issue.
+Other fixes and improvements
  • Loading branch information
Adam Myczkowski (mycax) authored Apr 30, 2018
2 parents d0784b8 + 1102f89 commit 3ed7e42
Show file tree
Hide file tree
Showing 17 changed files with 486 additions and 143 deletions.
4 changes: 2 additions & 2 deletions .idea/assetWizardSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
64 changes: 52 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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);
}

Expand All @@ -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;
}
Expand All @@ -99,22 +95,22 @@ 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);
}
}
}

@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 {
Expand Down
Loading

0 comments on commit 3ed7e42

Please sign in to comment.