Compare commits

...

41 commits

Author SHA1 Message Date
Boris Timofeev
5531a55fea version bump to 0.15 2017-12-07 12:52:03 +03:00
Boris Timofeev
0369c6e85a added Chinese and Portuguese translations
Thanks to Nabarl Wang, Davi Lopes, Matheus Silva Sales, Jhonatan Cardoso
2017-12-07 12:11:41 +03:00
Boris Timofeev
faaee235a2 update sdk and libs 2017-12-01 00:20:03 +03:00
Boris Timofeev
af8216dd05 update faq 2017-09-27 18:57:46 +03:00
Boris Timofeev
5cd83abcfc Merge branch 'master' of github.com:btimofeev/UniPatcher 2017-09-27 18:47:20 +03:00
Boris Timofeev
c0c26e59ad Merge pull request #14 from comradekingu/patch-5
General rework
2017-09-26 12:23:23 +03:00
Allan Nordhøy
beb6ed9404 General rework 2017-09-26 11:08:00 +02:00
Boris Timofeev
2cc0e0585d update faq 2017-09-08 10:17:02 +03:00
Boris Timofeev
512f23e680 update faq 2017-09-06 12:33:12 +03:00
Boris Timofeev
655e0954fa update changelog 2017-09-02 13:16:35 +03:00
Boris Timofeev
a959211176 fix crash on Android O 2017-09-02 12:36:13 +03:00
Boris Timofeev
f61cfb5121 vector icons 2017-09-02 12:33:27 +03:00
Boris Timofeev
0cab3fa8b5 placed content in the center of the screen on tablets 2017-09-01 23:25:59 +03:00
Boris Timofeev
550b14896e support startForegroundService from Android O 2017-09-01 18:27:07 +03:00
Boris Timofeev
3f56868998 support notification channels from Android O 2017-09-01 18:12:07 +03:00
Boris Timofeev
70db06eebc update libs and target SDK version to 26 2017-09-01 11:34:11 +03:00
Boris Timofeev
9ec29e3936 added donate snackbar 2017-08-31 16:39:26 +03:00
Boris Timofeev
6fea1b7b8e Globals class was deleted and its contents moved to UniPatcher class 2017-08-31 11:55:39 +03:00
Boris Timofeev
3e2f57dbd7 actions are moved to a separate class 2017-08-31 11:14:13 +03:00
Boris Timofeev
b267f87a99 Merge pull request #13 from comradekingu/patch-4
Specifying free
2017-08-31 08:48:05 +03:00
Boris Timofeev
e6b3dc1331 Merge pull request #12 from comradekingu/patch-3
"Gratis", and new Genesis checksum text
2017-08-31 08:41:31 +03:00
Boris Timofeev
8852b80907 Merge pull request #11 from comradekingu/patch-2
Spelling: July
2017-08-31 08:38:33 +03:00
Allan Nordhøy
a22d786f93 Specifying free 2017-08-31 06:16:29 +02:00
Allan Nordhøy
2c4512e775 "Gratis", and new Genesis checksum text 2017-08-31 06:13:28 +02:00
Allan Nordhøy
b9f9c30009 Spelling: July 2017-08-31 06:07:21 +02:00
Boris Timofeev
b460e3b0a6 removed unnecessary files (array.xml) 2017-08-26 15:04:30 +03:00
Boris Timofeev
c0bdd147cd removed support for all ABI except armeabi-v7a and x86 2017-08-26 14:44:35 +03:00
Boris Timofeev
b1705b3e7d removed version code variables (to support automatic assembly in f-droid) 2017-08-26 14:01:33 +03:00
Boris Timofeev
f137b4950f change license of material design icons by google 2017-08-26 13:52:26 +03:00
Boris Timofeev
e055a65d28 version bump to 0.14.2 2017-07-13 09:30:33 +03:00
Boris Timofeev
c1192dd20d fix typo 2017-07-07 12:10:23 +03:00
Boris Timofeev
c6869d01ba returned a string to the readme 2017-07-07 12:09:01 +03:00
Boris Timofeev
6b27827d4f Merge pull request #9 from comradekingu/patch-1
Clarification of intent
2017-07-07 12:03:46 +03:00
Boris Timofeev
e6174550ab fetch strings from Transifex && update Ukrainian 2017-07-07 12:03:44 +03:00
Boris Timofeev
a36c4ac1c7 added Korean translation
Thanks to Minseo Lee
2017-07-07 11:17:29 +03:00
Boris Timofeev
c3b0d595d1 update libs 2017-07-07 11:08:40 +03:00
Allan Nordhøy
7d9fd3017d Clarification of intent 2017-06-05 12:46:17 +02:00
Boris Timofeev
1cb040b216 Merge branch 'f-droid' 2017-05-31 20:28:27 +03:00
Boris Timofeev
18fe8fe8b1 update japanese translation 2017-05-25 22:05:05 +03:00
Boris Timofeev
9192fb975a set android:extractNativeLibs to true
it should fixes an F-Droid build issue
2017-05-23 23:44:38 +03:00
Boris Timofeev
9051da11d3 added f-droid badge 2017-04-04 12:22:26 +03:00
196 changed files with 2511 additions and 529 deletions

View file

@ -1,6 +1,6 @@
[main] [main]
host = https://www.transifex.com host = https://www.transifex.com
lang_map = he: iw, zh_TW: zh-rTW, es_MX: es-rMX, pt_BR: pt-rBR, nb_NO: nb-rNO lang_map = he: iw, zh_CN: zh-rCN, zh_TW: zh-rTW, es_MX: es-rMX, pt_BR: pt-rBR, nb_NO: nb-rNO
[unipatcher.strings_xml] [unipatcher.strings_xml]
file_filter = app/src/main/res/values-<lang>/strings.xml file_filter = app/src/main/res/values-<lang>/strings.xml

View file

