1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-01-07 10:42:07 +00:00

Fix 20 javadoc errors (fixes #234) (#235)

* Fix unused, outdated refs

* Constants: Static implies final

* Remove double semicolon

* Remove double semicolon

* Remove unused imports

* Remove unnecessary return in void func

* Fix javadoc errors (fixes #234)

* Remove blank

* EnhancedEditText: Reformat code

* Fix imports
This commit is contained in:
Catfriend1 2019-01-18 23:06:27 +01:00 committed by GitHub
parent 4487857785
commit 1154fc021e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 35 additions and 88 deletions

View file

@ -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;

View file

@ -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);
}

View file

@ -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;

View file

@ -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() {

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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;

View file

@ -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.
*/

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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<String, CompletionInfo> folderMap;
// Handle devices that were removed from the config.
List<String> removedDevices = new ArrayList<>();;
List<String> 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<String> removedFolders = new ArrayList<>();;
List<String> removedFolders = new ArrayList<>();
Boolean folderFound;
for (Map.Entry<String, HashMap<String, CompletionInfo>> device : deviceFolderMap.entrySet()) {
for (String folderId : device.getValue().keySet()) {

View file

@ -1,6 +1,5 @@
package com.nutomic.syncthingandroid.model;
import java.util.List;
import java.util.Map;
/**

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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"
android:layout_height="match_parent"

View file

@ -51,7 +51,7 @@
android:layout_height="200dp"
android:layout_gravity="center_horizontal"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_launcher"/>
tools:src="@mipmap/ic_launcher"/>
</LinearLayout>