Compare commits

..

No commits in common. "master" and "v0.14" have entirely different histories.

196 changed files with 606 additions and 3966 deletions

View file

@ -1,6 +1,5 @@
[main] [main]
host = https://www.transifex.com host = https://www.transifex.com
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

@ -14,24 +14,23 @@ UniPatcher is a ROM patcher for Android that supports IPS, IPS32, UPS, BPS, APS
### Screenshots: ### Screenshots:
<img src="/google-play/screenshot_1.png" width="350"> <img src="/google-play/screenshot_2.png" width="350"> <img src="/google-play/screenshot_1.png" width="350">
<img src="/google-play/screenshot_2.png" width="350">
### Install UniPatcher: ### Install 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/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/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)
### Contribute: ### How to contribute to UniPatcher:
#### Report a bug or suggest features #### Report a bug or suggest a new feature
These are discussed on the GitHub [Issue Tracker](https://github.com/btimofeev/UniPatcher/issues). Bugs and new features are being discussed on the GitHub [Issue Tracker](https://github.com/btimofeev/UniPatcher/issues).
#### Translations #### Help with translations
Help translate UniPatcher into another language on the [Transifex project page](https://www.transifex.com/unipatcher/unipatcher/). If you want to translate UniPatcher into another language, you can visit 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,8 +1,13 @@
def versionMajor = 0
def versionMinor = 14
def versionPatch = 0
def versionBuild = 0
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 27 compileSdkVersion 25
buildToolsVersion '27.0.1' buildToolsVersion '25.0.2'
signingConfigs { signingConfigs {
release release
@ -11,12 +16,11 @@ android {
defaultConfig { defaultConfig {
applicationId "org.emunix.unipatcher" applicationId "org.emunix.unipatcher"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 27 targetSdkVersion 25
versionCode 150000 versionCode versionMajor * 1000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
versionName "0.15" versionName "${versionMajor}.${versionMinor}.${versionPatch}"
vectorDrawables.useSupportLibrary = true
ndk { ndk {
abiFilters 'armeabi-v7a', 'x86' abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64', 'mips64', 'mips'
} }
externalNativeBuild { externalNativeBuild {
cmake { cmake {
@ -35,8 +39,6 @@ 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\""
@ -76,11 +78,6 @@ android {
path "CMakeLists.txt" path "CMakeLists.txt"
} }
} }
lintOptions {
disable 'MissingTranslation'
}
} }
def Properties props = new Properties() def Properties props = new Properties()
@ -109,18 +106,18 @@ if (propFile.canRead()) {
dependencies { dependencies {
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.12.0' testCompile 'org.mockito:mockito-core:2.7.14'
compile fileTree(dir: 'libs', include: ['*.jar']) compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:27.0.2' compile 'com.android.support:support-v4:25.3.0'
compile 'com.android.support:appcompat-v7:27.0.2' compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:cardview-v7:27.0.2' compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.android.support:preference-v14:27.0.2' compile 'com.android.support:preference-v14:25.3.0'
compile 'com.android.support:recyclerview-v7:27.0.2' compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:design:27.0.2' compile 'com.android.support:design:25.3.0'
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.5' compile 'org.sufficientlysecure:html-textview:3.3'
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.6.0' compile 'com.afollestad.material-dialogs:core:0.9.4.1'
compile 'com.android.support:support-v13:25.3.0' // used in material-dialogs
} }

View file

@ -8,9 +8,8 @@
<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="true" android:extractNativeLibs="false"
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"
@ -42,7 +41,6 @@
<data android:pathPattern="/.*\\.dps"/> <data android:pathPattern="/.*\\.dps"/>
<data android:pathPattern="/.*\\.xdelta"/> <data android:pathPattern="/.*\\.xdelta"/>
<data android:pathPattern="/.*\\.xdelta3"/> <data android:pathPattern="/.*\\.xdelta3"/>
<data android:pathPattern="/.*\\.xd"/>
<data android:pathPattern="/.*\\.vcdiff"/> <data android:pathPattern="/.*\\.vcdiff"/>
<data android:host="*"/> <data android:host="*"/>
</intent-filter> </intent-filter>
@ -71,4 +69,4 @@
</application> </application>
</manifest> </manifest>

View file

@ -1,35 +0,0 @@
/*
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

@ -0,0 +1,38 @@
/*
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,28 +74,4 @@ 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

@ -1,57 +0,0 @@
/*
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,7 +22,6 @@ 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;
@ -49,14 +48,6 @@ 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 {
@ -161,7 +152,7 @@ public class Utils {
public static boolean isPatch(File file) { public static boolean isPatch(File file) {
String[] patches = String[] patches =
{"ips", "ups", "bps", "aps", "ppf", "dps", "ebp", "xdelta", "xdelta3", "xd", "vcdiff"}; {"ips", "ups", "bps", "aps", "ppf", "dps", "ebp", "xdelta", "xdelta3", "vcdiff"};
String ext = FilenameUtils.getExtension(file.getName()).toLowerCase(Locale.getDefault()); String ext = FilenameUtils.getExtension(file.getName()).toLowerCase(Locale.getDefault());
for (String patch : patches) { for (String patch : patches) {
if (ext.equals(patch)) return true; if (ext.equals(patch)) return true;

View file

@ -24,7 +24,6 @@ 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;
@ -76,19 +75,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 Action.APPLY_PATCH: case Globals.ACTION_PATCHING:
actionPatching(intent); actionPatching(intent);
break; break;
case Action.CREATE_PATCH: case Globals.ACTION_CREATE_PATCH:
actionCreatePatch(intent); actionCreatePatch(intent);
break; break;
case Action.SMD_FIX_CHECKSUM: case Globals.ACTION_SMD_FIX_CHECKSUM:
actionSmdFixChecksum(intent); actionSmdFixChecksum(intent);
break; break;
case Action.SNES_ADD_SMC_HEADER: case Globals.ACTION_SNES_ADD_SMC_HEADER:
actionSnesAddSmcHeader(intent); actionSnesAddSmcHeader(intent);
break; break;
case Action.SNES_DELETE_SMC_HEADER: case Globals.ACTION_SNES_DELETE_SMC_HEADER:
actionSnesDeleteSmcHeader(intent); actionSnesDeleteSmcHeader(intent);
break; break;
} }
@ -146,24 +145,24 @@ public class WorkerService extends IntentService {
patcher = new EBP(this, patchFile, romFile, outputFile); patcher = new EBP(this, patchFile, romFile, outputFile);
else if ("dps".equals(ext)) else if ("dps".equals(ext))
patcher = new DPS(this, patchFile, romFile, outputFile); patcher = new DPS(this, patchFile, romFile, outputFile);
else if ("xdelta".equals(ext) || "xdelta3".equals(ext) || "xd".equals(ext) || "vcdiff".equals(ext)) else if ("xdelta".equals(ext) || "xdelta3".equals(ext) || "vcdiff".equals(ext))
patcher = new XDelta(this, patchFile, romFile, outputFile); patcher = new XDelta(this, patchFile, romFile, outputFile);
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) {
showErrorNotification(errorMsg); notify.showResult(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);
@ -220,7 +219,6 @@ 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);
@ -326,21 +324,15 @@ 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, UniPatcher.NOTIFICATION_CHANNEL_ID) Notification notify = new NotificationCompat.Builder(this)
.setContentTitle(getString(R.string.notify_error)) .setContentTitle(getString(R.string.notify_error))
.setContentText(text) .setContentText(text)
.setSmallIcon(R.drawable.ic_gamepad_variant_white_24dp) .setSmallIcon(R.drawable.ic_stat_patching)
.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,7 +29,6 @@ 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;
@ -64,7 +63,6 @@ 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;
@ -106,7 +104,6 @@ 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 */}
@ -204,7 +201,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.folder_upload); entry.setIcon(R.drawable.ic_folder_upload_grey600_24dp);
entry.setName(".."); entry.setName("..");
fileList.add(entry); fileList.add(entry);
} }
@ -214,15 +211,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.folder); entry.setIcon(R.drawable.ic_folder_grey600_24dp);
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.healing); entry.setIcon(R.drawable.ic_healing_grey600_24dp);
} else { } else {
entry.setIcon(R.drawable.file); entry.setIcon(R.drawable.ic_insert_drive_file_grey600_24dp);
} }
entry.setName(file.getName()); entry.setName(file.getName());
fileList.add(entry); fileList.add(entry);
@ -277,11 +274,11 @@ public class FilePickerActivity extends AppCompatActivity implements FilePickerA
private void showPermissionError(boolean on) { private void showPermissionError(boolean on) {
if (on) { if (on) {
card.setVisibility(View.GONE); list.setVisibility(View.GONE);
permissionErrorText.setVisibility(View.VISIBLE); permissionErrorText.setVisibility(View.VISIBLE);
} else { } else {
permissionErrorText.setVisibility(View.GONE); permissionErrorText.setVisibility(View.GONE);
card.setVisibility(View.VISIBLE); list.setVisibility(View.VISIBLE);
} }
} }

