1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-22 12:21:15 +00:00

Added first start dialog.

This commit is contained in:
Felix Ableitner 2014-05-06 13:21:58 +02:00
parent 472ccb6bed
commit 469de1d412
2 changed files with 29 additions and 0 deletions

View file

@ -3,6 +3,18 @@
<string name="app_name">Syncthing</string>
<!-- Title for dialog displayed on first start -->
<string name="welcome_title">First Start</string>
<!-- Text for dialog displayed on first start -->
<string name="welcome_text">Welcome to Syncthing for Android!\n\n\
This app is currently in Alpha state, and you may experience bugs, performance problems or data loss.\n\n\
The Syncthing background service runs as long as the notification is shown, use the exit button in the app to stop it.\n\n\
There is currently no special handling for mobile data, so it may use up your data volume if active.\n\n\
Please report any problems you encounter.
</string>
<!-- Text for WebGuiActivity loading view -->
<string name="web_gui_loading">Waiting for GUI</string>

View file

@ -1,10 +1,13 @@
package com.nutomic.syncthingandroid;
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;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@ -16,6 +19,8 @@ public class WebGuiActivity extends Activity {
private static final String TAG = "WebGuiActivity";
private static final String PREF_FIRST_START = "first_start";
/**
* URL of the local syncthing web UI.
*
@ -72,6 +77,18 @@ public class WebGuiActivity extends Activity {
mWebView.setWebViewClient(new WebViewClient());
mWebView.setWebViewClient(mWebViewClient);
mWebView.loadUrl(SYNCTHING_URL);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (prefs.getBoolean(PREF_FIRST_START, true)) {
new AlertDialog.Builder(this)
.setTitle(R.string.welcome_title)
.setMessage(R.string.welcome_text)
.setNeutralButton(android.R.string.ok, null)
.show();
prefs.edit()
.putBoolean(PREF_FIRST_START, false)
.commit();
}
}
@Override