1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-23 04:41:16 +00:00

Fixed various lint issues

This commit is contained in:
Felix Ableitner 2016-09-21 12:34:19 +09:00
parent 1cce70986b
commit d8a05ed392
67 changed files with 246 additions and 485 deletions

View file

@ -47,6 +47,10 @@ android {
testInstrumentationRunner 'android.test.InstrumentationTestRunner' testInstrumentationRunner 'android.test.InstrumentationTestRunner'
testHandleProfiling true testHandleProfiling true
testFunctionalTest true testFunctionalTest true
jackOptions {
enabled true
}
} }
// Without this parameter, all builds fail with error: // Without this parameter, all builds fail with error:
// Execution failed for task ':mergeArmeabiDebugResources'. // Execution failed for task ':mergeArmeabiDebugResources'.
@ -99,6 +103,10 @@ android {
versionCode Integer.parseInt("0" + defaultConfig.versionCode) versionCode Integer.parseInt("0" + defaultConfig.versionCode)
} }
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
} }
task buildNative(type: Exec) { task buildNative(type: Exec) {

View file

@ -15,8 +15,8 @@ import java.util.List;
*/ */
public class MockContext extends ContextWrapper { public class MockContext extends ContextWrapper {
private ArrayList<Intent> mReceivedIntents = new ArrayList<>(); private final ArrayList<Intent> mReceivedIntents = new ArrayList<>();
private ArrayList<Intent> mStopServiceIntents = new ArrayList<>(); private final ArrayList<Intent> mStopServiceIntents = new ArrayList<>();
/** /**
* Use the actual context for calls that aren't easily mocked. May be null if those * Use the actual context for calls that aren't easily mocked. May be null if those

View file

@ -3,6 +3,7 @@ package com.nutomic.syncthingandroid.test;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull;
import com.nutomic.syncthingandroid.syncthing.RestApi; import com.nutomic.syncthingandroid.syncthing.RestApi;
import java.util.ArrayList; import java.util.ArrayList;
@ -65,7 +66,7 @@ public class MockRestApi extends RestApi {
} }
@Override @Override
public void editDevice(Device device, Activity activity, OnDeviceIdNormalizedListener listener) { public void editDevice(@NonNull Device device, Activity activity, OnDeviceIdNormalizedListener listener) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View file

@ -10,7 +10,7 @@ import java.util.LinkedList;
public class MockSyncthingService extends SyncthingService { public class MockSyncthingService extends SyncthingService {
private LinkedList<OnApiChangeListener> mOnApiChangedListeners = new LinkedList<>(); private final LinkedList<OnApiChangeListener> mOnApiChangedListeners = new LinkedList<>();
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {

View file

@ -10,7 +10,7 @@ import com.nutomic.syncthingandroid.test.MockSyncthingService;
public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> { public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
private MockSyncthingService mService = new MockSyncthingService(); private final MockSyncthingService mService = new MockSyncthingService();
public MainActivityTest() { public MainActivityTest() {
super(MainActivity.class); super(MainActivity.class);

View file

@ -3,7 +3,6 @@ package com.nutomic.syncthingandroid.test.syncthing;
import android.content.Intent; import android.content.Intent;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import com.nutomic.syncthingandroid.syncthing.BatteryReceiver; import com.nutomic.syncthingandroid.syncthing.BatteryReceiver;
import com.nutomic.syncthingandroid.syncthing.DeviceStateHolder; import com.nutomic.syncthingandroid.syncthing.DeviceStateHolder;

View file

@ -3,7 +3,6 @@ package com.nutomic.syncthingandroid.test.syncthing;
import android.content.Intent; import android.content.Intent;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import com.nutomic.syncthingandroid.syncthing.BootReceiver; import com.nutomic.syncthingandroid.syncthing.BootReceiver;
import com.nutomic.syncthingandroid.syncthing.SyncthingService; import com.nutomic.syncthingandroid.syncthing.SyncthingService;

View file

@ -3,7 +3,6 @@ package com.nutomic.syncthingandroid.test.syncthing;
import android.content.Intent; import android.content.Intent;
import android.os.BatteryManager; import android.os.BatteryManager;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import com.nutomic.syncthingandroid.syncthing.DeviceStateHolder; import com.nutomic.syncthingandroid.syncthing.DeviceStateHolder;
import com.nutomic.syncthingandroid.test.MockContext; import com.nutomic.syncthingandroid.test.MockContext;

View file

@ -2,7 +2,6 @@ package com.nutomic.syncthingandroid.test.syncthing;
import android.net.Uri; import android.net.Uri;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import com.nutomic.syncthingandroid.syncthing.GetTask; import com.nutomic.syncthingandroid.syncthing.GetTask;
import com.nutomic.syncthingandroid.syncthing.RestApi; import com.nutomic.syncthingandroid.syncthing.RestApi;

View file

@ -4,7 +4,6 @@ import android.content.Intent;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import com.nutomic.syncthingandroid.syncthing.DeviceStateHolder; import com.nutomic.syncthingandroid.syncthing.DeviceStateHolder;
import com.nutomic.syncthingandroid.syncthing.NetworkReceiver; import com.nutomic.syncthingandroid.syncthing.NetworkReceiver;

View file

@ -1,8 +1,6 @@
package com.nutomic.syncthingandroid.test.syncthing; package com.nutomic.syncthingandroid.test.syncthing;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import com.nutomic.syncthingandroid.syncthing.PollWebGuiAvailableTask; import com.nutomic.syncthingandroid.syncthing.PollWebGuiAvailableTask;
import com.nutomic.syncthingandroid.syncthing.RestApi; import com.nutomic.syncthingandroid.syncthing.RestApi;
@ -38,12 +36,7 @@ public class RestApiTest extends AndroidTestCase {
} }
}.execute(config.getWebGuiUrl()); }.execute(config.getWebGuiUrl());
mApi = new RestApi(getContext(), config.getWebGuiUrl(), config.getApiKey(), mApi = new RestApi(getContext(), config.getWebGuiUrl(), config.getApiKey(),
new RestApi.OnApiAvailableListener() { latch::countDown, null);
@Override
public void onApiAvailable() {
latch.countDown();
}
}, null);
latch.await(1, TimeUnit.SECONDS); latch.await(1, TimeUnit.SECONDS);
} }

View file

@ -1,7 +1,6 @@
package com.nutomic.syncthingandroid.test.syncthing; package com.nutomic.syncthingandroid.test.syncthing;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import com.nutomic.syncthingandroid.syncthing.SyncthingRunnable; import com.nutomic.syncthingandroid.syncthing.SyncthingRunnable;
import com.nutomic.syncthingandroid.test.MockContext; import com.nutomic.syncthingandroid.test.MockContext;

View file

@ -1,7 +1,6 @@
package com.nutomic.syncthingandroid.test.syncthing; package com.nutomic.syncthingandroid.test.syncthing;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import com.nutomic.syncthingandroid.syncthing.SyncthingService; import com.nutomic.syncthingandroid.syncthing.SyncthingService;
import com.nutomic.syncthingandroid.syncthing.SyncthingServiceBinder; import com.nutomic.syncthingandroid.syncthing.SyncthingServiceBinder;

View file

@ -1,16 +1,10 @@
package com.nutomic.syncthingandroid.test.util; package com.nutomic.syncthingandroid.test.util;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
import com.nutomic.syncthingandroid.test.MockContext; import com.nutomic.syncthingandroid.test.MockContext;
import com.nutomic.syncthingandroid.util.ConfigXml; import com.nutomic.syncthingandroid.util.ConfigXml;
import java.io.File;
import java.io.IOException;
public class ConfigXmlTest extends AndroidTestCase { public class ConfigXmlTest extends AndroidTestCase {
private MockContext mContext; private MockContext mContext;

View file

@ -1,7 +1,6 @@
package com.nutomic.syncthingandroid.test.util; package com.nutomic.syncthingandroid.test.util;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import com.nutomic.syncthingandroid.syncthing.RestApi; import com.nutomic.syncthingandroid.syncthing.RestApi;
import com.nutomic.syncthingandroid.test.MockContext; import com.nutomic.syncthingandroid.test.MockContext;

View file

@ -17,8 +17,6 @@ import com.nutomic.syncthingandroid.R;
public class FirstStartActivity extends Activity implements Button.OnClickListener { public class FirstStartActivity extends Activity implements Button.OnClickListener {
private static final String TAG = "FirstStartActivity";
private static final int REQUEST_WRITE_STORAGE = 142; private static final int REQUEST_WRITE_STORAGE = 142;
private SharedPreferences mPreferences; private SharedPreferences mPreferences;

View file

@ -5,7 +5,6 @@ import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build; import android.os.Build;
@ -31,7 +30,6 @@ import com.nutomic.syncthingandroid.syncthing.SyncthingService;
import java.io.File; import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.TreeSet; import java.util.TreeSet;
/** /**
@ -90,13 +88,10 @@ public class FolderPickerActivity extends SyncthingActivity
@SuppressLint("NewApi") @SuppressLint("NewApi")
private void populateRoots() { private void populateRoots() {
// Use own comparator to handle null values. // Use own comparator to handle null values.
TreeSet<File> roots = new TreeSet<>(new Comparator<File>() { TreeSet<File> roots = new TreeSet<>((lhs, rhs) -> {
@Override
public int compare(File lhs, File rhs) {
if (lhs == null | rhs == null) if (lhs == null | rhs == null)
return 0; return 0;
return lhs.compareTo(rhs); return lhs.compareTo(rhs);
}
}); });
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
@ -152,22 +147,12 @@ public class FolderPickerActivity extends SyncthingActivity
.setTitle(R.string.create_folder) .setTitle(R.string.create_folder)
.setView(et) .setView(et)
.setPositiveButton(android.R.string.ok, .setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() { (dialogInterface, i) -> createFolder(et.getText().toString())
@Override
public void onClick(DialogInterface dialogInterface, int i) {
createFolder(et.getText().toString());
}
}
) )
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)
.create(); .create();
dialog.setOnShowListener(new DialogInterface.OnShowListener() { dialog.setOnShowListener(dialogInterface -> ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
@Override .showSoftInput(et, InputMethodManager.SHOW_IMPLICIT));
public void onShow(DialogInterface dialogInterface) {
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
.showSoftInput(et, InputMethodManager.SHOW_IMPLICIT);
}
});
dialog.show(); dialog.show();
return true; return true;
case R.id.select: case R.id.select:
@ -207,14 +192,12 @@ public class FolderPickerActivity extends SyncthingActivity
if (contents == null) if (contents == null)
contents = new File[]{}; contents = new File[]{};
Arrays.sort(contents, new Comparator<File>() { Arrays.sort(contents, (f1, f2) -> {
public int compare(File f1, File f2) {
if (f1.isDirectory() && f2.isFile()) if (f1.isDirectory() && f2.isFile())
return -1; return -1;
if (f1.isFile() && f2.isDirectory()) if (f1.isFile() && f2.isDirectory())
return 1; return 1;
return f1.getName().compareTo(f2.getName()); return f1.getName().compareTo(f2.getName());
}
}); });
for (File f : contents) { for (File f : contents) {

View file

@ -91,18 +91,13 @@ public class LogActivity extends SyncthingActivity {
} }
private void scrollToBottom() { private void scrollToBottom() {
mScrollView.post(new Runnable() { mScrollView.post(() -> mScrollView.scrollTo(0, mLog.getBottom()));
@Override
public void run() {
mScrollView.scrollTo(0, mLog.getBottom());
}
});
} }
private void updateLog() { private void updateLog() {
if (mFetchLogTask != null) if (mFetchLogTask != null)
mFetchLogTask.cancel(true); mFetchLogTask.cancel(true);
mLog.setText("Retrieving logs..."); mLog.setText(R.string.retrieving_logs);
mFetchLogTask = new AsyncTask<Void, Void, String>() { mFetchLogTask = new AsyncTask<Void, Void, String>() {
@Override @Override
protected String doInBackground(Void... params) { protected String doInBackground(Void... params) {
@ -137,7 +132,7 @@ public class LogActivity extends SyncthingActivity {
BufferedReader bufferedReader = new BufferedReader( BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream(), "UTF-8"), 8192); new InputStreamReader(process.getInputStream(), "UTF-8"), 8192);
StringBuilder log = new StringBuilder(); StringBuilder log = new StringBuilder();
String line = ""; String line;
String sep = System.getProperty("line.separator"); String sep = System.getProperty("line.separator");
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
log.append(line); log.append(line);

View file

@ -286,30 +286,17 @@ public class MainActivity extends SyncthingActivity
.setTitle(R.string.syncthing_disabled_title) .setTitle(R.string.syncthing_disabled_title)
.setMessage(R.string.syncthing_disabled_message) .setMessage(R.string.syncthing_disabled_message)
.setPositiveButton(R.string.syncthing_disabled_change_settings, .setPositiveButton(R.string.syncthing_disabled_change_settings,
new DialogInterface.OnClickListener() { (dialogInterface, i) -> {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
finish(); finish();
Intent intent = new Intent(MainActivity.this, SettingsActivity.class) Intent intent = new Intent(MainActivity.this, SettingsActivity.class)
.setAction(SettingsActivity.ACTION_APP_SETTINGS); .setAction(SettingsActivity.ACTION_APP_SETTINGS);
startActivity(intent); startActivity(intent);
} }
}
) )
.setNegativeButton(R.string.exit, .setNegativeButton(R.string.exit,
new DialogInterface.OnClickListener() { (dialogInterface, i) -> finish()
@Override
public void onClick(DialogInterface dialogInterface, int i) {
finish();
}
}
) )
.setOnCancelListener(new DialogInterface.OnCancelListener() { .setOnCancelListener(dialogInterface -> finish())
@Override
public void onCancel(DialogInterface dialogInterface) {
finish();
}
})
.show(); .show();
mDisabledDialog.setCanceledOnTouchOutside(false); mDisabledDialog.setCanceledOnTouchOutside(false);
} }
@ -402,9 +389,7 @@ public class MainActivity extends SyncthingActivity
* Displays dialog asking user to accept/deny usage reporting. * Displays dialog asking user to accept/deny usage reporting.
*/ */
private void showUsageReportingDialog() { private void showUsageReportingDialog() {
final DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() { final DialogInterface.OnClickListener listener = (dialog, which) -> {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) { switch (which) {
case DialogInterface.BUTTON_POSITIVE: case DialogInterface.BUTTON_POSITIVE:
getApi().setUsageReportAccepted(RestApi.USAGE_REPORTING_ACCEPTED, getApi().setUsageReportAccepted(RestApi.USAGE_REPORTING_ACCEPTED,
@ -420,12 +405,9 @@ public class MainActivity extends SyncthingActivity
break; break;
} }
}
}; };
getApi().getUsageReport(new RestApi.OnReceiveUsageReportListener() { getApi().getUsageReport(report -> {
@Override
public void onReceiveUsageReport(String report) {
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
View v = LayoutInflater.from(MainActivity.this) View v = LayoutInflater.from(MainActivity.this)
.inflate(R.layout.dialog_usage_reporting, null); .inflate(R.layout.dialog_usage_reporting, null);
@ -438,7 +420,6 @@ public class MainActivity extends SyncthingActivity
.setNegativeButton(R.string.no, listener) .setNegativeButton(R.string.no, listener)
.setNeutralButton(R.string.open_website, listener) .setNeutralButton(R.string.open_website, listener)
.show(); .show();
}
}); });
} }

View file

@ -5,7 +5,6 @@ import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
@ -30,26 +29,17 @@ public class RestartActivity extends SyncthingActivity {
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.restart_title) builder.setMessage(R.string.restart_title)
.setPositiveButton(R.string.restart_now, new DialogInterface.OnClickListener() { .setPositiveButton(R.string.restart_now, (dialogInterface, i) -> {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
getService().getApi().updateConfig(); getService().getApi().updateConfig();
finish(); finish();
}
}) })
.setNegativeButton(R.string.restart_later, new DialogInterface.OnClickListener() { .setNegativeButton(R.string.restart_later, (dialogInterface, i) -> {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
createRestartNotification(); createRestartNotification();
finish(); finish();
}
}) })
.setOnCancelListener(new DialogInterface.OnCancelListener() { .setOnCancelListener(dialog -> {
@Override
public void onCancel(DialogInterface dialog) {
createRestartNotification(); createRestartNotification();
finish(); finish();
}
}) })
.show(); .show();
} }

View file

@ -2,7 +2,6 @@ package com.nutomic.syncthingandroid.activities;
import android.app.Fragment; import android.app.Fragment;
import android.app.FragmentManager; import android.app.FragmentManager;
import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.R;
@ -96,12 +95,7 @@ public class SettingsActivity extends SyncthingActivity {
if (getIsCreate() && (mFragment instanceof DeviceFragment || mFragment instanceof FolderFragment)) { if (getIsCreate() && (mFragment instanceof DeviceFragment || mFragment instanceof FolderFragment)) {
new AlertDialog.Builder(this) new AlertDialog.Builder(this)
.setMessage(R.string.dialog_discard_changes) .setMessage(R.string.dialog_discard_changes)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.ok, (dialog, which) -> finish())
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
})
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)
.show(); .show();
} }

View file

@ -20,7 +20,7 @@ public abstract class SyncthingActivity extends ToolbarBindingActivity implement
private SyncthingService mSyncthingService; private SyncthingService mSyncthingService;
private LinkedList<OnServiceConnectedListener> mServiceConnectedListeners = new LinkedList<>(); private final LinkedList<OnServiceConnectedListener> mServiceConnectedListeners = new LinkedList<>();
/** /**
* To be used for Fragments. * To be used for Fragments.

View file

@ -83,7 +83,7 @@ public class DeviceFragment extends Fragment implements
private boolean mDeviceNeedsToUpdate; private boolean mDeviceNeedsToUpdate;
private DialogInterface.OnClickListener mCompressionEntrySelectedListener = new DialogInterface.OnClickListener() { private final DialogInterface.OnClickListener mCompressionEntrySelectedListener = new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
dialog.dismiss(); dialog.dismiss();
@ -99,7 +99,7 @@ public class DeviceFragment extends Fragment implements
} }
}; };
private TextWatcher mIdTextWatcher = new TextWatcherAdapter() { private final TextWatcher mIdTextWatcher = new TextWatcherAdapter() {
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if (!s.toString().equals(mDevice.deviceID)) { if (!s.toString().equals(mDevice.deviceID)) {
@ -110,7 +110,7 @@ public class DeviceFragment extends Fragment implements
} }
}; };
private TextWatcher mNameTextWatcher = new TextWatcherAdapter() { private final TextWatcher mNameTextWatcher = new TextWatcherAdapter() {
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if (!s.toString().equals(mDevice.name)) { if (!s.toString().equals(mDevice.name)) {
@ -121,7 +121,7 @@ public class DeviceFragment extends Fragment implements
} }
}; };
private TextWatcher mAddressesTextWatcher = new TextWatcherAdapter() { private final TextWatcher mAddressesTextWatcher = new TextWatcherAdapter() {
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if (!s.toString().equals(displayableAddresses())) { if (!s.toString().equals(displayableAddresses())) {
@ -132,7 +132,7 @@ public class DeviceFragment extends Fragment implements
} }
}; };
private CompoundButton.OnCheckedChangeListener mIntroducerCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() { private final CompoundButton.OnCheckedChangeListener mIntroducerCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (mDevice.introducer != isChecked) { if (mDevice.introducer != isChecked) {
@ -262,10 +262,10 @@ public class DeviceFragment extends Fragment implements
if (!mIsCreateMode) { if (!mIsCreateMode) {
List<RestApi.Device> devices = mSyncthingService.getApi().getDevices(false); List<RestApi.Device> devices = mSyncthingService.getApi().getDevices(false);
mDevice = null; mDevice = null;
for (int i = 0; i < devices.size(); i++) { for (RestApi.Device device : devices) {
if (devices.get(i).deviceID.equals( if (device.deviceID.equals(
getActivity().getIntent().getStringExtra(EXTRA_DEVICE_ID))) { getActivity().getIntent().getStringExtra(EXTRA_DEVICE_ID))) {
mDevice = devices.get(i); mDevice = device;
break; break;
} }
} }
@ -327,12 +327,7 @@ public class DeviceFragment extends Fragment implements
case R.id.remove: case R.id.remove:
new AlertDialog.Builder(getActivity()) new AlertDialog.Builder(getActivity())
.setMessage(R.string.remove_device_confirm) .setMessage(R.string.remove_device_confirm)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.yes, (dialogInterface, i) -> mSyncthingService.getApi().deleteDevice(mDevice, getActivity()))
@Override
public void onClick(DialogInterface dialogInterface, int i) {
mSyncthingService.getApi().deleteDevice(mDevice, getActivity());
}
})
.setNegativeButton(android.R.string.no, null) .setNegativeButton(android.R.string.no, null)
.show(); .show();
return true; return true;

View file

@ -29,12 +29,7 @@ import java.util.TimerTask;
public class DeviceListFragment extends ListFragment implements SyncthingService.OnApiChangeListener, public class DeviceListFragment extends ListFragment implements SyncthingService.OnApiChangeListener,
ListView.OnItemClickListener { ListView.OnItemClickListener {
private final static Comparator<RestApi.Device> DEVICES_COMPARATOR = new Comparator<RestApi.Device>() { private final static Comparator<RestApi.Device> DEVICES_COMPARATOR = (lhs, rhs) -> lhs.name.compareTo(rhs.name);
@Override
public int compare(RestApi.Device lhs, RestApi.Device rhs) {
return lhs.name.compareTo(rhs.name);
}
};
private DevicesAdapter mAdapter; private DevicesAdapter mAdapter;
@ -47,12 +42,7 @@ public class DeviceListFragment extends ListFragment implements SyncthingService
mTimer.schedule(new TimerTask() { mTimer.schedule(new TimerTask() {
@Override @Override
public void run() { public void run() {
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(DeviceListFragment.this::updateList);
@Override
public void run() {
updateList();
}
});
} }
}, 0, SyncthingService.GUI_UPDATE_INTERVAL); }, 0, SyncthingService.GUI_UPDATE_INTERVAL);

View file

@ -1,7 +1,6 @@
package com.nutomic.syncthingandroid.fragments; package com.nutomic.syncthingandroid.fragments;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -156,12 +155,7 @@ public class DrawerFragment extends Fragment implements RestApi.OnReceiveSystemI
return; return;
mDeviceId.setText(info.myID); mDeviceId.setText(info.myID);
mDeviceId.setOnClickListener(new View.OnClickListener() { mDeviceId.setOnClickListener(v -> mActivity.getApi().copyDeviceId(mDeviceId.getText().toString()));
@Override
public void onClick(View v) {
mActivity.getApi().copyDeviceId(mDeviceId.getText().toString());
}
});
mCpuUsage.setText(new DecimalFormat("0.00").format(info.cpuPercent) + "%"); mCpuUsage.setText(new DecimalFormat("0.00").format(info.cpuPercent) + "%");
mRamUsage.setText(RestApi.readableFileSize(mActivity, info.sys)); mRamUsage.setText(RestApi.readableFileSize(mActivity, info.sys));
mAnnounceServer.setText(Integer.toString(info.extAnnounceConnected) + "/" + mAnnounceServer.setText(Integer.toString(info.extAnnounceConnected) + "/" +
@ -217,13 +211,8 @@ public class DrawerFragment extends Fragment implements RestApi.OnReceiveSystemI
mActivity.closeDrawer(); mActivity.closeDrawer();
new AlertDialog.Builder(getContext()) new AlertDialog.Builder(getContext())
.setMessage(R.string.dialog_confirm_restart) .setMessage(R.string.dialog_confirm_restart)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.yes, (dialogInterface, i1) -> getContext().startService(new Intent(getContext(), SyncthingService.class)
@Override .setAction(SyncthingService.ACTION_RESTART)))
public void onClick(DialogInterface dialogInterface, int i) {
getContext().startService(new Intent(getContext(), SyncthingService.class)
.setAction(SyncthingService.ACTION_RESTART));
}
})
.setNegativeButton(android.R.string.no, null) .setNegativeButton(android.R.string.no, null)
.show(); .show();
break; break;

View file

@ -3,7 +3,6 @@ package com.nutomic.syncthingandroid.fragments;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Fragment; import android.app.Fragment;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
@ -71,9 +70,9 @@ public class FolderFragment extends Fragment
private boolean mIsCreateMode; private boolean mIsCreateMode;
private boolean mFolderNeedsToUpdate; private boolean mFolderNeedsToUpdate;
private KeepVersionsDialogFragment mKeepVersionsDialogFragment = new KeepVersionsDialogFragment(); private final KeepVersionsDialogFragment mKeepVersionsDialogFragment = new KeepVersionsDialogFragment();
private TextWatcher mTextWatcher = new TextWatcherAdapter() { private final TextWatcher mTextWatcher = new TextWatcherAdapter() {
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
mFolder.label = mLabelView.getText().toString(); mFolder.label = mLabelView.getText().toString();
@ -83,7 +82,7 @@ public class FolderFragment extends Fragment
} }
}; };
private CompoundButton.OnCheckedChangeListener mCheckedListener = private final CompoundButton.OnCheckedChangeListener mCheckedListener =
new CompoundButton.OnCheckedChangeListener() { new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton view, boolean isChecked) { public void onCheckedChanged(CompoundButton view, boolean isChecked) {
@ -105,7 +104,7 @@ public class FolderFragment extends Fragment
} }
}; };
private KeepVersionsDialogFragment.OnValueChangeListener mOnValueChangeListener = private final KeepVersionsDialogFragment.OnValueChangeListener mOnValueChangeListener =
new KeepVersionsDialogFragment.OnValueChangeListener() { new KeepVersionsDialogFragment.OnValueChangeListener() {
@Override @Override
public void onValueChange(int intValue) { public void onValueChange(int intValue) {
@ -121,7 +120,7 @@ public class FolderFragment extends Fragment
} }
}; };
private View.OnClickListener mPathViewClickListener = new View.OnClickListener() { private final View.OnClickListener mPathViewClickListener = new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(getActivity(), FolderPickerActivity.class); Intent intent = new Intent(getActivity(), FolderPickerActivity.class);
@ -197,12 +196,7 @@ public class FolderFragment extends Fragment
mDevicesContainer = (ViewGroup) view.findViewById(R.id.devicesContainer); mDevicesContainer = (ViewGroup) view.findViewById(R.id.devicesContainer);
mPathView.setOnClickListener(mPathViewClickListener); mPathView.setOnClickListener(mPathViewClickListener);
view.findViewById(R.id.versioningContainer).setOnClickListener(new View.OnClickListener() { view.findViewById(R.id.versioningContainer).setOnClickListener(v -> mKeepVersionsDialogFragment.show(getFragmentManager(), KEEP_VERSIONS_DIALOG_TAG));
@Override
public void onClick(View v) {
mKeepVersionsDialogFragment.show(getFragmentManager(), KEEP_VERSIONS_DIALOG_TAG);
}
});
if (mIsCreateMode) { if (mIsCreateMode) {
// Open keyboard on label view in edit mode. // Open keyboard on label view in edit mode.
@ -326,12 +320,7 @@ public class FolderFragment extends Fragment
case R.id.remove: case R.id.remove:
new AlertDialog.Builder(getActivity()) new AlertDialog.Builder(getActivity())
.setMessage(R.string.remove_folder_confirm) .setMessage(R.string.remove_folder_confirm)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.yes, (dialogInterface, i) -> mSyncthingService.getApi().deleteFolder(mFolder, getActivity()))
@Override
public void onClick(DialogInterface dialogInterface, int i) {
mSyncthingService.getApi().deleteFolder(mFolder, getActivity());
}
})
.setNegativeButton(android.R.string.no, null) .setNegativeButton(android.R.string.no, null)
.show(); .show();
return true; return true;
@ -355,7 +344,7 @@ public class FolderFragment extends Fragment
private void initFolder() { private void initFolder() {
mFolder = new RestApi.Folder(); mFolder = new RestApi.Folder();
mFolder.id = getActivity().getIntent().getStringExtra(EXTRA_FOLDER_ID); mFolder.id = getActivity().getIntent().getStringExtra(EXTRA_FOLDER_ID);
mFolder.label = getActivity().getIntent().getStringExtra(EXTRA_FOLDER_LABEL);; mFolder.label = getActivity().getIntent().getStringExtra(EXTRA_FOLDER_LABEL);
mFolder.path = ""; mFolder.path = "";
mFolder.rescanIntervalS = 259200; // Scan every 3 days (in case inotify dropped some changes) mFolder.rescanIntervalS = 259200; // Scan every 3 days (in case inotify dropped some changes)
mFolder.deviceIds = new ArrayList<>(); mFolder.deviceIds = new ArrayList<>();

View file

@ -32,14 +32,11 @@ public class FolderListFragment extends ListFragment implements SyncthingService
/** /**
* Compares folders by labels, uses the folder ID as fallback if the label is empty * Compares folders by labels, uses the folder ID as fallback if the label is empty
*/ */
private final static Comparator<RestApi.Folder> FOLDERS_COMPARATOR = new Comparator<RestApi.Folder>() { private final static Comparator<RestApi.Folder> FOLDERS_COMPARATOR = (lhs, rhs) -> {
@Override
public int compare(RestApi.Folder lhs, RestApi.Folder rhs) {
String lhsLabel = lhs.label != null && !lhs.label.isEmpty() ? lhs.label : lhs.id; String lhsLabel = lhs.label != null && !lhs.label.isEmpty() ? lhs.label : lhs.id;
String rhsLabel = rhs.label != null && !rhs.label.isEmpty() ? rhs.label : rhs.id; String rhsLabel = rhs.label != null && !rhs.label.isEmpty() ? rhs.label : rhs.id;
return lhsLabel.compareTo(rhsLabel); return lhsLabel.compareTo(rhsLabel);
}
}; };
private FoldersAdapter mAdapter; private FoldersAdapter mAdapter;
@ -53,12 +50,7 @@ public class FolderListFragment extends ListFragment implements SyncthingService
mTimer.schedule(new TimerTask() { mTimer.schedule(new TimerTask() {
@Override @Override
public void run() { public void run() {
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(FolderListFragment.this::updateList);
@Override
public void run() {
updateList();
}
});
} }
}, 0, SyncthingService.GUI_UPDATE_INTERVAL); }, 0, SyncthingService.GUI_UPDATE_INTERVAL);

