Update Gradle to 8.9.3, Sdk to 35, Java to 17 and Fix
This commit is contained in:
@ -1,12 +1,11 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
|
||||
compileSdk 35
|
||||
defaultConfig {
|
||||
applicationId "com.localtransfer"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 30
|
||||
minSdkVersion 27
|
||||
targetSdkVersion 35
|
||||
versionCode 1
|
||||
versionName "2.0"
|
||||
|
||||
@ -20,22 +19,20 @@ android {
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
namespace 'com.localtransfer'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.appcompat:appcompat:1.7.1'
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
implementation 'androidx.preference:preference:1.2.1'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
testImplementation 'junit:junit:4.13.1'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
implementation 'lib.kashif:folderpicker:2.4'
|
||||
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.localtransfer;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.localtransfer", appContext.getPackageName());
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.localtransfer">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
@ -20,7 +20,7 @@
|
||||
<service
|
||||
android:name=".TransferService"
|
||||
android:enabled="true"
|
||||
android:exported="true"></service>
|
||||
android:exported="true" />
|
||||
<!-- android:usesCleartextTraffic="true" -->
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
@ -34,9 +34,10 @@
|
||||
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:label="@string/title_activity_settings"></activity>
|
||||
android:label="@string/title_activity_settings" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
|
@ -72,7 +72,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
Transfer.resolver = this.getContentResolver();
|
||||
|
||||
Intent notificationIntent = new Intent(this, MainActivity.class);
|
||||
Transfer.pendingIntent = PendingIntent.getActivity(this,0, notificationIntent, 0);
|
||||
Transfer.pendingIntent = PendingIntent.getActivity(this,0, notificationIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
@ -244,6 +244,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
public void onRequestPermissionsResult(int requestCode,
|
||||
String permissions[],
|
||||
int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
switch (requestCode) {
|
||||
case REQUEST_ID_READ_EXTERNAL_STORAGE:
|
||||
if (grantResults.length > 0 &&
|
||||
|
@ -19,8 +19,6 @@ import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import lib.folderpicker.FolderPicker;
|
||||
|
||||
public class SettingsActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
@ -76,7 +74,8 @@ public class SettingsActivity extends AppCompatActivity {
|
||||
directory.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Intent intent = new Intent(getContext(), FolderPicker.class);
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
startActivityForResult(intent, REQUEST_DIRECTORY_PICKER);
|
||||
return false;
|
||||
}
|
||||
|
@ -2,12 +2,14 @@ package com.localtransfer;
|
||||
|
||||
import static java.lang.Integer.valueOf;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@ -18,6 +20,7 @@ import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
@ -202,6 +205,16 @@ public class Transfer {
|
||||
.setContentText(String.format("%d%% %s/%s", percent, loadedSI, sizeSI))
|
||||
.setProgress(100, (int) percent, false)
|
||||
.setContentIntent(pendingIntent);
|
||||
if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
|
||||
// TODO: Consider calling
|
||||
// ActivityCompat#requestPermissions
|
||||
// here to request the missing permissions, and then overriding
|
||||
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||
// int[] grantResults)
|
||||
// to handle the case where the user grants the permission. See the documentation
|
||||
// for ActivityCompat#requestPermissions for more details.
|
||||
return;
|
||||
}
|
||||
notifiManager.notify(Transfer.NOTIF_SERVICE, notifBuilder.build());
|
||||
|
||||
if (app_started && fragment_on)
|
||||
|
@ -23,11 +23,11 @@
|
||||
<!-- Server Preferences -->
|
||||
<string name="server_host">Host</string>
|
||||
<string name="server_protocol">Use secure https</string>
|
||||
<string name="server_host_def">www.netdldata.net</string>
|
||||
<string name="server_host_def">transfer.netdldata.net</string>
|
||||
<string name="server_port">Port</string>
|
||||
<string name="server_port_def"></string>
|
||||
<string name="server_root">Root</string>
|
||||
<string name="server_root_def">/transfer</string>
|
||||
<string name="server_root_def">/php</string>
|
||||
|
||||
<!-- Local Preferences -->
|
||||
<string name="use_shared_storage">Use shared storage</string>
|
||||
|
@ -1,17 +0,0 @@
|
||||
package com.localtransfer;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user