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

Use WebViewActivity in MainActivity#previewUr (fixes #241) (#259)

* WebViewActivity: Add intent with EXTRA_WEB_URL

* Use WebViewActivity in MainActivity#previewUr (fixes #241)

* Update string: Debug => Troubleshooting

* Update prepare-release.bash

* Imported de translation
This commit is contained in:
Catfriend1 2019-01-20 21:42:00 +00:00 committed by GitHub
parent 2f251bc875
commit e479bf6f77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 46 additions and 13 deletions

View file

@ -77,15 +77,11 @@
<activity <activity
android:name=".activities.WebViewActivity" android:name=".activities.WebViewActivity"
android:label="@string/report_issue_title" android:label="@string/report_issue_title"
android:parentActivityName=".activities.SettingsActivity"
android:configChanges="keyboardHidden|orientation|screenSize"> android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter> <intent-filter>
<action android:name=".activities.WebViewActivity" /> <action android:name=".activities.WebViewActivity" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.SettingsActivity" />
</activity> </activity>
<activity <activity
android:name=".activities.ShareActivity" android:name=".activities.ShareActivity"

View file

@ -43,6 +43,7 @@ import android.widget.TextView;
import com.annimon.stream.function.Consumer; import com.annimon.stream.function.Consumer;
import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.R;
import com.nutomic.syncthingandroid.SyncthingApp; import com.nutomic.syncthingandroid.SyncthingApp;
import com.nutomic.syncthingandroid.activities.WebViewActivity;
import com.nutomic.syncthingandroid.fragments.DeviceListFragment; import com.nutomic.syncthingandroid.fragments.DeviceListFragment;
import com.nutomic.syncthingandroid.fragments.DrawerFragment; import com.nutomic.syncthingandroid.fragments.DrawerFragment;
import com.nutomic.syncthingandroid.fragments.FolderListFragment; import com.nutomic.syncthingandroid.fragments.FolderListFragment;
@ -84,6 +85,7 @@ public class MainActivity extends SyncthingActivity
* See {@link #showUsageReportingDialog} * See {@link #showUsageReportingDialog}
*/ */
private static final long USAGE_REPORTING_DIALOG_DELAY = TimeUnit.DAYS.toMillis(3); private static final long USAGE_REPORTING_DIALOG_DELAY = TimeUnit.DAYS.toMillis(3);
private static final Boolean DEBUG_FORCE_USAGE_REPORTING_DIALOG = false;
private AlertDialog mQrCodeDialog; private AlertDialog mQrCodeDialog;
private AlertDialog mUsageReportingDialog; private AlertDialog mUsageReportingDialog;
@ -131,7 +133,14 @@ public class MainActivity extends SyncthingActivity
// Check if the usage reporting minimum delay passed by. // Check if the usage reporting minimum delay passed by.
Boolean usageReportingDelayPassed = (new Date().getTime() > getFirstStartTime() + USAGE_REPORTING_DIALOG_DELAY); Boolean usageReportingDelayPassed = (new Date().getTime() > getFirstStartTime() + USAGE_REPORTING_DIALOG_DELAY);
RestApi restApi = getApi(); RestApi restApi = getApi();
if (usageReportingDelayPassed && restApi != null && restApi.isConfigLoaded() && !restApi.isUsageReportingDecided()) { if ( (
DEBUG_FORCE_USAGE_REPORTING_DIALOG
) || (
usageReportingDelayPassed &&
restApi != null &&
restApi.isConfigLoaded() &&
!restApi.isUsageReportingDecided()
)) {
showUsageReportingDialog(restApi); showUsageReportingDialog(restApi);
} }
break; break;
@ -525,8 +534,9 @@ public class MainActivity extends SyncthingActivity
restApi.saveConfigAndRestart(); restApi.saveConfigAndRestart();
break; break;
case DialogInterface.BUTTON_NEUTRAL: case DialogInterface.BUTTON_NEUTRAL:
Uri uri = Uri.parse("https://data.syncthing.net"); final Intent intent = new Intent(MainActivity.this, WebViewActivity.class);
startActivity(new Intent(Intent.ACTION_VIEW, uri)); intent.putExtra(WebViewActivity.EXTRA_WEB_URL, getString(R.string.syncthing_usage_stats_url));
startActivity(intent);
break; break;
} }
} catch (Exception e) { } catch (Exception e) {

View file

@ -42,6 +42,7 @@ import com.google.common.base.Splitter;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.R;
import com.nutomic.syncthingandroid.SyncthingApp; import com.nutomic.syncthingandroid.SyncthingApp;
import com.nutomic.syncthingandroid.activities.WebViewActivity;
import com.nutomic.syncthingandroid.model.Device; import com.nutomic.syncthingandroid.model.Device;
import com.nutomic.syncthingandroid.model.Gui; import com.nutomic.syncthingandroid.model.Gui;
import com.nutomic.syncthingandroid.model.Options; import com.nutomic.syncthingandroid.model.Options;
@ -137,6 +138,7 @@ public class SettingsActivity extends SyncthingActivity {
private static final String KEY_EXPORT_CONFIG = "export_config"; private static final String KEY_EXPORT_CONFIG = "export_config";
private static final String KEY_IMPORT_CONFIG = "import_config"; private static final String KEY_IMPORT_CONFIG = "import_config";
// Settings/Debug // Settings/Debug
private static final String KEY_OPEN_ISSUE_TRACKER = "open_issue_tracker";
private static final String KEY_ST_RESET_DATABASE = "st_reset_database"; private static final String KEY_ST_RESET_DATABASE = "st_reset_database";
private static final String KEY_ST_RESET_DELTAS = "st_reset_deltas"; private static final String KEY_ST_RESET_DELTAS = "st_reset_deltas";
// Settings/About // Settings/About
@ -322,17 +324,19 @@ public class SettingsActivity extends SyncthingActivity {
importConfig.setOnPreferenceClickListener(this); importConfig.setOnPreferenceClickListener(this);
/* Debugging */ /* Debugging */
Preference openIssueTracker = findPreference(KEY_OPEN_ISSUE_TRACKER);
Preference debugFacilitiesEnabled = findPreference(Constants.PREF_DEBUG_FACILITIES_ENABLED); Preference debugFacilitiesEnabled = findPreference(Constants.PREF_DEBUG_FACILITIES_ENABLED);
Preference environmentVariables = findPreference("environment_variables"); Preference environmentVariables = findPreference("environment_variables");
Preference stResetDatabase = findPreference("st_reset_database"); Preference stResetDatabase = findPreference("st_reset_database");
Preference stResetDeltas = findPreference("st_reset_deltas"); Preference stResetDeltas = findPreference("st_reset_deltas");
openIssueTracker.setOnPreferenceClickListener(this);
debugFacilitiesEnabled.setOnPreferenceChangeListener(this); debugFacilitiesEnabled.setOnPreferenceChangeListener(this);
environmentVariables.setOnPreferenceChangeListener(this); environmentVariables.setOnPreferenceChangeListener(this);
stResetDatabase.setOnPreferenceClickListener(this); stResetDatabase.setOnPreferenceClickListener(this);
stResetDeltas.setOnPreferenceClickListener(this); stResetDeltas.setOnPreferenceClickListener(this);
screen.findPreference("open_issue_tracker").setSummary(getString(R.string.open_issue_tracker_summary, getString(R.string.issue_tracker_url))); screen.findPreference(KEY_OPEN_ISSUE_TRACKER).setSummary(getString(R.string.open_issue_tracker_summary, getString(R.string.issue_tracker_url)));
/* Experimental options */ /* Experimental options */
mUseTor = (CheckBoxPreference) findPreference(Constants.PREF_USE_TOR); mUseTor = (CheckBoxPreference) findPreference(Constants.PREF_USE_TOR);
@ -711,6 +715,11 @@ public class SettingsActivity extends SyncthingActivity {
mPendingConfig = true; mPendingConfig = true;
} }
return true; return true;
case KEY_OPEN_ISSUE_TRACKER:
intent = new Intent(getActivity(), WebViewActivity.class);
intent.putExtra(WebViewActivity.EXTRA_WEB_URL, getString(R.string.issue_tracker_url));
startActivity(intent);
return true;
case KEY_EXPORT_CONFIG: case KEY_EXPORT_CONFIG:
new AlertDialog.Builder(getActivity()) new AlertDialog.Builder(getActivity())
.setMessage(R.string.dialog_confirm_export) .setMessage(R.string.dialog_confirm_export)

View file

@ -26,6 +26,9 @@ import com.nutomic.syncthingandroid.util.Util;
*/ */
public class WebViewActivity extends SyncthingActivity { public class WebViewActivity extends SyncthingActivity {
public static final String EXTRA_WEB_URL =
"com.github.catfriend1.syncthingandroid.activities.WebViewActivity.WEB_URL";
private static final String TAG = "WebViewActivity"; private static final String TAG = "WebViewActivity";
private AlertDialog mSecurityNoticeDialog; private AlertDialog mSecurityNoticeDialog;
@ -91,7 +94,13 @@ public class WebViewActivity extends SyncthingActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
isRunningOnTV = Util.isRunningOnTV(WebViewActivity.this); isRunningOnTV = Util.isRunningOnTV(WebViewActivity.this);
setContentView(R.layout.activity_web_gui); setContentView(R.layout.activity_web_gui);
webPageUrl = getString(R.string.issue_tracker_url);
if (!getIntent().hasExtra(EXTRA_WEB_URL)) {
Log.e(TAG, "EXTRA_WEB_URL not set.");
finish();
}
webPageUrl = getIntent().getStringExtra(EXTRA_WEB_URL);
mLoadingView = findViewById(R.id.loading); mLoadingView = findViewById(R.id.loading);
((TextView) findViewById(R.id.loading_text)).setText(getString(R.string.web_page_loading, webPageUrl)); ((TextView) findViewById(R.id.loading_text)).setText(getString(R.string.web_page_loading, webPageUrl));
mWebView = findViewById(R.id.webview); mWebView = findViewById(R.id.webview);
@ -129,6 +138,9 @@ public class WebViewActivity extends SyncthingActivity {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
case R.id.openBrowser: case R.id.openBrowser:
// This can only be triggered on a non-TV device. // This can only be triggered on a non-TV device.
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(webPageUrl))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(webPageUrl)));

View file

@ -371,7 +371,7 @@ Bitte melden Sie auftretende Probleme via GitHub.</string>
<string name="category_behaviour">Verhalten</string> <string name="category_behaviour">Verhalten</string>
<string name="category_syncthing_options">Syncthing-Optionen</string> <string name="category_syncthing_options">Syncthing-Optionen</string>
<string name="category_backup">Import und Export</string> <string name="category_backup">Import und Export</string>
<string name="category_debug">Fehleranalyse</string> <string name="category_debug">Fehlerbehebung</string>
<string name="category_experimental">Experimentell</string> <string name="category_experimental">Experimentell</string>
<!-- Preference screen - Run conditions --> <!-- Preference screen - Run conditions -->

View file

@ -89,6 +89,9 @@ Please report any problems you encounter via Github.</string>
<string name="open_website">Open Website</string> <string name="open_website">Open Website</string>
<!-- URL to open when user chose to open website in usage reporting dialog -->
<string name="syncthing_usage_stats_url" translatable="false">https://data.syncthing.net</string>
<string name="toast_write_storage_permission_required">Write storage permission is required for this app</string> <string name="toast_write_storage_permission_required">Write storage permission is required for this app</string>
<string name="device_rejected">Device \"%1$s\" wants to connect</string> <string name="device_rejected">Device \"%1$s\" wants to connect</string>
@ -371,7 +374,7 @@ Please report any problems you encounter via Github.</string>
<string name="category_behaviour">Behaviour</string> <string name="category_behaviour">Behaviour</string>
<string name="category_syncthing_options">Syncthing Options</string> <string name="category_syncthing_options">Syncthing Options</string>
<string name="category_backup">Import and Export</string> <string name="category_backup">Import and Export</string>
<string name="category_debug">Debug</string> <string name="category_debug">Troubleshooting</string>
<string name="category_experimental">Experimental</string> <string name="category_experimental">Experimental</string>
<!-- Preference screen - Run conditions --> <!-- Preference screen - Run conditions -->

View file

@ -196,10 +196,12 @@
<Preference <Preference
android:key="export_config" android:key="export_config"
android:persistent="false"
android:title="@string/export_config" /> android:title="@string/export_config" />
<Preference <Preference
android:key="import_config" android:key="import_config"
android:persistent="false"
android:title="@string/import_config" /> android:title="@string/import_config" />
</PreferenceScreen> </PreferenceScreen>
@ -211,8 +213,6 @@
android:key="open_issue_tracker" android:key="open_issue_tracker"
android:persistent="false" android:persistent="false"
android:title="@string/report_issue_title"> android:title="@string/report_issue_title">
<intent
android:action=".activities.WebViewActivity" />
</Preference> </Preference>
<Preference <Preference

View file

@ -45,7 +45,10 @@ tx push -s
# Force push/pull to make sure this is executed. Apparently tx only compares timestamps, not file # Force push/pull to make sure this is executed. Apparently tx only compares timestamps, not file
# contents. So if a file was `touch`ed, it won't be updated by default. # contents. So if a file was `touch`ed, it won't be updated by default.
# Use multiple transifex instances for pulling to speed things up. # Use multiple transifex instances for pulling to speed things up.
#
# tx pull -a --mode reviewed -r "syncthing-android-1.stringsxml" # tx pull -a --mode reviewed -r "syncthing-android-1.stringsxml"
# tx pull -l de --mode reviewed -r "syncthing-android-1.stringsxml"
#
tx pull -a -f -r "syncthing-android-1.stringsxml" & tx pull -a -f -r "syncthing-android-1.stringsxml" &
tx pull -a -f -r "syncthing-android-1.description_fulltxt" & tx pull -a -f -r "syncthing-android-1.description_fulltxt" &
tx pull -a -f -r "syncthing-android-1.description_shorttxt" & tx pull -a -f -r "syncthing-android-1.description_shorttxt" &