mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Improve code quality
This commit is contained in:
parent
813cb1093e
commit
9dd01b9170
4 changed files with 16 additions and 19 deletions
|
|
@ -57,7 +57,6 @@ public class CommonsApplication extends Application {
|
||||||
|
|
||||||
public static final String FEEDBACK_EMAIL_SUBJECT = "Commons Android App (%s) Feedback";
|
public static final String FEEDBACK_EMAIL_SUBJECT = "Commons Android App (%s) Feedback";
|
||||||
|
|
||||||
private CommonsApplicationComponent component;
|
|
||||||
private RefWatcher refWatcher;
|
private RefWatcher refWatcher;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -136,9 +135,10 @@ public class CommonsApplication extends Application {
|
||||||
.subscribe(() -> {
|
.subscribe(() -> {
|
||||||
Timber.d("All accounts have been removed");
|
Timber.d("All accounts have been removed");
|
||||||
//TODO: fix preference manager
|
//TODO: fix preference manager
|
||||||
defaultPrefs.edit().clear().commit();
|
defaultPrefs.edit().clear().apply();
|
||||||
applicationPrefs.edit().clear().commit();
|
applicationPrefs.edit().clear().apply();
|
||||||
applicationPrefs.edit().putBoolean("firstrun", false).apply();otherPrefs.edit().clear().commit();
|
applicationPrefs.edit().putBoolean("firstrun", false).apply();
|
||||||
|
otherPrefs.edit().clear().apply();
|
||||||
updateAllDatabases();
|
updateAllDatabases();
|
||||||
|
|
||||||
logoutListener.onLogoutComplete();
|
logoutListener.onLogoutComplete();
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class LatLng {
|
||||||
/**
|
/**
|
||||||
* gets the latitude and longitude of a given non-null location
|
* gets the latitude and longitude of a given non-null location
|
||||||
* @param location the non-null location of the user
|
* @param location the non-null location of the user
|
||||||
* @return
|
* @return LatLng the Latitude and Longitude of a given location
|
||||||
*/
|
*/
|
||||||
public static LatLng from(@NonNull Location location) {
|
public static LatLng from(@NonNull Location location) {
|
||||||
return new LatLng(location.getLatitude(), location.getLongitude(), location.getAccuracy());
|
return new LatLng(location.getLatitude(), location.getLongitude(), location.getAccuracy());
|
||||||
|
|
@ -48,13 +48,12 @@ public class LatLng {
|
||||||
* creates a hash code for the longitude and longitude
|
* creates a hash code for the longitude and longitude
|
||||||
*/
|
*/
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
boolean var1 = true;
|
byte var1 = 1;
|
||||||
byte var2 = 1;
|
long var2 = Double.doubleToLongBits(this.latitude);
|
||||||
long var3 = Double.doubleToLongBits(this.latitude);
|
int var3 = 31 * var1 + (int)(var2 ^ var2 >>> 32);
|
||||||
int var5 = 31 * var2 + (int)(var3 ^ var3 >>> 32);
|
var2 = Double.doubleToLongBits(this.longitude);
|
||||||
var3 = Double.doubleToLongBits(this.longitude);
|
var3 = 31 * var3 + (int)(var2 ^ var2 >>> 32);
|
||||||
var5 = 31 * var5 + (int)(var3 ^ var3 >>> 32);
|
return var3;
|
||||||
return var5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -49,18 +49,14 @@ public class FileUtils {
|
||||||
if ("primary".equalsIgnoreCase(type)) {
|
if ("primary".equalsIgnoreCase(type)) {
|
||||||
return Environment.getExternalStorageDirectory() + "/" + split[1];
|
return Environment.getExternalStorageDirectory() + "/" + split[1];
|
||||||
}
|
}
|
||||||
}
|
} else if (isDownloadsDocument(uri)) { // DownloadsProvider
|
||||||
// DownloadsProvider
|
|
||||||
else if (isDownloadsDocument(uri)) {
|
|
||||||
|
|
||||||
final String id = DocumentsContract.getDocumentId(uri);
|
final String id = DocumentsContract.getDocumentId(uri);
|
||||||
final Uri contentUri = ContentUris.withAppendedId(
|
final Uri contentUri = ContentUris.withAppendedId(
|
||||||
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
|
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
|
||||||
|
|
||||||
return getDataColumn(context, contentUri, null, null);
|
return getDataColumn(context, contentUri, null, null);
|
||||||
}
|
} else if (isMediaDocument(uri)) { // MediaProvider
|
||||||
// MediaProvider
|
|
||||||
else if (isMediaDocument(uri)) {
|
|
||||||
final String docId = DocumentsContract.getDocumentId(uri);
|
final String docId = DocumentsContract.getDocumentId(uri);
|
||||||
final String[] split = docId.split(":");
|
final String[] split = docId.split(":");
|
||||||
final String type = split[0];
|
final String type = split[0];
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ public class ExecutorUtils {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Executor uiExecutor() { return uiExecutor; }
|
public static Executor uiExecutor() {
|
||||||
|
return uiExecutor;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue