mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 03:11:30 +00:00
Changed code style to use spaces instead of tabs.
It is impossible to add a custom code style in Android Studio that is stored in the project repository. So change style to something that's easy to use in practice now rather than later.
This commit is contained in:
parent
c3b027e8b5
commit
b1749ce7cb
49 changed files with 3611 additions and 3668 deletions
|
@ -41,6 +41,6 @@ screenshots: *link to file* (only for UI problems)
|
||||||
|
|
||||||
Always welcome.
|
Always welcome.
|
||||||
|
|
||||||
Code should follow the [Android Code Style Guidelines](https://source.android.com/source/code-style.html#java-language-rules), with the exception that we use tabs, not spaces for indentation.
|
Code should follow the [Android Code Style Guidelines](https://source.android.com/source/code-style.html#java-language-rules). This can be done automatically in Android Studio.
|
||||||
|
|
||||||
Lint warnings should be fixed. If that's not possible, they should be ignored as specifically as possible.
|
Lint warnings should be fixed. If that's not possible, they should be ignored as specifically as possible.
|
||||||
|
|
|
@ -13,18 +13,18 @@
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/AppTheme">
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.MainActivity"
|
android:name=".activities.MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:launchMode="singleTop" >
|
android:launchMode="singleTop">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
@ -33,13 +33,12 @@
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.WebGuiActivity"
|
android:name=".activities.WebGuiActivity"
|
||||||
android:label="@string/web_gui_title" >
|
android:label="@string/web_gui_title">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value=".gui.MainActivity" />
|
android:value=".gui.MainActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity android:name=".activities.SettingsActivity">
|
||||||
android:name=".activities.SettingsActivity" >
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value=".gui.MainActivity" />
|
android:value=".gui.MainActivity" />
|
||||||
|
@ -49,25 +48,26 @@
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.FolderPickerActivity"
|
android:name=".activities.FolderPickerActivity"
|
||||||
android:label="@string/folder_picker_title" >
|
android:label="@string/folder_picker_title">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.UI_OPTIONS"
|
android:name="android.support.UI_OPTIONS"
|
||||||
android:value="splitActionBarWhenNarrow" />
|
android:value="splitActionBarWhenNarrow" />
|
||||||
</activity>
|
</activity>
|
||||||
<receiver android:name=".syncthing.NetworkReceiver" >
|
|
||||||
|
<receiver android:name=".syncthing.NetworkReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
|
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<receiver android:name=".syncthing.BatteryReceiver" >
|
<receiver android:name=".syncthing.BatteryReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
|
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
|
||||||
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
|
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<receiver android:name=".syncthing.BootReceiver">
|
<receiver android:name=".syncthing.BootReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
</application>
|
</application>
|
||||||
|
|
|
@ -90,7 +90,8 @@ public class FolderPickerActivity extends SyncthingActivity
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
createFolder(et.getText().toString());
|
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(new DialogInterface.OnShowListener() {
|
||||||
|
@ -174,8 +175,7 @@ public class FolderPickerActivity extends SyncthingActivity
|
||||||
if (!mLocation.equals(Environment.getExternalStorageDirectory())) {
|
if (!mLocation.equals(Environment.getExternalStorageDirectory())) {
|
||||||
mLocation = mLocation.getParentFile();
|
mLocation = mLocation.getParentFile();
|
||||||
refresh();
|
refresh();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setResult(Activity.RESULT_CANCELED);
|
setResult(Activity.RESULT_CANCELED);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,7 @@ public class MainActivity extends SyncthingActivity
|
||||||
mLoadingDialog.dismiss();
|
mLoadingDialog.dismiss();
|
||||||
}
|
}
|
||||||
SyncthingService.showDisabledDialog(this);
|
SyncthingService.showDisabledDialog(this);
|
||||||
}
|
} else if (mLoadingDialog == null) {
|
||||||
else if (mLoadingDialog == null) {
|
|
||||||
final SharedPreferences prefs =
|
final SharedPreferences prefs =
|
||||||
PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
|
PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
|
||||||
|
|
||||||
|
@ -102,9 +101,12 @@ public class MainActivity extends SyncthingActivity
|
||||||
@Override
|
@Override
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
switch (position) {
|
switch (position) {
|
||||||
case 0: return mRepositoriesFragment;
|
case 0:
|
||||||
case 1: return mNodesFragment;
|
return mRepositoriesFragment;
|
||||||
default: return null;
|
case 1:
|
||||||
|
return mNodesFragment;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,8 +179,7 @@ public class MainActivity extends SyncthingActivity
|
||||||
mLocalNodeInfoFragment = (LocalNodeInfoFragment) fm.getFragment(
|
mLocalNodeInfoFragment = (LocalNodeInfoFragment) fm.getFragment(
|
||||||
savedInstanceState, LocalNodeInfoFragment.class.getName());
|
savedInstanceState, LocalNodeInfoFragment.class.getName());
|
||||||
mViewPager.setCurrentItem(savedInstanceState.getInt("currentTab"));
|
mViewPager.setCurrentItem(savedInstanceState.getInt("currentTab"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mRepositoriesFragment = new ReposFragment();
|
mRepositoriesFragment = new ReposFragment();
|
||||||
mNodesFragment = new NodesFragment();
|
mNodesFragment = new NodesFragment();
|
||||||
mLocalNodeInfoFragment = new LocalNodeInfoFragment();
|
mLocalNodeInfoFragment = new LocalNodeInfoFragment();
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
* Must be set for {@link #ACTION_NODE_SETTINGS_FRAGMENT} and
|
* Must be set for {@link #ACTION_NODE_SETTINGS_FRAGMENT} and
|
||||||
* {@link #ACTION_REPO_SETTINGS_FRAGMENT} to determine if an existing repo/node should be
|
* {@link #ACTION_REPO_SETTINGS_FRAGMENT} to determine if an existing repo/node should be
|
||||||
* edited or a new one created.
|
* edited or a new one created.
|
||||||
*
|
* <p/>
|
||||||
* If this is false, {@link com.nutomic.syncthingandroid.fragments.RepoSettingsFragment#EXTRA_REPO_ID} or
|
* If this is false, {@link com.nutomic.syncthingandroid.fragments.RepoSettingsFragment#EXTRA_REPO_ID} or
|
||||||
* {@link com.nutomic.syncthingandroid.fragments.NodeSettingsFragment#EXTRA_NODE_ID} must be set (according to the selected fragment).
|
* {@link com.nutomic.syncthingandroid.fragments.NodeSettingsFragment#EXTRA_NODE_ID} must be set (according to the selected fragment).
|
||||||
*/
|
*/
|
||||||
|
@ -42,8 +42,7 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
mFragment = fm.getFragment(savedInstanceState,
|
mFragment = fm.getFragment(savedInstanceState,
|
||||||
savedInstanceState.getString("fragment_name"));
|
savedInstanceState.getString("fragment_name"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
switch (getIntent().getAction()) {
|
switch (getIntent().getAction()) {
|
||||||
case ACTION_APP_SETTINGS_FRAGMENT:
|
case ACTION_APP_SETTINGS_FRAGMENT:
|
||||||
setTitle(R.string.settings_title);
|
setTitle(R.string.settings_title);
|
||||||
|
|
|
@ -64,8 +64,7 @@ public class SyncthingActivity extends ActionBarActivity implements ServiceConne
|
||||||
public void registerOnServiceConnectedListener(OnServiceConnectedListener listener) {
|
public void registerOnServiceConnectedListener(OnServiceConnectedListener listener) {
|
||||||
if (mSyncthingService != null) {
|
if (mSyncthingService != null) {
|
||||||
listener.onServiceConnected();
|
listener.onServiceConnected();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mServiceConnectedListeners.addLast(listener);
|
mServiceConnectedListeners.addLast(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class WebGuiActivity extends SyncthingActivity implements SyncthingServic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize WebView.
|
* Initialize WebView.
|
||||||
*
|
* <p/>
|
||||||
* Ignore lint javascript warning as js is loaded only from our known, local service.
|
* Ignore lint javascript warning as js is loaded only from our known, local service.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -66,7 +66,9 @@ public class LocalNodeInfoFragment extends Fragment
|
||||||
super.onDrawerOpened(drawerView);
|
super.onDrawerOpened(drawerView);
|
||||||
LocalNodeInfoFragment.this.onDrawerOpened();
|
LocalNodeInfoFragment.this.onDrawerOpened();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
@ -143,8 +145,7 @@ public class LocalNodeInfoFragment extends Fragment
|
||||||
if (info.extAnnounceOK) {
|
if (info.extAnnounceOK) {
|
||||||
mAnnounceServer.setText("Online");
|
mAnnounceServer.setText("Online");
|
||||||
mAnnounceServer.setTextColor(getResources().getColor(R.color.text_green));
|
mAnnounceServer.setTextColor(getResources().getColor(R.color.text_green));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mAnnounceServer.setText("Offline");
|
mAnnounceServer.setText("Offline");
|
||||||
mAnnounceServer.setTextColor(getResources().getColor(R.color.text_red));
|
mAnnounceServer.setTextColor(getResources().getColor(R.color.text_red));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.nutomic.syncthingandroid.fragments;
|
package com.nutomic.syncthingandroid.fragments;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
|
@ -64,8 +63,7 @@ public class NodeSettingsFragment extends PreferenceFragment implements
|
||||||
|
|
||||||
if (mIsCreate) {
|
if (mIsCreate) {
|
||||||
addPreferencesFromResource(R.xml.node_settings_create);
|
addPreferencesFromResource(R.xml.node_settings_create);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
addPreferencesFromResource(R.xml.node_settings_edit);
|
addPreferencesFromResource(R.xml.node_settings_edit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,8 +104,7 @@ public class NodeSettingsFragment extends PreferenceFragment implements
|
||||||
mNode.NodeID = "";
|
mNode.NodeID = "";
|
||||||
mNode.Addresses = "dynamic";
|
mNode.Addresses = "dynamic";
|
||||||
((EditTextPreference) mNodeId).setText(mNode.NodeID);
|
((EditTextPreference) mNodeId).setText(mNode.NodeID);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
getActivity().setTitle(R.string.edit_node);
|
getActivity().setTitle(R.string.edit_node);
|
||||||
List<RestApi.Node> nodes = mSyncthingService.getApi().getNodes();
|
List<RestApi.Node> nodes = mSyncthingService.getApi().getNodes();
|
||||||
for (int i = 0; i < nodes.size(); i++) {
|
for (int i = 0; i < nodes.size(); i++) {
|
||||||
|
@ -192,13 +189,11 @@ public class NodeSettingsFragment extends PreferenceFragment implements
|
||||||
mNode.NodeID = (String) o;
|
mNode.NodeID = (String) o;
|
||||||
nodeUpdated();
|
nodeUpdated();
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (preference.equals(mName)) {
|
||||||
else if (preference.equals(mName)) {
|
|
||||||
mNode.Name = (String) o;
|
mNode.Name = (String) o;
|
||||||
nodeUpdated();
|
nodeUpdated();
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (preference.equals(mAddresses)) {
|
||||||
else if (preference.equals(mAddresses)) {
|
|
||||||
mNode.Addresses = (String) o;
|
mNode.Addresses = (String) o;
|
||||||
nodeUpdated();
|
nodeUpdated();
|
||||||
return true;
|
return true;
|
||||||
|
@ -217,7 +212,7 @@ public class NodeSettingsFragment extends PreferenceFragment implements
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets version and current address of the node.
|
* Sets version and current address of the node.
|
||||||
*
|
* <p/>
|
||||||
* NOTE: This is only called once on startup, should be called more often to properly display
|
* NOTE: This is only called once on startup, should be called more often to properly display
|
||||||
* version/address changes.
|
* version/address changes.
|
||||||
*/
|
*/
|
||||||
|
@ -248,8 +243,7 @@ public class NodeSettingsFragment extends PreferenceFragment implements
|
||||||
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||||
try {
|
try {
|
||||||
startActivityForResult(intentScan, SCAN_QR_REQUEST_CODE);
|
startActivityForResult(intentScan, SCAN_QR_REQUEST_CODE);
|
||||||
}
|
} catch (ActivityNotFoundException e) {
|
||||||
catch (ActivityNotFoundException e) {
|
|
||||||
Toast.makeText(getActivity(), R.string.no_qr_scanner_installed,
|
Toast.makeText(getActivity(), R.string.no_qr_scanner_installed,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
@ -278,8 +272,7 @@ public class NodeSettingsFragment extends PreferenceFragment implements
|
||||||
public void onNodeIdNormalized(String normalizedId, String error) {
|
public void onNodeIdNormalized(String normalizedId, String error) {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
Toast.makeText(getActivity(), error, Toast.LENGTH_LONG).show();
|
Toast.makeText(getActivity(), error, Toast.LENGTH_LONG).show();
|
||||||
}
|
} else if (mIsCreate) {
|
||||||
else if (mIsCreate) {
|
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,7 @@ public class NodesFragment extends ListFragment implements SyncthingService.OnAp
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 0, SyncthingService.GUI_UPDATE_INTERVAL);
|
}, 0, SyncthingService.GUI_UPDATE_INTERVAL);
|
||||||
}
|
} else if (mTimer != null) {
|
||||||
else if (mTimer != null) {
|
|
||||||
mTimer.cancel();
|
mTimer.cancel();
|
||||||
mTimer = null;
|
mTimer = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,7 @@ public class RepoSettingsFragment extends PreferenceFragment
|
||||||
|
|
||||||
if (mIsCreate) {
|
if (mIsCreate) {
|
||||||
addPreferencesFromResource(R.xml.repo_settings_create);
|
addPreferencesFromResource(R.xml.repo_settings_create);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
addPreferencesFromResource(R.xml.repo_settings_edit);
|
addPreferencesFromResource(R.xml.repo_settings_edit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,8 +109,7 @@ public class RepoSettingsFragment extends PreferenceFragment
|
||||||
mRepo.Directory = "";
|
mRepo.Directory = "";
|
||||||
mRepo.Nodes = new ArrayList<RestApi.Node>();
|
mRepo.Nodes = new ArrayList<RestApi.Node>();
|
||||||
mRepo.Versioning = new RestApi.Versioning();
|
mRepo.Versioning = new RestApi.Versioning();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
getActivity().setTitle(R.string.edit_repo);
|
getActivity().setTitle(R.string.edit_repo);
|
||||||
List<RestApi.Repo> repos = mSyncthingService.getApi().getRepos();
|
List<RestApi.Repo> repos = mSyncthingService.getApi().getRepos();
|
||||||
for (int i = 0; i < repos.size(); i++) {
|
for (int i = 0; i < repos.size(); i++) {
|
||||||
|
@ -146,8 +144,7 @@ public class RepoSettingsFragment extends PreferenceFragment
|
||||||
mVersioningKeep.setText(mRepo.Versioning.getParams().get("keep"));
|
mVersioningKeep.setText(mRepo.Versioning.getParams().get("keep"));
|
||||||
mVersioningKeep.setSummary(mRepo.Versioning.getParams().get("keep"));
|
mVersioningKeep.setSummary(mRepo.Versioning.getParams().get("keep"));
|
||||||
mVersioningKeep.setEnabled(true);
|
mVersioningKeep.setEnabled(true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mVersioningKeep.setEnabled(false);
|
mVersioningKeep.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,24 +215,20 @@ public class RepoSettingsFragment extends PreferenceFragment
|
||||||
mRepo.ID = (String) o;
|
mRepo.ID = (String) o;
|
||||||
repoUpdated();
|
repoUpdated();
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (preference.equals(mDirectory)) {
|
||||||
else if (preference.equals(mDirectory)) {
|
|
||||||
mRepo.Directory = (String) o;
|
mRepo.Directory = (String) o;
|
||||||
repoUpdated();
|
repoUpdated();
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (preference.equals(mRepoMaster)) {
|
||||||
else if (preference.equals(mRepoMaster)) {
|
|
||||||
mRepo.ReadOnly = (Boolean) o;
|
mRepo.ReadOnly = (Boolean) o;
|
||||||
repoUpdated();
|
repoUpdated();
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (preference.getKey().equals(KEY_NODE_SHARED)) {
|
||||||
else if (preference.getKey().equals(KEY_NODE_SHARED)) {
|
|
||||||
ExtendedCheckBoxPreference pref = (ExtendedCheckBoxPreference) preference;
|
ExtendedCheckBoxPreference pref = (ExtendedCheckBoxPreference) preference;
|
||||||
RestApi.Node node = (RestApi.Node) pref.getObject();
|
RestApi.Node node = (RestApi.Node) pref.getObject();
|
||||||
if ((Boolean) o) {
|
if ((Boolean) o) {
|
||||||
mRepo.Nodes.add(node);
|
mRepo.Nodes.add(node);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (RestApi.Node n : mRepo.Nodes) {
|
for (RestApi.Node n : mRepo.Nodes) {
|
||||||
if (n.NodeID.equals(node.NodeID)) {
|
if (n.NodeID.equals(node.NodeID)) {
|
||||||
mRepo.Nodes.remove(n);
|
mRepo.Nodes.remove(n);
|
||||||
|
@ -244,8 +237,7 @@ public class RepoSettingsFragment extends PreferenceFragment
|
||||||
}
|
}
|
||||||
repoUpdated();
|
repoUpdated();
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (preference.equals(mVersioning)) {
|
||||||
else if (preference.equals(mVersioning)) {
|
|
||||||
mVersioningKeep.setEnabled((Boolean) o);
|
mVersioningKeep.setEnabled((Boolean) o);
|
||||||
if ((Boolean) o) {
|
if ((Boolean) o) {
|
||||||
RestApi.SimpleVersioning v = new RestApi.SimpleVersioning();
|
RestApi.SimpleVersioning v = new RestApi.SimpleVersioning();
|
||||||
|
@ -253,14 +245,12 @@ public class RepoSettingsFragment extends PreferenceFragment
|
||||||
v.setParams(5);
|
v.setParams(5);
|
||||||
mVersioningKeep.setText("5");
|
mVersioningKeep.setText("5");
|
||||||
mVersioningKeep.setSummary("5");
|
mVersioningKeep.setSummary("5");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mRepo.Versioning = new RestApi.Versioning();
|
mRepo.Versioning = new RestApi.Versioning();
|
||||||
}
|
}
|
||||||
repoUpdated();
|
repoUpdated();
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (preference.equals(mVersioningKeep)) {
|
||||||
else if (preference.equals(mVersioningKeep)) {
|
|
||||||
((RestApi.SimpleVersioning) mRepo.Versioning)
|
((RestApi.SimpleVersioning) mRepo.Versioning)
|
||||||
.setParams(Integer.parseInt((String) o));
|
.setParams(Integer.parseInt((String) o));
|
||||||
repoUpdated();
|
repoUpdated();
|
||||||
|
@ -277,10 +267,10 @@ public class RepoSettingsFragment extends PreferenceFragment
|
||||||
.putExtra(FolderPickerActivity.EXTRA_INITIAL_DIRECTORY,
|
.putExtra(FolderPickerActivity.EXTRA_INITIAL_DIRECTORY,
|
||||||
(mRepo.Directory.length() != 0)
|
(mRepo.Directory.length() != 0)
|
||||||
? mRepo.Directory
|
? mRepo.Directory
|
||||||
: Environment.getExternalStorageDirectory().getAbsolutePath());
|
: Environment.getExternalStorageDirectory().getAbsolutePath()
|
||||||
|
);
|
||||||
startActivityForResult(intent, DIRECTORY_REQUEST_CODE);
|
startActivityForResult(intent, DIRECTORY_REQUEST_CODE);
|
||||||
}
|
} else if (preference.equals(mNodes) && mSyncthingService.getApi().getNodes().isEmpty()) {
|
||||||
else if (preference.equals(mNodes) && mSyncthingService.getApi().getNodes().isEmpty()) {
|
|
||||||
Toast.makeText(getActivity(), R.string.no_nodes, Toast.LENGTH_SHORT)
|
Toast.makeText(getActivity(), R.string.no_nodes, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,8 +79,7 @@ public class ReposFragment extends ListFragment implements SyncthingService.OnAp
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 0, SyncthingService.GUI_UPDATE_INTERVAL);
|
}, 0, SyncthingService.GUI_UPDATE_INTERVAL);
|
||||||
}
|
} else if (mTimer != null) {
|
||||||
else if (mTimer != null) {
|
|
||||||
mTimer.cancel();
|
mTimer.cancel();
|
||||||
mTimer = null;
|
mTimer = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class SettingsFragment extends PreferenceFragment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies the given value to the preference.
|
* Applies the given value to the preference.
|
||||||
*
|
* <p/>
|
||||||
* If pref is an EditTextPreference, setText is used and the value shown as summary. If pref is
|
* If pref is an EditTextPreference, setText is used and the value shown as summary. If pref is
|
||||||
* a CheckBoxPreference, setChecked is used (by parsing value as Boolean).
|
* a CheckBoxPreference, setChecked is used (by parsing value as Boolean).
|
||||||
*/
|
*/
|
||||||
|
@ -73,8 +73,7 @@ public class SettingsFragment extends PreferenceFragment
|
||||||
if (pref instanceof EditTextPreference) {
|
if (pref instanceof EditTextPreference) {
|
||||||
((EditTextPreference) pref).setText(value);
|
((EditTextPreference) pref).setText(value);
|
||||||
pref.setSummary(value);
|
pref.setSummary(value);
|
||||||
}
|
} else if (pref instanceof CheckBoxPreference) {
|
||||||
else if (pref instanceof CheckBoxPreference) {
|
|
||||||
((CheckBoxPreference) pref).setChecked(Boolean.parseBoolean(value));
|
((CheckBoxPreference) pref).setChecked(Boolean.parseBoolean(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +81,7 @@ public class SettingsFragment extends PreferenceFragment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads layout, sets version from Rest API.
|
* Loads layout, sets version from Rest API.
|
||||||
*
|
* <p/>
|
||||||
* Manual target API as we manually check if ActionBar is available (for ActionBar back button).
|
* Manual target API as we manually check if ActionBar is available (for ActionBar back button).
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -139,12 +138,10 @@ public class SettingsFragment extends PreferenceFragment
|
||||||
|
|
||||||
if (preference.equals(mStopNotCharging) || preference.equals(mStopMobileData)) {
|
if (preference.equals(mStopNotCharging) || preference.equals(mStopMobileData)) {
|
||||||
mSyncthingService.updateState();
|
mSyncthingService.updateState();
|
||||||
}
|
} else if (mOptionsScreen.findPreference(preference.getKey()) != null) {
|
||||||
else if (mOptionsScreen.findPreference(preference.getKey()) != null) {
|
|
||||||
mSyncthingService.getApi().setValue(RestApi.TYPE_OPTIONS, preference.getKey(), o,
|
mSyncthingService.getApi().setValue(RestApi.TYPE_OPTIONS, preference.getKey(), o,
|
||||||
preference.getKey().equals("ListenAddress"), getActivity());
|
preference.getKey().equals("ListenAddress"), getActivity());
|
||||||
}
|
} else if (mGuiScreen.findPreference(preference.getKey()) != null) {
|
||||||
else if (mGuiScreen.findPreference(preference.getKey()) != null) {
|
|
||||||
mSyncthingService.getApi().setValue(
|
mSyncthingService.getApi().setValue(
|
||||||
RestApi.TYPE_GUI, preference.getKey(), o, false, getActivity());
|
RestApi.TYPE_GUI, preference.getKey(), o, false, getActivity());
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import android.os.BatteryManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds information about the current wifi and charging state of the device.
|
* Holds information about the current wifi and charging state of the device.
|
||||||
*
|
* <p/>
|
||||||
* This information is actively read on construction, and then updated from intents that are passed
|
* This information is actively read on construction, and then updated from intents that are passed
|
||||||
* to {@link #update(android.content.Intent)}.
|
* to {@link #update(android.content.Intent)}.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -68,14 +68,13 @@ public class GetTask extends AsyncTask<String, Void, String> {
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||||
String line;
|
String line;
|
||||||
String result = "";
|
String result = "";
|
||||||
while((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
result += line;
|
result += line;
|
||||||
}
|
}
|
||||||
br.close();
|
br.close();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
Log.w(TAG, "Failed to call Rest API at " + fullUri, e);
|
Log.w(TAG, "Failed to call Rest API at " + fullUri, e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -42,8 +42,7 @@ public class PostTask extends AsyncTask<String, Void, Void> {
|
||||||
post.setEntity(new StringEntity(params[3]));
|
post.setEntity(new StringEntity(params[3]));
|
||||||
}
|
}
|
||||||
httpclient.execute(post);
|
httpclient.execute(post);
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
Log.w(TAG, "Failed to call Rest API at " + fullUri, e);
|
Log.w(TAG, "Failed to call Rest API at " + fullUri, e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -80,9 +80,11 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
|
|
||||||
public static class Versioning {
|
public static class Versioning {
|
||||||
protected final Map<String, String> mParams = new HashMap<>();
|
protected final Map<String, String> mParams = new HashMap<>();
|
||||||
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getParams() {
|
public Map<String, String> getParams() {
|
||||||
return mParams;
|
return mParams;
|
||||||
}
|
}
|
||||||
|
@ -93,6 +95,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return "simple";
|
return "simple";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParams(int keep) {
|
public void setParams(int keep) {
|
||||||
mParams.put("keep", Integer.toString(keep));
|
mParams.put("keep", Integer.toString(keep));
|
||||||
}
|
}
|
||||||
|
@ -211,8 +214,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
try {
|
try {
|
||||||
mConfig = new JSONObject(config);
|
mConfig = new JSONObject(config);
|
||||||
tryIsAvailable();
|
tryIsAvailable();
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.w(TAG, "Failed to parse config", e);
|
Log.w(TAG, "Failed to parse config", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,7 +259,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a value from config,
|
* Gets a value from config,
|
||||||
*
|
* <p/>
|
||||||
* Booleans are returned as {@link }Boolean#toString}, arrays as space seperated string.
|
* Booleans are returned as {@link }Boolean#toString}, arrays as space seperated string.
|
||||||
*
|
*
|
||||||
* @param name {@link #TYPE_OPTIONS} or {@link #TYPE_GUI}
|
* @param name {@link #TYPE_OPTIONS} or {@link #TYPE_GUI}
|
||||||
|
@ -270,8 +272,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
return (value instanceof JSONArray)
|
return (value instanceof JSONArray)
|
||||||
? ((JSONArray) value).join(" ").replace("\"", "")
|
? ((JSONArray) value).join(" ").replace("\"", "")
|
||||||
: String.valueOf(value);
|
: String.valueOf(value);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.w(TAG, "Failed to get value for " + key, e);
|
Log.w(TAG, "Failed to get value for " + key, e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -279,7 +280,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value to config and sends it via Rest API.
|
* Sets a value to config and sends it via Rest API.
|
||||||
*
|
* <p/>
|
||||||
* Booleans must be passed as {@link Boolean}, arrays as space seperated string
|
* Booleans must be passed as {@link Boolean}, arrays as space seperated string
|
||||||
* with isArray true.
|
* with isArray true.
|
||||||
*
|
*
|
||||||
|
@ -294,8 +295,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
? listToJson(((String) value).split(" "))
|
? listToJson(((String) value).split(" "))
|
||||||
: value);
|
: value);
|
||||||
configUpdated(activity);
|
configUpdated(activity);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.w(TAG, "Failed to set value for " + key, e);
|
Log.w(TAG, "Failed to set value for " + key, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,8 +380,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return getNodes(mConfig.getJSONArray("Nodes"));
|
return getNodes(mConfig.getJSONArray("Nodes"));
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.w(TAG, "Failed to read nodes", e);
|
Log.w(TAG, "Failed to read nodes", e);
|
||||||
return new ArrayList<Node>();
|
return new ArrayList<Node>();
|
||||||
}
|
}
|
||||||
|
@ -416,8 +415,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
si.myID = system.getString("myID");
|
si.myID = system.getString("myID");
|
||||||
si.sys = system.getLong("sys");
|
si.sys = system.getLong("sys");
|
||||||
listener.onReceiveSystemInfo(si);
|
listener.onReceiveSystemInfo(si);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.w(TAG, "Failed to read system info", e);
|
Log.w(TAG, "Failed to read system info", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -462,17 +460,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
r.Directory = json.getString("Directory");
|
r.Directory = json.getString("Directory");
|
||||||
r.ID = json.getString("ID");
|
r.ID = json.getString("ID");
|
||||||
r.Invalid = json.getString("Invalid");
|
r.Invalid = json.getString("Invalid");
|
||||||
r.Nodes = new ArrayList<Node>();
|
r.Nodes = getNodes(json.getJSONArray("Nodes"));
|
||||||
JSONArray nodes = json.getJSONArray("Nodes");
|
|
||||||
for (int j = 0; j < nodes.length(); j++) {
|
|
||||||
JSONObject n = nodes.getJSONObject(j);
|
|
||||||
String id = n.getString("NodeID");
|
|
||||||
for (Node n2 : getNodes()) {
|
|
||||||
if (n2.NodeID.equals(id)) {
|
|
||||||
r.Nodes.add(n2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
r.ReadOnly = json.getBoolean("ReadOnly");
|
r.ReadOnly = json.getBoolean("ReadOnly");
|
||||||
JSONObject versioning = json.getJSONObject("Versioning");
|
JSONObject versioning = json.getJSONObject("Versioning");
|
||||||
|
@ -481,15 +469,13 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
JSONObject params = versioning.getJSONObject("Params");
|
JSONObject params = versioning.getJSONObject("Params");
|
||||||
sv.setParams(params.getInt("keep"));
|
sv.setParams(params.getInt("keep"));
|
||||||
r.Versioning = sv;
|
r.Versioning = sv;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
r.Versioning = new Versioning();
|
r.Versioning = new Versioning();
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.add(r);
|
ret.add(r);
|
||||||
}
|
}
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.w(TAG, "Failed to read nodes", e);
|
Log.w(TAG, "Failed to read nodes", e);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -501,9 +487,9 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
public static String readableFileSize(Context context, long bytes) {
|
public static String readableFileSize(Context context, long bytes) {
|
||||||
final String[] units = context.getResources().getStringArray(R.array.file_size_units);
|
final String[] units = context.getResources().getStringArray(R.array.file_size_units);
|
||||||
if (bytes <= 0) return "0 " + units[0];
|
if (bytes <= 0) return "0 " + units[0];
|
||||||
int digitGroups = (int) (Math.log10(bytes)/Math.log10(1024));
|
int digitGroups = (int) (Math.log10(bytes) / Math.log10(1024));
|
||||||
return new DecimalFormat("#,##0.#")
|
return new DecimalFormat("#,##0.#")
|
||||||
.format(bytes/Math.pow(1024, digitGroups)) + " " + units[digitGroups];
|
.format(bytes / Math.pow(1024, digitGroups)) + " " + units[digitGroups];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -512,9 +498,9 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
public static String readableTransferRate(Context context, long bits) {
|
public static String readableTransferRate(Context context, long bits) {
|
||||||
final String[] units = context.getResources().getStringArray(R.array.transfer_rate_units);
|
final String[] units = context.getResources().getStringArray(R.array.transfer_rate_units);
|
||||||
if (bits <= 0) return "0 " + units[0];
|
if (bits <= 0) return "0 " + units[0];
|
||||||
int digitGroups = (int) (Math.log10(bits)/Math.log10(1024));
|
int digitGroups = (int) (Math.log10(bits) / Math.log10(1024));
|
||||||
return new DecimalFormat("#,##0.#")
|
return new DecimalFormat("#,##0.#")
|
||||||
.format(bits/Math.pow(1024, digitGroups)) + " " + units[digitGroups];
|
.format(bits / Math.pow(1024, digitGroups)) + " " + units[digitGroups];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -524,7 +510,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param connections Map from Node ID to {@link Connection}.
|
* @param connections Map from Node ID to {@link Connection}.
|
||||||
*
|
* <p/>
|
||||||
* NOTE: The parameter connections is cached internally. Do not modify it or
|
* NOTE: The parameter connections is cached internally. Do not modify it or
|
||||||
* any of its contents.
|
* any of its contents.
|
||||||
*/
|
*/
|
||||||
|
@ -533,7 +519,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns connection info for the local node and all connected nodes.
|
* Returns connection info for the local node and all connected nodes.
|
||||||
*
|
* <p/>
|
||||||
* Use the key {@link #LOCAL_NODE_CONNECTIONS} to get connection info for the local node.
|
* Use the key {@link #LOCAL_NODE_CONNECTIONS} to get connection info for the local node.
|
||||||
*/
|
*/
|
||||||
public void getConnections(final OnReceiveConnectionsListener listener) {
|
public void getConnections(final OnReceiveConnectionsListener listener) {
|
||||||
|
@ -581,8 +567,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
}
|
}
|
||||||
mPreviousConnections = connections;
|
mPreviousConnections = connections;
|
||||||
listener.onReceiveConnections(mPreviousConnections);
|
listener.onReceiveConnections(mPreviousConnections);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.w(TAG, "Failed to parse connections", e);
|
Log.w(TAG, "Failed to parse connections", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -656,8 +641,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
m.invalid = json.optString("invalid");
|
m.invalid = json.optString("invalid");
|
||||||
mCachedModelInfo.put(repoId, m);
|
mCachedModelInfo.put(repoId, m);
|
||||||
listener.onReceiveModel(repoId, m);
|
listener.onReceiveModel(repoId, m);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.w(TAG, "Failed to read repository info", e);
|
Log.w(TAG, "Failed to read repository info", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -695,8 +679,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
if (create) {
|
if (create) {
|
||||||
n = new JSONObject();
|
n = new JSONObject();
|
||||||
nodes.put(n);
|
nodes.put(n);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (int i = 0; i < nodes.length(); i++) {
|
for (int i = 0; i < nodes.length(); i++) {
|
||||||
JSONObject json = nodes.getJSONObject(i);
|
JSONObject json = nodes.getJSONObject(i);
|
||||||
if (node.NodeID.equals(json.getString("NodeID"))) {
|
if (node.NodeID.equals(json.getString("NodeID"))) {
|
||||||
|
@ -709,12 +692,12 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
n.put("Name", node.Name);
|
n.put("Name", node.Name);
|
||||||
n.put("Addresses", listToJson(node.Addresses.split(" ")));
|
n.put("Addresses", listToJson(node.Addresses.split(" ")));
|
||||||
configUpdated(mSyncthingService);
|
configUpdated(mSyncthingService);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.w(TAG, "Failed to read nodes", e);
|
Log.w(TAG, "Failed to read nodes", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -733,8 +716,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
configUpdated(activity);
|
configUpdated(activity);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.w(TAG, "Failed to edit repo", e);
|
Log.w(TAG, "Failed to edit repo", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -749,8 +731,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
if (create) {
|
if (create) {
|
||||||
r = new JSONObject();
|
r = new JSONObject();
|
||||||
repos.put(r);
|
repos.put(r);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (int i = 0; i < repos.length(); i++) {
|
for (int i = 0; i < repos.length(); i++) {
|
||||||
JSONObject json = repos.getJSONObject(i);
|
JSONObject json = repos.getJSONObject(i);
|
||||||
if (repo.ID.equals(json.getString("ID"))) {
|
if (repo.ID.equals(json.getString("ID"))) {
|
||||||
|
@ -781,8 +762,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
}
|
}
|
||||||
r.put("Versioning", versioning);
|
r.put("Versioning", versioning);
|
||||||
configUpdated(context);
|
configUpdated(context);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.w(TAG, "Failed to edit repo " + repo.ID + " at " + repo.Directory, e);
|
Log.w(TAG, "Failed to edit repo " + repo.ID + " at " + repo.Directory, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -803,8 +783,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
configUpdated(activity);
|
configUpdated(activity);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.w(TAG, "Failed to edit repo", e);
|
Log.w(TAG, "Failed to edit repo", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -849,8 +828,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
JSONObject json = new JSONObject(s);
|
JSONObject json = new JSONObject(s);
|
||||||
normalized = json.optString("id", null);
|
normalized = json.optString("id", null);
|
||||||
error = json.optString("error", null);
|
error = json.optString("error", null);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.d(TAG, "Failed to parse normalized node ID JSON", e);
|
Log.d(TAG, "Failed to parse normalized node ID JSON", e);
|
||||||
}
|
}
|
||||||
listener.onNodeIdNormalized(normalized, error);
|
listener.onNodeIdNormalized(normalized, error);
|
||||||
|
@ -878,7 +856,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
|
||||||
@TargetApi(11)
|
@TargetApi(11)
|
||||||
public void copyNodeId(String id) {
|
public void copyNodeId(String id) {
|
||||||
int sdk = android.os.Build.VERSION.SDK_INT;
|
int sdk = android.os.Build.VERSION.SDK_INT;
|
||||||
if(sdk < android.os.Build.VERSION_CODES.HONEYCOMB) {
|
if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) {
|
||||||
android.text.ClipboardManager clipboard = (android.text.ClipboardManager)
|
android.text.ClipboardManager clipboard = (android.text.ClipboardManager)
|
||||||
mSyncthingService.getSystemService(Context.CLIPBOARD_SERVICE);
|
mSyncthingService.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
clipboard.setText(id);
|
clipboard.setText(id);
|
||||||
|
|
|
@ -57,15 +57,12 @@ public class SyncthingRunnable implements Runnable {
|
||||||
log(process.getInputStream());
|
log(process.getInputStream());
|
||||||
|
|
||||||
ret = process.waitFor();
|
ret = process.waitFor();
|
||||||
}
|
} catch (IOException | InterruptedException e) {
|
||||||
catch(IOException | InterruptedException e) {
|
|
||||||
Log.e(TAG, "Failed to execute syncthing binary or read output", e);
|
Log.e(TAG, "Failed to execute syncthing binary or read output", e);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
try {
|
try {
|
||||||
dos.close();
|
dos.close();
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
Log.w(TAG, "Failed to close shell stream", e);
|
Log.w(TAG, "Failed to close shell stream", e);
|
||||||
}
|
}
|
||||||
process.destroy();
|
process.destroy();
|
||||||
|
@ -95,7 +92,8 @@ public class SyncthingRunnable implements Runnable {
|
||||||
int i) {
|
int i) {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
.create();
|
.create();
|
||||||
dialog.getWindow()
|
dialog.getWindow()
|
||||||
.setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
.setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
||||||
|
@ -120,8 +118,7 @@ public class SyncthingRunnable implements Runnable {
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
Log.i(TAG_NATIVE, line);
|
Log.i(TAG_NATIVE, line);
|
||||||
}
|
}
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
// NOTE: This is sometimes called on shutdown, as
|
// NOTE: This is sometimes called on shutdown, as
|
||||||
// Process.destroy() closes the stream.
|
// Process.destroy() closes the stream.
|
||||||
Log.w(TAG, "Failed to read syncthing command line output", e);
|
Log.w(TAG, "Failed to read syncthing command line output", e);
|
||||||
|
|
|
@ -123,8 +123,7 @@ public class SyncthingService extends Service {
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
// Just catch the empty intent and return.
|
// Just catch the empty intent and return.
|
||||||
if (intent == null) {
|
if (intent == null) {
|
||||||
}
|
} else if (ACTION_RESTART.equals(intent.getAction()) && mCurrentState == State.ACTIVE) {
|
||||||
else if (ACTION_RESTART.equals(intent.getAction()) && mCurrentState == State.ACTIVE) {
|
|
||||||
new PostTask() {
|
new PostTask() {
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void aVoid) {
|
protected void onPostExecute(Void aVoid) {
|
||||||
|
@ -136,8 +135,7 @@ public class SyncthingService extends Service {
|
||||||
new PollWebGuiAvailableTask().execute();
|
new PollWebGuiAvailableTask().execute();
|
||||||
}
|
}
|
||||||
}.execute(mApi.getUrl(), PostTask.URI_RESTART, mApi.getApiKey());
|
}.execute(mApi.getUrl(), PostTask.URI_RESTART, mApi.getApiKey());
|
||||||
}
|
} else if (mCurrentState != State.INIT) {
|
||||||
else if (mCurrentState != State.INIT) {
|
|
||||||
mDeviceStateHolder.update(intent);
|
mDeviceStateHolder.update(intent);
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
|
@ -147,7 +145,7 @@ public class SyncthingService extends Service {
|
||||||
/**
|
/**
|
||||||
* Checks according to preferences and charging/wifi state, whether syncthing should be enabled
|
* Checks according to preferences and charging/wifi state, whether syncthing should be enabled
|
||||||
* or not.
|
* or not.
|
||||||
*
|
* <p/>
|
||||||
* Depending on the result, syncthing is started or stopped, and {@link #onApiChange()} is
|
* Depending on the result, syncthing is started or stopped, and {@link #onApiChange()} is
|
||||||
* called.
|
* called.
|
||||||
*/
|
*/
|
||||||
|
@ -203,18 +201,15 @@ public class SyncthingService extends Service {
|
||||||
// NOTE: status is not really needed, as HttpHostConnectException is thrown
|
// NOTE: status is not really needed, as HttpHostConnectException is thrown
|
||||||
// earlier.
|
// earlier.
|
||||||
status = response.getStatusLine().getStatusCode();
|
status = response.getStatusLine().getStatusCode();
|
||||||
}
|
} catch (HttpHostConnectException e) {
|
||||||
catch (HttpHostConnectException e) {
|
|
||||||
// We catch this in every call, as long as the service is not online,
|
// We catch this in every call, as long as the service is not online,
|
||||||
// so we ignore and continue.
|
// so we ignore and continue.
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
Log.w(TAG, "Failed to poll for web interface", e);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
Log.w(TAG, "Failed to poll for web interface", e);
|
Log.w(TAG, "Failed to poll for web interface", e);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
} while (status != HttpStatus.SC_OK);
|
||||||
Log.w(TAG, "Failed to poll for web interface", e);
|
|
||||||
}
|
|
||||||
} while(status != HttpStatus.SC_OK);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +233,7 @@ public class SyncthingService extends Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move config file, keys, and index files to "official" folder
|
* Move config file, keys, and index files to "official" folder
|
||||||
*
|
* <p/>
|
||||||
* Intended to bring the file locations in older installs in line with
|
* Intended to bring the file locations in older installs in line with
|
||||||
* newer versions.
|
* newer versions.
|
||||||
*/
|
*/
|
||||||
|
@ -340,22 +335,21 @@ public class SyncthingService extends Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a listener for the web gui becoming available..
|
* Register a listener for the web gui becoming available..
|
||||||
*
|
* <p/>
|
||||||
* If the web gui is already available, listener will be called immediately.
|
* If the web gui is already available, listener will be called immediately.
|
||||||
* Listeners are unregistered automatically after being called.
|
* Listeners are unregistered automatically after being called.
|
||||||
*/
|
*/
|
||||||
public void registerOnWebGuiAvailableListener(OnWebGuiAvailableListener listener) {
|
public void registerOnWebGuiAvailableListener(OnWebGuiAvailableListener listener) {
|
||||||
if (mCurrentState == State.ACTIVE) {
|
if (mCurrentState == State.ACTIVE) {
|
||||||
listener.onWebGuiAvailable();
|
listener.onWebGuiAvailable();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mOnWebGuiAvailableListeners.add(listener);
|
mOnWebGuiAvailableListeners.add(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this service has not been started before (ie config.xml does not exist).
|
* Returns true if this service has not been started before (ie config.xml does not exist).
|
||||||
*
|
* <p/>
|
||||||
* This will return true until the public key file has been generated.
|
* This will return true until the public key file has been generated.
|
||||||
*/
|
*/
|
||||||
public boolean isFirstStart() {
|
public boolean isFirstStart() {
|
||||||
|
@ -368,7 +362,7 @@ public class SyncthingService extends Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a listener for the syncthing API state changing.
|
* Register a listener for the syncthing API state changing.
|
||||||
*
|
* <p/>
|
||||||
* 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.
|
* changes.
|
||||||
*/
|
*/
|
||||||
|
@ -381,7 +375,7 @@ public class SyncthingService extends Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to notifiy listeners of an API change.
|
* Called to notifiy listeners of an API change.
|
||||||
*
|
* <p/>
|
||||||
* Must only be called from SyncthingService or {@link RestApi}.
|
* Must only be called from SyncthingService or {@link RestApi}.
|
||||||
*/
|
*/
|
||||||
public void onApiChange() {
|
public void onApiChange() {
|
||||||
|
@ -390,8 +384,7 @@ public class SyncthingService extends Service {
|
||||||
WeakReference<OnApiChangeListener> listener = i.next();
|
WeakReference<OnApiChangeListener> listener = i.next();
|
||||||
if (listener.get() != null) {
|
if (listener.get() != null) {
|
||||||
listener.get().onApiChange(mCurrentState);
|
listener.get().onApiChange(mCurrentState);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
i.remove();
|
i.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,7 +407,8 @@ public class SyncthingService extends Service {
|
||||||
.setAction(SettingsActivity.ACTION_APP_SETTINGS_FRAGMENT);
|
.setAction(SettingsActivity.ACTION_APP_SETTINGS_FRAGMENT);
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
.setNegativeButton(R.string.exit,
|
.setNegativeButton(R.string.exit,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,7 +28,7 @@ import javax.xml.transform.stream.StreamResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides direct access to the config.xml file in the file system.
|
* Provides direct access to the config.xml file in the file system.
|
||||||
*
|
* <p/>
|
||||||
* This class should only be used if the syncthing API is not available (usually during startup).
|
* This class should only be used if the syncthing API is not available (usually during startup).
|
||||||
*/
|
*/
|
||||||
public class ConfigXml {
|
public class ConfigXml {
|
||||||
|
@ -67,10 +67,10 @@ public class ConfigXml {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the config file.
|
* Updates the config file.
|
||||||
*
|
* <p/>
|
||||||
* Coming from 0.2.0 and earlier, globalAnnounceServer value "announce.syncthing.net:22025" is
|
* Coming from 0.2.0 and earlier, globalAnnounceServer value "announce.syncthing.net:22025" is
|
||||||
* replaced with "194.126.249.5:22025" (as domain resolve is broken).
|
* replaced with "194.126.249.5:22025" (as domain resolve is broken).
|
||||||
*
|
* <p/>
|
||||||
* Coming from 0.3.0 and earlier, the ignorePerms flag is set to true on every repository.
|
* Coming from 0.3.0 and earlier, the ignorePerms flag is set to true on every repository.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("SdCardPath")
|
@SuppressWarnings("SdCardPath")
|
||||||
|
@ -172,8 +172,7 @@ public class ConfigXml {
|
||||||
DOMSource domSource = new DOMSource(mConfig);
|
DOMSource domSource = new DOMSource(mConfig);
|
||||||
StreamResult streamResult = new StreamResult(mConfigFile);
|
StreamResult streamResult = new StreamResult(mConfigFile);
|
||||||
transformer.transform(domSource, streamResult);
|
transformer.transform(domSource, streamResult);
|
||||||
}
|
} catch (TransformerException e) {
|
||||||
catch (TransformerException e) {
|
|
||||||
Log.w(TAG, "Failed to save updated config", e);
|
Log.w(TAG, "Failed to save updated config", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,16 +192,13 @@ public class ConfigXml {
|
||||||
while ((read = in.read(buff)) > 0) {
|
while ((read = in.read(buff)) > 0) {
|
||||||
out.write(buff, 0, read);
|
out.write(buff, 0, read);
|
||||||
}
|
}
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
throw new RuntimeException("Failed to write config file", e);
|
throw new RuntimeException("Failed to write config file", e);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
try {
|
try {
|
||||||
in.close();
|
in.close();
|
||||||
out.close();
|
out.close();
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
Log.w(TAG, "Failed to close stream while copying config", e);
|
Log.w(TAG, "Failed to close stream while copying config", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,15 +51,13 @@ public class NodesAdapter extends ArrayAdapter<RestApi.Node>
|
||||||
if (conn.Completion == 100) {
|
if (conn.Completion == 100) {
|
||||||
status.setText(res.getString(R.string.node_up_to_date));
|
status.setText(res.getString(R.string.node_up_to_date));
|
||||||
status.setTextColor(res.getColor(R.color.text_green));
|
status.setTextColor(res.getColor(R.color.text_green));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
status.setText(res.getString(R.string.node_syncing, conn.Completion));
|
status.setText(res.getString(R.string.node_syncing, conn.Completion));
|
||||||
status.setTextColor(res.getColor(R.color.text_blue));
|
status.setTextColor(res.getColor(R.color.text_blue));
|
||||||
}
|
}
|
||||||
download.setText(RestApi.readableTransferRate(getContext(), conn.InBits));
|
download.setText(RestApi.readableTransferRate(getContext(), conn.InBits));
|
||||||
upload.setText(RestApi.readableTransferRate(getContext(), conn.OutBits));
|
upload.setText(RestApi.readableTransferRate(getContext(), conn.OutBits));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
download.setText("0 " + res.getStringArray(R.array.transfer_rate_units)[0]);
|
download.setText("0 " + res.getStringArray(R.array.transfer_rate_units)[0]);
|
||||||
upload.setText("0 " + res.getStringArray(R.array.transfer_rate_units)[0]);
|
upload.setText("0 " + res.getStringArray(R.array.transfer_rate_units)[0]);
|
||||||
status.setText(res.getString(R.string.node_disconnected));
|
status.setText(res.getString(R.string.node_disconnected));
|
||||||
|
@ -83,7 +81,7 @@ public class NodesAdapter extends ArrayAdapter<RestApi.Node>
|
||||||
*/
|
*/
|
||||||
public void updateConnections(RestApi api, ListView listView) {
|
public void updateConnections(RestApi api, ListView listView) {
|
||||||
for (int i = 0; i < getCount(); i++) {
|
for (int i = 0; i < getCount(); i++) {
|
||||||
if ( i >= listView.getFirstVisiblePosition() &&
|
if (i >= listView.getFirstVisiblePosition() &&
|
||||||
i <= listView.getLastVisiblePosition()) {
|
i <= listView.getLastVisiblePosition()) {
|
||||||
api.getConnections(this);
|
api.getConnections(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,15 +50,15 @@ public class ReposAdapter extends ArrayAdapter<RestApi.Repo>
|
||||||
state.setText(getContext().getString(R.string.repo_progress_format, model.state,
|
state.setText(getContext().getString(R.string.repo_progress_format, model.state,
|
||||||
(model.globalBytes <= 0)
|
(model.globalBytes <= 0)
|
||||||
? 100
|
? 100
|
||||||
: (int) ((model.localBytes / (float) model.globalBytes) * 100)));
|
: (int) ((model.localBytes / (float) model.globalBytes) * 100)
|
||||||
|
));
|
||||||
items.setText(getContext()
|
items.setText(getContext()
|
||||||
.getString(R.string.files, model.localFiles, model.globalFiles));
|
.getString(R.string.files, model.localFiles, model.globalFiles));
|
||||||
size.setText(RestApi.readableFileSize(getContext(), model.localBytes) + " / " +
|
size.setText(RestApi.readableFileSize(getContext(), model.localBytes) + " / " +
|
||||||
RestApi.readableFileSize(getContext(), model.globalBytes));
|
RestApi.readableFileSize(getContext(), model.globalBytes));
|
||||||
invalid.setText(model.invalid);
|
invalid.setText(model.invalid);
|
||||||
invalid.setVisibility((model.invalid.equals("")) ? View.GONE : View.VISIBLE);
|
invalid.setVisibility((model.invalid.equals("")) ? View.GONE : View.VISIBLE);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
invalid.setVisibility(View.GONE);
|
invalid.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class ReposAdapter extends ArrayAdapter<RestApi.Repo>
|
||||||
*/
|
*/
|
||||||
public void updateModel(RestApi api, ListView listView) {
|
public void updateModel(RestApi api, ListView listView) {
|
||||||
for (int i = 0; i < getCount(); i++) {
|
for (int i = 0; i < getCount(); i++) {
|
||||||
if ( i >= listView.getFirstVisiblePosition() &&
|
if (i >= listView.getFirstVisiblePosition() &&
|
||||||
i <= listView.getLastVisiblePosition()) {
|
i <= listView.getLastVisiblePosition()) {
|
||||||
api.getModel(getItem(i).ID, this);
|
api.getModel(getItem(i).ID, this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@android:id/list"
|
android:id="@android:id/list"
|
||||||
|
@ -12,6 +12,6 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/directory_empty"
|
android:text="@string/directory_empty"
|
||||||
android:layout_centerInParent="true"/>
|
android:layout_centerInParent="true" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:padding="10dip"
|
android:padding="10dip"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
style="?android:attr/progressBarStyleLarge"
|
style="?android:attr/progressBarStyleLarge"
|
||||||
|
|
|
@ -4,16 +4,17 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="10dip"
|
android:padding="10dip"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/node_id_title"
|
android:id="@+id/node_id_title"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/node_id"
|
android:id="@+id/node_id"
|
||||||
|
@ -26,7 +27,8 @@
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/cpu_usage_title"
|
android:id="@+id/cpu_usage_title"
|
||||||
android:text="@string/cpu_usage"
|
android:text="@string/cpu_usage"
|
||||||
|
@ -44,7 +46,8 @@
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/ram_usage_title"
|
android:id="@+id/ram_usage_title"
|
||||||
android:text="@string/ram_usage"
|
android:text="@string/ram_usage"
|
||||||
|
@ -62,7 +65,8 @@
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/download_title"
|
android:id="@+id/download_title"
|
||||||
android:text="@string/download_title"
|
android:text="@string/download_title"
|
||||||
|
@ -80,7 +84,8 @@
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/upload_title"
|
android:id="@+id/upload_title"
|
||||||
android:text="@string/upload_title"
|
android:text="@string/upload_title"
|
||||||
|
@ -98,7 +103,8 @@
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/announce_server_title"
|
android:id="@+id/announce_server_title"
|
||||||
android:text="@string/announce_server"
|
android:text="@string/announce_server"
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<android.support.v4.widget.DrawerLayout
|
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/drawer_layout"
|
android:id="@+id/drawer_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="4dip" >
|
android:padding="4dip">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/name"
|
android:id="@+id/name"
|
||||||
|
@ -21,8 +21,7 @@
|
||||||
android:layout_alignBottom="@+id/name"
|
android:layout_alignBottom="@+id/name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
android:ellipsize="end" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/download_title"
|
android:id="@+id/download_title"
|
||||||
|
@ -55,5 +54,6 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
>>>>>>> Changed code style to use spaces instead of tabs.
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="4dip" >
|
android:padding="4dip">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/id"
|
android:id="@+id/id"
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<WebView
|
<WebView
|
||||||
android:id="@+id/webview"
|
android:id="@+id/webview"
|
||||||
|
@ -15,7 +14,7 @@
|
||||||
android:id="@+id/loading"
|
android:id="@+id/loading"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progress"
|
android:id="@+id/progress"
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<menu
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto" >
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/select"
|
android:id="@+id/select"
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<menu
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto" >
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/share_node_id"
|
android:id="@+id/share_node_id"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto" >
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/create"
|
android:id="@+id/create"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto" >
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/create"
|
android:id="@+id/create"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar" />
|
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar" />
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<style name="AppTheme" parent="@style/Theme.AppCompat" />
|
<style name="AppTheme" parent="@style/Theme.AppCompat" />
|
||||||
</resources>
|
</resources>
|
|
@ -14,7 +14,7 @@
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:key="syncthing_options"
|
android:key="syncthing_options"
|
||||||
android:title="Syncthing Options"
|
android:title="Syncthing Options"
|
||||||
android:persistent="false" >
|
android:persistent="false">
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:key="ListenAddress"
|
android:key="ListenAddress"
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:key="syncthing_gui"
|
android:key="syncthing_gui"
|
||||||
android:title="Syncthing GUI"
|
android:title="Syncthing GUI"
|
||||||
android:persistent="false" >
|
android:persistent="false">
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:key="Address"
|
android:key="Address"
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:title="@string/report_issue_title"
|
android:title="@string/report_issue_title"
|
||||||
android:summary="@string/report_issue_summary" >
|
android:summary="@string/report_issue_summary">
|
||||||
<intent
|
<intent
|
||||||
android:action="android.intent.action.VIEW"
|
android:action="android.intent.action.VIEW"
|
||||||
android:data="@string/issue_tracker_url" />
|
android:data="@string/issue_tracker_url" />
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:persistent="false" >
|
android:persistent="false">
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:key="node_id"
|
android:key="node_id"
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:persistent="false" >
|
android:persistent="false">
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="node_id"
|
android:key="node_id"
|
||||||
android:title="@string/node_id"/>
|
android:title="@string/node_id" />
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:key="name"
|
android:key="name"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:persistent="false" >
|
android:persistent="false">
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:key="repo_id"
|
android:key="repo_id"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:persistent="false" >
|
android:persistent="false">
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:key="repo_id"
|
android:key="repo_id"
|
||||||
|
|
Loading…
Reference in a new issue