@ -18,18 +18,20 @@ UniPatcher is a ROM patcher for Android that supports IPS, IPS32, UPS, BPS, APS
### Install UniPatcher: ### Install UniPatcher:
[<img src="/google-play/badges/google-play.png" width="220">](https://play.google.com/store/apps/details?id=org.emunix.unipatcher) [<img src="/google-play/badges/amazon.png" width="220">](http://www.amazon.com/gp/mas/dl/android?p=org.emunix.unipatcher) [<img src="/google-play/badges/slideme.png" width="220">](http://slideme.org/application/unipatcher) [<img src="/google-play/badges/google-play.png" alt="Get it on Google Play" width="220">](https://play.google.com/store/apps/details?id=org.emunix.unipatcher) [<img src="/google-play/badges/f-droid.png" alt="Get it on F-Droid" width="220">](https://f-droid.org/app/org.emunix.unipatcher)
[<img src="/google-play/badges/amazon.png" alt="Get it on Amazon" width="220">](http://www.amazon.com/gp/mas/dl/android?p=org.emunix.unipatcher) [<img src="/google-play/badges/slideme.png" alt="Get it on SlideMe" width="220">](http://slideme.org/application/unipatcher)
[... or get a Release APK here on GitHub](https://github.com/btimofeev/UniPatcher/releases) [... or get a Release APK here on GitHub](https://github.com/btimofeev/UniPatcher/releases)
### How to contribute to UniPatcher: ### Contribute:
#### Report a bug or suggest a new feature #### Report a bug or suggest features
Bugs and new features are being discussed on the GitHub [Issue Tracker](https://github.com/btimofeev/UniPatcher/issues). These are discussed on the GitHub [Issue Tracker](https://github.com/btimofeev/UniPatcher/issues).
#### Help with translations #### Translations
If you want to translate UniPatcher into another language, you can visit the [Transifex project page](https://www.transifex.com/unipatcher/unipatcher/). Help translate UniPatcher into another language on the [Transifex project page](https://www.transifex.com/unipatcher/unipatcher/).
### License ### License
UniPatcher is licensed under the GPL version 3. You can find the license text in the COPYING file. UniPatcher is licensed under the GPL version 3. You can find the license text in the COPYING file.

View file

@ -1,13 +1,8 @@
def versionMajor = 0
def versionMinor = 14
def versionPatch = 1
def versionBuild = 0
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 25 compileSdkVersion 27
buildToolsVersion '25.0.2' buildToolsVersion '27.0.1'
signingConfigs { signingConfigs {
release release
@ -16,11 +11,12 @@ android {
defaultConfig { defaultConfig {
applicationId "org.emunix.unipatcher" applicationId "org.emunix.unipatcher"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 25 targetSdkVersion 27
versionCode versionMajor * 1000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild versionCode 150000
versionName "${versionMajor}.${versionMinor}.${versionPatch}" versionName "0.15"
vectorDrawables.useSupportLibrary = true
ndk { ndk {
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64', 'mips64', 'mips' abiFilters 'armeabi-v7a', 'x86'
} }
externalNativeBuild { externalNativeBuild {
cmake { cmake {
@ -39,6 +35,8 @@ android {
} }
} }
flavorDimensions "default"
productFlavors { productFlavors {
free { free {
buildConfigField "String", "RATE_URL", "\"https://github.com/btimofeev/UniPatcher\"" buildConfigField "String", "RATE_URL", "\"https://github.com/btimofeev/UniPatcher\""
@ -111,18 +109,18 @@ if (propFile.canRead()) {
dependencies { dependencies {
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.7.14' testCompile 'org.mockito:mockito-core:2.12.0'
compile fileTree(dir: 'libs', include: ['*.jar']) compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:25.3.1' compile 'com.android.support:support-v4:27.0.2'
compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:cardview-v7:25.3.1' compile 'com.android.support:cardview-v7:27.0.2'
compile 'com.android.support:preference-v14:25.3.1' compile 'com.android.support:preference-v14:27.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1' compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.android.support:design:25.3.1' compile 'com.android.support:design:27.0.2'
compile 'com.android.support:support-v13:25.3.1' // used in material-dialogs compile 'com.android.support:support-v13:27.0.2' // used in material-dialogs
compile 'commons-io:commons-io:2.5' compile 'commons-io:commons-io:2.5'
compile 'org.sufficientlysecure:donations:2.5' compile 'org.sufficientlysecure:donations:2.5'
compile 'org.sufficientlysecure:html-textview:3.3' compile 'org.sufficientlysecure:html-textview:3.5'
compile 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.1' compile 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.1'
compile 'com.afollestad.material-dialogs:core:0.9.4.4' compile 'com.afollestad.material-dialogs:core:0.9.6.0'
} }

View file

@ -8,8 +8,9 @@
<uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.WAKE_LOCK"/>
<application <application
android:name=".UniPatcher"
android:allowBackup="false" android:allowBackup="false"
android:extractNativeLibs="false" android:extractNativeLibs="true"
android:fullBackupContent="false" android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
@ -70,4 +71,4 @@
</application> </application>
</manifest> </manifest>

View file

@ -0,0 +1,35 @@
/*
Copyright (c) 2017 Boris Timofeev
This file is part of UniPatcher.
UniPatcher is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
UniPatcher is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with UniPatcher. If not, see <http://www.gnu.org/licenses/>.
*/
package org.emunix.unipatcher;
public class Action {
public static final int SELECT_ROM_FILE = 1;
public static final int SELECT_PATCH_FILE = 2;
public static final int SELECT_SOURCE_FILE = 3;
public static final int SELECT_MODIFIED_FILE = 4;
public static final int SELECT_HEADER_FILE = 5;
public static final int APPLY_PATCH = 101;
public static final int CREATE_PATCH = 102;
public static final int SMD_FIX_CHECKSUM = 103;
public static final int SNES_ADD_SMC_HEADER = 104;
public static final int SNES_DELETE_SMC_HEADER = 105;
}

View file

@ -1,38 +0,0 @@
/*
Copyright (C) 2013-2017 Boris Timofeev
This file is part of UniPatcher.
UniPatcher is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
UniPatcher is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with UniPatcher. If not, see <http://www.gnu.org/licenses/>.
*/
package org.emunix.unipatcher;
public class Globals {
private static String cmdArgument = null;
public static String getCmdArgument() {
return cmdArgument;
}
public static void setCmdArgument(String cmdArgument) {
Globals.cmdArgument = cmdArgument;
}
public static final int ACTION_PATCHING = 1;
public static final int ACTION_CREATE_PATCH = 2;
public static final int ACTION_SMD_FIX_CHECKSUM = 3;
public static final int ACTION_SNES_ADD_SMC_HEADER = 4;
public static final int ACTION_SNES_DELETE_SMC_HEADER = 5;
}

View file

@ -74,4 +74,28 @@ public class Settings {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
return prefs.getBoolean("ignore_checksum", false); return prefs.getBoolean("ignore_checksum", false);
} }
public static void setPatchingSuccessful(Context context, Boolean isSuccessful) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean("patching_successful", isSuccessful);
editor.apply();
}
public static boolean getPatchingSuccessful(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
return prefs.getBoolean("patching_successful", false);
}
public static void setDontShowDonateSnackbarCount(Context context, int count) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt("dont_show_donate_snackbar", count);
editor.apply();
}
public static int getDontShowDonateSnackbarCount(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
return prefs.getInt("dont_show_donate_snackbar", 0);
}
} }

View file

@ -0,0 +1,57 @@
/*
Copyright (c) 2017 Boris Timofeev
This file is part of UniPatcher.
UniPatcher is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
UniPatcher is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with UniPatcher. If not, see <http://www.gnu.org/licenses/>.
*/
package org.emunix.unipatcher;
import android.app.Application;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Build;
public class UniPatcher extends Application {
private static String appArgument = null;
public static final String NOTIFICATION_CHANNEL_ID = "notifications";
@Override
public void onCreate() {
super.onCreate();
initNotificationChannel();
}
public static String getAppArgument() {
return appArgument;
}
public static void setAppArgument(String appArgument) {
UniPatcher.appArgument = appArgument;
}
public void initNotificationChannel() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
return;
}
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID,
getString(R.string.notification_channel_name),
NotificationManager.IMPORTANCE_DEFAULT);
manager.createNotificationChannel(channel);
}
}

View file

@ -22,6 +22,7 @@ package org.emunix.unipatcher;
import android.Manifest; import android.Manifest;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Build; import android.os.Build;
@ -48,6 +49,14 @@ public class Utils {
private static final int BUFFER_SIZE = 10240; // 10 Kb private static final int BUFFER_SIZE = 10240; // 10 Kb
public static void startForegroundService(Context context, Intent intent) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
context.startService(intent);
} else {
context.startForegroundService(intent);
}
}
public static String getAppVersion(Context context) { public static String getAppVersion(Context context) {
String versionName = "N/A"; String versionName = "N/A";
try { try {

View file

@ -24,6 +24,7 @@ import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import android.os.PowerManager; import android.os.PowerManager;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
@ -75,19 +76,19 @@ public class WorkerService extends IntentService {
try { try {
int action = intent.getIntExtra("action", 0); int action = intent.getIntExtra("action", 0);
switch (action) { switch (action) {
case Globals.ACTION_PATCHING: case Action.APPLY_PATCH:
actionPatching(intent); actionPatching(intent);
break; break;
case Globals.ACTION_CREATE_PATCH: case Action.CREATE_PATCH:
actionCreatePatch(intent); actionCreatePatch(intent);
break; break;
case Globals.ACTION_SMD_FIX_CHECKSUM: case Action.SMD_FIX_CHECKSUM:
actionSmdFixChecksum(intent); actionSmdFixChecksum(intent);
break; break;
case Globals.ACTION_SNES_ADD_SMC_HEADER: case Action.SNES_ADD_SMC_HEADER:
actionSnesAddSmcHeader(intent); actionSnesAddSmcHeader(intent);
break; break;
case Globals.ACTION_SNES_DELETE_SMC_HEADER: case Action.SNES_DELETE_SMC_HEADER:
actionSnesDeleteSmcHeader(intent); actionSnesDeleteSmcHeader(intent);
break; break;
} }
@ -150,19 +151,19 @@ public class WorkerService extends IntentService {
else else
errorMsg = getString(R.string.notify_error_unknown_patch_format); errorMsg = getString(R.string.notify_error_unknown_patch_format);
Notify notify = new PatchingNotify(this, outputFile.getName());
if (errorMsg != null) { if (errorMsg != null) {
notify.showResult(errorMsg); showErrorNotification(errorMsg);
return; return;
} }
Notify notify = new PatchingNotify(this, outputFile.getName());
startForeground(notify.getID(), notify.getNotifyBuilder().build()); startForeground(notify.getID(), notify.getNotifyBuilder().build());
try { try {
if ("ppf".equals(ext)) if ("ppf".equals(ext))
Utils.copyFile(this, romFile, outputFile); Utils.copyFile(this, romFile, outputFile);
patcher.apply(Settings.getIgnoreChecksum(this)); patcher.apply(Settings.getIgnoreChecksum(this));
Settings.setPatchingSuccessful(this, true);
} catch (PatchException | IOException e) { } catch (PatchException | IOException e) {
if (Utils.getFreeSpace(outputFile.getParentFile()) == 0) { if (Utils.getFreeSpace(outputFile.getParentFile()) == 0) {
errorMsg = getString(R.string.notify_error_not_enough_space); errorMsg = getString(R.string.notify_error_not_enough_space);
@ -219,6 +220,7 @@ public class WorkerService extends IntentService {
try { try {
patcher.create(); patcher.create();
Settings.setPatchingSuccessful(this, true);
} catch (PatchException | IOException e) { } catch (PatchException | IOException e) {
if (Utils.getFreeSpace(patchFile.getParentFile()) == 0) { if (Utils.getFreeSpace(patchFile.getParentFile()) == 0) {
errorMsg = getString(R.string.notify_error_not_enough_space); errorMsg = getString(R.string.notify_error_not_enough_space);
@ -324,15 +326,21 @@ public class WorkerService extends IntentService {
private void showErrorNotification(String text) { private void showErrorNotification(String text) {
Intent notificationIntent = new Intent(this, MainActivity.class); Intent notificationIntent = new Intent(this, MainActivity.class);
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification notify = new NotificationCompat.Builder(this) Notification notify = new NotificationCompat.Builder(this, UniPatcher.NOTIFICATION_CHANNEL_ID)
.setContentTitle(getString(R.string.notify_error)) .setContentTitle(getString(R.string.notify_error))
.setContentText(text) .setContentText(text)
.setSmallIcon(R.drawable.ic_stat_patching) .setSmallIcon(R.drawable.ic_gamepad_variant_white_24dp)
.setContentIntent(PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT)) .setContentIntent(PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT))
.setAutoCancel(true) .setAutoCancel(true)
.setStyle(new NotificationCompat.BigTextStyle() .setStyle(new NotificationCompat.BigTextStyle()
.bigText(text)) .bigText(text))
.build(); .build();
nm.notify(0, notify);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
nm.notify(32768, notify);
} else {
startForeground(32768, notify);
stopForeground(STOP_FOREGROUND_DETACH);
}
} }
} }

View file

@ -29,6 +29,7 @@ import android.os.Environment;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
@ -63,6 +64,7 @@ public class FilePickerActivity extends AppCompatActivity implements FilePickerA
private RecyclerView list; private RecyclerView list;
private FilePickerAdapter listAdapter; private FilePickerAdapter listAdapter;
private TextView permissionErrorText; private TextView permissionErrorText;
private CardView card;
private TextView crc32; private TextView crc32;
private TextView md5; private TextView md5;
@ -104,6 +106,7 @@ public class FilePickerActivity extends AppCompatActivity implements FilePickerA
permissionErrorText = (TextView) findViewById(R.id.empty_view); permissionErrorText = (TextView) findViewById(R.id.empty_view);
list = (RecyclerView) findViewById(R.id.list); list = (RecyclerView) findViewById(R.id.list);
card = (CardView) findViewById(R.id.card);
try { try {
list.setHasFixedSize(true); list.setHasFixedSize(true);
} catch (NullPointerException e) {/* TODO log */} } catch (NullPointerException e) {/* TODO log */}
@ -201,7 +204,7 @@ public class FilePickerActivity extends AppCompatActivity implements FilePickerA
if (currentDir.getParent() != null && currentDir.getParentFile().canRead()) { if (currentDir.getParent() != null && currentDir.getParentFile().canRead()) {
entry = new FileEntry(); entry = new FileEntry();
entry.setIcon(R.drawable.ic_folder_upload_grey600_24dp); entry.setIcon(R.drawable.folder_upload);
entry.setName(".."); entry.setName("..");
fileList.add(entry); fileList.add(entry);
} }
@ -211,15 +214,15 @@ public class FilePickerActivity extends AppCompatActivity implements FilePickerA
continue; continue;
if (file.isDirectory()) { if (file.isDirectory()) {
entry = new FileEntry(); entry = new FileEntry();
entry.setIcon(R.drawable.ic_folder_grey600_24dp); entry.setIcon(R.drawable.folder);
entry.setName(file.getName()); entry.setName(file.getName());
fileList.add(entry); fileList.add(entry);
} else { } else {
entry = new FileEntry(); entry = new FileEntry();
if (Utils.isPatch(file)) { if (Utils.isPatch(file)) {
entry.setIcon(R.drawable.ic_healing_grey600_24dp); entry.setIcon(R.drawable.healing);
} else { } else {
entry.setIcon(R.drawable.ic_insert_drive_file_grey600_24dp); entry.setIcon(R.drawable.file);
} }
entry.setName(file.getName()); entry.setName(file.getName());
fileList.add(entry); fileList.add(entry);
@ -274,11 +277,11 @@ public class FilePickerActivity extends AppCompatActivity implements FilePickerA
private void showPermissionError(boolean on) { private void showPermissionError(boolean on) {
if (on) { if (on) {
list.setVisibility(View.GONE); card.setVisibility(View.GONE);
permissionErrorText.setVisibility(View.VISIBLE); permissionErrorText.setVisibility(View.VISIBLE);
} else { } else {
permissionErrorText.setVisibility(View.GONE); permissionErrorText.setVisibility(View.GONE);
list.setVisibility(View.VISIBLE); card.setVisibility(View.VISIBLE);
} }
} }

View file

@ -25,6 +25,7 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView; import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
@ -35,26 +36,27 @@ import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatDelegate; import android.support.v7.app.AppCompatDelegate;
import android.support.v7.preference.PreferenceManager; import android.support.v7.preference.PreferenceManager;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import org.emunix.unipatcher.BuildConfig; import org.emunix.unipatcher.BuildConfig;
import org.emunix.unipatcher.Globals;
import org.emunix.unipatcher.R; import org.emunix.unipatcher.R;
import org.emunix.unipatcher.Settings;
import org.emunix.unipatcher.UniPatcher;
import org.emunix.unipatcher.ui.fragment.ActionFragment; import org.emunix.unipatcher.ui.fragment.ActionFragment;
import org.emunix.unipatcher.ui.fragment.CreatePatchFragment; import org.emunix.unipatcher.ui.fragment.CreatePatchFragment;
import org.emunix.unipatcher.ui.fragment.PatchingFragment; import org.emunix.unipatcher.ui.fragment.PatchingFragment;
import org.emunix.unipatcher.ui.fragment.SmdFixChecksumFragment; import org.emunix.unipatcher.ui.fragment.SmdFixChecksumFragment;
import org.emunix.unipatcher.ui.fragment.SnesSmcHeaderFragment; import org.emunix.unipatcher.ui.fragment.SnesSmcHeaderFragment;
import java.util.Random;
import static android.support.v7.app.AppCompatDelegate.MODE_NIGHT_AUTO; import static android.support.v7.app.AppCompatDelegate.MODE_NIGHT_AUTO;
import static android.support.v7.app.AppCompatDelegate.MODE_NIGHT_NO; import static android.support.v7.app.AppCompatDelegate.MODE_NIGHT_NO;
import static android.support.v7.app.AppCompatDelegate.MODE_NIGHT_YES; import static android.support.v7.app.AppCompatDelegate.MODE_NIGHT_YES;
public class MainActivity extends AppCompatActivity public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener { implements NavigationView.OnNavigationItemSelectedListener {
private static final String LOG_TAG = "org.emunix.unipatcher";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -80,8 +82,6 @@ public class MainActivity extends AppCompatActivity
if (fragment != null) { if (fragment != null) {
boolean ret = fragment.runAction(); boolean ret = fragment.runAction();
} }
//Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
// .setAction("Action", null).show();
} }
}); });
@ -93,6 +93,7 @@ public class MainActivity extends AppCompatActivity
} }
parseArgument(); parseArgument();
showDonateSnackbar();
} }
private void setTheme() { private void setTheme() {
@ -134,8 +135,7 @@ public class MainActivity extends AppCompatActivity
} else if (id == R.id.nav_rate) { } else if (id == R.id.nav_rate) {
rateApp(); rateApp();
} else if (id == R.id.nav_donate) { } else if (id == R.id.nav_donate) {
Intent donateIntent = new Intent(this, DonateActivity.class); showDonateActivity();
startActivity(donateIntent);
} else if (id == R.id.nav_share) { } else if (id == R.id.nav_share) {
shareApp(); shareApp();
} else if (id == R.id.nav_help) { } else if (id == R.id.nav_help) {
@ -171,13 +171,51 @@ public class MainActivity extends AppCompatActivity
private void parseArgument() { private void parseArgument() {
try { try {
String arg = getIntent().getData().getPath(); String arg = getIntent().getData().getPath();
Globals.setCmdArgument(arg); UniPatcher.setAppArgument(arg);
Log.d(LOG_TAG, "Cmd argument: " + arg);
} catch (NullPointerException e) { } catch (NullPointerException e) {
Log.e(LOG_TAG, "NullPointerException in argument fetching"); // The application is not opened from the file manager
} }
} }
private void showDonateSnackbar() {
// don't show snackbar if the user did not patch the file successfully
if (!Settings.getPatchingSuccessful(this))
return;
// don't show snackbar some time if the user swiped off it before
int count = Settings.getDontShowDonateSnackbarCount(this);
if (count != 0) {
Settings.setDontShowDonateSnackbarCount(this, --count);
return;
}
// don't show snackbar each time you open the application
if (new Random().nextInt(6) != 0)
return;
Snackbar.make(findViewById(R.id.content_frame), R.string.main_activity_donate_snackbar_text, Snackbar.LENGTH_INDEFINITE)
.setAction(R.string.main_activity_donate_snackbar_button, new View.OnClickListener() {
@Override
public void onClick(View v) {
showDonateActivity();
}
})
.addCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
if (event == Snackbar.Callback.DISMISS_EVENT_SWIPE) {
Settings.setDontShowDonateSnackbarCount(getApplicationContext(), 30);
}
}
}
).show();
}
private void showDonateActivity() {
Intent donateIntent = new Intent(this, DonateActivity.class);
startActivity(donateIntent);
}
private void shareApp() { private void shareApp() {
Intent shareIntent = new Intent(Intent.ACTION_SEND); Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain"); shareIntent.setType("text/plain");

View file

@ -37,7 +37,7 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.emunix.unipatcher.Globals; import org.emunix.unipatcher.Action;
import org.emunix.unipatcher.R; import org.emunix.unipatcher.R;
import org.emunix.unipatcher.Settings; import org.emunix.unipatcher.Settings;
import org.emunix.unipatcher.Utils; import org.emunix.unipatcher.Utils;
@ -50,8 +50,6 @@ public class CreatePatchFragment extends ActionFragment implements View.OnClickL
private static final String LOG_TAG = "org.emunix.unipatcher"; private static final String LOG_TAG = "org.emunix.unipatcher";
private static final int SELECT_SOURCE_FILE = 1;
private static final int SELECT_MODIFIED_FILE = 2;
private TextView sourceNameTextView; private TextView sourceNameTextView;
private TextView modifiedNameTextView; private TextView modifiedNameTextView;
private TextView patchNameTextView; private TextView patchNameTextView;
@ -136,12 +134,12 @@ public class CreatePatchFragment extends ActionFragment implements View.OnClickL
case R.id.sourceFileCardView: case R.id.sourceFileCardView:
intent.putExtra("title", getString(R.string.file_picker_activity_title_select_source_file)); intent.putExtra("title", getString(R.string.file_picker_activity_title_select_source_file));
intent.putExtra("directory", Settings.getRomDir(getActivity())); intent.putExtra("directory", Settings.getRomDir(getActivity()));
startActivityForResult(intent, SELECT_SOURCE_FILE); startActivityForResult(intent, Action.SELECT_SOURCE_FILE);
break; break;
case R.id.modifiedFileCardView: case R.id.modifiedFileCardView:
intent.putExtra("title", getString(R.string.file_picker_activity_title_select_modified_file)); intent.putExtra("title", getString(R.string.file_picker_activity_title_select_modified_file));
intent.putExtra("directory", Settings.getRomDir(getActivity())); intent.putExtra("directory", Settings.getRomDir(getActivity()));
startActivityForResult(intent, SELECT_MODIFIED_FILE); startActivityForResult(intent, Action.SELECT_MODIFIED_FILE);
break; break;
case R.id.patchFileCardView: case R.id.patchFileCardView:
renamePatchFile(); renamePatchFile();
@ -157,13 +155,13 @@ public class CreatePatchFragment extends ActionFragment implements View.OnClickL
File fpath = new File(path); File fpath = new File(path);
switch (requestCode) { switch (requestCode) {
case SELECT_SOURCE_FILE: case Action.SELECT_SOURCE_FILE:
sourcePath = path; sourcePath = path;
sourceNameTextView.setVisibility(View.VISIBLE); sourceNameTextView.setVisibility(View.VISIBLE);
sourceNameTextView.setText(fpath.getName()); sourceNameTextView.setText(fpath.getName());
Settings.setLastRomDir(getActivity(), fpath.getParent()); Settings.setLastRomDir(getActivity(), fpath.getParent());
break; break;
case SELECT_MODIFIED_FILE: case Action.SELECT_MODIFIED_FILE:
modifiedPath = path; modifiedPath = path;
modifiedNameTextView.setVisibility(View.VISIBLE); modifiedNameTextView.setVisibility(View.VISIBLE);
modifiedNameTextView.setText(fpath.getName()); modifiedNameTextView.setText(fpath.getName());
@ -198,11 +196,11 @@ public class CreatePatchFragment extends ActionFragment implements View.OnClickL
} }
Intent intent = new Intent(getActivity(), WorkerService.class); Intent intent = new Intent(getActivity(), WorkerService.class);
intent.putExtra("action", Globals.ACTION_CREATE_PATCH); intent.putExtra("action", Action.CREATE_PATCH);
intent.putExtra("sourcePath", sourcePath); intent.putExtra("sourcePath", sourcePath);
intent.putExtra("modifiedPath", modifiedPath); intent.putExtra("modifiedPath", modifiedPath);
intent.putExtra("patchPath", patchPath); intent.putExtra("patchPath", patchPath);
getActivity().startService(intent); Utils.startForegroundService(getActivity(), intent);
Toast.makeText(getActivity(), R.string.toast_create_patch_started_check_notify, Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), R.string.toast_create_patch_started_check_notify, Toast.LENGTH_SHORT).show();
return true; return true;

View file

@ -36,9 +36,10 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.emunix.unipatcher.Globals; import org.emunix.unipatcher.Action;
import org.emunix.unipatcher.R; import org.emunix.unipatcher.R;
import org.emunix.unipatcher.Settings; import org.emunix.unipatcher.Settings;
import org.emunix.unipatcher.UniPatcher;
import org.emunix.unipatcher.Utils; import org.emunix.unipatcher.Utils;
import org.emunix.unipatcher.WorkerService; import org.emunix.unipatcher.WorkerService;
import org.emunix.unipatcher.ui.activity.FilePickerActivity; import org.emunix.unipatcher.ui.activity.FilePickerActivity;
@ -49,8 +50,6 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
private static final String LOG_TAG = "org.emunix.unipatcher"; private static final String LOG_TAG = "org.emunix.unipatcher";
private static final int SELECT_ROM_FILE = 1;
private static final int SELECT_PATCH_FILE = 2;
private TextView romNameTextView; private TextView romNameTextView;
private TextView patchNameTextView; private TextView patchNameTextView;
private TextView outputNameTextView; private TextView outputNameTextView;
@ -97,7 +96,7 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
} }
private void parseArgument() { private void parseArgument() {
patchPath = Globals.getCmdArgument(); patchPath = UniPatcher.getAppArgument();
if (patchPath != null) { if (patchPath != null) {
patchNameTextView.setText(new File(patchPath).getName()); patchNameTextView.setText(new File(patchPath).getName());
} }
@ -147,12 +146,12 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
case R.id.patchCardView: case R.id.patchCardView:
intent.putExtra("title", getString(R.string.file_picker_activity_title_select_patch)); intent.putExtra("title", getString(R.string.file_picker_activity_title_select_patch));
intent.putExtra("directory", Settings.getPatchDir(getActivity())); intent.putExtra("directory", Settings.getPatchDir(getActivity()));
startActivityForResult(intent, SELECT_PATCH_FILE); startActivityForResult(intent, Action.SELECT_PATCH_FILE);
break; break;
case R.id.romCardView: case R.id.romCardView:
intent.putExtra("title", getString(R.string.file_picker_activity_title_select_rom)); intent.putExtra("title", getString(R.string.file_picker_activity_title_select_rom));
intent.putExtra("directory", Settings.getRomDir(getActivity())); intent.putExtra("directory", Settings.getRomDir(getActivity()));
startActivityForResult(intent, SELECT_ROM_FILE); startActivityForResult(intent, Action.SELECT_ROM_FILE);
break; break;
case R.id.outputCardView: case R.id.outputCardView:
renameOutputRom(); renameOutputRom();
@ -172,7 +171,7 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
} }
switch (requestCode) { switch (requestCode) {
case SELECT_ROM_FILE: case Action.SELECT_ROM_FILE:
romPath = path; romPath = path;
romNameTextView.setVisibility(View.VISIBLE); romNameTextView.setVisibility(View.VISIBLE);
romNameTextView.setText(fpath.getName()); romNameTextView.setText(fpath.getName());
@ -180,7 +179,7 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
outputPath = makeOutputPath(path); outputPath = makeOutputPath(path);
outputNameTextView.setText(new File(outputPath).getName()); outputNameTextView.setText(new File(outputPath).getName());
break; break;
case SELECT_PATCH_FILE: case Action.SELECT_PATCH_FILE:
patchPath = path; patchPath = path;
patchNameTextView.setVisibility(View.VISIBLE); patchNameTextView.setVisibility(View.VISIBLE);
patchNameTextView.setText(fpath.getName()); patchNameTextView.setText(fpath.getName());
@ -214,11 +213,11 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
} }
Intent intent = new Intent(getActivity(), WorkerService.class); Intent intent = new Intent(getActivity(), WorkerService.class);
intent.putExtra("action", Globals.ACTION_PATCHING); intent.putExtra("action", Action.APPLY_PATCH);
intent.putExtra("romPath", romPath); intent.putExtra("romPath", romPath);
intent.putExtra("patchPath", patchPath); intent.putExtra("patchPath", patchPath);
intent.putExtra("outputPath", outputPath); intent.putExtra("outputPath", outputPath);
getActivity().startService(intent); Utils.startForegroundService(getActivity(), intent);
Toast.makeText(getActivity(), R.string.toast_patching_started_check_notify, Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), R.string.toast_patching_started_check_notify, Toast.LENGTH_SHORT).show();
return true; return true;

View file

@ -31,7 +31,7 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.emunix.unipatcher.Globals; import org.emunix.unipatcher.Action;
import org.emunix.unipatcher.R; import org.emunix.unipatcher.R;
import org.emunix.unipatcher.Settings; import org.emunix.unipatcher.Settings;
import org.emunix.unipatcher.Utils; import org.emunix.unipatcher.Utils;
@ -43,7 +43,6 @@ import java.io.File;
public class SmdFixChecksumFragment extends ActionFragment implements View.OnClickListener { public class SmdFixChecksumFragment extends ActionFragment implements View.OnClickListener {
private static final String LOG_TAG = "org.emunix.unipatcher"; private static final String LOG_TAG = "org.emunix.unipatcher";
private static final int SELECT_ROM_FILE = 1;
private TextView romNameTextView; private TextView romNameTextView;
private TextView fixChecksumInfoTextview; private TextView fixChecksumInfoTextview;
@ -108,7 +107,7 @@ public class SmdFixChecksumFragment extends ActionFragment implements View.OnCli
case R.id.romCardView: case R.id.romCardView:
intent.putExtra("title", getString(R.string.file_picker_activity_title_select_rom)); intent.putExtra("title", getString(R.string.file_picker_activity_title_select_rom));
intent.putExtra("directory", Settings.getRomDir(getActivity())); intent.putExtra("directory", Settings.getRomDir(getActivity()));
startActivityForResult(intent, SELECT_ROM_FILE); startActivityForResult(intent, Action.SELECT_ROM_FILE);
break; break;
} }
} }
@ -124,7 +123,7 @@ public class SmdFixChecksumFragment extends ActionFragment implements View.OnCli
} }
switch (requestCode) { switch (requestCode) {
case SELECT_ROM_FILE: case Action.SELECT_ROM_FILE:
romPath = path; romPath = path;
romNameTextView.setVisibility(View.VISIBLE); romNameTextView.setVisibility(View.VISIBLE);
romNameTextView.setText(new File(path).getName()); romNameTextView.setText(new File(path).getName());
@ -142,9 +141,9 @@ public class SmdFixChecksumFragment extends ActionFragment implements View.OnCli
} }
Intent intent = new Intent(getActivity(), WorkerService.class); Intent intent = new Intent(getActivity(), WorkerService.class);
intent.putExtra("action", Globals.ACTION_SMD_FIX_CHECKSUM);
intent.putExtra("romPath", romPath); intent.putExtra("romPath", romPath);
getActivity().startService(intent); intent.putExtra("action", Action.SMD_FIX_CHECKSUM);
Utils.startForegroundService(getActivity(), intent);
Toast.makeText(getActivity(), R.string.notify_smd_fix_checksum_started_check_notify, Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), R.string.notify_smd_fix_checksum_started_check_notify, Toast.LENGTH_SHORT).show();
return true; return true;

View file

@ -31,7 +31,7 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.emunix.unipatcher.Globals; import org.emunix.unipatcher.Action;
import org.emunix.unipatcher.R; import org.emunix.unipatcher.R;
import org.emunix.unipatcher.Settings; import org.emunix.unipatcher.Settings;
import org.emunix.unipatcher.Utils; import org.emunix.unipatcher.Utils;
@ -43,8 +43,6 @@ import java.io.File;
public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClickListener { public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClickListener {
private static final String LOG_TAG = "org.emunix.unipatcher"; private static final String LOG_TAG = "org.emunix.unipatcher";
private static final int SELECT_ROM_FILE = 1;
private static final int SELECT_HEADER_FILE = 2;
private TextView romNameTextView; private TextView romNameTextView;
private TextView headerNameTextView; private TextView headerNameTextView;
@ -104,10 +102,10 @@ public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClic
romPath = savedInstanceState.getString("romPath"); romPath = savedInstanceState.getString("romPath");
headerPath = savedInstanceState.getString("headerPath"); headerPath = savedInstanceState.getString("headerPath");
action = savedInstanceState.getInt("action"); action = savedInstanceState.getInt("action");
if (action == Globals.ACTION_SNES_ADD_SMC_HEADER) { if (action == Action.SNES_ADD_SMC_HEADER) {
headerInfoTextView.setText(R.string.snes_smc_header_will_be_added); headerInfoTextView.setText(R.string.snes_smc_header_will_be_added);
headerCardView.setVisibility(View.VISIBLE); headerCardView.setVisibility(View.VISIBLE);
} else if (action == Globals.ACTION_SNES_DELETE_SMC_HEADER) { } else if (action == Action.SNES_DELETE_SMC_HEADER) {
headerInfoTextView.setText(R.string.snes_smc_header_will_be_removed); headerInfoTextView.setText(R.string.snes_smc_header_will_be_removed);
headerCardView.setVisibility(View.GONE); headerCardView.setVisibility(View.GONE);
} }
@ -133,11 +131,11 @@ public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClic
case R.id.romCardView: case R.id.romCardView:
intent.putExtra("title", getString(R.string.file_picker_activity_title_select_rom)); intent.putExtra("title", getString(R.string.file_picker_activity_title_select_rom));
intent.putExtra("directory", Settings.getRomDir(getActivity())); intent.putExtra("directory", Settings.getRomDir(getActivity()));
startActivityForResult(intent, SELECT_ROM_FILE); startActivityForResult(intent, Action.SELECT_ROM_FILE);
break; break;
case R.id.headerCardView: case R.id.headerCardView:
intent.putExtra("title", getString(R.string.file_picker_activity_title_select_header)); intent.putExtra("title", getString(R.string.file_picker_activity_title_select_header));
startActivityForResult(intent, SELECT_HEADER_FILE); startActivityForResult(intent, Action.SELECT_HEADER_FILE);
break; break;
} }
} }
@ -153,25 +151,25 @@ public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClic
} }
switch (requestCode) { switch (requestCode) {
case SELECT_ROM_FILE: case Action.SELECT_ROM_FILE:
romPath = path; romPath = path;
romNameTextView.setVisibility(View.VISIBLE); romNameTextView.setVisibility(View.VISIBLE);
romNameTextView.setText(new File(path).getName()); romNameTextView.setText(new File(path).getName());
Settings.setLastRomDir(getActivity(), new File(path).getParent()); Settings.setLastRomDir(getActivity(), new File(path).getParent());
SnesSmcHeader checker = new SnesSmcHeader(); SnesSmcHeader checker = new SnesSmcHeader();
if (checker.isHasSmcHeader(new File(path))) { if (checker.isHasSmcHeader(new File(path))) {
action = Globals.ACTION_SNES_DELETE_SMC_HEADER; action = Action.SNES_DELETE_SMC_HEADER;
headerCardView.setVisibility(View.GONE); headerCardView.setVisibility(View.GONE);
headerInfoTextView.setText(R.string.snes_smc_header_will_be_removed); headerInfoTextView.setText(R.string.snes_smc_header_will_be_removed);
} else { } else {
action = Globals.ACTION_SNES_ADD_SMC_HEADER; action = Action.SNES_ADD_SMC_HEADER;
headerCardView.setVisibility(View.VISIBLE); headerCardView.setVisibility(View.VISIBLE);
headerInfoTextView.setText(R.string.snes_smc_header_will_be_added); headerInfoTextView.setText(R.string.snes_smc_header_will_be_added);
} }
headerPath = null; headerPath = null;
headerNameTextView.setText(R.string.main_activity_tap_to_select); headerNameTextView.setText(R.string.main_activity_tap_to_select);
break; break;
case SELECT_HEADER_FILE: case Action.SELECT_HEADER_FILE:
headerPath = path; headerPath = path;
headerNameTextView.setText(new File(path).getName()); headerNameTextView.setText(new File(path).getName());
break; break;
@ -190,9 +188,9 @@ public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClic
intent.putExtra("action", action); intent.putExtra("action", action);
intent.putExtra("romPath", romPath); intent.putExtra("romPath", romPath);
intent.putExtra("headerPath", headerPath); intent.putExtra("headerPath", headerPath);
getActivity().startService(intent); Utils.startForegroundService(getActivity(), intent);
if (action == Globals.ACTION_SNES_ADD_SMC_HEADER) { if (action == Action.SNES_ADD_SMC_HEADER) {
Toast.makeText(getActivity(), R.string.notify_snes_add_smc_header_stared_check_noify, Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), R.string.notify_snes_add_smc_header_stared_check_noify, Toast.LENGTH_SHORT).show();
} else { } else {
Toast.makeText(getActivity(), R.string.notify_snes_delete_smc_header_stared_check_noify, Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), R.string.notify_snes_delete_smc_header_stared_check_noify, Toast.LENGTH_SHORT).show();

View file

@ -29,7 +29,7 @@ public class CreatePatchNotify extends Notify {
public CreatePatchNotify(Context c, String text) { public CreatePatchNotify(Context c, String text) {
super(c); super(c);
notifyBuilder.setSmallIcon(R.drawable.ic_stat_patching); notifyBuilder.setSmallIcon(R.drawable.ic_gamepad_variant_white_24dp);
notifyBuilder.setContentTitle(context.getString(R.string.notify_creating_patch)); notifyBuilder.setContentTitle(context.getString(R.string.notify_creating_patch));
notifyBuilder.setContentText(text); notifyBuilder.setContentText(text);
notifyBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(text)); notifyBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(text));

View file

@ -24,6 +24,7 @@ import android.content.Intent;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat; import android.support.v4.app.NotificationManagerCompat;
import org.emunix.unipatcher.UniPatcher;
import org.emunix.unipatcher.ui.activity.MainActivity; import org.emunix.unipatcher.ui.activity.MainActivity;
public abstract class Notify { public abstract class Notify {
@ -40,9 +41,8 @@ public abstract class Notify {
Intent notificationIntent = new Intent(context, MainActivity.class); Intent notificationIntent = new Intent(context, MainActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
notifyBuilder = new NotificationCompat.Builder(context); notifyBuilder = new NotificationCompat.Builder(context, UniPatcher.NOTIFICATION_CHANNEL_ID);
notifyBuilder.setContentIntent(PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT)); notifyBuilder.setContentIntent(PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT));
//notifyMng = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
notifyMng = NotificationManagerCompat.from(context); notifyMng = NotificationManagerCompat.from(context);
} }

View file

@ -28,7 +28,7 @@ public class PatchingNotify extends Notify {
public PatchingNotify(Context c, String text) { public PatchingNotify(Context c, String text) {
super(c); super(c);
notifyBuilder.setSmallIcon(R.drawable.ic_stat_patching); notifyBuilder.setSmallIcon(R.drawable.ic_gamepad_variant_white_24dp);
notifyBuilder.setContentTitle(context.getString(R.string.notify_applying_patch)); notifyBuilder.setContentTitle(context.getString(R.string.notify_applying_patch));
notifyBuilder.setContentText(text); notifyBuilder.setContentText(text);
notifyBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(text)); notifyBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(text));

View file

@ -28,7 +28,7 @@ public class SmdFixChecksumNotify extends Notify {
public SmdFixChecksumNotify(Context c, String text) { public SmdFixChecksumNotify(Context c, String text) {
super(c); super(c);
notifyBuilder.setSmallIcon(R.drawable.ic_stat_patching); notifyBuilder.setSmallIcon(R.drawable.ic_gamepad_variant_white_24dp);
notifyBuilder.setContentTitle(context.getString(R.string.notify_smd_fix_checksum_in_progress)); notifyBuilder.setContentTitle(context.getString(R.string.notify_smd_fix_checksum_in_progress));
notifyBuilder.setContentText(text); notifyBuilder.setContentText(text);
notifyBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(text)); notifyBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(text));

View file

@ -27,7 +27,7 @@ import org.emunix.unipatcher.R;
public class SnesAddSmcHeaderNotify extends Notify { public class SnesAddSmcHeaderNotify extends Notify {
public SnesAddSmcHeaderNotify(Context c, String text) { public SnesAddSmcHeaderNotify(Context c, String text) {
super(c); super(c);
notifyBuilder.setSmallIcon(R.drawable.ic_stat_patching); notifyBuilder.setSmallIcon(R.drawable.ic_gamepad_variant_white_24dp);
notifyBuilder.setContentTitle(context.getString(R.string.notify_snes_add_smc_header_in_progress)); notifyBuilder.setContentTitle(context.getString(R.string.notify_snes_add_smc_header_in_progress));
notifyBuilder.setContentText(text); notifyBuilder.setContentText(text);
notifyBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(text)); notifyBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(text));

View file

@ -27,7 +27,7 @@ import org.emunix.unipatcher.R;
public class SnesDeleteSmcHeaderNotify extends Notify { public class SnesDeleteSmcHeaderNotify extends Notify {
public SnesDeleteSmcHeaderNotify(Context c, String text) { public SnesDeleteSmcHeaderNotify(Context c, String text) {
super(c); super(c);
notifyBuilder.setSmallIcon(R.drawable.ic_stat_patching); notifyBuilder.setSmallIcon(R.drawable.ic_gamepad_variant_white_24dp);
notifyBuilder.setContentTitle(context.getString(R.string.notify_snes_delete_smc_header_in_progress)); notifyBuilder.setContentTitle(context.getString(R.string.notify_snes_delete_smc_header_in_progress));
notifyBuilder.setContentText(text); notifyBuilder.setContentText(text);
notifyBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(text)); notifyBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(text));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,018 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 866 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

View file

@ -0,0 +1,8 @@
<!-- drawable/content_cut.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z" />
</vector>

View file

@ -0,0 +1,8 @@
<!-- drawable/content_save.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#fff" android:pathData="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z" />
</vector>

View file

@ -0,0 +1,8 @@
<!-- drawable/file.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M13,9V3.5L18.5,9M6,2C4.89,2 4,2.89 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2H6Z" />
</vector>

View file

@ -0,0 +1,8 @@
<!-- drawable/fingerprint.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M11.83,1.73C8.43,1.79 6.23,3.32 6.23,3.32C5.95,3.5 5.88,3.91 6.07,4.19C6.27,4.5 6.66,4.55 6.96,4.34C6.96,4.34 11.27,1.15 17.46,4.38C17.75,4.55 18.14,4.45 18.31,4.15C18.5,3.85 18.37,3.47 18.03,3.28C16.36,2.4 14.78,1.96 13.36,1.8C12.83,1.74 12.32,1.72 11.83,1.73M12.22,4.34C6.26,4.26 3.41,9.05 3.41,9.05C3.22,9.34 3.3,9.72 3.58,9.91C3.87,10.1 4.26,10 4.5,9.68C4.5,9.68 6.92,5.5 12.2,5.59C17.5,5.66 19.82,9.65 19.82,9.65C20,9.94 20.38,10.04 20.68,9.87C21,9.69 21.07,9.31 20.9,9C20.9,9 18.15,4.42 12.22,4.34M11.5,6.82C9.82,6.94 8.21,7.55 7,8.56C4.62,10.53 3.1,14.14 4.77,19C4.88,19.33 5.24,19.5 5.57,19.39C5.89,19.28 6.07,18.92 5.95,18.6V18.6C4.41,14.13 5.78,11.2 7.8,9.5C9.77,7.89 13.25,7.5 15.84,9.1C17.11,9.9 18.1,11.28 18.6,12.64C19.11,14 19.08,15.32 18.67,15.94C18.25,16.59 17.4,16.83 16.65,16.64C15.9,16.45 15.29,15.91 15.26,14.77C15.23,13.06 13.89,12 12.5,11.84C11.16,11.68 9.61,12.4 9.21,14C8.45,16.92 10.36,21.07 14.78,22.45C15.11,22.55 15.46,22.37 15.57,22.04C15.67,21.71 15.5,21.35 15.15,21.25C11.32,20.06 9.87,16.43 10.42,14.29C10.66,13.33 11.5,13 12.38,13.08C13.25,13.18 14,13.7 14,14.79C14.05,16.43 15.12,17.54 16.34,17.85C17.56,18.16 18.97,17.77 19.72,16.62C20.5,15.45 20.37,13.8 19.78,12.21C19.18,10.61 18.07,9.03 16.5,8.04C14.96,7.08 13.19,6.7 11.5,6.82M11.86,9.25V9.26C10.08,9.32 8.3,10.24 7.28,12.18C5.96,14.67 6.56,17.21 7.44,19.04C8.33,20.88 9.54,22.1 9.54,22.1C9.78,22.35 10.17,22.35 10.42,22.11C10.67,21.87 10.67,21.5 10.43,21.23C10.43,21.23 9.36,20.13 8.57,18.5C7.78,16.87 7.3,14.81 8.38,12.77C9.5,10.67 11.5,10.16 13.26,10.67C15.04,11.19 16.53,12.74 16.5,15.03C16.46,15.38 16.71,15.68 17.06,15.7C17.4,15.73 17.7,15.47 17.73,15.06C17.79,12.2 15.87,10.13 13.61,9.47C13.04,9.31 12.45,9.23 11.86,9.25M12.08,14.25C11.73,14.26 11.46,14.55 11.47,14.89C11.47,14.89 11.5,16.37 12.31,17.8C13.15,19.23 14.93,20.59 18.03,20.3C18.37,20.28 18.64,20 18.62,19.64C18.6,19.29 18.3,19.03 17.91,19.06C15.19,19.31 14.04,18.28 13.39,17.17C12.74,16.07 12.72,14.88 12.72,14.88C12.72,14.53 12.44,14.25 12.08,14.25Z" />
</vector>

Some files were not shown because too many files have changed in this diff Show more