From ac7d410db4520020d754086ba6c6b91aa308a2bc Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Sun, 3 Apr 2016 20:45:22 +0200 Subject: [PATCH] Use proper namespace for intent actions and extras. --- .../activities/FolderPickerActivity.java | 8 ++++---- .../activities/SettingsActivity.java | 12 ++++++++---- .../syncthingandroid/fragments/DeviceFragment.java | 3 ++- .../syncthingandroid/fragments/FolderFragment.java | 6 ++++-- .../syncthing/DeviceStateHolder.java | 6 ++++-- .../syncthingandroid/syncthing/SyncthingService.java | 6 ++++-- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/activities/FolderPickerActivity.java b/src/main/java/com/nutomic/syncthingandroid/activities/FolderPickerActivity.java index d29a5b87..f205dad7 100644 --- a/src/main/java/com/nutomic/syncthingandroid/activities/FolderPickerActivity.java +++ b/src/main/java/com/nutomic/syncthingandroid/activities/FolderPickerActivity.java @@ -40,11 +40,11 @@ import java.util.TreeSet; public class FolderPickerActivity extends SyncthingActivity implements AdapterView.OnItemClickListener, SyncthingService.OnApiChangeListener { - private static final String TAG = "FolderPickerActivity"; + public static final String EXTRA_INITIAL_DIRECTORY = + "com.nutomic.syncthingandroid.activities.FolderPickerActivity.INITIAL_DIRECTORY"; - public static final String EXTRA_INITIAL_DIRECTORY = "initial_directory"; - - public static final String EXTRA_RESULT_DIRECTORY = "result_directory"; + public static final String EXTRA_RESULT_DIRECTORY = + "com.nutomic.syncthingandroid.activities.FolderPickerActivity.RESULT_DIRECTORY"; private ListView mListView; diff --git a/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java b/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java index 3074b0f3..d501ade7 100644 --- a/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java +++ b/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java @@ -14,16 +14,20 @@ import com.nutomic.syncthingandroid.fragments.SettingsFragment; */ public class SettingsActivity extends SyncthingActivity { - public static final String ACTION_APP_SETTINGS = "app_settings_fragment"; - public static final String ACTION_DEVICE_SETTINGS = "device_settings_fragment"; - public static final String ACTION_FOLDER_SETTINGS = "folder_settings_fragment"; + public static final String ACTION_APP_SETTINGS = + "com.nutomic.syncthingandroid.activities.SettingsActivity.APP_SETTINGS"; + public static final String ACTION_DEVICE_SETTINGS = + "com.nutomic.syncthingandroid.activities.SettingsActivity.DEVICE_SETTINGS"; + public static final String ACTION_FOLDER_SETTINGS = + "com.nutomic.syncthingandroid.activities.SettingsActivity.FOLDER_SETTINGS"; /** * Must be set for {@link #ACTION_DEVICE_SETTINGS} and * {@link #ACTION_FOLDER_SETTINGS} to determine if an existing folder/device should be * edited or a new one created. */ - public static final String EXTRA_IS_CREATE = "create"; + public static final String EXTRA_IS_CREATE = + "com.nutomic.syncthingandroid.activities.SettingsActivity.IS_CREATE"; private Fragment mFragment; diff --git a/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceFragment.java b/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceFragment.java index c1481458..6734f3aa 100644 --- a/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceFragment.java +++ b/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceFragment.java @@ -54,7 +54,8 @@ public class DeviceFragment extends Fragment implements SyncthingService.OnApiChangeListener, RestApi.OnDeviceIdNormalizedListener, View.OnClickListener { - public static final String EXTRA_DEVICE_ID = "device_id"; + public static final String EXTRA_DEVICE_ID = + "com.nutomic.syncthingandroid.fragments.DeviceFragment.DEVICE_ID"; private static final String TAG = "DeviceSettingsFragment"; diff --git a/src/main/java/com/nutomic/syncthingandroid/fragments/FolderFragment.java b/src/main/java/com/nutomic/syncthingandroid/fragments/FolderFragment.java index 2a4a0e6d..0d119c46 100644 --- a/src/main/java/com/nutomic/syncthingandroid/fragments/FolderFragment.java +++ b/src/main/java/com/nutomic/syncthingandroid/fragments/FolderFragment.java @@ -52,9 +52,11 @@ import static java.lang.String.valueOf; public class FolderFragment extends Fragment implements SyncthingActivity.OnServiceConnectedListener, SyncthingService.OnApiChangeListener { - public static final String EXTRA_FOLDER_ID = "folder_id"; + public static final String EXTRA_FOLDER_ID = + "com.nutomic.syncthingandroid.fragments.FolderFragment.FOLDER_ID"; - public static final String EXTRA_DEVICE_ID = "device_id"; + public static final String EXTRA_DEVICE_ID = + "com.nutomic.syncthingandroid.fragments.FolderFragment.DEVICE_ID"; private static final int DIRECTORY_REQUEST_CODE = 234; diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/DeviceStateHolder.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/DeviceStateHolder.java index 9c028ae0..d31c842d 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/DeviceStateHolder.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/DeviceStateHolder.java @@ -20,13 +20,15 @@ public class DeviceStateHolder extends BroadcastReceiver { /** * Intent extra containing a boolean saying whether wifi is connected or not. */ - public static final String EXTRA_HAS_WIFI = "has_wifi"; + public static final String EXTRA_HAS_WIFI = + "com.nutomic.syncthingandroid.syncthing.DeviceStateHolder.HAS_WIFI"; /** * Intent extra containging a boolean saying whether the device is * charging or not (any power source). */ - public static final String EXTRA_IS_CHARGING = "is_charging"; + public static final String EXTRA_IS_CHARGING = + "com.nutomic.syncthingandroid.syncthing.DeviceStateHolder.IS_CHARGING"; private Context mContext; diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java index d31b7140..6f5db56f 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java @@ -50,12 +50,14 @@ public class SyncthingService extends Service implements /** * Intent action to perform a Syncthing restart. */ - public static final String ACTION_RESTART = "restart"; + public static final String ACTION_RESTART = + "com.nutomic.syncthingandroid.service.SyncthingService.RESTART"; /** * Intent action to reset Syncthing's database. */ - public static final String ACTION_RESET = "reset"; + public static final String ACTION_RESET = + "com.nutomic.syncthingandroid.service.SyncthingService.RESET"; /**