Skip to content

Commit

Permalink
Google, get your shit together
Browse files Browse the repository at this point in the history
  • Loading branch information
valkriaine committed Mar 2, 2024
1 parent 00f8b57 commit 0c01633
Show file tree
Hide file tree
Showing 31 changed files with 335 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

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

10 changes: 0 additions & 10 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

5 changes: 3 additions & 2 deletions .idea/gradle.xml

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

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

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

10 changes: 0 additions & 10 deletions .idea/migrations.xml

This file was deleted.

10 changes: 3 additions & 7 deletions .idea/misc.xml

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

29 changes: 14 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ plugins {
}

android {
compileSdk 34
compileSdkVersion 33
buildToolsVersion "30.0.3"
ndkVersion "21.0.6113669"

defaultConfig {
applicationId "com.factor.launcher"
minSdkVersion 22
targetSdkVersion 34
targetSdkVersion 33
versionCode 44
versionName "0.74"

Expand Down Expand Up @@ -50,9 +51,7 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}

configurations.all {
resolutionStrategy.force "org.antlr:antlr4-runtime:4.7.1"
resolutionStrategy.force "org.antlr:antlr4-tool:4.7.1"
Expand All @@ -71,13 +70,13 @@ android {


dependencies {
def room_version = "2.6.1"
def lifecycle_version = '2.7.0'
def room_version = "2.4.3"
def lifecycle_version = '2.5.1'

implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
Expand All @@ -89,16 +88,16 @@ dependencies {
implementation 'pub.devrel:easypermissions:3.0.0'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation "androidx.cardview:cardview:1.0.0"
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation "androidx.fragment:fragment-ktx:1.6.2"
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.fragment:fragment-ktx:1.6.0-alpha01"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.core:core-ktx:1.12.0"
implementation "androidx.core:core-ktx:1.8.0"
kapt "androidx.room:room-compiler:$room_version"
annotationProcessor "androidx.room:room-compiler:2.6.1"
annotationProcessor "androidx.room:room-compiler:2.5.0-alpha02"

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

// bouncy
implementation project(path: ':bouncy')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.jupiter.api.Test;
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;
Expand Down
15 changes: 5 additions & 10 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@
xmlns:tools="http://schemas.android.com/tools"
>

<!-- Devices running Android 12L (API level 32) or lower -->
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

<!-- Devices running Android 13 (API level 33) or higher -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />


<uses-permission android:name="android.permission.READ_WALLPAPER_INTERNAL"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>


<uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ private void initializeComponents()
binding.welcomeHomePager.addView(binding.notificationPage, 2);
binding.welcomeHomePager.addView(binding.finishPage, 3);

if ((ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_MEDIA_IMAGES) == PackageManager.PERMISSION_GRANTED)
| (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED))
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)
{
binding.turnOnBlurButton.setText(R.string.permission_granted);
binding.skipButton.setText(R.string.next);
Expand Down Expand Up @@ -256,23 +255,11 @@ private AlertDialog buildNotificationServiceAlertDialog()
private void toHomeScreen()
{
boolean isBlurred = AppSettingsManager.getInstance(getApplication()).getAppSettings().isBlurred();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED && isBlurred)
{
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_MEDIA_IMAGES) != PackageManager.PERMISSION_GRANTED && isBlurred)
{
AppSettingsManager.getInstance(getApplication()).getAppSettings().setBlurred(false);
AppSettingsManager.getInstance(getApplication()).updateSettings();
}
AppSettingsManager.getInstance(getApplication()).getAppSettings().setBlurred(false);
AppSettingsManager.getInstance(getApplication()).updateSettings();
}
else
{
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED && isBlurred)
{
AppSettingsManager.getInstance(getApplication()).getAppSettings().setBlurred(false);
AppSettingsManager.getInstance(getApplication()).updateSettings();
}
}

Intent intent = new Intent(getApplicationContext(), HomeActivity.class);
startActivity(intent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ public void onPageScrollStateChanged(int state) {}
char cap = '#';
if (item.getPackageName().isEmpty())
return new FastScrollItemIndicator.Text("");
if (!item.getLabelNew().isEmpty())
if (item.getLabelNew().toUpperCase().length() != 0)
cap = item.getLabelNew().toUpperCase().charAt(0);
String capString = "";
try
Expand All @@ -496,7 +496,7 @@ public void onPageScrollStateChanged(int state) {}
catch (NumberFormatException ignored)
{
// not number
if (!item.getLabelNew().isEmpty())
if (item.getLabelNew().length() != 0)
capString = "" + ChineseHelper.INSTANCE.getStringPinYin(item.getLabelNew()).toUpperCase().charAt(0);
}
return new FastScrollItemIndicator.Text(capString);
Expand Down Expand Up @@ -875,14 +875,7 @@ private void registerBroadcastReceivers(AppListManager appListManager, FragmentH
filterAppAction.addAction(Constants.BROADCAST_ACTION_RENAME);
filterAppAction.addAction(Constants.SETTINGS_CHANGED);
//filterAppAction.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
{
getContext().registerReceiver(appActionReceiver, filterAppAction, Context.RECEIVER_NOT_EXPORTED);
}
else
{
getContext().registerReceiver(appActionReceiver, filterAppAction);
}
getContext().registerReceiver(appActionReceiver, filterAppAction);

packageActionsReceiver = new PackageActionsReceiver(appListManager);
IntentFilter filterPackageAction = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
Expand All @@ -898,12 +891,7 @@ private void registerBroadcastReceivers(AppListManager appListManager, FragmentH
IntentFilter filterNotification = new IntentFilter();
filterNotification.addAction(Constants.NOTIFICATION_INTENT_ACTION_CLEAR);
filterNotification.addAction(Constants.NOTIFICATION_INTENT_ACTION_POST);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
{
getContext().registerReceiver(notificationBroadcastReceiver, filterNotification, Context.RECEIVER_NOT_EXPORTED);
}else {
getContext().registerReceiver(notificationBroadcastReceiver, filterNotification);
}
getContext().registerReceiver(notificationBroadcastReceiver, filterNotification);

if (notificationListenerIntent != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,25 +558,13 @@ else if (title.equals("Search bar color"))

private void requestStoragePermission()
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
EasyPermissions.requestPermissions
(new PermissionRequest.Builder(this, Constants.STORAGE_PERMISSION_CODE, Manifest.permission.READ_MEDIA_IMAGES)
.setRationale(R.string.storage_permission_rationale)
.setPositiveButtonText(R.string.okay)
.setNegativeButtonText(R.string.cancel)
.setTheme(R.style.DialogTheme)
.build());
}
else
{
EasyPermissions.requestPermissions
(new PermissionRequest.Builder(this, Constants.STORAGE_PERMISSION_CODE, perms)
.setRationale(R.string.storage_permission_rationale)
.setPositiveButtonText(R.string.okay)
.setNegativeButtonText(R.string.cancel)
.setTheme(R.style.DialogTheme)
.build());
}
EasyPermissions.requestPermissions
(new PermissionRequest.Builder(this, Constants.STORAGE_PERMISSION_CODE, perms)
.setRationale(R.string.storage_permission_rationale)
.setPositiveButtonText(R.string.okay)
.setNegativeButtonText(R.string.cancel)
.setTheme(R.style.DialogTheme)
.build());
}

//change UI enabled state and displayed text based on granted permissions
Expand All @@ -585,17 +573,14 @@ private void setUpUIState()
binding.notificationAccessButton.setText(isNotificationServiceEnabled() ? getString(R.string.granted) : getString(R.string.request));

if (getContext() != null)
if ((ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.READ_MEDIA_IMAGES) == PackageManager.PERMISSION_GRANTED)
| (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED))
{
if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {

binding.storageAccessButton.setText(getString(R.string.granted));
binding.blurToggleLabel.setText(R.string.blur_effect);
binding.blurToggle.setClickable(true);
binding.blurToggleBase.setOnClickListener(null);
}
else
{
else {

binding.storageAccessButton.setText(getString(R.string.request));
binding.blurToggleLabel.setText(R.string.blur_effect_missing_permission);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import android.util.TypedValue
import android.view.ViewGroup
import androidx.annotation.AttrRes
import androidx.appcompat.widget.AppCompatImageView
import android.renderscript.*
import androidx.renderscript.*
import com.factor.launcher.R
import kotlin.math.min

Expand Down Expand Up @@ -84,7 +84,7 @@ open class ElevationImageView : AppCompatImageView
invalidate()
}

override fun onDraw(canvas: Canvas)
override fun onDraw(canvas: Canvas?)
{
if (!isInEditMode && canvas != null)
{
Expand Down
Loading

0 comments on commit 0c01633

Please sign in to comment.