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

Added menu with link to issue tracker.

This commit is contained in:
Felix Ableitner 2014-05-06 12:41:31 +02:00
parent 6f500f7c89
commit 65bc9c46da
3 changed files with 36 additions and 1 deletions

8
res/menu/menu.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/report_issue"
android:title="@string/report_issue" />
</menu>

View file

@ -3,6 +3,13 @@
<string name="app_name">Syncthing</string>
<!-- Text for WebGuiActivity loading view -->
<string name="web_gui_loading">Waiting for GUI</string>
<!-- Menu item "report issue" that opens issue tracker -->
<string name="report_issue">Report Issue</string>
<!-- URL of the issue tracker -->
<string name="issue_tracker_url" translatable="false">https://github.com/Nutomic/syncthing-android/issues</string>
</resources>

View file

@ -2,8 +2,11 @@ package com.nutomic.syncthingandroid;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@ -63,12 +66,29 @@ public class WebGuiActivity extends Activity {
mLoadingView = findViewById(R.id.loading);
ProgressBar pb = (ProgressBar) mLoadingView.findViewById(R.id.progress);
pb.setIndeterminate(true);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new WebViewClient());
mWebView.setWebViewClient(mWebViewClient);
mWebView.loadUrl(SYNCTHING_URL);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}
@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))));
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}