View file

@ -1,9 +1,7 @@
package com.nutomic.syncthingandroid.fragments; package com.nutomic.syncthingandroid.fragments;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
@ -11,11 +9,8 @@ import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference; import android.preference.EditTextPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.support.v4.app.NavUtils; import android.support.v4.app.NavUtils;
import android.text.InputType;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.Toast; import android.widget.Toast;
@ -27,7 +22,6 @@ import com.nutomic.syncthingandroid.syncthing.RestApi;
import com.nutomic.syncthingandroid.syncthing.SyncthingService; import com.nutomic.syncthingandroid.syncthing.SyncthingService;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import eu.chainfire.libsuperuser.Shell; import eu.chainfire.libsuperuser.Shell;
@ -284,14 +278,6 @@ public class SettingsFragment extends PreferenceFragment
return true; return true;
} }
private String formatWifiNameList(Set<String> ssids) {
Set<String> formatted = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
for (String ssid : ssids) {
formatted.add(ssid.replaceFirst("^\"", "").replaceFirst("\"$", ""));
}
return TextUtils.join(", ", formatted);
}
/** /**
* Changes the owner of syncthing files so they can be accessed without root. * Changes the owner of syncthing files so they can be accessed without root.
*/ */
@ -324,14 +310,11 @@ public class SettingsFragment extends PreferenceFragment
new AlertDialog.Builder(getActivity()) new AlertDialog.Builder(getActivity())
.setMessage(R.string.dialog_confirm_export) .setMessage(R.string.dialog_confirm_export)
.setPositiveButton(android.R.string.yes, .setPositiveButton(android.R.string.yes,
new DialogInterface.OnClickListener() { (dialog, which) -> {
@Override
public void onClick(DialogInterface dialog, int which) {
mSyncthingService.exportConfig(); mSyncthingService.exportConfig();
Toast.makeText(getActivity(), Toast.makeText(getActivity(),
getString(R.string.config_export_successful, getString(R.string.config_export_successful,
SyncthingService.EXPORT_PATH), Toast.LENGTH_LONG).show(); SyncthingService.EXPORT_PATH), Toast.LENGTH_LONG).show();
}
}) })
.setNegativeButton(android.R.string.no, null) .setNegativeButton(android.R.string.no, null)
.show(); .show();
@ -340,9 +323,7 @@ public class SettingsFragment extends PreferenceFragment
new AlertDialog.Builder(getActivity()) new AlertDialog.Builder(getActivity())
.setMessage(R.string.dialog_confirm_import) .setMessage(R.string.dialog_confirm_import)
.setPositiveButton(android.R.string.yes, .setPositiveButton(android.R.string.yes,
new DialogInterface.OnClickListener() { (dialog, which) -> {
@Override
public void onClick(DialogInterface dialog, int which) {
if (mSyncthingService.importConfig()) { if (mSyncthingService.importConfig()) {
Toast.makeText(getActivity(), Toast.makeText(getActivity(),
getString(R.string.config_imported_successful), getString(R.string.config_imported_successful),
@ -354,7 +335,6 @@ public class SettingsFragment extends PreferenceFragment
getString(R.string.config_import_failed, getString(R.string.config_import_failed,
SyncthingService.EXPORT_PATH), Toast.LENGTH_LONG).show(); SyncthingService.EXPORT_PATH), Toast.LENGTH_LONG).show();
} }
}
}) })
.setNegativeButton(android.R.string.no, null) .setNegativeButton(android.R.string.no, null)
.show(); .show();
@ -366,17 +346,11 @@ public class SettingsFragment extends PreferenceFragment
new AlertDialog.Builder(getActivity()) new AlertDialog.Builder(getActivity())
.setTitle(R.string.streset_title) .setTitle(R.string.streset_title)
.setMessage(R.string.streset_question) .setMessage(R.string.streset_question)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
getActivity().startService(intent); getActivity().startService(intent);
Toast.makeText(getActivity(), R.string.streset_done, Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), R.string.streset_done, Toast.LENGTH_LONG).show();
}
}) })
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { .setNegativeButton(android.R.string.no, (dialogInterface, i) -> {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
}) })
.show(); .show();
return true; return true;

