diff --git a/app/src/main/java/com/android/PRNGFixes.java b/app/src/main/java/com/android/PRNGFixes.java index 31a09947..8c5671b7 100644 --- a/app/src/main/java/com/android/PRNGFixes.java +++ b/app/src/main/java/com/android/PRNGFixes.java @@ -188,7 +188,7 @@ public final class PRNGFixes { * Input stream for reading from Linux PRNG or {@code null} if not yet * opened. * - * @GuardedBy("sLock") + * @ GuardedBy("sLock") */ private static DataInputStream sUrandomIn; @@ -196,7 +196,7 @@ public final class PRNGFixes { * Output stream for writing to Linux PRNG or {@code null} if not yet * opened. * - * @GuardedBy("sLock") + * @ GuardedBy("sLock") */ private static OutputStream sUrandomOut; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/DeviceActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/DeviceActivity.java index e16f72bb..18bd92e9 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/DeviceActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/DeviceActivity.java @@ -48,10 +48,8 @@ import java.util.List; import javax.inject.Inject; import static android.text.TextUtils.isEmpty; -import static android.view.View.GONE; import static android.view.View.VISIBLE; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN; -import static com.nutomic.syncthingandroid.service.SyncthingService.State.ACTIVE; import static com.nutomic.syncthingandroid.util.Compression.METADATA; /** @@ -236,7 +234,7 @@ public class DeviceActivity extends SyncthingActivity } /** - * Invoked after user clicked on the {@link mCustomSyncConditionsDialog} label. + * Invoked after user clicked on the {@link #mCustomSyncConditionsDialog} label. */ private void onCustomSyncConditionsDialogClick() { startActivityForResult( @@ -245,7 +243,6 @@ public class DeviceActivity extends SyncthingActivity ), 0 ); - return; } private void restoreDialogStates(Bundle savedInstanceState) { @@ -516,7 +513,7 @@ public class DeviceActivity extends SyncthingActivity Drawable dr = ContextCompat.getDrawable(this, R.drawable.ic_content_copy_black_24dp); mIdView.setCompoundDrawablesWithIntrinsicBounds(null, null, dr, null); mIdView.setEnabled(false); - mQrButton.setVisibility(GONE); + mQrButton.setVisibility(View.GONE); mIdContainer.setOnClickListener(this); } diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/FirstStartActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/FirstStartActivity.java index b920cf09..b5906426 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/FirstStartActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/FirstStartActivity.java @@ -2,7 +2,6 @@ package com.nutomic.syncthingandroid.activities; import android.annotation.SuppressLint; import android.annotation.TargetApi; -import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java index 73b8e1fd..62bf76b9 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java @@ -57,7 +57,6 @@ import static android.support.v4.view.MarginLayoutParamsCompat.setMarginStart; import static android.util.TypedValue.COMPLEX_UNIT_DIP; import static android.view.Gravity.CENTER_VERTICAL; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; -import static com.nutomic.syncthingandroid.service.SyncthingService.State.ACTIVE; /** * Shows folder details and allows changing them. @@ -132,7 +131,7 @@ public class FolderActivity extends SyncthingActivity @Override public void afterTextChanged(Editable s) { mFolder.label = mLabelView.getText().toString(); - mFolder.id = mIdView.getText().toString();; + mFolder.id = mIdView.getText().toString(); // mPathView must not be handled here as it's handled by {@link onActivityResult} // mEditIgnoreListContent must not be handled here as it's written back when the dialog ends. mFolderNeedsToUpdate = true; @@ -252,7 +251,7 @@ public class FolderActivity extends SyncthingActivity } /** - * Invoked after user clicked on the {@link mPathView} label. + * Invoked after user clicked on the {@link #mPathView} label. */ @SuppressLint("InlinedAPI") private void onPathViewClick() { @@ -282,7 +281,7 @@ public class FolderActivity extends SyncthingActivity } /** - * Invoked after user clicked on the {@link mCustomSyncConditionsDialog} label. + * Invoked after user clicked on the {@link #mCustomSyncConditionsDialog} label. */ private void onCustomSyncConditionsDialogClick() { startActivityForResult( @@ -291,7 +290,6 @@ public class FolderActivity extends SyncthingActivity ), 0 ); - return; } private void showFolderTypeDialog() { diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderPickerActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderPickerActivity.java index a43e4190..3a7530ec 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderPickerActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/FolderPickerActivity.java @@ -3,13 +3,11 @@ package com.nutomic.syncthingandroid.activities; import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.os.Environment; -import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; @@ -29,7 +27,6 @@ import android.widget.Toast; import com.google.common.collect.Sets; import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.SyncthingApp; -import com.nutomic.syncthingandroid.service.Constants; import com.nutomic.syncthingandroid.util.Util; import java.io.File; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java index 86a1087f..b70d653d 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java @@ -5,7 +5,6 @@ import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.ComponentName; -import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; @@ -39,7 +38,6 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; -import android.widget.Toast; import com.annimon.stream.function.Consumer; import com.nutomic.syncthingandroid.R; @@ -48,7 +46,6 @@ import com.nutomic.syncthingandroid.fragments.DeviceListFragment; import com.nutomic.syncthingandroid.fragments.DrawerFragment; import com.nutomic.syncthingandroid.fragments.FolderListFragment; import com.nutomic.syncthingandroid.fragments.StatusFragment; -import com.nutomic.syncthingandroid.model.Options; import com.nutomic.syncthingandroid.service.RestApi; import com.nutomic.syncthingandroid.service.SyncthingService; import com.nutomic.syncthingandroid.service.SyncthingServiceBinder; @@ -83,8 +80,7 @@ public class MainActivity extends SyncthingActivity /** * Time after first start when usage reporting dialog should be shown. - * - * @see #showUsageReportingDialog() + * See {@link #showUsageReportingDialog} */ private static final long USAGE_REPORTING_DIALOG_DELAY = TimeUnit.DAYS.toMillis(3); diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/RecentChangesActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/RecentChangesActivity.java index 16ef5d7e..ca074777 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/RecentChangesActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/RecentChangesActivity.java @@ -7,7 +7,6 @@ import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.util.Log; -import android.view.View; import com.google.common.reflect.TypeToken; import com.google.gson.Gson; @@ -26,7 +25,6 @@ import com.nutomic.syncthingandroid.views.ChangeListAdapter.ItemClickListener; import java.io.File; import java.lang.reflect.Type; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import static com.nutomic.syncthingandroid.service.Constants.ENABLE_TEST_DATA; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java index 8875bebf..a9f7712b 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java @@ -27,8 +27,6 @@ import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.Log; import android.util.TypedValue; -import android.view.KeyEvent; -import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.KeyEvent; @@ -43,7 +41,6 @@ import com.google.common.base.Splitter; import com.google.common.collect.Iterables; import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.SyncthingApp; -import com.nutomic.syncthingandroid.model.Config; import com.nutomic.syncthingandroid.model.Device; import com.nutomic.syncthingandroid.model.Gui; import com.nutomic.syncthingandroid.model.Options; @@ -883,7 +880,7 @@ public class SettingsActivity extends SyncthingActivity { } /** - * Calley by {@link #ImportConfigTask} after config import. + * Calley by {@link SyncthingService#importConfig} after config import. */ private void afterConfigImport(Boolean actionSucceeded) { if (!actionSucceeded) { diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/ShareActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/ShareActivity.java index b49bdcb3..0474ef4c 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/ShareActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/ShareActivity.java @@ -26,7 +26,6 @@ import android.widget.Toast; import com.google.common.io.Files; import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.model.Folder; -import com.nutomic.syncthingandroid.service.RestApi; import com.nutomic.syncthingandroid.service.SyncthingService; import com.nutomic.syncthingandroid.service.SyncthingServiceBinder; import com.nutomic.syncthingandroid.util.ConfigRouter; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/SyncConditionsActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/SyncConditionsActivity.java index a3e35a1e..6532c8ba 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/SyncConditionsActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/SyncConditionsActivity.java @@ -1,7 +1,6 @@ package com.nutomic.syncthingandroid.activities; import android.app.Activity; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -10,7 +9,6 @@ import android.support.v7.widget.SwitchCompat; import android.util.Log; import android.util.TypedValue; import android.view.LayoutInflater; -import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; @@ -18,11 +16,9 @@ import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.TextView; -import com.google.common.collect.Sets; import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.SyncthingApp; import com.nutomic.syncthingandroid.service.Constants; -import com.nutomic.syncthingandroid.util.Util; import java.util.HashSet; import java.util.Set; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/SyncthingActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/SyncthingActivity.java index 98e5b713..814315aa 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/SyncthingActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/SyncthingActivity.java @@ -11,14 +11,11 @@ import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; // import android.util.Log; -import com.annimon.stream.Stream; import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.service.RestApi; import com.nutomic.syncthingandroid.service.SyncthingService; import com.nutomic.syncthingandroid.service.SyncthingServiceBinder; -import java.util.LinkedList; - /** * Connects to {@link SyncthingService} and provides access to it. */ diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/WebGuiActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/WebGuiActivity.java index 2f3b4c60..8020ed51 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/WebGuiActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/WebGuiActivity.java @@ -34,7 +34,6 @@ import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Constructor; import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/fragments/DrawerFragment.java b/app/src/main/java/com/nutomic/syncthingandroid/fragments/DrawerFragment.java index 711cf97c..a7a5f6c3 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/fragments/DrawerFragment.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/fragments/DrawerFragment.java @@ -6,7 +6,6 @@ import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; -import android.support.v4.content.ContextCompat; import android.util.Log; import android.view.LayoutInflater; import android.view.View; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/fragments/StatusFragment.java b/app/src/main/java/com/nutomic/syncthingandroid/fragments/StatusFragment.java index 1174d6bc..ba1a1e39 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/fragments/StatusFragment.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/fragments/StatusFragment.java @@ -1,6 +1,5 @@ package com.nutomic.syncthingandroid.fragments; -import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Handler; @@ -22,7 +21,6 @@ import com.nutomic.syncthingandroid.activities.SettingsActivity; import com.nutomic.syncthingandroid.activities.SyncthingActivity; import com.nutomic.syncthingandroid.model.Connections; import com.nutomic.syncthingandroid.model.SystemStatus; -import com.nutomic.syncthingandroid.model.SystemVersion; import com.nutomic.syncthingandroid.service.Constants; import com.nutomic.syncthingandroid.service.RestApi; import com.nutomic.syncthingandroid.service.SyncthingService; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/model/Completion.java b/app/src/main/java/com/nutomic/syncthingandroid/model/Completion.java index 5e866635..d223927a 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/model/Completion.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/model/Completion.java @@ -9,7 +9,7 @@ import java.util.Map; /** * This class caches remote folder and device synchronization - * completion indicators defined in {@link CompletionInfo#CompletionInfo} + * completion indicators defined in {@link CompletionInfo} * according to syncthing's REST "/completion" JSON result schema. * Completion model of syncthing's web UI is completion[deviceId][folderId] */ @@ -42,7 +42,7 @@ public class Completion { HashMap folderMap; // Handle devices that were removed from the config. - List removedDevices = new ArrayList<>();; + List removedDevices = new ArrayList<>(); Boolean deviceFound; for (String deviceId : deviceFolderMap.keySet()) { deviceFound = false; @@ -74,7 +74,7 @@ public class Completion { } // Handle folders that were removed from the config. - List removedFolders = new ArrayList<>();; + List removedFolders = new ArrayList<>(); Boolean folderFound; for (Map.Entry> device : deviceFolderMap.entrySet()) { for (String folderId : device.getValue().keySet()) { diff --git a/app/src/main/java/com/nutomic/syncthingandroid/model/SystemStatus.java b/app/src/main/java/com/nutomic/syncthingandroid/model/SystemStatus.java index 468a1236..145f751f 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/model/SystemStatus.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/model/SystemStatus.java @@ -1,6 +1,5 @@ package com.nutomic.syncthingandroid.model; -import java.util.List; import java.util.Map; /** diff --git a/app/src/main/java/com/nutomic/syncthingandroid/service/Constants.java b/app/src/main/java/com/nutomic/syncthingandroid/service/Constants.java index 1d9fc6c3..8082ebe3 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/service/Constants.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/service/Constants.java @@ -77,7 +77,7 @@ public class Constants { public static final String PREF_EVENT_PROCESSOR_LAST_SYNC_ID = "last_sync_id"; /** - * Available options cache for preference {@link app_settings#debug_facilities_enabled} + * Available options cache for preference {@link com.nutomic.syncthingandroid.R.xml#app_settings#debug_facilities_enabled} * Read via REST API call in {@link RestApi#updateDebugFacilitiesCache} after first successful binary startup. */ public static final String PREF_DEBUG_FACILITIES_AVAILABLE = "debug_facilities_available"; @@ -180,7 +180,7 @@ public class Constants { * fall back to an unencrypted HTTP connection to localhost. This applies * to syncthing core v0.14.53+. */ - public static final Boolean osSupportsTLS12() { + public static Boolean osSupportsTLS12() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; } } diff --git a/app/src/main/java/com/nutomic/syncthingandroid/service/EventProcessor.java b/app/src/main/java/com/nutomic/syncthingandroid/service/EventProcessor.java index 363e230f..9427e52d 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/service/EventProcessor.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/service/EventProcessor.java @@ -15,7 +15,6 @@ import android.text.TextUtils; import android.util.Log; import com.annimon.stream.Stream; -import com.nutomic.syncthingandroid.BuildConfig; import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.SyncthingApp; import com.nutomic.syncthingandroid.activities.DeviceActivity; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/service/ReceiverManager.java b/app/src/main/java/com/nutomic/syncthingandroid/service/ReceiverManager.java index 0ed0679b..acae4008 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/service/ReceiverManager.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/service/ReceiverManager.java @@ -2,7 +2,6 @@ package com.nutomic.syncthingandroid.service; import android.content.BroadcastReceiver; import android.content.Context; -import android.content.Intent; import android.content.IntentFilter; import android.util.Log; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/service/RestApi.java b/app/src/main/java/com/nutomic/syncthingandroid/service/RestApi.java index ca4c6d04..92ecd43a 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/service/RestApi.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/service/RestApi.java @@ -1,6 +1,5 @@ package com.nutomic.syncthingandroid.service; -import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -53,7 +52,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; import javax.inject.Inject; @@ -112,11 +110,11 @@ public class RestApi { private long mPreviousConnectionTime = 0; /** - * In the last-finishing {@link readConfigFromRestApi} callback, we have to call + * In the last-finishing {@link #readConfigFromRestApi} callback, we have to call * {@link SyncthingService#onApiAvailable} to indicate that the RestApi class is fully initialized. * We do this to avoid getting stuck with our main thread due to synchronous REST queries. * The correct indication of full initialisation is crucial to stability as other listeners of - * {@link SettingsActivity#onServiceStateChange} needs cached config and system information available. + * {@link ../activities/SettingsActivity#SettingsFragment#onServiceStateChange} needs cached config and system information available. * e.g. SettingsFragment need "mLocalDeviceId" */ private Boolean asyncQueryConfigComplete = false; @@ -451,7 +449,7 @@ public class RestApi { } /** - * This is only used for new folder creation, see {@link FolderActivity}. + * This is only used for new folder creation, see {@link ../activities/FolderActivity}. */ public void addFolder(Folder folder) { synchronized (mConfigLock) { diff --git a/app/src/main/java/com/nutomic/syncthingandroid/service/RunConditionMonitor.java b/app/src/main/java/com/nutomic/syncthingandroid/service/RunConditionMonitor.java index fa209f30..c6323c4c 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/service/RunConditionMonitor.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/service/RunConditionMonitor.java @@ -19,16 +19,13 @@ import android.os.Handler; import android.os.Looper; import android.os.PowerManager; import android.support.annotation.Nullable; -import android.support.v4.content.LocalBroadcastManager; import android.util.Log; -import com.google.common.collect.Lists; import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.SyncthingApp; import com.nutomic.syncthingandroid.service.ReceiverManager; import java.util.HashSet; -import java.util.List; import java.util.Set; import javax.inject.Inject; @@ -36,8 +33,7 @@ import javax.inject.Inject; /** * Holds information about the current wifi and charging state of the device. * - * This information is actively read on instance creation, and then updated from intents - * that are passed with {@link #ACTION_DEVICE_STATE_CHANGED}. + * This information is actively read on instance creation, and then updated from intents. */ public class RunConditionMonitor { @@ -96,17 +92,17 @@ public class RunConditionMonitor { SharedPreferences mPreferences; /** - * Sending callback notifications through {@link #OnShouldRunChangedListener} is enabled if not null. + * Sending callback notifications through OnShouldRunChangedListener is enabled if not null. */ private @Nullable OnShouldRunChangedListener mOnShouldRunChangedListener = null; /** - * Sending callback notifications through {@link #OnSyncPreconditionChangedListener} is enabled if not null. + * Sending callback notifications through OnSyncPreconditionChangedListener is enabled if not null. */ private @Nullable OnSyncPreconditionChangedListener mOnSyncPreconditionChangedListener = null; /** - * Stores the result of the last call to {@link decideShouldRun}. + * Stores the result of the last call to {@link #decideShouldRun}. */ private boolean lastDeterminedShouldRun = false; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java b/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java index de5ba344..d9ba26be 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java @@ -6,18 +6,14 @@ import android.content.pm.PackageManager; import android.content.res.Resources; import android.content.SharedPreferences; import android.Manifest; -import android.os.AsyncTask; import android.os.Build; import android.os.Handler; import android.os.Looper; -import android.os.SystemClock; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.util.Log; -import android.widget.Toast; import com.android.PRNGFixes; -import com.annimon.stream.Stream; import com.google.common.io.Files; import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.SyncthingApp; @@ -34,13 +30,11 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import java.lang.ref.WeakReference; import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -158,7 +152,7 @@ public class SyncthingService extends Service { /** * Initialize the service with State.DISABLED as {@link RunConditionMonitor} will * send an update if we should run the binary after it got instantiated in - * {@link onStartCommand}. + * {@link #onStartCommand}. */ private State mCurrentState = State.DISABLED; private ConfigXml mConfig; @@ -200,8 +194,8 @@ public class SyncthingService extends Service { private boolean mLastDeterminedShouldRun = false; /** - * True if a service {@link onDestroy} was requested while syncthing is starting, - * in that case, perform stop in {@link onApiAvailable}. + * True if a service {@link #onDestroy} was requested while syncthing is starting, + * in that case, perform stop in {@link #onApiAvailable}. */ private boolean mDestroyScheduled = false; @@ -711,7 +705,7 @@ public class SyncthingService extends Service { /** * Force re-evaluating run conditions immediately e.g. after - * preferences were modified by {@link SettingsActivity}. + * preferences were modified by {@link ../activities/SettingsActivity#onStop}. */ public void evaluateRunConditions() { if (mRunConditionMonitor == null) { diff --git a/app/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java b/app/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java index 84302878..9a6314bf 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java @@ -33,8 +33,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Random; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/views/ChangeListAdapter.java b/app/src/main/java/com/nutomic/syncthingandroid/views/ChangeListAdapter.java index bc7d275a..7f4f9eff 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/views/ChangeListAdapter.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/views/ChangeListAdapter.java @@ -10,7 +10,6 @@ import android.os.Build; // import android.util.Log; import android.view.LayoutInflater; import android.view.View; -import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/views/DevicesAdapter.java b/app/src/main/java/com/nutomic/syncthingandroid/views/DevicesAdapter.java index 33601992..2d61ee3b 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/views/DevicesAdapter.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/views/DevicesAdapter.java @@ -4,7 +4,6 @@ import android.content.Context; import android.content.res.Resources; import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/views/EnhancedEditText.java b/app/src/main/java/com/nutomic/syncthingandroid/views/EnhancedEditText.java index 2313e50d..9b484375 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/views/EnhancedEditText.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/views/EnhancedEditText.java @@ -34,18 +34,21 @@ public class EnhancedEditText extends AppCompatEditText { @Override public boolean onTouchEvent(MotionEvent event) { - if (!isEnabled()) + if (!isEnabled()) { return false; - if (event.getAction() == MotionEvent.ACTION_UP) + } + if (event.getAction() == MotionEvent.ACTION_UP) { super.performClick(); - return super.onTouchEvent(event); + } + return super.onTouchEvent(event); } @Override public boolean performClick() { - return (isEnabled()) - ? super.performClick() - : false; + if (!isEnabled()) { + return false; + } + return super.performClick(); } @Override diff --git a/app/src/main/java/com/nutomic/syncthingandroid/views/FoldersAdapter.java b/app/src/main/java/com/nutomic/syncthingandroid/views/FoldersAdapter.java index 32ab4f96..4f07cf3e 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/views/FoldersAdapter.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/views/FoldersAdapter.java @@ -6,7 +6,6 @@ import android.databinding.DataBindingUtil; import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; import android.text.TextUtils; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/views/SttracePreference.java b/app/src/main/java/com/nutomic/syncthingandroid/views/SttracePreference.java index a0a1c394..eef4ab0c 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/views/SttracePreference.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/views/SttracePreference.java @@ -1,12 +1,8 @@ package com.nutomic.syncthingandroid.views; -import android.Manifest; import android.content.Context; -import android.os.Build; import android.os.Bundle; import android.preference.MultiSelectListPreference; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; import android.util.AttributeSet; import android.util.Log; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/views/TipListAdapter.java b/app/src/main/java/com/nutomic/syncthingandroid/views/TipListAdapter.java index 72e68d42..b2921b23 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/views/TipListAdapter.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/views/TipListAdapter.java @@ -5,7 +5,6 @@ import android.support.v7.widget.RecyclerView; // import android.util.Log; import android.view.LayoutInflater; import android.view.View; -import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.TextView; diff --git a/app/src/main/res/layout/activity_first_start.xml b/app/src/main/res/layout/activity_first_start.xml index 9b416962..7a078cf1 100644 --- a/app/src/main/res/layout/activity_first_start.xml +++ b/app/src/main/res/layout/activity_first_start.xml @@ -1,7 +1,6 @@ + tools:src="@mipmap/ic_launcher"/>