Skip to content

Commit

Permalink
SonarQube-induced minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanepechard committed Oct 30, 2016
1 parent 42a1a9d commit 7d66d52
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
13 changes: 7 additions & 6 deletions app/src/main/java/fr/s13d/photobackup/PBApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
import android.preference.PreferenceManager;

import java.util.Map;
import java.util.Set;

import fr.s13d.photobackup.media.PBMediaStore;


/**
* Application of the app
*/
public class PBApplication extends Application {

private static final String LOG_TAG = "PBApplication";
Expand All @@ -52,11 +54,10 @@ public void onCreate() {

if (BuildConfig.DEBUG) {
Log.d(LOG_TAG, "Default SharedPreferences:");
Map<String, ?> allPrefs = PreferenceManager.getDefaultSharedPreferences(this).getAll();
Set<String> set = allPrefs.keySet();
for (String s : set) {
Log.d(LOG_TAG, s + "<" + allPrefs.get(s).getClass().getSimpleName() + "> = "
+ allPrefs.get(s).toString());
final Map<String, ?> allPrefs = PreferenceManager.getDefaultSharedPreferences(this).getAll();
for (final Map.Entry<String, ?> entry : allPrefs.entrySet()) {
Log.d(LOG_TAG, entry.getKey() + "<" + entry.getValue().getClass().getSimpleName() + "> = "
+ entry.getValue().toString());
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/fr/s13d/photobackup/PBService.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public void onSyncMediaStoreTaskPostExecute() {
//////////////////////////////////////
/**
* Does nothing on receiving a message.
* @param message received message
*/
public void onMessage(final String message) {
// Do nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
import fr.s13d.photobackup.media.PBMedia;


/**
* Receives wifi broadcast intents and starts media upload if required.
*/
public class PBWifiBroadcastReceiver extends BroadcastReceiver {
private static final String LOG_TAG = "PBWifiBroadcastReceiver";
private static long lastFiredOn = 0;
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/fr/s13d/photobackup/media/PBMedia.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,24 @@
import fr.s13d.photobackup.Log;
import fr.s13d.photobackup.PBApplication;


/**
* Media object adding information over device medias.
*/
public class PBMedia implements Serializable {
private final int id;
private final String path;
private final long dateAdded;
private final SharedPreferences mediasPreferences;
private String errorMessage;
private PBMediaState state;

/**
* Enumeration of all possible media states
* - waiting: the media waits for being uploaded;
* - synced: the media is synced with the server already;
* - error: an error occurred.
*/
public enum PBMediaState { WAITING, SYNCED, ERROR }


Expand Down

0 comments on commit 7d66d52

Please sign in to comment.