View file

@ -16,7 +16,7 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
public class KeepVersionsDialogFragment extends DialogFragment { public class KeepVersionsDialogFragment extends DialogFragment {
private OnValueChangeListener mOnValueChangeListener = OnValueChangeListener.NO_OP; private OnValueChangeListener mOnValueChangeListener;
private NumberPicker mNumberPickerView; private NumberPicker mNumberPickerView;
@ -28,6 +28,7 @@ public class KeepVersionsDialogFragment extends DialogFragment {
switch (which) { switch (which) {
case DialogInterface.BUTTON_POSITIVE: case DialogInterface.BUTTON_POSITIVE:
mValue = mNumberPickerView.getValue(); mValue = mNumberPickerView.getValue();
if (mOnValueChangeListener != null)
mOnValueChangeListener.onValueChange(mValue); mOnValueChangeListener.onValueChange(mValue);
break; break;
} }
@ -47,10 +48,6 @@ public class KeepVersionsDialogFragment extends DialogFragment {
} }
public void setOnValueChangeListener(OnValueChangeListener onValueChangeListener) { public void setOnValueChangeListener(OnValueChangeListener onValueChangeListener) {
if (onValueChangeListener == null) {
onValueChangeListener = OnValueChangeListener.NO_OP;
}
mOnValueChangeListener = onValueChangeListener; mOnValueChangeListener = onValueChangeListener;
} }
@ -73,11 +70,6 @@ public class KeepVersionsDialogFragment extends DialogFragment {
} }
public interface OnValueChangeListener { public interface OnValueChangeListener {
OnValueChangeListener NO_OP = new OnValueChangeListener() {
@Override
public void onValueChange(int value) {}
};
void onValueChange(int value); void onValueChange(int value);
} }
} }

View file