View file

@ -25,7 +25,6 @@ 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;
@ -36,27 +35,26 @@ 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) {
@ -82,6 +80,8 @@ 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,7 +93,6 @@ public class MainActivity extends AppCompatActivity
} }
parseArgument(); parseArgument();
showDonateSnackbar();
} }
private void setTheme() { private void setTheme() {
@ -135,7 +134,8 @@ 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) {
showDonateActivity(); Intent donateIntent = new Intent(this, DonateActivity.class);
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,51 +171,13 @@ public class MainActivity extends AppCompatActivity
private void parseArgument() { private void parseArgument() {
try { try {
String arg = getIntent().getData().getPath(); String arg = getIntent().getData().getPath();
UniPatcher.setAppArgument(arg); Globals.setCmdArgument(arg);
Log.d(LOG_TAG, "Cmd argument: " + arg);
} catch (NullPointerException e) { } catch (NullPointerException e) {
// The application is not opened from the file manager Log.e(LOG_TAG, "NullPointerException in argument fetching");
} }
} }
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.Action; import org.emunix.unipatcher.Globals;
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,6 +50,8 @@ 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;
@ -134,12 +136,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, Action.SELECT_SOURCE_FILE); startActivityForResult(intent, 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, Action.SELECT_MODIFIED_FILE); startActivityForResult(intent, SELECT_MODIFIED_FILE);
break; break;
case R.id.patchFileCardView: case R.id.patchFileCardView:
renamePatchFile(); renamePatchFile();
@ -155,13 +157,13 @@ public class CreatePatchFragment extends ActionFragment implements View.OnClickL
File fpath = new File(path); File fpath = new File(path);
switch (requestCode) { switch (requestCode) {
case Action.SELECT_SOURCE_FILE: case 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 Action.SELECT_MODIFIED_FILE: case SELECT_MODIFIED_FILE:
modifiedPath = path; modifiedPath = path;
modifiedNameTextView.setVisibility(View.VISIBLE); modifiedNameTextView.setVisibility(View.VISIBLE);
modifiedNameTextView.setText(fpath.getName()); modifiedNameTextView.setText(fpath.getName());
@ -196,11 +198,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", Action.CREATE_PATCH); intent.putExtra("action", Globals.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);
Utils.startForegroundService(getActivity(), intent); getActivity().startService(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,10 +36,9 @@ 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.Action; import org.emunix.unipatcher.Globals;
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;
@ -50,6 +49,8 @@ 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;
@ -96,7 +97,7 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
} }
private void parseArgument() { private void parseArgument() {
patchPath = UniPatcher.getAppArgument(); patchPath = Globals.getCmdArgument();
if (patchPath != null) { if (patchPath != null) {
patchNameTextView.setText(new File(patchPath).getName()); patchNameTextView.setText(new File(patchPath).getName());
} }
@ -146,12 +147,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, Action.SELECT_PATCH_FILE); startActivityForResult(intent, 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, Action.SELECT_ROM_FILE); startActivityForResult(intent, SELECT_ROM_FILE);
break; break;
case R.id.outputCardView: case R.id.outputCardView:
renameOutputRom(); renameOutputRom();
@ -171,7 +172,7 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
} }
switch (requestCode) { switch (requestCode) {
case Action.SELECT_ROM_FILE: case SELECT_ROM_FILE:
romPath = path; romPath = path;
romNameTextView.setVisibility(View.VISIBLE); romNameTextView.setVisibility(View.VISIBLE);
romNameTextView.setText(fpath.getName()); romNameTextView.setText(fpath.getName());
@ -179,7 +180,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 Action.SELECT_PATCH_FILE: case SELECT_PATCH_FILE:
patchPath = path; patchPath = path;
patchNameTextView.setVisibility(View.VISIBLE); patchNameTextView.setVisibility(View.VISIBLE);
patchNameTextView.setText(fpath.getName()); patchNameTextView.setText(fpath.getName());
@ -213,11 +214,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", Action.APPLY_PATCH); intent.putExtra("action", Globals.ACTION_PATCHING);
intent.putExtra("romPath", romPath); intent.putExtra("romPath", romPath);
intent.putExtra("patchPath", patchPath); intent.putExtra("patchPath", patchPath);
intent.putExtra("outputPath", outputPath); intent.putExtra("outputPath", outputPath);
Utils.startForegroundService(getActivity(), intent); getActivity().startService(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.Action; import org.emunix.unipatcher.Globals;
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,6 +43,7 @@ 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;
@ -107,7 +108,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, Action.SELECT_ROM_FILE); startActivityForResult(intent, SELECT_ROM_FILE);
break; break;
} }
} }
@ -123,7 +124,7 @@ public class SmdFixChecksumFragment extends ActionFragment implements View.OnCli
} }
switch (requestCode) { switch (requestCode) {
case Action.SELECT_ROM_FILE: case 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());
@ -141,9 +142,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);
intent.putExtra("action", Action.SMD_FIX_CHECKSUM); getActivity().startService(intent);
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.Action; import org.emunix.unipatcher.Globals;
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,6 +43,8 @@ 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;
@ -102,10 +104,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 == Action.SNES_ADD_SMC_HEADER) { if (action == Globals.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 == Action.SNES_DELETE_SMC_HEADER) { } else if (action == Globals.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);
} }
@ -131,11 +133,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, Action.SELECT_ROM_FILE); startActivityForResult(intent, 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, Action.SELECT_HEADER_FILE); startActivityForResult(intent, SELECT_HEADER_FILE);
break; break;
} }
} }
@ -151,25 +153,25 @@ public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClic
} }
switch (requestCode) { switch (requestCode) {
case Action.SELECT_ROM_FILE: case 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 = Action.SNES_DELETE_SMC_HEADER; action = Globals.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 = Action.SNES_ADD_SMC_HEADER; action = Globals.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 Action.SELECT_HEADER_FILE: case SELECT_HEADER_FILE:
headerPath = path; headerPath = path;
headerNameTextView.setText(new File(path).getName()); headerNameTextView.setText(new File(path).getName());
break; break;
@ -188,9 +190,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);
Utils.startForegroundService(getActivity(), intent); getActivity().startService(intent);
if (action == Action.SNES_ADD_SMC_HEADER) { if (action == Globals.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_gamepad_variant_white_24dp); notifyBuilder.setSmallIcon(R.drawable.ic_stat_patching);
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,7 +24,6 @@ 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 {
@ -41,8 +40,9 @@ 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, UniPatcher.NOTIFICATION_CHANNEL_ID); notifyBuilder = new NotificationCompat.Builder(context);
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_gamepad_variant_white_24dp); notifyBuilder.setSmallIcon(R.drawable.ic_stat_patching);
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_gamepad_variant_white_24dp); notifyBuilder.setSmallIcon(R.drawable.ic_stat_patching);
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_gamepad_variant_white_24dp); notifyBuilder.setSmallIcon(R.drawable.ic_stat_patching);
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_gamepad_variant_white_24dp); notifyBuilder.setSmallIcon(R.drawable.ic_stat_patching);
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.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

After

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

View file

@ -1,8 +0,0 @@
<!-- 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

@ -1,8 +0,0 @@
<!-- 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

@ -1,8 +0,0 @@
<!-- 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

@ -1,8 +0,0 @@
<!-- 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