Reformat code

This commit is contained in:
Boris Timofeev 2017-01-19 17:35:00 +03:00
parent 1e634ec86e
commit c7754a562f
48 changed files with 399 additions and 363 deletions

View file

@ -56,10 +56,10 @@ android {
def Properties props = new Properties()
def propFile = file('../../signing.properties')
if (propFile.canRead()){
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props!=null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
if (props != null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
println 'RELEASE BUILD SIGNING'

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.emunix.unipatcher">
package="org.emunix.unipatcher">
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="com.android.vending.BILLING"/>
<application />
<application/>
</manifest>

View file

@ -1,77 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.emunix.unipatcher"
android:installLocation="auto">
package="org.emunix.unipatcher"
android:installLocation="auto">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="false"
android:extractNativeLibs="false"
android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="false"
android:extractNativeLibs="false"
android:theme="@style/AppTheme.NoActionBar">
<activity
android:name=".ui.activity.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="file" />
<data android:mimeType="*/*" />
<data android:pathPattern="/.*\\.aps" />
<data android:pathPattern="/.*\\.ips" />
<data android:pathPattern="/.*\\.ups" />
<data android:pathPattern="/.*\\.bps" />
<data android:pathPattern="/.*\\.ppf" />
<data android:pathPattern="/.*\\.ebp" />
<data android:pathPattern="/.*\\.dps" />
<data android:pathPattern="/.*\\.xdelta" />
<data android:pathPattern="/.*\\.xdelta3" />
<data android:pathPattern="/.*\\.vcdiff" />
<data android:host="*" />
<data android:scheme="file"/>
<data android:mimeType="*/*"/>
<data android:pathPattern="/.*\\.aps"/>
<data android:pathPattern="/.*\\.ips"/>
<data android:pathPattern="/.*\\.ups"/>
<data android:pathPattern="/.*\\.bps"/>
<data android:pathPattern="/.*\\.ppf"/>
<data android:pathPattern="/.*\\.ebp"/>
<data android:pathPattern="/.*\\.dps"/>
<data android:pathPattern="/.*\\.xdelta"/>
<data android:pathPattern="/.*\\.xdelta3"/>
<data android:pathPattern="/.*\\.vcdiff"/>
<data android:host="*"/>
</intent-filter>
</activity>
<activity
android:name=".ui.activity.FilePickerActivity"
android:label="@string/file_picker_activity_title" />
android:label="@string/file_picker_activity_title"/>
<activity
android:name=".ui.activity.SettingsActivity"
android:label="@string/settings_activity_title"
android:theme="@style/PreferenceTheme" />
android:theme="@style/PreferenceTheme"/>
<activity
android:name=".ui.activity.HelpActivity"
android:label="@string/help_activity_title" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
android:label="@string/help_activity_title"/>
<activity
android:name=".ui.activity.DonateActivity"
android:label="@string/donate_activity_title" />
android:label="@string/donate_activity_title"/>
<service
android:name=".WorkerService"
android:exported="false" />
android:exported="false"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
</application>

View file

@ -39,11 +39,10 @@ const int ERR_UNABLE_OPEN_OUTPUT = -5003;
const int ERR_WRONG_CHECKSUM = -5010;
int Java_org_emunix_unipatcher_patch_XDelta_xdelta3apply(JNIEnv *env,
jobject this,
jstring patchPath,
jstring romPath,
jstring outputPath)
{
jobject this,
jstring patchPath,
jstring romPath,
jstring outputPath) {
int ret = 0;
const char *patchName = (*env)->GetStringUTFChars(env, patchPath, NULL);
const char *romName = (*env)->GetStringUTFChars(env, romPath, NULL);
@ -57,19 +56,16 @@ int Java_org_emunix_unipatcher_patch_XDelta_xdelta3apply(JNIEnv *env,
(*env)->ReleaseStringUTFChars(env, romPath, romName);
(*env)->ReleaseStringUTFChars(env, outputPath, outputName);
if (!patchFile)
{
if (!patchFile) {
return ERR_UNABLE_OPEN_PATCH;
}
if (!romFile)
{
if (!romFile) {
fclose(patchFile);
return ERR_UNABLE_OPEN_ROM;
}
if (!outputFile)
{
if (!outputFile) {
fclose(patchFile);
fclose(romFile);
return ERR_UNABLE_OPEN_OUTPUT;
@ -83,19 +79,18 @@ int Java_org_emunix_unipatcher_patch_XDelta_xdelta3apply(JNIEnv *env,
return ret;
}
int apply(FILE *patch, FILE *in, FILE *out)
{
int apply(FILE *patch, FILE *in, FILE *out) {
int BUFFER_SIZE = 32768;
int r, ret;
xd3_stream stream;
xd3_config config;
xd3_source source;
void* Input_Buf;
void *Input_Buf;
int Input_Buf_Read;
memset (&stream, 0, sizeof (stream));
memset (&source, 0, sizeof (source));
memset(&stream, 0, sizeof(stream));
memset(&source, 0, sizeof(source));
xd3_init_config(&config, 0);
config.winsize = BUFFER_SIZE;
@ -108,18 +103,16 @@ int apply(FILE *patch, FILE *in, FILE *out)
r = fseek(in, 0, SEEK_SET);
if (r)
return r;
source.onblk = fread((void*)source.curblk, 1, source.blksize, in);
source.onblk = fread((void *) source.curblk, 1, source.blksize, in);
source.curblkno = 0;
xd3_set_source(&stream, &source);
Input_Buf = malloc(BUFFER_SIZE);
fseek(patch, 0, SEEK_SET);
do
{
do {
Input_Buf_Read = fread(Input_Buf, 1, BUFFER_SIZE, patch);
if (Input_Buf_Read < BUFFER_SIZE)
{
if (Input_Buf_Read < BUFFER_SIZE) {
xd3_set_flags(&stream, XD3_FLUSH | stream.flags);
}
xd3_avail_input(&stream, Input_Buf, Input_Buf_Read);
@ -128,14 +121,13 @@ int apply(FILE *patch, FILE *in, FILE *out)
ret = xd3_decode_input(&stream);
switch (ret)
{
switch (ret) {
case XD3_INPUT:
continue;
case XD3_OUTPUT:
r = fwrite(stream.next_out, 1, stream.avail_out, out);
if (r != (int)stream.avail_out)
if (r != (int) stream.avail_out)
return r;
xd3_consume_output(&stream);
goto process;
@ -144,7 +136,7 @@ int apply(FILE *patch, FILE *in, FILE *out)
r = fseek(in, source.blksize * source.getblkno, SEEK_SET);
if (r)
return r;
source.onblk = fread((void*)source.curblk, 1, source.blksize, in);
source.onblk = fread((void *) source.curblk, 1, source.blksize, in);
source.curblkno = source.getblkno;
goto process;
@ -166,7 +158,7 @@ int apply(FILE *patch, FILE *in, FILE *out)
free(Input_Buf);
free((void*)source.curblk);
free((void *) source.curblk);
xd3_close_stream(&stream);
xd3_free_stream(&stream);

View file

@ -73,17 +73,20 @@ public class Utils {
public static long getFreeSpace(File file) {
StatFs stat = new StatFs(file.getPath());
long bytesAvailable;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
bytesAvailable = stat.getAvailableBytes();
else
//noinspection deprecation
} else
//noinspection deprecation
{
bytesAvailable = (long) stat.getBlockSize() * (long) stat.getAvailableBlocks();
}
return bytesAvailable;
}
public static void copyFile(Context context, File from, File to) throws IOException {
if (Utils.getFreeSpace(to.getParentFile()) < from.length())
if (Utils.getFreeSpace(to.getParentFile()) < from.length()) {
throw new IOException(context.getString(R.string.notify_error_not_enough_space));
}
try {
FileUtils.copyFile(from, to);
@ -94,7 +97,7 @@ public class Utils {
public static void moveFile(Context context, File from, File to) throws IOException {
FileUtils.deleteQuietly(to);
if(!from.renameTo(to)) {
if (!from.renameTo(to)) {
copyFile(context, from, to);
FileUtils.deleteQuietly(from);
}
@ -141,24 +144,28 @@ public class Utils {
public static String bytesToHexString(byte[] bytes) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < bytes.length ;i++) {
for (int i = 0; i < bytes.length; i++) {
sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
}
return sb.toString();
}
public static boolean isPatch(File file) {
String[] patches = {"ips", "ups", "bps", "aps", "ppf", "dps", "ebp", "xdelta", "xdelta3", "vcdiff"};
String[] patches =
{"ips", "ups", "bps", "aps", "ppf", "dps", "ebp", "xdelta", "xdelta3", "vcdiff"};
String ext = FilenameUtils.getExtension(file.getName()).toLowerCase(Locale.getDefault());
for (String patch : patches) {
if (ext.equals(patch))
return true;
if (ext.equals(patch)) return true;
}
return false;
}
public static boolean isArchive(String path) {
String ext = FilenameUtils.getExtension(path).toLowerCase(Locale.getDefault());
return ext.equals("zip") || ext.equals("rar") || ext.equals("7z") || ext.equals("gz") || ext.equals("tgz");
return ext.equals("zip")
|| ext.equals("rar")
|| ext.equals("7z")
|| ext.equals("gz")
|| ext.equals("tgz");
}
}

View file

@ -99,7 +99,7 @@ public class WorkerService extends IntentService {
File outputFile = new File(intent.getStringExtra("outputPath"));
Patch patcher = null;
if(!fileExists(patchFile) || !fileExists(romFile))
if (!fileExists(patchFile) || !fileExists(romFile))
return;
// create output dir
@ -115,7 +115,7 @@ public class WorkerService extends IntentService {
// check access to output dir
try {
if (!outputFile.getParentFile().canWrite()){
if (!outputFile.getParentFile().canWrite()) {
String text = getString(R.string.notify_error_unable_to_write_to_directory, outputFile.getParent());
showErrorNotification(text);
return;
@ -176,7 +176,7 @@ public class WorkerService extends IntentService {
String errorMsg = null;
File romFile = new File(intent.getStringExtra("romPath"));
if(!fileExists(romFile))
if (!fileExists(romFile))
return;
SmdFixChecksum fixer = new SmdFixChecksum(this, romFile);
@ -200,7 +200,7 @@ public class WorkerService extends IntentService {
File romFile = new File(intent.getStringExtra("romPath"));
String headerPath = intent.getStringExtra("headerPath");
if(!fileExists(romFile))
if (!fileExists(romFile))
return;
SnesSmcHeader worker = new SnesSmcHeader();
@ -230,7 +230,7 @@ public class WorkerService extends IntentService {
File romFile = new File(intent.getStringExtra("romPath"));
if(!fileExists(romFile))
if (!fileExists(romFile))
return;
SnesSmcHeader worker = new SnesSmcHeader();
@ -271,7 +271,7 @@ public class WorkerService extends IntentService {
.setContentIntent(PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT))
.setAutoCancel(true)
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(text))
.bigText(text))
.build();
nm.notify(0, notify);
}

View file

@ -47,9 +47,11 @@ public class APS extends Patch {
Patch aps = null;
switch (checkAPS(patchFile)) {
case APS_N64_PATCH:
aps = new APS_N64(context, patchFile, romFile, outputFile); break;
aps = new APS_N64(context, patchFile, romFile, outputFile);
break;
case APS_GBA_PATCH:
aps = new APS_GBA(context, patchFile, romFile, outputFile); break;
aps = new APS_GBA(context, patchFile, romFile, outputFile);
break;
case NOT_APS_PATCH:
throw new PatchException(context.getString(R.string.notify_error_not_aps_patch));
}

View file

@ -130,7 +130,7 @@ public class APS_GBA extends Patch {
crc = crc16(romBuf);
for(int i = 0; i < CHUNK_SIZE; i++)
for (int i = 0; i < CHUNK_SIZE; i++)
romBuf[i] ^= patchBuf[i];
if (crc == patchCrc1) {
@ -151,7 +151,7 @@ public class APS_GBA extends Patch {
IOUtils.closeQuietly(output);
}
if(isOriginal) {
if (isOriginal) {
Utils.truncateFile(outputFile, fileSize2);
} else {
Utils.truncateFile(outputFile, fileSize1);

View file

@ -144,7 +144,7 @@ public class APS_N64 extends Patch {
size = patchStream.read();
patchPos++;
if (size != 0) {
byte[] data = new byte[(int)size];
byte[] data = new byte[(int) size];
patchStream.read(data);
patchPos += size;
outputStream.write(data);
@ -153,7 +153,7 @@ public class APS_N64 extends Patch {
byte val = (byte) patchStream.read();
size = patchStream.read();
patchPos += 2;
byte[] data = new byte[(int)size];
byte[] data = new byte[(int) size];
Arrays.fill(data, val);
outputStream.write(data);
outPos += size;
@ -164,7 +164,7 @@ public class APS_N64 extends Patch {
if (romPos + size > romSize) {
romPos = (int) romSize;
} else {
byte[] buf = new byte[(int)size];
byte[] buf = new byte[(int) size];
romStream.read(buf);
romPos += size;
}
@ -226,7 +226,7 @@ public class APS_N64 extends Patch {
}
private long readLELong(InputStream stream) throws IOException {
return (stream.read() & 0xff) + ((stream.read() & 0xff) << 8)
return (stream.read() & 0xff) + ((stream.read() & 0xff) << 8)
+ ((stream.read() & 0xff) << 16) + ((stream.read() & 0xff) << 24);
}
}

View file

@ -250,7 +250,7 @@ public class BPS extends Patch {
throw new PatchException(context.getString(R.string.notify_error_patch_corrupted));
return new BpsCrc(inputCrc, outputCrc, patchCrc, realPatchCrc);
} finally {
IOUtils.closeQuietly(stream);
IOUtils.closeQuietly(stream);
}
}

View file

@ -44,11 +44,11 @@ public class DPS extends Patch {
@Override
public void apply() throws PatchException, IOException {
if (patchFile.length() < MIN_SIZE_PATCH) {
throw new PatchException(context.getString(R.string.notify_error_patch_corrupted));
}
if (patchFile.length() < MIN_SIZE_PATCH) {
throw new PatchException(context.getString(R.string.notify_error_patch_corrupted));
}
BufferedInputStream patchStream = null;
BufferedInputStream patchStream = null;
RandomAccessFile romStream = null;
RandomAccessFile outputStream = null;
@ -121,7 +121,7 @@ public class DPS extends Patch {
}
private long getUInt(byte[] a, int offset) {
return ((long)(a[offset] & 0xff)) + ((long)(a[offset + 1] & 0xff) << 8) +
((long)(a[offset + 2] & 0xff) << 16) + ((long)(a[offset + 3] & 0xff) << 24);
return ((long) (a[offset] & 0xff)) + ((long) (a[offset + 1] & 0xff) << 8) +
((long) (a[offset + 2] & 0xff) << 16) + ((long) (a[offset + 3] & 0xff) << 24);
}
}

View file

@ -106,7 +106,7 @@ public class EBP extends Patch {
// if we couldn't fix the ROM, try to remove a 0xff byte at the end.
if (!checkMD5(file)) {
int length = (int)file.length();
int length = (int) file.length();
byte[] buffer = new byte[length];
FileInputStream in = new FileInputStream(file);
int count = in.read(buffer);
@ -254,7 +254,7 @@ public class EBP extends Patch {
if (size < 2)
throw new PatchException(context.getString(R.string.notify_error_patch_corrupted));
ips.write(buffer, 0, 2);
size = (((int)buffer[0] & 0xff) << 8) + ((int)buffer[1] & 0xff);
size = (((int) buffer[0] & 0xff) << 8) + ((int) buffer[1] & 0xff);
if (size != 0) {
int c = ebp.read(buffer, 0, size);
if (c < size)

View file

@ -32,7 +32,6 @@ import java.util.Arrays;
public class PPF extends Patch {
// private static final String LOG_TAG = "PPF";
private static final byte[] MAGIC_NUMBER = {0x50, 0x50, 0x46}; // "PPF" without version
private RandomAccessFile patchStream;
@ -75,10 +74,17 @@ public class PPF extends Patch {
}
switch (getPPFVersion(patchFile)) {
case 1: applyPPF1(); break;
case 2: applyPPF2(); break;
case 3: applyPPF3(); break;
default: throw new PatchException(context.getString(R.string.notify_error_not_ppf_patch));
case 1:
applyPPF1();
break;
case 2:
applyPPF2();
break;
case 3:
applyPPF3();
break;
default:
throw new PatchException(context.getString(R.string.notify_error_not_ppf_patch));
}
}
@ -217,24 +223,24 @@ public class PPF extends Patch {
private long readLittleEndianLong(RandomAccessFile stream) throws IOException {
byte[] b = new byte[8];
stream.read(b);
long result = ((long)(b[7] & 0xff) << 56) + ((long)(b[6] & 0xff) << 48 ) +
((long)(b[5] & 0xff) << 40) + ((long)(b[4] & 0xff) << 32 ) +
((long)(b[3] & 0xff) << 24) + ((long)(b[2] & 0xff) << 16 ) +
((long)(b[1] & 0xff) << 8) + ((long)b[0] & 0xff);
long result = ((long) (b[7] & 0xff) << 56) + ((long) (b[6] & 0xff) << 48) +
((long) (b[5] & 0xff) << 40) + ((long) (b[4] & 0xff) << 32) +
((long) (b[3] & 0xff) << 24) + ((long) (b[2] & 0xff) << 16) +
((long) (b[1] & 0xff) << 8) + ((long) b[0] & 0xff);
return result;
}
private int readLittleEndianInt(RandomAccessFile stream) throws IOException {
byte[] b = new byte[4];
stream.read(b);
return ((b[3] & 0xff) << 24) + ((b[2] & 0xff) <<16 ) +
((b[1] & 0xff) << 8) + (b[0]&0xff);
return ((b[3] & 0xff) << 24) + ((b[2] & 0xff) << 16) +
((b[1] & 0xff) << 8) + (b[0] & 0xff);
}
/**
* Returns size of FileID
*
* @param stream stream of PPF file
* @param stream stream of PPF file
* @param ppfVersion version of PPF patch
* @return size of FileID or 0
*/

View file

@ -38,6 +38,7 @@ import java.util.zip.CRC32;
public class UPS extends Patch {
private static final byte[] MAGIC_NUMBER = {0x55, 0x50, 0x53, 0x31}; // "UPS1"
public UPS(Context context, File patch, File rom, File output) {
super(context, patch, rom, output);
}
@ -197,7 +198,7 @@ public class UPS extends Patch {
throw new PatchException(context.getString(R.string.notify_error_patch_corrupted));
return new UpsCrc(inputCrc, outputCrc, patchCrc, realPatchCrc);
} finally {
IOUtils.closeQuietly(stream);
IOUtils.closeQuietly(stream);
}
}
@ -243,7 +244,7 @@ public class UPS extends Patch {
return realPatchCRC;
}
public void swapInOut(){
public void swapInOut() {
long tmp;
tmp = inputFileCRC;
inputFileCRC = outputFileCRC;

View file

@ -51,7 +51,7 @@ public class SmdFixChecksum {
try {
smdStream = new BufferedInputStream(new FileInputStream(smdFile));
long c = IOUtils.skip(smdStream, 512);
long c = IOUtils.skip(smdStream, 512);
if (c != 512)
throw new IOException("Skip failed");
@ -83,7 +83,7 @@ public class SmdFixChecksum {
smdStream.writeByte((sum >> 8) & 0xff);
smdStream.writeByte(sum & 0xff);
} finally {
IOUtils.closeQuietly(smdStream);
IOUtils.closeQuietly(smdStream);
}
}
}

View file

@ -60,7 +60,7 @@ public class SnesSmcHeader {
int length;
length = inputRom.read(header);
if (saveHeader) {
File headerfile = new File(romfile.getPath()+".smc_header");
File headerfile = new File(romfile.getPath() + ".smc_header");
outputHeader = new FileOutputStream(headerfile);
outputHeader.write(header, 0, length);
}

View file

@ -216,7 +216,7 @@ public class FilePickerActivity extends AppCompatActivity implements FilePickerA
fileList.add(entry);
} else {
entry = new FileEntry();
if (Utils.isPatch(file)){
if (Utils.isPatch(file)) {
entry.setIcon(R.drawable.ic_healing_grey600_24dp);
} else {
entry.setIcon(R.drawable.ic_insert_drive_file_grey600_24dp);
@ -359,8 +359,7 @@ public class FilePickerActivity extends AppCompatActivity implements FilePickerA
}
}
private HashMap<String, String> getFileChecksums(File file) throws IOException, NoSuchAlgorithmException, IllegalArgumentException
{
private HashMap<String, String> getFileChecksums(File file) throws IOException, NoSuchAlgorithmException, IllegalArgumentException {
if (file.isDirectory())
throw new IllegalArgumentException("Unable calculate checksum for directory");

View file

@ -54,7 +54,7 @@ import static android.support.v7.app.AppCompatDelegate.MODE_NIGHT_NO;
import static android.support.v7.app.AppCompatDelegate.MODE_NIGHT_YES;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
implements NavigationView.OnNavigationItemSelectedListener {
private static final String LOG_TAG = "org.emunix.unipatcher";
private FirebaseAnalytics firebaseAnalytics;
@ -84,7 +84,7 @@ public class MainActivity extends AppCompatActivity
public void onClick(View view) {
FragmentManager fragmentManager = getSupportFragmentManager();
ActionFragment fragment = (ActionFragment) fragmentManager.findFragmentById(R.id.content_frame);
if (fragment != null){
if (fragment != null) {
boolean ret = fragment.runAction();
}
//Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
@ -105,7 +105,7 @@ public class MainActivity extends AppCompatActivity
private void setTheme() {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
String theme = sp.getString("theme","light");
String theme = sp.getString("theme", "light");
switch (theme) {
case "light":
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
@ -156,9 +156,14 @@ public class MainActivity extends AppCompatActivity
// update the main content by replacing fragments
Fragment fragment;
switch (position) {
case 1: fragment = new SmdFixChecksumFragment(); break;
case 2: fragment = new SnesSmcHeaderFragment(); break;
default: fragment = new PatchingFragment();
case 1:
fragment = new SmdFixChecksumFragment();
break;
case 2:
fragment = new SnesSmcHeaderFragment();
break;
default:
fragment = new PatchingFragment();
}
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();

View file

@ -38,6 +38,7 @@ public class FilePickerAdapter extends RecyclerView.Adapter<FilePickerAdapter.Vi
public interface OnItemClickListener {
void onItemClick(View v, int position);
void onItemLongClick(View v, int position);
}

View file

@ -58,7 +58,8 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
private String patchPath = null;
private String outputPath = null;
public PatchingFragment() {}
public PatchingFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
@ -118,14 +119,14 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
}
private void restoreState(Bundle savedInstanceState) {
if (savedInstanceState != null){
if (savedInstanceState != null) {
romPath = savedInstanceState.getString("romPath");
patchPath = savedInstanceState.getString("patchPath");
outputPath = savedInstanceState.getString("outputPath");
if (romPath != null)
romNameTextView.setText(new File(romPath).getName());
if (patchPath != null)
patchNameTextView.setText(new File (patchPath).getName());
patchNameTextView.setText(new File(patchPath).getName());
if (outputPath != null)
outputNameTextView.setText(new File(outputPath).getName());
}
@ -140,7 +141,7 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
}
@Override
public void onClick(View view){
public void onClick(View view) {
Intent intent = new Intent(getActivity(), FilePickerActivity.class);
switch (view.getId()) {
case R.id.patchCardView:
@ -160,7 +161,7 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data){
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(LOG_TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);
if (resultCode == Activity.RESULT_OK) {
String path = data.getStringExtra("path");
@ -171,20 +172,20 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
}
switch (requestCode) {
case SELECT_ROM_FILE:
romPath = path;
romNameTextView.setVisibility(View.VISIBLE);
romNameTextView.setText(fpath.getName());
Settings.setLastRomDir(getActivity(), fpath.getParent());
outputPath = makeOutputPath(path);
outputNameTextView.setText(new File(outputPath).getName());
break;
case SELECT_PATCH_FILE:
patchPath = path;
patchNameTextView.setVisibility(View.VISIBLE);
patchNameTextView.setText(fpath.getName());
Settings.setLastPatchDir(getActivity(), fpath.getParent());
break;
case SELECT_ROM_FILE:
romPath = path;
romNameTextView.setVisibility(View.VISIBLE);
romNameTextView.setText(fpath.getName());
Settings.setLastRomDir(getActivity(), fpath.getParent());
outputPath = makeOutputPath(path);
outputNameTextView.setText(new File(outputPath).getName());
break;
case SELECT_PATCH_FILE:
patchPath = path;
patchNameTextView.setVisibility(View.VISIBLE);
patchNameTextView.setText(fpath.getName());
Settings.setLastPatchDir(getActivity(), fpath.getParent());
break;
}
}
super.onActivityResult(requestCode, resultCode, data);
@ -200,14 +201,14 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
return FilenameUtils.concat(dir, baseName.concat(" [patched].").concat(ext));
}
public boolean runAction(){
if (romPath == null & patchPath == null){
public boolean runAction() {
if (romPath == null & patchPath == null) {
Toast.makeText(getActivity(), getString(R.string.main_activity_toast_rom_and_patch_not_selected), Toast.LENGTH_LONG).show();
return false;
} else if (romPath == null){
} else if (romPath == null) {
Toast.makeText(getActivity(), getString(R.string.main_activity_toast_rom_not_selected), Toast.LENGTH_LONG).show();
return false;
} else if (patchPath == null){
} else if (patchPath == null) {
Toast.makeText(getActivity(), getString(R.string.main_activity_toast_patch_not_selected), Toast.LENGTH_LONG).show();
return false;
}
@ -219,11 +220,11 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
intent.putExtra("outputPath", outputPath);
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;
}
private void renameOutputRom(){
private void renameOutputRom() {
if (romPath == null) {
Toast.makeText(getActivity(), getString(R.string.main_activity_toast_rom_not_selected), Toast.LENGTH_LONG).show();
return;

View file

@ -49,7 +49,8 @@ public class SmdFixChecksumFragment extends ActionFragment implements View.OnCli
private TextView fixChecksumInfoTextview;
private String romPath = null;
public SmdFixChecksumFragment() {}
public SmdFixChecksumFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
@ -87,7 +88,7 @@ public class SmdFixChecksumFragment extends ActionFragment implements View.OnCli
}
private void restoreState(Bundle savedInstanceState) {
if (savedInstanceState != null){
if (savedInstanceState != null) {
romPath = savedInstanceState.getString("romPath");
if (romPath != null)
romNameTextView.setText(new File(romPath).getName());
@ -101,7 +102,7 @@ public class SmdFixChecksumFragment extends ActionFragment implements View.OnCli
}
@Override
public void onClick(View view){
public void onClick(View view) {
Intent intent = new Intent(getActivity(), FilePickerActivity.class);
switch (view.getId()) {
case R.id.romCardView:
@ -113,7 +114,7 @@ public class SmdFixChecksumFragment extends ActionFragment implements View.OnCli
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data){
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(LOG_TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);
if (resultCode == Activity.RESULT_OK) {
String path = data.getStringExtra("path");
@ -134,8 +135,8 @@ public class SmdFixChecksumFragment extends ActionFragment implements View.OnCli
super.onActivityResult(requestCode, resultCode, data);
}
public boolean runAction(){
if (romPath == null){
public boolean runAction() {
if (romPath == null) {
Toast.makeText(getActivity(), getString(R.string.main_activity_toast_rom_not_selected), Toast.LENGTH_LONG).show();
return false;
}
@ -145,7 +146,7 @@ public class SmdFixChecksumFragment extends ActionFragment implements View.OnCli
intent.putExtra("romPath", romPath);
getActivity().startService(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;
}
}

View file

@ -55,7 +55,8 @@ public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClic
private int action = 0;
public SnesSmcHeaderFragment() {}
public SnesSmcHeaderFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
@ -69,7 +70,7 @@ public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClic
romNameTextView = (TextView) view.findViewById(R.id.romNameTextView);
headerNameTextView = (TextView) view.findViewById(R.id.headerNameTextView);
headerInfoTextView = (TextView) view.findViewById(R.id.headerInfoTextView);
CardView romCardView = (CardView) view.findViewById(R.id.romCardView);
romCardView.setOnClickListener(this);
headerCardView = (CardView) view.findViewById(R.id.headerCardView);
@ -99,7 +100,7 @@ public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClic
}
private void restoreState(Bundle savedInstanceState) {
if (savedInstanceState != null){
if (savedInstanceState != null) {
romPath = savedInstanceState.getString("romPath");
headerPath = savedInstanceState.getString("headerPath");
action = savedInstanceState.getInt("action");
@ -126,7 +127,7 @@ public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClic
}
@Override
public void onClick(View view){
public void onClick(View view) {
Intent intent = new Intent(getActivity(), FilePickerActivity.class);
switch (view.getId()) {
case R.id.romCardView:
@ -142,7 +143,7 @@ public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClic
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data){
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(LOG_TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);
if (resultCode == Activity.RESULT_OK) {
String path = data.getStringExtra("path");
@ -179,8 +180,8 @@ public class SnesSmcHeaderFragment extends ActionFragment implements View.OnClic
super.onActivityResult(requestCode, resultCode, data);
}
public boolean runAction(){
if (romPath == null){
public boolean runAction() {
if (romPath == null) {
Toast.makeText(getActivity(), getString(R.string.main_activity_toast_rom_not_selected), Toast.LENGTH_LONG).show();
return false;
}

View file

@ -68,6 +68,7 @@ public abstract class Notify {
}
public abstract void setCompleted();
public abstract void setFailed(String message);
public void setProgress(boolean isEnabled) {

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator">
android:interpolator="@android:anim/decelerate_interpolator">
<translate
android:duration="500"
android:fromYDelta="100%"
android:toYDelta="0"
android:duration="500" />
android:toYDelta="0"/>
</set>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -17,7 +18,7 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay" />
app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
@ -25,6 +26,6 @@
android:id="@+id/donate_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>

View file

@ -6,18 +6,19 @@
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".ui.activity.FilePickerActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/appbar"
android:layout_alignParentTop="true"
android:theme="@style/AppTheme.AppBarOverlay">
<include layout="@layout/toolbar" />
<include layout="@layout/toolbar"/>
</android.support.design.widget.AppBarLayout>
@ -26,12 +27,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/appbar"
android:layout_margin="@dimen/activity_horizontal_margin"
android:gravity="center"
android:includeFontPadding="false"
android:layout_margin="@dimen/activity_horizontal_margin"
android:visibility="gone"
android:text="@string/permissions_storage_error_info"
android:textStyle="bold"
android:text="@string/permissions_storage_error_info" />
android:visibility="gone"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/list"

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -18,14 +19,14 @@
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize" />
android:minHeight="?attr/actionBarSize"/>
</android.support.design.widget.AppBarLayout>
@ -33,6 +34,6 @@
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>

View file

@ -19,7 +19,7 @@
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<include layout="@layout/toolbar" />
<include layout="@layout/toolbar"/>
</android.support.design.widget.AppBarLayout>
@ -36,7 +36,7 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_save_white_24dp" />
android:src="@drawable/ic_save_white_24dp"/>
</android.support.design.widget.CoordinatorLayout>
@ -47,8 +47,8 @@
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer"
app:itemIconTint="@color/colorDrawerText"
app:itemTextColor="@color/colorDrawerText"
app:itemIconTint="@color/colorDrawerText" />
app:menu="@menu/activity_main_drawer"/>
</android.support.v4.widget.DrawerLayout>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -17,7 +18,7 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay" />
app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>

View file

@ -1,41 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/item_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="@+id/item_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/row_image"
android:contentDescription="@string/icon"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="@dimen/keyline_one">
</ImageView>
<ImageView
android:id="@+id/row_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginBottom="8dp"
android:layout_marginLeft="@dimen/keyline_one"
android:layout_marginTop="8dp"
android:contentDescription="@string/icon">
</ImageView>
<TextView
android:id="@+id/row_text"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="@dimen/keyline_two"
android:layout_marginRight="@dimen/keyline_one"
android:textSize="20sp">
</TextView>
<TextView
android:id="@+id/row_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginBottom="8dp"
android:layout_marginLeft="@dimen/keyline_two"
android:layout_marginRight="@dimen/keyline_one"
android:layout_marginTop="8dp"
android:textSize="20sp">
</TextView>
</RelativeLayout>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"/>
</FrameLayout>

View file

@ -1,4 +1,6 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -19,13 +21,13 @@
<ImageView
android:id="@+id/appIcon"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="16dp"
android:src="@mipmap/ic_launcher"
android:contentDescription="@string/app_name"
android:adjustViewBounds="false"
android:contentDescription="@string/app_name"
android:cropToPadding="false"
android:layout_height="64dp" />
android:src="@mipmap/ic_launcher"/>
<LinearLayout
android:layout_width="match_parent"
@ -46,10 +48,10 @@
android:text="@string/help_activity_about_tab_version"/>
<TextView
android:text="@string/help_activity_about_tab_license"
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView" />
android:text="@string/help_activity_about_tab_license"/>
<TextView
android:id="@+id/copyright"
@ -65,7 +67,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textAppearance="@android:style/TextAppearance.Small" />
android:textAppearance="@android:style/TextAppearance.Small"/>
</LinearLayout>
</ScrollView>

View file

@ -1,4 +1,6 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -13,7 +15,7 @@
android:id="@+id/changelogText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Small" />
android:textAppearance="@android:style/TextAppearance.Small"/>
</FrameLayout>
</ScrollView>

View file

@ -1,4 +1,6 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -13,7 +15,7 @@
android:id="@+id/faqText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Small" />
android:textAppearance="@android:style/TextAppearance.Small"/>
</FrameLayout>
</ScrollView>

View file

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
@ -11,19 +12,19 @@
android:orientation="horizontal">
<TextView
android:id="@+id/name_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="8dp"
android:text="@string/file_properties_dialog_name"
android:id="@+id/name_label"
android:textSize="@dimen/material_text_subhead" />
android:textSize="@dimen/material_text_subhead"/>
<TextView
android:id="@+id/name_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/name_value"
android:textSize="@dimen/material_text_subhead"
android:textIsSelectable="true" />
android:textIsSelectable="true"
android:textSize="@dimen/material_text_subhead"/>
</LinearLayout>
<LinearLayout
@ -33,19 +34,19 @@
android:orientation="horizontal">
<TextView
android:id="@+id/path_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="8dp"
android:text="@string/file_properties_dialog_path"
android:id="@+id/path_label"
android:textSize="@dimen/material_text_subhead" />
android:textSize="@dimen/material_text_subhead"/>
<TextView
android:id="@+id/path_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/path_value"
android:textSize="@dimen/material_text_subhead"
android:textIsSelectable="true" />
android:textIsSelectable="true"
android:textSize="@dimen/material_text_subhead"/>
</LinearLayout>
@ -56,19 +57,19 @@
android:orientation="horizontal">
<TextView
android:id="@+id/size_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="8dp"
android:text="@string/file_properties_dialog_size"
android:id="@+id/size_label"
android:textSize="@dimen/material_text_subhead" />
android:textSize="@dimen/material_text_subhead"/>
<TextView
android:id="@+id/size_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/size_value"
android:textSize="@dimen/material_text_subhead"
android:textIsSelectable="true" />
android:textIsSelectable="true"
android:textSize="@dimen/material_text_subhead"/>
</LinearLayout>
@ -79,20 +80,20 @@
android:orientation="horizontal">
<TextView
android:id="@+id/crc32_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="8dp"
android:text="@string/file_properties_dialog_crc32"
android:id="@+id/crc32_label"
android:textSize="@dimen/material_text_subhead" />
android:textSize="@dimen/material_text_subhead"/>
<TextView
android:id="@+id/crc32_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/file_properties_dialog_wait_message"
android:id="@+id/crc32_value"
android:textSize="@dimen/material_text_subhead"
android:textIsSelectable="true" />
android:textIsSelectable="true"
android:textSize="@dimen/material_text_subhead"/>
</LinearLayout>
<LinearLayout
@ -102,20 +103,20 @@
android:orientation="horizontal">
<TextView
android:id="@+id/SHA1_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="8dp"
android:text="@string/file_properties_dialog_sha1"
android:id="@+id/SHA1_label"
android:textSize="@dimen/material_text_subhead" />
android:textSize="@dimen/material_text_subhead"/>
<TextView
android:id="@+id/sha1_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/file_properties_dialog_wait_message"
android:id="@+id/sha1_value"
android:textSize="@dimen/material_text_subhead"
android:textIsSelectable="true" />
android:textIsSelectable="true"
android:textSize="@dimen/material_text_subhead"/>
</LinearLayout>
<LinearLayout
@ -124,20 +125,20 @@
android:orientation="horizontal">
<TextView
android:id="@+id/md5_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="8dp"
android:text="@string/file_properties_dialog_md5"
android:id="@+id/md5_label"
android:textSize="@dimen/material_text_subhead" />
android:textSize="@dimen/material_text_subhead"/>
<TextView
android:id="@+id/md5_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/file_properties_dialog_wait_message"
android:id="@+id/md5_value"
android:textSize="@dimen/material_text_subhead"
android:textIsSelectable="true" />
android:textIsSelectable="true"
android:textSize="@dimen/material_text_subhead"/>
</LinearLayout>
</LinearLayout>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/drawer_header"

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true">
@ -18,30 +19,30 @@
android:padding="@dimen/card_padding">
<TextView
android:id="@+id/patchLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/patchLabel"
android:padding="8dp"
android:text="@string/main_activity_patch_file"
android:textColor="@color/colorCardHeaderText"
android:textSize="24sp"/>
<View
android:layout_marginTop="@dimen/card_line_margin"
android:layout_marginBottom="@dimen/card_line_margin"
android:layout_width="match_parent"
android:layout_height="@dimen/card_line_height"
android:layout_marginBottom="@dimen/card_line_margin"
android:layout_marginTop="@dimen/card_line_margin"
android:background="@color/colorCardLine"/>
<TextView
android:id="@+id/patchNameTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/patchNameTextView"
android:drawableLeft="@drawable/ic_folder_grey600_24dp"
android:drawablePadding="8dp"
android:padding="8dp"
android:text="@string/main_activity_tap_to_select"
android:textSize="20sp"
android:drawableLeft="@drawable/ic_folder_grey600_24dp"
android:drawablePadding="8dp"/>
android:textSize="20sp"/>
</LinearLayout>
@ -58,30 +59,30 @@
android:padding="@dimen/card_padding">
<TextView
android:id="@+id/romLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/romLabel"
android:padding="8dp"
android:text="@string/main_activity_rom_file"
android:textColor="@color/colorCardHeaderText"
android:textSize="24sp"/>
<View
android:layout_marginTop="@dimen/card_line_margin"
android:layout_marginBottom="@dimen/card_line_margin"
android:layout_width="match_parent"
android:layout_height="@dimen/card_line_height"
android:layout_marginBottom="@dimen/card_line_margin"
android:layout_marginTop="@dimen/card_line_margin"
android:background="@color/colorCardLine"/>
<TextView
android:id="@+id/romNameTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/romNameTextView"
android:drawableLeft="@drawable/ic_folder_grey600_24dp"
android:drawablePadding="8dp"
android:padding="8dp"
android:text="@string/main_activity_tap_to_select"
android:textSize="20sp"
android:drawableLeft="@drawable/ic_folder_grey600_24dp"
android:drawablePadding="8dp"/>
android:textSize="20sp"/>
</LinearLayout>
@ -98,30 +99,30 @@
android:padding="@dimen/card_padding">
<TextView
android:id="@+id/outputLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/outputLabel"
android:padding="8dp"
android:text="@string/main_activity_output_file"
android:textColor="@color/colorCardHeaderText"
android:textSize="24sp"/>
<View
android:layout_marginTop="@dimen/card_line_margin"
android:layout_marginBottom="@dimen/card_line_margin"
android:layout_width="match_parent"
android:layout_height="@dimen/card_line_height"
android:layout_marginBottom="@dimen/card_line_margin"
android:layout_marginTop="@dimen/card_line_margin"
android:background="@color/colorCardLine"/>
<TextView
android:id="@+id/outputNameTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/outputNameTextView"
android:padding="8dp"
android:textSize="20sp"
android:text="@string/main_activity_tap_to_rename"
android:drawableLeft="@drawable/ic_edit_grey600_24dp"
android:drawablePadding="8dp"/>
android:drawablePadding="8dp"
android:padding="8dp"
android:text="@string/main_activity_tap_to_rename"
android:textSize="20sp"/>
</LinearLayout>
</android.support.v7.widget.CardView>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true">
@ -18,9 +19,9 @@
android:padding="@dimen/card_padding">
<TextView
android:id="@+id/romLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/romLabel"
android:padding="8dp"
android:text="@string/main_activity_rom_file"
android:textColor="@color/colorCardHeaderText"
@ -28,21 +29,21 @@
<View
android:id="@+id/romLine"
android:layout_marginTop="@dimen/card_line_margin"
android:layout_marginBottom="@dimen/card_line_margin"
android:layout_width="match_parent"
android:layout_height="@dimen/card_line_height"
android:layout_marginBottom="@dimen/card_line_margin"
android:layout_marginTop="@dimen/card_line_margin"
android:background="@color/colorCardLine"/>
<TextView
android:id="@+id/romNameTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/romNameTextView"
android:drawableLeft="@drawable/ic_folder_grey600_24dp"
android:drawablePadding="8dp"
android:padding="8dp"
android:text="@string/main_activity_tap_to_select"
android:textSize="20sp"
android:drawableLeft="@drawable/ic_folder_grey600_24dp"
android:drawablePadding="8dp"/>
android:textSize="20sp"/>
</LinearLayout>
@ -53,12 +54,12 @@
style="@style/Card">
<TextView
android:padding="@dimen/card_padding"
android:id="@+id/fixChecksumInfoTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/fixChecksumInfoTextView"
android:textSize="16sp"
android:text="@string/smd_fix_checksum_help"/>
android:padding="@dimen/card_padding"
android:text="@string/smd_fix_checksum_help"
android:textSize="16sp"/>
</android.support.v7.widget.CardView>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true">
@ -18,9 +19,9 @@
android:padding="@dimen/card_padding">
<TextView
android:id="@+id/romLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/romLabel"
android:padding="8dp"
android:text="@string/main_activity_rom_file"
android:textColor="@color/colorCardHeaderText"
@ -28,21 +29,21 @@
<View
android:id="@+id/romLine"
android:layout_marginTop="@dimen/card_line_margin"
android:layout_marginBottom="@dimen/card_line_margin"
android:layout_width="match_parent"
android:layout_height="@dimen/card_line_height"
android:layout_marginBottom="@dimen/card_line_margin"
android:layout_marginTop="@dimen/card_line_margin"
android:background="@color/colorCardLine"/>
<TextView
android:id="@+id/romNameTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/romNameTextView"
android:drawableLeft="@drawable/ic_folder_grey600_24dp"
android:drawablePadding="8dp"
android:padding="8dp"
android:text="@string/main_activity_tap_to_select"
android:textSize="20sp"
android:drawableLeft="@drawable/ic_folder_grey600_24dp"
android:drawablePadding="8dp"/>
android:textSize="20sp"/>
</LinearLayout>
@ -53,12 +54,12 @@
style="@style/Card">
<TextView
android:padding="@dimen/card_padding"
android:id="@+id/headerInfoTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/headerInfoTextView"
android:textSize="16sp"
android:text="@string/snes_smc_header_help"/>
android:padding="@dimen/card_padding"
android:text="@string/snes_smc_header_help"
android:textSize="16sp"/>
</android.support.v7.widget.CardView>
@ -74,9 +75,9 @@
android:padding="@dimen/card_padding">
<TextView
android:id="@+id/headerLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/headerLabel"
android:padding="8dp"
android:text="@string/main_activity_header_file"
android:textColor="@color/colorCardHeaderText"
@ -84,21 +85,21 @@
<View
android:id="@+id/headerLine"
android:layout_marginTop="@dimen/card_line_margin"
android:layout_marginBottom="@dimen/card_line_margin"
android:layout_width="match_parent"
android:layout_height="@dimen/card_line_height"
android:layout_marginBottom="@dimen/card_line_margin"
android:layout_marginTop="@dimen/card_line_margin"
android:background="@color/colorCardLine"/>
<TextView
android:id="@+id/headerNameTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/headerNameTextView"
android:drawableLeft="@drawable/ic_folder_grey600_24dp"
android:drawablePadding="8dp"
android:padding="8dp"
android:text="@string/main_activity_tap_to_select"
android:textSize="20sp"
android:drawableLeft="@drawable/ic_folder_grey600_24dp"
android:drawablePadding="8dp"/>
android:textSize="20sp"/>
</LinearLayout>

View file

@ -6,4 +6,4 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
app:popupTheme="@style/AppTheme.PopupOverlay"/>

View file

@ -1,17 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".ui.activity.HelpActivity" >
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".ui.activity.HelpActivity">
<item android:id="@+id/action_send_feedback"
android:title="@string/help_activity_action_send_feedback"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/action_send_feedback"
android:orderInCategory="100"
android:title="@string/help_activity_action_send_feedback"
app:showAsAction="never"/>
<item android:id="@+id/action_visit_website"
android:title="@string/help_activity_action_visit_site"
android:orderInCategory="200"
app:showAsAction="never" />
<item
android:id="@+id/action_visit_website"
android:orderInCategory="200"
android:title="@string/help_activity_action_visit_site"
app:showAsAction="never"/>
</menu>

View file

@ -1,46 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group
android:checkableBehavior="single"
android:id="@+id/grp_action">
<group
android:id="@+id/grp_action"
android:checkableBehavior="single">
<item
android:id="@+id/nav_apply_patch"
android:icon="@drawable/ic_healing_grey600_24dp"
android:title="@string/nav_apply_patch" />
android:title="@string/nav_apply_patch"/>
<item
android:id="@+id/nav_smd_fix_checksum"
android:icon="@drawable/ic_fingerprint_grey600_24dp"
android:title="@string/nav_smd_fix_checksum" />
android:title="@string/nav_smd_fix_checksum"/>
<item
android:id="@+id/nav_snes_add_del_smc_header"
android:icon="@drawable/ic_content_cut_grey600_24dp"
android:title="@string/nav_snes_add_del_smc_header" />
android:title="@string/nav_snes_add_del_smc_header"/>
</group>
<group
android:checkableBehavior="none"
android:id="@+id/grp_other">
<group
android:id="@+id/grp_other"
android:checkableBehavior="none">
<item
android:id="@+id/nav_settings"
android:icon="@drawable/ic_settings_grey600_24dp"
android:title="@string/nav_settings" />
android:title="@string/nav_settings"/>
<item
android:id="@+id/nav_rate"
android:icon="@drawable/ic_thumb_up_grey600_24dp"
android:title="@string/nav_rate" />
android:title="@string/nav_rate"/>
<item
android:id="@+id/nav_donate"
android:icon="@drawable/ic_gift_grey600_24dp"
android:title="@string/nav_donate" />
android:title="@string/nav_donate"/>
<item
android:id="@+id/nav_share"
android:icon="@drawable/ic_share_grey600_24dp"
android:title="@string/nav_share" />
android:title="@string/nav_share"/>
<item
android:id="@+id/nav_help"
android:icon="@drawable/ic_help_grey600_24dp"
android:title="@string/nav_help" />
android:title="@string/nav_help"/>
</group>
</menu>

View file

@ -38,7 +38,7 @@
<string name="file_picker_activity_title_select_patch">Seleziona il file di patch</string>
<string name="file_picker_activity_title_select_header">Scegli il file di intestazione</string>
<string name="file_picker_activity_error_unable_read_dir">Impossibile leggere la cartella %1$s</string>
<!-- File properties dialog -->
<string name="file_properties_dialog_title">Proprietà</string>
<string name="file_properties_dialog_name">Nome:</string>

View file

@ -38,7 +38,7 @@
<string name="file_picker_activity_title_select_patch">Wybier plik Łatki</string>
<string name="file_picker_activity_title_select_header">Wybierz plik nagłówka</string>
<string name="file_picker_activity_error_unable_read_dir">Błędna ścieżka %1$s</string>
<!-- File properties dialog -->
<string name="file_properties_dialog_title">Właściwości</string>
<string name="file_properties_dialog_name">Nazwa:</string>

View file

@ -38,7 +38,7 @@
<string name="file_picker_activity_title_select_patch">Выберите патч</string>
<string name="file_picker_activity_title_select_header">Выберите файл заголовка</string>
<string name="file_picker_activity_error_unable_read_dir">Не удалось открыть директорию %1$s</string>
<!-- File properties dialog -->
<string name="file_properties_dialog_title">Свойства</string>
<string name="file_properties_dialog_name">Имя:</string>

View file

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This

View file

@ -38,7 +38,7 @@
<string name="file_picker_activity_title_select_patch">Select the patch file</string>
<string name="file_picker_activity_title_select_header">Select the header file</string>
<string name="file_picker_activity_error_unable_read_dir">Unable to read directory %1$s</string>
<!-- File properties dialog -->
<string name="file_properties_dialog_title">Properties</string>
<string name="file_properties_dialog_name">Name:</string>

View file

@ -15,9 +15,9 @@
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
<style name="CardsHolder">
<item name="android:orientation">vertical</item>
@ -44,9 +44,9 @@
<item name="android:foreground">?attr/selectableItemBackground</item>
</style>
<style name="AppTheme.NoActionBar.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.NoActionBar.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.NoActionBar.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.NoActionBar.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
<style name="PreferenceTheme" parent="AppTheme.NoActionBar">
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>

View file

@ -2,35 +2,35 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/settings_interface_header">
<ListPreference
android:key="theme"
android:title="@string/settings_theme"
android:summary="@string/settings_theme_description"
android:defaultValue="light"
android:dialogTitle="@string/settings_theme_dialog_title"
android:entries="@array/theme_names"
android:entryValues="@array/theme_values"
android:defaultValue="light" />
android:key="theme"
android:summary="@string/settings_theme_description"
android:title="@string/settings_theme"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_directories_header">
<CheckBoxPreference
android:key="remember_last_directories"
android:defaultValue="true"
android:disableDependentsState="true"
android:title="@string/settings_remember_last_directories" />
android:key="remember_last_directories"
android:title="@string/settings_remember_last_directories"/>
<EditTextPreference
android:defaultValue="/"
android:dependency="remember_last_directories"
android:key="rom_directory"
android:title="@string/settings_rom_directory"
android:defaultValue="/" />
android:title="@string/settings_rom_directory"/>
<EditTextPreference
android:defaultValue="/"
android:dependency="remember_last_directories"
android:key="patch_directory"
android:title="@string/settings_patch_directory"
android:defaultValue="/" />
android:title="@string/settings_patch_directory"/>
<EditTextPreference
android:defaultValue=""
android:key="output_directory"
android:title="@string/settings_output_directory"
android:summary="@string/settings_output_directory_description"
android:defaultValue="" />
android:title="@string/settings_output_directory"/>
</PreferenceCategory>
</PreferenceScreen>