@ -11,7 +11,6 @@ import android.widget.Toast;
import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.R;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -53,7 +52,7 @@ public class WifiSsidPreference extends MultiSelectListPreference {
protected void showDialog(Bundle state) { protected void showDialog(Bundle state) {
WifiConfiguration[] networks = loadConfiguredNetworksSorted(); WifiConfiguration[] networks = loadConfiguredNetworksSorted();
if (networks != null) { if (networks != null) {
Set<String> selected = getSharedPreferences().getStringSet(getKey(), new HashSet<String>()); Set<String> selected = getSharedPreferences().getStringSet(getKey(), new HashSet<>());
// from JavaDoc: Note that you must not modify the set instance returned by this call. // from JavaDoc: Note that you must not modify the set instance returned by this call.
// therefore required to make a defensive copy of the elements // therefore required to make a defensive copy of the elements
selected = new HashSet<>(selected); selected = new HashSet<>(selected);
@ -114,14 +113,11 @@ public class WifiSsidPreference extends MultiSelectListPreference {
// if WiFi is turned off, getConfiguredNetworks returns null on many devices // if WiFi is turned off, getConfiguredNetworks returns null on many devices
if (configuredNetworks != null) { if (configuredNetworks != null) {
WifiConfiguration[] result = configuredNetworks.toArray(new WifiConfiguration[configuredNetworks.size()]); WifiConfiguration[] result = configuredNetworks.toArray(new WifiConfiguration[configuredNetworks.size()]);
Arrays.sort(result, new Comparator<WifiConfiguration>() { Arrays.sort(result, (lhs, rhs) -> {
@Override
public int compare(WifiConfiguration lhs, WifiConfiguration rhs) {
// See #620: There may be null-SSIDs // See #620: There may be null-SSIDs
String l = lhs.SSID != null ? lhs.SSID : ""; String l = lhs.SSID != null ? lhs.SSID : "";
String r = rhs.SSID != null ? rhs.SSID : ""; String r = rhs.SSID != null ? rhs.SSID : "";
return l.compareToIgnoreCase(r); return l.compareToIgnoreCase(r);
}
}); });
return result; return result;
} }

View file

@ -40,7 +40,7 @@ public class DeviceStateHolder extends BroadcastReceiver {
public static final String EXTRA_IS_CHARGING = public static final String EXTRA_IS_CHARGING =
"com.nutomic.syncthingandroid.syncthing.DeviceStateHolder.IS_CHARGING"; "com.nutomic.syncthingandroid.syncthing.DeviceStateHolder.IS_CHARGING";
private Context mContext; private final Context mContext;
private boolean mIsWifiConnected = false; private boolean mIsWifiConnected = false;
@ -132,7 +132,7 @@ public class DeviceStateHolder extends BroadcastReceiver {
boolean wifiConnected = isWifiConnected(); boolean wifiConnected = isWifiConnected();
if (wifiConnected) { if (wifiConnected) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
Set<String> ssids = sp.getStringSet(SyncthingService.PREF_SYNC_ONLY_WIFI_SSIDS, new HashSet<String>()); Set<String> ssids = sp.getStringSet(SyncthingService.PREF_SYNC_ONLY_WIFI_SSIDS, new HashSet<>());
if (ssids.isEmpty()) { if (ssids.isEmpty()) {
Log.d(TAG, "All SSIDs allowed for syncing"); Log.d(TAG, "All SSIDs allowed for syncing");
return true; return true;

View file

@ -70,7 +70,7 @@ public class EventProcessor implements SyncthingService.OnWebGuiAvailableListene
// If that's the case we've to start at zero because syncthing was restarted. // If that's the case we've to start at zero because syncthing was restarted.
mApi.getEvents(0, 1, new RestApi.OnReceiveEventListener() { mApi.getEvents(0, 1, new RestApi.OnReceiveEventListener() {
@Override @Override
public void onEvent(long id, String eventType, JSONObject data) throws JSONException { public void onEvent(String eventType, JSONObject data) throws JSONException {
} }
@ -89,7 +89,7 @@ public class EventProcessor implements SyncthingService.OnWebGuiAvailableListene
* Performs the actual event handling. * Performs the actual event handling.
*/ */
@Override @Override
public void onEvent(long id, String type, JSONObject data) throws JSONException { public void onEvent(String type, JSONObject data) throws JSONException {
switch (type) { switch (type) {
case "DeviceRejected": case "DeviceRejected":
String deviceId = data.getString("device"); String deviceId = data.getString("device");
@ -159,7 +159,7 @@ public class EventProcessor implements SyncthingService.OnWebGuiAvailableListene
final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
//noinspection CommitPrefEdits //noinspection CommitPrefEdits
sp.edit().putLong(PREF_LAST_SYNC_ID, mLastEventId).commit(); sp.edit().putLong(PREF_LAST_SYNC_ID, mLastEventId).apply();
} }
synchronized (mMainThreadHandler) { synchronized (mMainThreadHandler) {

View file

@ -38,7 +38,7 @@ public class GetTask extends AsyncTask<String, Void, String> {
public static final String URI_REPORT = "/rest/svc/report"; public static final String URI_REPORT = "/rest/svc/report";
public static final String URI_EVENTS = "/rest/events"; public static final String URI_EVENTS = "/rest/events";
private String mHttpsCertPath; private final String mHttpsCertPath;
public GetTask(String httpsCertPath) { public GetTask(String httpsCertPath) {
mHttpsCertPath = httpsCertPath; mHttpsCertPath = httpsCertPath;

View file

@ -28,14 +28,14 @@ public abstract class PollWebGuiAvailableTask extends AsyncTask<String, Void, Vo
*/ */
private static final long WEB_GUI_POLL_INTERVAL = 100; private static final long WEB_GUI_POLL_INTERVAL = 100;
private String mHttpsCertPath; private final String mHttpsCertPath;
public PollWebGuiAvailableTask(String httpsCertPath) { public PollWebGuiAvailableTask(String httpsCertPath) {
mHttpsCertPath = httpsCertPath; mHttpsCertPath = httpsCertPath;
} }
/** /**
* @param @url The URL of the web GUI (eg 127.0.0.1:8384). * @param url The URL of the web GUI (eg 127.0.0.1:8384).
*/ */
@Override @Override
protected Void doInBackground(String... url) { protected Void doInBackground(String... url) {

View file

@ -22,7 +22,7 @@ public class PostConfigTask extends AsyncTask<String, Void, Boolean> {
public static final String URI_CONFIG = "/rest/system/config"; public static final String URI_CONFIG = "/rest/system/config";
private String mHttpsCertPath; private final String mHttpsCertPath;
public PostConfigTask(String httpsCertPath) { public PostConfigTask(String httpsCertPath) {
mHttpsCertPath = httpsCertPath; mHttpsCertPath = httpsCertPath;

View file

@ -26,7 +26,7 @@ public class PostScanTask extends AsyncTask<String, Void, Void> {
public static final String URI_SCAN = "/rest/db/scan"; public static final String URI_SCAN = "/rest/db/scan";
private String mHttpsCertPath; private final String mHttpsCertPath;
public PostScanTask(String httpsCertPath) { public PostScanTask(String httpsCertPath) {
mHttpsCertPath = httpsCertPath; mHttpsCertPath = httpsCertPath;

View file

@ -13,7 +13,6 @@ import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException; import com.google.gson.JsonSyntaxException;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import com.nutomic.syncthingandroid.BuildConfig; import com.nutomic.syncthingandroid.BuildConfig;
@ -170,7 +169,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
private String mVersion; private String mVersion;
private String mUrl; private final String mUrl;
private final String mApiKey; private final String mApiKey;
@ -197,12 +196,12 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
* Stores the latest result of {@link #getModel(String, OnReceiveModelListener)} for each folder, * Stores the latest result of {@link #getModel(String, OnReceiveModelListener)} for each folder,
* for calculating device percentage in {@link #getConnections(OnReceiveConnectionsListener)}. * for calculating device percentage in {@link #getConnections(OnReceiveConnectionsListener)}.
*/ */
private HashMap<String, Model> mCachedModelInfo = new HashMap<>(); private final HashMap<String, Model> mCachedModelInfo = new HashMap<>();
/** /**
* Stores a hash map to resolve folders to paths for events. * Stores a hash map to resolve folders to paths for events.
*/ */
private final Map<String, String> mCacheFolderPathLookup = new HashMap<String, String>(); private final Map<String, String> mCacheFolderPathLookup = new HashMap<>();
public RestApi(Context context, String url, String apiKey, OnApiAvailableListener apiListener, public RestApi(Context context, String url, String apiKey, OnApiAvailableListener apiListener,
OnConfigChangedListener configListener) { OnConfigChangedListener configListener) {
@ -214,14 +213,10 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
mOnConfigChangedListener = configListener; mOnConfigChangedListener = configListener;
} }
public void setWebGuiUrl(String newUrl) {
mUrl = newUrl;
}
/** /**
* Number of previous calls to {@link #tryIsAvailable()}. * Number of previous calls to {@link #tryIsAvailable()}.
*/ */
private AtomicInteger mAvailableCount = new AtomicInteger(0); private final AtomicInteger mAvailableCount = new AtomicInteger(0);
/** /**
* Number of asynchronous calls performed in {@link #onWebGuiAvailable()}. * Number of asynchronous calls performed in {@link #onWebGuiAvailable()}.
@ -270,12 +265,9 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
} }
} }
}.execute(mUrl, GetTask.URI_CONFIG, mApiKey); }.execute(mUrl, GetTask.URI_CONFIG, mApiKey);
getSystemInfo(new OnReceiveSystemInfoListener() { getSystemInfo(info -> {
@Override
public void onReceiveSystemInfo(SystemInfo info) {
mLocalDeviceId = info.myID; mLocalDeviceId = info.myID;
tryIsAvailable(); tryIsAvailable();
}
}); });
} }
@ -712,12 +704,10 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
* Called for each event. * Called for each event.
* *
* Events with a "folder" field in the data have an extra "folderpath" element added. * Events with a "folder" field in the data have an extra "folderpath" element added.
*
* @param id ID of the event. Monotonously increasing.
* @param eventType Name of the event. (See Syncthing documentation) * @param eventType Name of the event. (See Syncthing documentation)
* @param data Contains the data fields of the event. * @param data Contains the data fields of the event.
*/ */
void onEvent(long id, String eventType, JSONObject data) throws JSONException; void onEvent(String eventType, JSONObject data) throws JSONException;
/** /**
* Called after all available events have been processed. * Called after all available events have been processed.
@ -816,7 +806,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
data.put("folderpath", folderPath); data.put("folderpath", folderPath);
} }
listener.onEvent(id, type, data); listener.onEvent(type, data);
} }
listener.onDone(lastId); listener.onDone(lastId);
@ -838,9 +828,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
public void editDevice(@NonNull final Device device, final Activity activity, public void editDevice(@NonNull final Device device, final Activity activity,
final OnDeviceIdNormalizedListener listener) { final OnDeviceIdNormalizedListener listener) {
normalizeDeviceId(device.deviceID, normalizeDeviceId(device.deviceID,
new RestApi.OnDeviceIdNormalizedListener() { (normalizedId, error) -> {
@Override
public void onDeviceIdNormalized(String normalizedId, String error) {
if (listener != null) listener.onDeviceIdNormalized(normalizedId, error); if (listener != null) listener.onDeviceIdNormalized(normalizedId, error);
if (normalizedId == null) if (normalizedId == null)
return; return;
@ -848,7 +836,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
device.deviceID = normalizedId; device.deviceID = normalizedId;
// If the device already exists, just update it. // If the device already exists, just update it.
boolean create = true; boolean create = true;
for (RestApi.Device n : getDevices(true)) { for (Device n : getDevices(true)) {
if (n.deviceID.equals(device.deviceID)) { if (n.deviceID.equals(device.deviceID)) {
create = false; create = false;
} }
@ -879,7 +867,6 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
Log.w(TAG, "Failed to read devices", e); Log.w(TAG, "Failed to read devices", e);
} }
} }
}
); );
} }
@ -909,7 +896,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
/** /**
* Updates or creates the given device. * Updates or creates the given device.
*/ */
public boolean editFolder(Folder folder, boolean create, Activity activity) { public void editFolder(Folder folder, boolean create, Activity activity) {
try { try {
JSONArray folders = mConfig.getJSONArray("folders"); JSONArray folders = mConfig.getJSONArray("folders");
JSONObject r = null; JSONObject r = null;
@ -950,11 +937,10 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
requireRestart(activity); requireRestart(activity);
} catch (JSONException e) { } catch (JSONException e) {
Log.w(TAG, "Failed to edit folder " + folder.id + " at " + folder.path, e); Log.w(TAG, "Failed to edit folder " + folder.id + " at " + folder.path, e);
return false; return;
} }
clearFolderCache(); clearFolderCache();
return true;
} }
/** /**

View file

@ -42,7 +42,7 @@ public class SyncthingRunnable implements Runnable {
private final Context mContext; private final Context mContext;
private String mSyncthingBinary; private final String mSyncthingBinary;
private String[] mCommand; private String[] mCommand;
@ -91,7 +91,7 @@ public class SyncthingRunnable implements Runnable {
@Override @Override
public void run() { public void run() {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
int ret = 1; int ret;
// Make sure Syncthing is executable // Make sure Syncthing is executable
try { try {
ProcessBuilder pb = new ProcessBuilder("chmod", "500", mSyncthingBinary); ProcessBuilder pb = new ProcessBuilder("chmod", "500", mSyncthingBinary);
@ -313,9 +313,7 @@ public class SyncthingRunnable implements Runnable {
* @param saveLog True if the log should be stored to {@link #mErrorLog}. * @param saveLog True if the log should be stored to {@link #mErrorLog}.
*/ */
private Thread log(final InputStream is, final int priority, final boolean saveLog) { private Thread log(final InputStream is, final int priority, final boolean saveLog) {
Thread t = new Thread(new Runnable() { Thread t = new Thread(() -> {
@Override
public void run() {
try { try {
InputStreamReader isr = new InputStreamReader(is, "UTF-8"); InputStreamReader isr = new InputStreamReader(is, "UTF-8");
BufferedReader br = new BufferedReader(isr); BufferedReader br = new BufferedReader(isr);
@ -329,7 +327,6 @@ public class SyncthingRunnable implements Runnable {
} catch (IOException e) { } catch (IOException e) {
Log.w(TAG, "Failed to read Syncthing's command line output", e); Log.w(TAG, "Failed to read Syncthing's command line output", e);
} }
}
}); });
t.start(); t.start();
return t; return t;

View file

@ -5,7 +5,6 @@ import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.Service; import android.app.Service;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
@ -32,11 +31,9 @@ import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.security.SecureRandom;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
@ -107,7 +104,7 @@ public class SyncthingService extends Service implements
private EventProcessor mEventProcessor; private EventProcessor mEventProcessor;
private LinkedList<FolderObserver> mObservers = new LinkedList<>(); private final LinkedList<FolderObserver> mObservers = new LinkedList<>();
private final SyncthingServiceBinder mBinder = new SyncthingServiceBinder(this); private final SyncthingServiceBinder mBinder = new SyncthingServiceBinder(this);
@ -347,14 +344,10 @@ public class SyncthingService extends Service implements
} }
mApi = new RestApi(SyncthingService.this, urlAndKey.first, urlAndKey.second, mApi = new RestApi(SyncthingService.this, urlAndKey.first, urlAndKey.second,
new RestApi.OnApiAvailableListener() { () -> {
@Override
public void onApiAvailable() {
mCurrentState = State.ACTIVE; mCurrentState = State.ACTIVE;
onApiChange(); onApiChange();
new Thread(new Runnable() { new Thread(() -> {
@Override
public void run() {
for (RestApi.Folder r : mApi.getFolders()) { for (RestApi.Folder r : mApi.getFolders()) {
try { try {
mObservers.add(new FolderObserver(mApi, r)); mObservers.add(new FolderObserver(mApi, r));
@ -368,15 +361,8 @@ public class SyncthingService extends Service implements
.show(); .show();
} }
} }
}
}).start(); }).start();
} }, SyncthingService.this::onApiChange);
}, new RestApi.OnConfigChangedListener() {
@Override
public void onConfigChanged() {
onApiChange();
}
});
mEventProcessor = new EventProcessor(SyncthingService.this, mApi); mEventProcessor = new EventProcessor(SyncthingService.this, mApi);
@ -472,7 +458,7 @@ public class SyncthingService extends Service implements
* The listener is called immediately with the current state, and again whenever the state * The listener is called immediately with the current state, and again whenever the state
* changes. The call is always from the GUI thread. * changes. The call is always from the GUI thread.
* *
* @see {@link #unregisterOnApiChangeListener} * @see #unregisterOnApiChangeListener
*/ */
public void registerOnApiChangeListener(OnApiChangeListener listener) { public void registerOnApiChangeListener(OnApiChangeListener listener) {
// Make sure we don't send an invalid state or syncthing might show a "disabled" message // Make sure we don't send an invalid state or syncthing might show a "disabled" message
@ -484,7 +470,7 @@ public class SyncthingService extends Service implements
/** /**
* Unregisters a previously registered listener. * Unregisters a previously registered listener.
* *
* @see {@link #registerOnApiChangeListener} * @see #registerOnApiChangeListener
*/ */
public void unregisterOnApiChangeListener(OnApiChangeListener listener) { public void unregisterOnApiChangeListener(OnApiChangeListener listener) {
mOnApiChangeListeners.remove(listener); mOnApiChangeListeners.remove(listener);

View file

@ -63,7 +63,7 @@ public class ConfigXml {
private final Context mContext; private final Context mContext;
private File mConfigFile; private final File mConfigFile;
private Document mConfig; private Document mConfig;

View file

@ -1,5 +1,6 @@
package com.nutomic.syncthingandroid.util; package com.nutomic.syncthingandroid.util;
import android.annotation.SuppressLint;
import android.util.Log; import android.util.Log;
import org.apache.http.conn.ssl.SSLSocketFactory; import org.apache.http.conn.ssl.SSLSocketFactory;
@ -61,13 +62,14 @@ public class CustomX509TrustManager implements X509TrustManager {
} }
} }
private String mHttpsCertPath; private final String mHttpsCertPath;
public CustomX509TrustManager(String httpsCertPath) { public CustomX509TrustManager(String httpsCertPath) {
mHttpsCertPath = httpsCertPath; mHttpsCertPath = httpsCertPath;
} }
@Override @Override
@SuppressLint("TrustAllX509TrustManager")
public void checkClientTrusted(X509Certificate[] chain, String authType) public void checkClientTrusted(X509Certificate[] chain, String authType)
throws CertificateException { throws CertificateException {
} }

View file

@ -6,7 +6,6 @@ import android.util.Log;
import com.nutomic.syncthingandroid.syncthing.RestApi; import com.nutomic.syncthingandroid.syncthing.RestApi;
import java.io.File; import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
@ -35,7 +34,7 @@ public class FolderObserver extends FileObserver {
public class FolderNotExistingException extends Exception { public class FolderNotExistingException extends Exception {
private String mPath; private final String mPath;
public FolderNotExistingException(String path) { public FolderNotExistingException(String path) {
mPath = path; mPath = path;
@ -69,12 +68,7 @@ public class FolderObserver extends FileObserver {
if (!currentFolder.exists()) { if (!currentFolder.exists()) {
throw new FolderNotExistingException(currentFolder.getAbsolutePath()); throw new FolderNotExistingException(currentFolder.getAbsolutePath());
} }
File[] directories = currentFolder.listFiles(new FilenameFilter() { File[] directories = currentFolder.listFiles((current, name) -> new File(current, name).isDirectory());
@Override
public boolean accept(File current, String name) {
return new File(current, name).isDirectory();
}
});
if (directories != null) { if (directories != null) {
for (File f : directories) { for (File f : directories) {

View file

@ -24,8 +24,8 @@ import static com.nutomic.syncthingandroid.syncthing.RestApi.readableFileSize;
public class FoldersAdapter extends ArrayAdapter<RestApi.Folder> public class FoldersAdapter extends ArrayAdapter<RestApi.Folder>
implements RestApi.OnReceiveModelListener { implements RestApi.OnReceiveModelListener {
private HashMap<String, RestApi.Model> mModels = new HashMap<>(); private final HashMap<String, RestApi.Model> mModels = new HashMap<>();
private LayoutInflater mInflater; private final LayoutInflater mInflater;
public FoldersAdapter(Context context) { public FoldersAdapter(Context context) {
super(context, R.layout.item_folder_list); super(context, R.layout.item_folder_list);

View file

@ -34,11 +34,9 @@ public class EnhancedEditText extends EditText {
@Override @Override
public boolean onTouchEvent(MotionEvent event) { public boolean onTouchEvent(MotionEvent event) {
if (isEnabled()) { return (isEnabled())
return super.onTouchEvent(event); ? super.onTouchEvent(event)
} else { : false;
return false;
}
} }
@Override @Override

View file

@ -141,8 +141,6 @@
<string name="sync_only_charging">Само по време на зареждане</string> <string name="sync_only_charging">Само по време на зареждане</string>
<string name="sync_only_wifi">Само чрез WiFi</string> <string name="sync_only_wifi">Само чрез WiFi</string>
<string name="sync_only_wifi_ssids">Ограничаване до определени WiFi мрежи</string> <string name="sync_only_wifi_ssids">Ограничаване до определени WiFi мрежи</string>
<string name="sync_only_wifi_ssids_all">Синхронизиране чрез всяка WiFi мрежа</string>
<string name="sync_only_wifi_ssids_values">Синхронизиране само чрез: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">За да изберете мрежа, моля включете WiFi</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">За да изберете мрежа, моля включете WiFi</string>
<string name="advanced_folder_picker">Избор на папка, за напреднали</string> <string name="advanced_folder_picker">Избор на папка, за напреднали</string>
<string name="advanced_folder_picker_summary">Изберете папка, от устройството, за синхронизиране</string> <string name="advanced_folder_picker_summary">Изберете папка, от устройството, за синхронизиране</string>

View file

@ -144,8 +144,6 @@ Všechny problémy, se kterými se setkáte, nahlašte prosím přes Github.</st
<string name="sync_only_charging">Synchronizovat pouze při nabíjení</string> <string name="sync_only_charging">Synchronizovat pouze při nabíjení</string>
<string name="sync_only_wifi">Synchronizovat pouze přes wifi</string> <string name="sync_only_wifi">Synchronizovat pouze přes wifi</string>
<string name="sync_only_wifi_ssids">Omezit na vybrané sítě wifi</string> <string name="sync_only_wifi_ssids">Omezit na vybrané sítě wifi</string>
<string name="sync_only_wifi_ssids_all">Synchronizovat na všech wifi sítích</string>
<string name="sync_only_wifi_ssids_values">Synchronizovat pouze při připojení k: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Pro výběr sítí prosím zapněte WiFi.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Pro výběr sítí prosím zapněte WiFi.</string>
<string name="advanced_folder_picker">Použít rozšířený výběr adresáře</string> <string name="advanced_folder_picker">Použít rozšířený výběr adresáře</string>
<string name="advanced_folder_picker_summary">Vyberte jakýkoliv adresář v přístroji pro synchronizaci</string> <string name="advanced_folder_picker_summary">Vyberte jakýkoliv adresář v přístroji pro synchronizaci</string>

View file

@ -142,8 +142,6 @@ Bitte auftretenden Probleme via Github melden.</string>
<string name="sync_only_charging">Sync nur mit Ladegerät</string> <string name="sync_only_charging">Sync nur mit Ladegerät</string>
<string name="sync_only_wifi">Sync nur im WLAN</string> <string name="sync_only_wifi">Sync nur im WLAN</string>
<string name="sync_only_wifi_ssids">Nur in bestimmten WLAN Netzwerken</string> <string name="sync_only_wifi_ssids">Nur in bestimmten WLAN Netzwerken</string>
<string name="sync_only_wifi_ssids_all">Synchronisiere in allen WLAN Netzwerken</string>
<string name="sync_only_wifi_ssids_values">Synchronisiere nur in folgendem WLAN: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Bitte WLAN aktivieren, um eines zu wählen.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Bitte WLAN aktivieren, um eines zu wählen.</string>
<string name="advanced_folder_picker">Erweiterte Verzeichnisauswahl benutzen</string> <string name="advanced_folder_picker">Erweiterte Verzeichnisauswahl benutzen</string>
<string name="advanced_folder_picker_summary">Alle Verzeichnisse auf dem Gerät für Synchronisation auswählbar</string> <string name="advanced_folder_picker_summary">Alle Verzeichnisse auf dem Gerät für Synchronisation auswählbar</string>

View file

@ -142,8 +142,6 @@ Por favor reporte cualquier problema que encuentre por medio de Github.</string>
<string name="sync_only_charging">Sincronizar sólo cuando se está cargando</string> <string name="sync_only_charging">Sincronizar sólo cuando se está cargando</string>
<string name="sync_only_wifi">Sincronizar sólo por wifi</string> <string name="sync_only_wifi">Sincronizar sólo por wifi</string>
<string name="sync_only_wifi_ssids">Restringir a ciertas redes wifi</string> <string name="sync_only_wifi_ssids">Restringir a ciertas redes wifi</string>
<string name="sync_only_wifi_ssids_all">Sincronizar en todas las redes wifi</string>
<string name="sync_only_wifi_ssids_values">Sincronizar sólo cuando esté conectado a: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Por favor encienda el WiFi para seleccionar redes.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Por favor encienda el WiFi para seleccionar redes.</string>
<string name="advanced_folder_picker">Usar el avanzado Seleccionador de Carpetas</string> <string name="advanced_folder_picker">Usar el avanzado Seleccionador de Carpetas</string>
<string name="advanced_folder_picker_summary">Seleccionar cualquier carpeta en el dispositivo para sincronizar</string> <string name="advanced_folder_picker_summary">Seleccionar cualquier carpeta en el dispositivo para sincronizar</string>

View file

@ -137,8 +137,6 @@ Por favor informe de qualquier problema que encuentres via Github.</string>
<string name="sync_only_charging">Sincronizar solo cuando esté cargando</string> <string name="sync_only_charging">Sincronizar solo cuando esté cargando</string>
<string name="sync_only_wifi">Sincronizar sólo en wifi</string> <string name="sync_only_wifi">Sincronizar sólo en wifi</string>
<string name="sync_only_wifi_ssids">Restringir a algunas redes wifi</string> <string name="sync_only_wifi_ssids">Restringir a algunas redes wifi</string>
<string name="sync_only_wifi_ssids_all">Sincronizar en todas las redes wifi</string>
<string name="sync_only_wifi_ssids_values">Sincronizar solo cuando se está conectado a: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Por favor enciende el WIFI en las redes seleccionadas.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Por favor enciende el WIFI en las redes seleccionadas.</string>
<string name="advanced_folder_picker">Usar Selección Avanzada de carpeta</string> <string name="advanced_folder_picker">Usar Selección Avanzada de carpeta</string>
<string name="advanced_folder_picker_summary">Escoja una carpeta del dispositivo para sincronizar</string> <string name="advanced_folder_picker_summary">Escoja una carpeta del dispositivo para sincronizar</string>

View file

@ -144,8 +144,6 @@ S\'il vous plait, signalez les problèmes que vous rencontrez via Gihub.</string
<string name="sync_only_charging">Synchro uniquement sur chargeur</string> <string name="sync_only_charging">Synchro uniquement sur chargeur</string>
<string name="sync_only_wifi">Synchro uniquement en WiFi</string> <string name="sync_only_wifi">Synchro uniquement en WiFi</string>
<string name="sync_only_wifi_ssids">Limiter à certains réseaux WiFi</string> <string name="sync_only_wifi_ssids">Limiter à certains réseaux WiFi</string>
<string name="sync_only_wifi_ssids_all">Synchroniser sur tous réseaux WiFi</string>
<string name="sync_only_wifi_ssids_values">Synchroniser seulement si connecté à: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">S\'il vous plait, activer le WiFi pour sélectionner un réseau</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">S\'il vous plait, activer le WiFi pour sélectionner un réseau</string>
<string name="advanced_folder_picker">Choix étendu des dossiers</string> <string name="advanced_folder_picker">Choix étendu des dossiers</string>
<string name="advanced_folder_picker_summary">Autorise la sélection n\'importe quel dossier de cette machine pour la synchronisation</string> <string name="advanced_folder_picker_summary">Autorise la sélection n\'importe quel dossier de cette machine pour la synchronisation</string>

View file

@ -120,7 +120,6 @@
<string name="sync_only_charging">Csak töltés közbeni szinkronizálás</string> <string name="sync_only_charging">Csak töltés közbeni szinkronizálás</string>
<string name="sync_only_wifi">Szinkronizálás csak WiFi-n keresztül</string> <string name="sync_only_wifi">Szinkronizálás csak WiFi-n keresztül</string>
<string name="sync_only_wifi_ssids">Korlátozás bizonyos wifi hálózatokra</string> <string name="sync_only_wifi_ssids">Korlátozás bizonyos wifi hálózatokra</string>
<string name="sync_only_wifi_ssids_all">Szinkronizálás minden wifi hálózaton</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Hálózat választásához kapcsold be a wifit.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Hálózat választásához kapcsold be a wifit.</string>
<string name="use_root_title">Syncthing futtatása Superuser-ként</string> <string name="use_root_title">Syncthing futtatása Superuser-ként</string>
<string name="notification_type_title">Értesítés</string> <string name="notification_type_title">Értesítés</string>

View file

@ -144,8 +144,6 @@ Riferisci tramite Github i problemi che incontri.</string>
<string name="sync_only_charging">Sincr. solo in Ricarica</string> <string name="sync_only_charging">Sincr. solo in Ricarica</string>
<string name="sync_only_wifi">Sincr. solo in Wifi</string> <string name="sync_only_wifi">Sincr. solo in Wifi</string>
<string name="sync_only_wifi_ssids">Solo determinate reti wifi</string> <string name="sync_only_wifi_ssids">Solo determinate reti wifi</string>
<string name="sync_only_wifi_ssids_all">Sincronizzazione su tutte le reti wifi</string>
<string name="sync_only_wifi_ssids_values">Sincronizzazione solo quando connessi a: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Prego accendere wifi per selezionare reti.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Prego accendere wifi per selezionare reti.</string>
<string name="advanced_folder_picker">Selettore Cartella Avanzato</string> <string name="advanced_folder_picker">Selettore Cartella Avanzato</string>
<string name="advanced_folder_picker_summary">Selezionare una cartella sul dispositivo per la sincronizzazione</string> <string name="advanced_folder_picker_summary">Selezionare una cartella sul dispositivo per la sincronizzazione</string>

View file

@ -144,8 +144,6 @@
<string name="sync_only_charging">充電中のみ同期</string> <string name="sync_only_charging">充電中のみ同期</string>
<string name="sync_only_wifi">Wifi 時のみ同期</string> <string name="sync_only_wifi">Wifi 時のみ同期</string>
<string name="sync_only_wifi_ssids">特定の WiFi ネットワークに制限する</string> <string name="sync_only_wifi_ssids">特定の WiFi ネットワークに制限する</string>
<string name="sync_only_wifi_ssids_all">すべての WiFi ネットワークで共有する</string>
<string name="sync_only_wifi_ssids_values">%1$s に接続時のみ同期する</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">ネットワークを選択するために WiFi をオンにしてください。</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">ネットワークを選択するために WiFi をオンにしてください。</string>
<string name="advanced_folder_picker">高度なフォルダー選択を使用する</string> <string name="advanced_folder_picker">高度なフォルダー選択を使用する</string>
<string name="advanced_folder_picker_summary">同期するデバイスのフォルダーを選択してください</string> <string name="advanced_folder_picker_summary">同期するデバイスのフォルダーを選択してください</string>

View file

@ -144,8 +144,6 @@
<string name="sync_only_charging">충전 중일 때만 동기화</string> <string name="sync_only_charging">충전 중일 때만 동기화</string>
<string name="sync_only_wifi">Wi-Fi에서만 동기화</string> <string name="sync_only_wifi">Wi-Fi에서만 동기화</string>
<string name="sync_only_wifi_ssids">특정 WI-FI 네트워크로 제한하기</string> <string name="sync_only_wifi_ssids">특정 WI-FI 네트워크로 제한하기</string>
<string name="sync_only_wifi_ssids_all">모든 WI-FI 네트워크에서 동기화</string>
<string name="sync_only_wifi_ssids_values">%1$s에 연결되어 있을 때만 동기화</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">WI-FI를 활성화하고 네트워크를 선택해주세요.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">WI-FI를 활성화하고 네트워크를 선택해주세요.</string>
<string name="advanced_folder_picker">고급 폴더 선택기 사용</string> <string name="advanced_folder_picker">고급 폴더 선택기 사용</string>
<string name="advanced_folder_picker_summary">기기에서 동기화에 사용할 폴더를 골라 주세요</string> <string name="advanced_folder_picker_summary">기기에서 동기화에 사용할 폴더를 골라 주세요</string>

View file

@ -144,8 +144,6 @@ Vennligst rapporter eventuelle problemer som oppstår via GitHub.</string>
<string name="sync_only_charging">Synkroniser kun ved lading</string> <string name="sync_only_charging">Synkroniser kun ved lading</string>
<string name="sync_only_wifi">Synkroniser kun over WiFi</string> <string name="sync_only_wifi">Synkroniser kun over WiFi</string>
<string name="sync_only_wifi_ssids">Begrens til visse wifi-nettverk</string> <string name="sync_only_wifi_ssids">Begrens til visse wifi-nettverk</string>
<string name="sync_only_wifi_ssids_all">Synkroniser på alle wifi-nettverk</string>
<string name="sync_only_wifi_ssids_values">Synkroniser bare når koblet til: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Vennligst skru på WiFi for å velge nettverk.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Vennligst skru på WiFi for å velge nettverk.</string>
<string name="advanced_folder_picker">Bruk avansert mappevelger</string> <string name="advanced_folder_picker">Bruk avansert mappevelger</string>
<string name="advanced_folder_picker_summary">Velg en mappe på enheten for synkronisering</string> <string name="advanced_folder_picker_summary">Velg en mappe på enheten for synkronisering</string>

View file

@ -144,8 +144,6 @@ Gelieve alle problemen die je tegenkomt via GitHub te melden.</string>
<string name="sync_only_charging">Synchroniseer alleen tijdens opladen</string> <string name="sync_only_charging">Synchroniseer alleen tijdens opladen</string>
<string name="sync_only_wifi">Synchroniseer alleen via Wi-Fi</string> <string name="sync_only_wifi">Synchroniseer alleen via Wi-Fi</string>
<string name="sync_only_wifi_ssids">Tot bepaalde Wi-Fi-netwerken beperken</string> <string name="sync_only_wifi_ssids">Tot bepaalde Wi-Fi-netwerken beperken</string>
<string name="sync_only_wifi_ssids_all">Synchroniseer op alle Wi-Fi-netwerken</string>
<string name="sync_only_wifi_ssids_values">Louter synchroniseren terwijl verbonden met: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Wi-Fi aanzetten t.b.v. netwerkselectie.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Wi-Fi aanzetten t.b.v. netwerkselectie.</string>
<string name="advanced_folder_picker">Gebruik geavanceerd map-kiezer</string> <string name="advanced_folder_picker">Gebruik geavanceerd map-kiezer</string>
<string name="advanced_folder_picker_summary">Selecteer een map op het toestel om te synchroniseren</string> <string name="advanced_folder_picker_summary">Selecteer een map op het toestel om te synchroniseren</string>

View file

@ -144,8 +144,6 @@ Om du skulle støyte på problem, ver snill å rapportere dei via Github.</strin
<string name="sync_only_charging">Synkroniser berre mens eg laddar</string> <string name="sync_only_charging">Synkroniser berre mens eg laddar</string>
<string name="sync_only_wifi">Synkroniser berre over WiFi</string> <string name="sync_only_wifi">Synkroniser berre over WiFi</string>
<string name="sync_only_wifi_ssids">Avgrens til visse WiFi-nettverk</string> <string name="sync_only_wifi_ssids">Avgrens til visse WiFi-nettverk</string>
<string name="sync_only_wifi_ssids_all">Synkroniser på alle WiFi-nettverk</string>
<string name="sync_only_wifi_ssids_values">Synkroniser berre på: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Skru på WiFi for å velje nettverk.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Skru på WiFi for å velje nettverk.</string>
<string name="advanced_folder_picker">Bruk avansert mappeveljar</string> <string name="advanced_folder_picker">Bruk avansert mappeveljar</string>
<string name="advanced_folder_picker_summary">Vel kva mappe som helst for synkronisering</string> <string name="advanced_folder_picker_summary">Vel kva mappe som helst for synkronisering</string>

View file

@ -143,8 +143,6 @@ Proszę zgłaszać błędy programu w serwisie Github.</string>
<string name="sync_only_charging">Synchronizowanie tylko podczas ładowania</string> <string name="sync_only_charging">Synchronizowanie tylko podczas ładowania</string>
<string name="sync_only_wifi">Synchronizowanie tylko przy użyciu Wi-Fi</string> <string name="sync_only_wifi">Synchronizowanie tylko przy użyciu Wi-Fi</string>
<string name="sync_only_wifi_ssids">Ogranicz do określonych sieci WiFi</string> <string name="sync_only_wifi_ssids">Ogranicz do określonych sieci WiFi</string>
<string name="sync_only_wifi_ssids_all">Synchronizowanie przy użyciu wszystkich sieci wifi</string>
<string name="sync_only_wifi_ssids_values">Synchronizuj jedynie gdy połączono z: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Proszę włącz WiFi dla wybranych sieci</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Proszę włącz WiFi dla wybranych sieci</string>
<string name="advanced_folder_picker">Zaawansowane wybieranie katalogów</string> <string name="advanced_folder_picker">Zaawansowane wybieranie katalogów</string>
<string name="advanced_folder_picker_summary">Wskazuje dowolny katalog na urządzeniu do zsynchronizowania</string> <string name="advanced_folder_picker_summary">Wskazuje dowolny katalog na urządzeniu do zsynchronizowania</string>

View file

@ -144,8 +144,6 @@ Por favor, informe-nos sobre quaisquer problemas via Github.</string>
<string name="sync_only_charging">Somente durante o carregamento</string> <string name="sync_only_charging">Somente durante o carregamento</string>
<string name="sync_only_wifi">Somente conectado ao WiFi</string> <string name="sync_only_wifi">Somente conectado ao WiFi</string>
<string name="sync_only_wifi_ssids">Limitar a certas redes WiFi</string> <string name="sync_only_wifi_ssids">Limitar a certas redes WiFi</string>
<string name="sync_only_wifi_ssids_all">Sincronizar em todas as redes WiFi</string>
<string name="sync_only_wifi_ssids_values">Sincronizar somente quando conectado a %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Ligue o WiFi para selecionar as redes</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Ligue o WiFi para selecionar as redes</string>
<string name="advanced_folder_picker">Usar seletor de pasta avançado</string> <string name="advanced_folder_picker">Usar seletor de pasta avançado</string>
<string name="advanced_folder_picker_summary">Selecione qualquer pasta do dispositivo para sincronização</string> <string name="advanced_folder_picker_summary">Selecione qualquer pasta do dispositivo para sincronização</string>

View file

@ -143,8 +143,6 @@
<string name="sync_only_charging">Синхронизация только во время зарядки</string> <string name="sync_only_charging">Синхронизация только во время зарядки</string>
<string name="sync_only_wifi">Синхронизация только по WIFI</string> <string name="sync_only_wifi">Синхронизация только по WIFI</string>
<string name="sync_only_wifi_ssids">Ограничить определёнными wifi сетями</string> <string name="sync_only_wifi_ssids">Ограничить определёнными wifi сетями</string>
<string name="sync_only_wifi_ssids_all">Синхронизировать в любых wifi сетях</string>
<string name="sync_only_wifi_ssids_values">Синхронизировать только в: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Включите WiFi, чтобы выбрать сети</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Включите WiFi, чтобы выбрать сети</string>
<string name="advanced_folder_picker">Использовать продвинутый выбор папок</string> <string name="advanced_folder_picker">Использовать продвинутый выбор папок</string>
<string name="advanced_folder_picker_summary">Выберите любую папку на устройстве для синхронизации</string> <string name="advanced_folder_picker_summary">Выберите любую папку на устройстве для синхронизации</string>

View file

@ -144,8 +144,6 @@ Vänligen rapportera eventuella problem du stöter på via Github.</string>
<string name="sync_only_charging">Synkronisera endast vid laddning</string> <string name="sync_only_charging">Synkronisera endast vid laddning</string>
<string name="sync_only_wifi">Synkronisera endast trådlöst</string> <string name="sync_only_wifi">Synkronisera endast trådlöst</string>
<string name="sync_only_wifi_ssids">Begränsa till vissa WiFi-nätverk</string> <string name="sync_only_wifi_ssids">Begränsa till vissa WiFi-nätverk</string>
<string name="sync_only_wifi_ssids_all">Synkronisera på alla WiFi-nätverk</string>
<string name="sync_only_wifi_ssids_values">Synkronisera endast när den är ansluten till: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Sätt på WiFi för att välja nätverk.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Sätt på WiFi för att välja nätverk.</string>
<string name="advanced_folder_picker">Använd avancerad katalogväljare</string> <string name="advanced_folder_picker">Använd avancerad katalogväljare</string>
<string name="advanced_folder_picker_summary">Välj någon katalog på enheten för synkronisering</string> <string name="advanced_folder_picker_summary">Välj någon katalog på enheten för synkronisering</string>

View file

@ -144,8 +144,6 @@ Vänligen rapportera eventuella problem du stöter på via Github.</string>
<string name="sync_only_charging">Synkronisera endast vid laddning</string> <string name="sync_only_charging">Synkronisera endast vid laddning</string>
<string name="sync_only_wifi">Synkronisera endast trådlöst</string> <string name="sync_only_wifi">Synkronisera endast trådlöst</string>
<string name="sync_only_wifi_ssids">Begränsa till vissa WiFi-nätverk</string> <string name="sync_only_wifi_ssids">Begränsa till vissa WiFi-nätverk</string>
<string name="sync_only_wifi_ssids_all">Synkronisera på alla WiFi-nätverk</string>
<string name="sync_only_wifi_ssids_values">Synkronisera endast när den är ansluten till: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Slå på WiFi för att välja nätverk.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Slå på WiFi för att välja nätverk.</string>
<string name="advanced_folder_picker">Använd avancerade katalogväljaren</string> <string name="advanced_folder_picker">Använd avancerade katalogväljaren</string>
<string name="advanced_folder_picker_summary">Välj någon katalog på enheten för synkronisering</string> <string name="advanced_folder_picker_summary">Välj någon katalog på enheten för synkronisering</string>

View file

@ -137,8 +137,6 @@ Lütfen, herhangi bir sorunla karşılaştığınızda Github üzerinden bildiri
<string name="sync_only_charging">Sadece şarj edilirken eşzamanlama yap</string> <string name="sync_only_charging">Sadece şarj edilirken eşzamanlama yap</string>
<string name="sync_only_wifi">Sadece kablosuz ağ üzerindeyken eşzamanlama yap</string> <string name="sync_only_wifi">Sadece kablosuz ağ üzerindeyken eşzamanlama yap</string>
<string name="sync_only_wifi_ssids">Belirlenmiş kablosuz ağlarla sınırlandır.</string> <string name="sync_only_wifi_ssids">Belirlenmiş kablosuz ağlarla sınırlandır.</string>
<string name="sync_only_wifi_ssids_all">Herhangi bir kablosuz ağ üzerindeyken eşzamanlama yap</string>
<string name="sync_only_wifi_ssids_values">Sadece %1$s\'e bağlıyken eşzamanlama yap</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Ağ seçmek için lütfen kablosuz bağlantınızıın.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Ağ seçmek için lütfen kablosuz bağlantınızıın.</string>
<string name="advanced_folder_picker">Gelişmiş Klasör Seçici Kullan</string> <string name="advanced_folder_picker">Gelişmiş Klasör Seçici Kullan</string>
<string name="advanced_folder_picker_summary">Eşzamanlama yapmak için cihazdan herhangi bir klasör seçin</string> <string name="advanced_folder_picker_summary">Eşzamanlama yapmak için cihazdan herhangi bir klasör seçin</string>

View file

@ -142,8 +142,6 @@ Xin báo cáo mọi vấn đề phát sinh thông qua Github.</string>
<string name="sync_only_charging">Chỉ đ.bộ khi sạc pin</string> <string name="sync_only_charging">Chỉ đ.bộ khi sạc pin</string>
<string name="sync_only_wifi">Chỉ đ.bộ khi dùng wifi</string> <string name="sync_only_wifi">Chỉ đ.bộ khi dùng wifi</string>
<string name="sync_only_wifi_ssids">Hạn chế với vài mạng wifi nhất định</string> <string name="sync_only_wifi_ssids">Hạn chế với vài mạng wifi nhất định</string>
<string name="sync_only_wifi_ssids_all">Đồng bộ trên t.cả mạng wifi</string>
<string name="sync_only_wifi_ssids_values">Chỉ đồng bộ khi kết nối đến: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Hãy bật WiFi để lựa chọn mạng.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Hãy bật WiFi để lựa chọn mạng.</string>
<string name="advanced_folder_picker">S.dụng trình chọn th.mục nâng cao</string> <string name="advanced_folder_picker">S.dụng trình chọn th.mục nâng cao</string>
<string name="advanced_folder_picker_summary">Chọn bất kỳ th.mục nào trên th.bị để đồng bộ</string> <string name="advanced_folder_picker_summary">Chọn bất kỳ th.mục nào trên th.bị để đồng bộ</string>

View file

@ -144,8 +144,6 @@
<string name="sync_only_charging">仅在充电时同步</string> <string name="sync_only_charging">仅在充电时同步</string>
<string name="sync_only_wifi">仅在无线网络下同步</string> <string name="sync_only_wifi">仅在无线网络下同步</string>
<string name="sync_only_wifi_ssids">对某些无线网络下限制同步</string> <string name="sync_only_wifi_ssids">对某些无线网络下限制同步</string>
<string name="sync_only_wifi_ssids_all">在所有网络环境下同步</string>
<string name="sync_only_wifi_ssids_values">仅当连接到 %1$s 网络中才进行同步</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">请打开无线网络连接并选择网络</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">请打开无线网络连接并选择网络</string>
<string name="advanced_folder_picker">使用高级文件夹选择器</string> <string name="advanced_folder_picker">使用高级文件夹选择器</string>
<string name="advanced_folder_picker_summary">可以选择设备上任何文件夹</string> <string name="advanced_folder_picker_summary">可以选择设备上任何文件夹</string>

View file

@ -237,10 +237,6 @@ Please report any problems you encounter via Github.</string>
<string name="sync_only_wifi_ssids">Restrict to certain wifi networks</string> <string name="sync_only_wifi_ssids">Restrict to certain wifi networks</string>
<string name="sync_only_wifi_ssids_all">Sync on all wifi networks</string>
<string name="sync_only_wifi_ssids_values">Sync only while connected to: %1$s</string>
<string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Please turn on WiFi to select networks.</string> <string name="sync_only_wifi_ssids_wifi_turn_on_wifi">Please turn on WiFi to select networks.</string>
<string name="advanced_folder_picker">Use advanced Folder Picker</string> <string name="advanced_folder_picker">Use advanced Folder Picker</string>
@ -406,6 +402,8 @@ Please report any problems you encounter via Github.</string>
<!-- Title of the "log Syncthing" menu button --> <!-- Title of the "log Syncthing" menu button -->
<string name="log_syncthing_title">View Syncthing Log</string> <string name="log_syncthing_title">View Syncthing Log</string>
<string name="retrieving_logs">Retrieving logs…</string>
<!-- Title of the "share log" menu button --> <!-- Title of the "share log" menu button -->
<string name="share_title">Share</string> <string name="share_title">Share</string>

View file

@ -49,12 +49,7 @@ public class SyncthingServiceTest {
@Test @Test
public void testBindService() throws InterruptedException { public void testBindService() throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(2); final CountDownLatch latch = new CountDownLatch(2);
mService.registerOnWebGuiAvailableListener(new SyncthingService.OnWebGuiAvailableListener() { mService.registerOnWebGuiAvailableListener(latch::countDown);
@Override
public void onWebGuiAvailable() {
latch.countDown();
}
});
mService.registerOnApiChangeListener(new SyncthingService.OnApiChangeListener() { mService.registerOnApiChangeListener(new SyncthingService.OnApiChangeListener() {
@Override @Override
public void onApiChange(SyncthingService.State currentState) { public void onApiChange(SyncthingService.State currentState) {