1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-26 21:01:32 +00:00

Added settings with syncthing version version, moved "report issue" to settings.

This commit is contained in:
Felix Ableitner 2014-05-11 21:39:40 +02:00
parent 004b5a69dd
commit 1610ce9507
6 changed files with 64 additions and 7 deletions

View file

@ -24,6 +24,10 @@
</intent-filter>
</activity>
<activity
android:name=".SettingsActivity"
android:label="@string/settings_title" />
<service android:name=".SyncthingService" />
</application>

View file

@ -2,8 +2,8 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/report_issue"
android:title="@string/report_issue" />
android:id="@+id/settings"
android:title="@string/settings_title" />
<item
android:id="@+id/exit"

View file

@ -3,6 +3,9 @@
<string name="app_name">Syncthing</string>
<!-- Upstream version name of the included syncthing binary -->
<string name="syncthing_version_title">Syncthing Version: HEAD</string>
<!-- Title for dialog displayed on first start -->
<string name="welcome_title">First Start</string>
@ -18,12 +21,15 @@ Please report any problems you encounter.
<!-- Text for WebGuiActivity loading view -->
<string name="web_gui_loading">Waiting for GUI</string>
<!-- Menu item that opens issue tracker -->
<string name="report_issue">Report Issue</string>
<!-- Menu item that opens app settings -->
<string name="settings_title">Settings</string>
<!-- Menu item that stops Activity and Service -->
<string name="exit">Exit</string>
<!-- Settings item that opens issue tracker -->
<string name="report_issue_title">Report Issue</string>
<!-- URL of the issue tracker -->
<string name="issue_tracker_url" translatable="false">https://github.com/Nutomic/syncthing-android/issues</string>

12
res/xml/settings.xml Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<Preference
android:key="report_issue"
android:title="@string/report_issue_title" />
<Preference
android:title="@string/syncthing_version_title"
android:enabled="false" />
</PreferenceScreen>

View file

@ -0,0 +1,36 @@
package com.nutomic.syncthingandroid;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import com.nutomic.syncthingandroid.R;
public class SettingsActivity extends PreferenceActivity {
private static final String REPORT_ISSUE_KEY = "report_issue";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
}
/**
* Opens issue tracker when that preference is clicked.
*/
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
Preference preference) {
if (REPORT_ISSUE_KEY.equals(preference.getKey())) {
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse(getString(R.string.issue_tracker_url))));
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
}

View file

@ -4,7 +4,6 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
@ -99,8 +98,8 @@ public class WebGuiActivity extends Activity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.report_issue:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.issue_tracker_url))));
case R.id.settings:
startActivity(new Intent(this, SettingsActivity.class));
return true;
case R.id.exit:
stopService(new Intent(this, SyncthingService.class));