Skip to content
This repository was archived by the owner on Jun 20, 2021. It is now read-only.

Commit e62faaf

Browse files
Flasher: Implement own file picker, update to latest build tools and SDK version,
and related updates Signed-off-by: sunilpaulmathew <sunil.kde@gmail.com>
1 parent d60edc4 commit e62faaf

29 files changed

Lines changed: 668 additions & 720 deletions

app/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ android {
1212
}
1313

1414
compileSdkVersion 30
15-
buildToolsVersion "29.0.3"
15+
buildToolsVersion "30.0.3"
1616

1717
defaultConfig {
1818
applicationId "com.smartpack.smartflasher"
1919
minSdkVersion 23
20-
targetSdkVersion 29
20+
targetSdkVersion 30
2121
versionCode 43
2222
versionName "v5.2"
2323
vectorDrawables.useSupportLibrary = true
@@ -61,6 +61,7 @@ repositories {
6161

6262
dependencies {
6363
playImplementation 'com.android.billingclient:billing:3.0.3'
64-
implementation "com.github.topjohnwu.libsu:core:3.0.2"
65-
implementation 'com.google.android.material:material:1.4.0-alpha01'
64+
implementation 'com.github.sunilpaulmathew:RootFilePicker:v0.4'
65+
implementation "com.github.topjohnwu.libsu:core:3.1.2"
66+
implementation 'com.google.android.material:material:1.4.0-alpha02'
6667
}

app/proguard-rules.pro

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
2121
#-renamesourcefileattribute SourceFile
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
2-
<!--Author: andrey167 <andrey_167@bk.ru>-->
3-
4-
<string name="app_store_summary">Посетить страницу Smart Flasher в F-Droid</string>
5-
<string name="share_app_message">Загрузите смарт-флешер %s из F-Droid: https://f-droid.org/packages/com.smartpack.smartflasher/</string>
1+
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
2+
<!--Author: andrey167 <andrey_167@bk.ru>-->
3+
4+
<string name="app_store_summary">Посетить страницу Smart Flasher в F-Droid</string>
5+
<string name="share_app_message">Загрузите смарт-флешер %s из F-Droid: https://f-droid.org/packages/com.smartpack.smartflasher/</string>
66
</resources>

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
4-
package="com.smartpack.smartflasher" >
4+
package="com.smartpack.smartflasher">
55

66
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
7-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
7+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
8+
tools:ignore="ScopedStorage" />
89

910
<application
1011
android:allowBackup="true"
@@ -13,9 +14,7 @@
1314
android:label="@string/app_name"
1415
android:roundIcon="@mipmap/ic_launcher_round"
1516
android:supportsRtl="true"
16-
android:theme="@style/AppTheme"
17-
android:requestLegacyExternalStorage="true"
18-
tools:targetApi="q" >
17+
android:theme="@style/AppTheme" >
1918

2019
<activity android:name=".MainActivity">
2120
<intent-filter>
Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1-
/*
2-
* Copyright (C) 2020-2021 sunilpaulmathew <sunil.kde@gmail.com>
3-
*
4-
* This file is part of Smart Flasher, which is a simple app aimed to make flashing
5-
* recovery zip files much easier. Significant amount of code for this app has been from
6-
* Kernel Adiutor by Willi Ye <williye97@gmail.com>.
7-
*
8-
* Smart Flasher is a free software: you can redistribute it and/or modify it under the terms
9-
* of the GNU General Public License as published by the Free Software Foundation, either
10-
* version 3 of the License, or (at your option) any later version.
11-
*
12-
* Smart Flasher is distributed in the hope that it will be useful, but WITHOUT ANY
13-
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14-
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
15-
*
16-
* You should have received a copy of the GNU General Public License along with
17-
* Smart Flasher. If not, see <http://www.gnu.org/licenses/>.
18-
*
19-
*/
20-
21-
package com.smartpack.smartflasher.activities;
22-
23-
import android.os.Bundle;
24-
25-
import androidx.appcompat.app.AppCompatActivity;
26-
import androidx.viewpager.widget.ViewPager;
27-
28-
import com.google.android.material.tabs.TabLayout;
29-
import com.smartpack.smartflasher.R;
30-
import com.smartpack.smartflasher.fragments.CreditsFragment;
31-
import com.smartpack.smartflasher.utils.PagerAdapter;
32-
33-
/*
34-
* Created by sunilpaulmathew <sunil.kde@gmail.com> on November 21, 2020
35-
*/
36-
37-
public class CreditsActivity extends AppCompatActivity {
38-
39-
@Override
40-
protected void onCreate(Bundle savedInstanceState) {
41-
super.onCreate(savedInstanceState);
42-
setContentView(R.layout.activity_credits);
43-
44-
TabLayout mTabLayout = findViewById(R.id.tab_layout);
45-
ViewPager mViewPager = findViewById(R.id.view_pager);
46-
47-
PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager());
48-
adapter.AddFragment(new CreditsFragment(), getString(R.string.credits_summary));
49-
50-
mViewPager.setAdapter(adapter);
51-
mTabLayout.setupWithViewPager(mViewPager);
52-
}
53-
1+
/*
2+
* Copyright (C) 2020-2021 sunilpaulmathew <sunil.kde@gmail.com>
3+
*
4+
* This file is part of Smart Flasher, which is a simple app aimed to make flashing
5+
* recovery zip files much easier. Significant amount of code for this app has been from
6+
* Kernel Adiutor by Willi Ye <williye97@gmail.com>.
7+
*
8+
* Smart Flasher is a free software: you can redistribute it and/or modify it under the terms
9+
* of the GNU General Public License as published by the Free Software Foundation, either
10+
* version 3 of the License, or (at your option) any later version.
11+
*
12+
* Smart Flasher is distributed in the hope that it will be useful, but WITHOUT ANY
13+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14+
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License along with
17+
* Smart Flasher. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
*/
20+
21+
package com.smartpack.smartflasher.activities;
22+
23+
import android.os.Bundle;
24+
25+
import androidx.appcompat.app.AppCompatActivity;
26+
import androidx.viewpager.widget.ViewPager;
27+
28+
import com.google.android.material.tabs.TabLayout;
29+
import com.smartpack.smartflasher.R;
30+
import com.smartpack.smartflasher.fragments.CreditsFragment;
31+
import com.smartpack.smartflasher.utils.PagerAdapter;
32+
33+
/*
34+
* Created by sunilpaulmathew <sunil.kde@gmail.com> on November 21, 2020
35+
*/
36+
37+
public class CreditsActivity extends AppCompatActivity {
38+
39+
@Override
40+
protected void onCreate(Bundle savedInstanceState) {
41+
super.onCreate(savedInstanceState);
42+
setContentView(R.layout.activity_credits);
43+
44+
TabLayout mTabLayout = findViewById(R.id.tab_layout);
45+
ViewPager mViewPager = findViewById(R.id.view_pager);
46+
47+
PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager());
48+
adapter.AddFragment(new CreditsFragment(), getString(R.string.credits_summary));
49+
50+
mViewPager.setAdapter(adapter);
51+
mTabLayout.setupWithViewPager(mViewPager);
52+
}
53+
5454
}

app/src/main/java/com/smartpack/smartflasher/activities/FlashingActivity.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import com.smartpack.smartflasher.utils.Flasher;
3939
import com.smartpack.smartflasher.utils.Utils;
4040

41+
import java.io.File;
42+
4143
/*
4244
* Created by sunilpaulmathew <sunil.kde@gmail.com> on April 23, 2020
4345
*/
@@ -73,10 +75,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
7375
refreshStatus();
7476
mBack.setOnClickListener(v -> onBackPressed());
7577
mSave.setOnClickListener(v -> {
76-
Utils.create(Flasher.mFlashingResult.toString(), Utils.getInternalDataStorage() + "/flasher_log-" +
77-
Flasher.mZipName.replace(".zip", ""));
78-
Utils.snackbar(mSave, getString(R.string.save_log_message, Utils.getInternalDataStorage() + "/flasher_log-" +
79-
Flasher.mZipName.replace(".zip", "")));
78+
Utils.create(Flasher.mFlashingResult.toString(), new File(Utils.getStorageDir(this), "/flasher_log-" +
79+
Flasher.mZipName.replace(".zip", "")).getAbsolutePath());
80+
Utils.snackbar(mSave, getString(R.string.save_log_message, new File(Utils.getStorageDir(this), "/flasher_log-" +
81+
Flasher.mZipName.replace(".zip", "")).getAbsolutePath()));
8082
});
8183
mCancel.setOnClickListener(v -> finish());
8284
mLog.setOnClickListener(v -> {

app/src/main/java/com/smartpack/smartflasher/activities/LogViewActivity.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import com.smartpack.smartflasher.utils.Flasher;
3333
import com.smartpack.smartflasher.utils.Utils;
3434

35+
import java.io.File;
36+
3537
/*
3638
* Created by sunilpaulmathew <sunil.kde@gmail.com> on November 21, 2020
3739
*/
@@ -51,10 +53,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
5153
mLogView.setText(Flasher.mFlashingResult.toString());
5254
mBack.setOnClickListener(v -> onBackPressed());
5355
mSave.setOnClickListener(v -> {
54-
Utils.create(Flasher.mFlashingResult.toString(), Utils.getInternalDataStorage() + "/flasher_log-" +
55-
Flasher.mZipName.replace(".zip", ""));
56-
Utils.snackbar(mSave, getString(R.string.save_log_message, Utils.getInternalDataStorage() + "/flasher_log-" +
57-
Flasher.mZipName.replace(".zip", "")));
56+
Utils.create(Flasher.mFlashingResult.toString(), new File(Utils.getStorageDir(this), "/flasher_log-" +
57+
Flasher.mZipName.replace(".zip", "")).getAbsolutePath());
58+
Utils.snackbar(mSave, getString(R.string.save_log_message, new File(Utils.getStorageDir(this), "/flasher_log-" +
59+
Flasher.mZipName.replace(".zip", "")).getAbsolutePath()));
5860
});
5961
mCancel.setOnClickListener(v -> onBackPressed());
6062
}

app/src/main/java/com/smartpack/smartflasher/activities/UpdateChannelActivity.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.json.JSONException;
4141
import org.json.JSONObject;
4242

43+
import java.io.File;
4344
import java.util.Objects;
4445

4546
/*
@@ -129,7 +130,7 @@ private void saveUpdateChannel() {
129130
if (text.contains(" ")) {
130131
text = text.replace(" ", "_");
131132
}
132-
if (Utils.exist(Utils.getInternalDataStorage() + "/" + text)) {
133+
if (Utils.exist(new File(Utils.getStorageDir(this), text).getAbsolutePath())) {
133134
Utils.snackbar(mCardView, getString(R.string.already_exists, text));
134135
return;
135136
}
@@ -146,10 +147,10 @@ private void saveUpdateChannel() {
146147
support.put("link", mSupportHint.getText());
147148
support.put("donation", mDonationHint.getText());
148149
obj.put("support", support);
149-
Flasher.prepareFolder(Utils.getInternalDataStorage() + "/flash");
150-
Utils.create(obj.toString(), Utils.getInternalDataStorage() + "/" + text);
150+
Flasher.prepareFolder(Utils.getStorageDir(this).getAbsolutePath());
151+
Utils.create(obj.toString(), new File(Utils.getStorageDir(this), text).getAbsolutePath());
151152
Utils.snackbar(mCardView, getString(R.string.update_channel_create_success,
152-
Utils.getInternalDataStorage() + "/" + text));
153+
new File(Utils.getStorageDir(this), text).getAbsolutePath()));
153154
} catch (JSONException ignored) {
154155
}
155156
}, this).setOnDismissListener(dialogInterface -> {

0 commit comments

Comments
 (0)