Help as activity & cs
This commit is contained in:
parent
08690da5cf
commit
25fcd7041a
8 changed files with 71 additions and 47 deletions
12
build.gradle
12
build.gradle
|
@ -65,10 +65,6 @@ apply plugin: 'android-unit-test'
|
|||
|
||||
|
||||
dependencies {
|
||||
// TODO watch progress at zxing - last official had problems with aztec format
|
||||
// snapshot works - but switch back to official when available
|
||||
// compile 'com.google.zxing:core:2.3'
|
||||
compile fileTree(dir: 'libs', include: 'zxing-core-2.3.0-SNAPSHOT.jar')
|
||||
compile 'com.googlecode.android-query:android-query:0.25.+'
|
||||
compile 'com.google.code.gson:gson:2.2.4'
|
||||
compile 'org.ligi:tracedroid:1.1'
|
||||
|
@ -83,6 +79,11 @@ dependencies {
|
|||
//
|
||||
compile fileTree(dir: 'libs', include: 'zxing-core-2.3.0-SNAPSHOT.jar')
|
||||
|
||||
// TODO watch progress at zxing - last official had problems with aztec format
|
||||
// snapshot works - but switch back to official when available
|
||||
//
|
||||
compile fileTree(dir: 'libs', include: 'zxing-core-2.3.0-SNAPSHOT.jar')
|
||||
|
||||
testCompile 'junit:junit:4.10'
|
||||
testCompile 'org.robolectric:robolectric:2.2'
|
||||
testCompile 'com.squareup:fest-android:1.0.7'
|
||||
|
@ -95,9 +96,6 @@ dependencies {
|
|||
testCompile 'com.android.support:support-v4:19.0.0'
|
||||
testCompile 'com.android.support:appcompat-v7:19.0.0'
|
||||
|
||||
|
||||
|
||||
|
||||
withAnalyticsCompile fileTree(dir: 'libs', include: 'libGoogleAnalyticsV2.jar')
|
||||
withMapsCompile 'com.google.android.gms:play-services:4.0.30'
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="org.ligi.ticketviewer.ui.HelpActivity" />
|
||||
<activity
|
||||
android:name="org.ligi.ticketviewer.ui.TicketImportActivity"
|
||||
tools:ignore="ExportedActivity">
|
||||
|
|
42
src/main/java/org/ligi/ticketviewer/ui/HelpActivity.java
Normal file
42
src/main/java/org/ligi/ticketviewer/ui/HelpActivity.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package org.ligi.ticketviewer.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.text.Html;
|
||||
import android.text.util.Linkify;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.ligi.ticketviewer.R;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.InjectView;
|
||||
|
||||
public class HelpActivity extends ActionBarActivity {
|
||||
|
||||
@InjectView(R.id.help_tv)
|
||||
TextView helpTextView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_help);
|
||||
ButterKnife.inject(this);
|
||||
|
||||
helpTextView.setText(Html.fromHtml(getString(R.string.help_content)));
|
||||
|
||||
Linkify.addLinks(helpTextView, Linkify.ALL);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package org.ligi.ticketviewer.ui;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.util.Linkify;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.ligi.ticketviewer.Tracker;
|
||||
|
||||
import org.ligi.ticketviewer.R;
|
||||
public class HelpDialog {
|
||||
|
||||
public static void show(Context c) {
|
||||
|
||||
Tracker.get().trackEvent("ui_action", "help", "open", null);
|
||||
|
||||
TextView tv = new TextView(c);
|
||||
tv.setPadding(10, 10, 10, 10);
|
||||
tv.setText(Html.fromHtml(c.getString(R.string.help_content)));
|
||||
|
||||
Linkify.addLinks(tv, Linkify.ALL);
|
||||
tv.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
new AlertDialog.Builder(c).setTitle(R.string.help_label).setView(tv)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
}).show();
|
||||
|
||||
}
|
||||
}
|
|
@ -128,7 +128,8 @@ public class TicketListActivity extends ActionBarActivity {
|
|||
new ScanForPassesTask().execute();
|
||||
return true;
|
||||
case R.id.menu_help:
|
||||
HelpDialog.show(this);
|
||||
Intent intent = new Intent(this, HelpActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
|
@ -56,15 +56,15 @@ public class TicketViewActivity extends TicketViewActivityBase {
|
|||
|
||||
if (!passbookParser.isValid()) { // don't deal with invalid passes
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage("Sorry, but there was a problem processing this Passbook. If you want you can send me this passbook so I can check what the problem is and improve the software.")
|
||||
.setTitle("Problem")
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
.setMessage(getString(R.string.pass_problem))
|
||||
.setTitle(getString(R.string.problem))
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNeutralButton("Send", new DialogInterface.OnClickListener() {
|
||||
.setNeutralButton(getString(R.string.send), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
new ExportProblemPassToLigiAndFinishTask(TicketViewActivity.this, passbookParser.getPath(), TicketDefinitions.getShareDir(TicketViewActivity.this), "share.pkpass").execute();
|
||||
|
|
13
src/main/res/layout/activity_help.xml
Normal file
13
src/main/res/layout/activity_help.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/help_tv"
|
||||
android:padding="7dp">
|
||||
|
||||
</TextView>
|
||||
</ScrollView>
|
|
@ -33,5 +33,8 @@
|
|||
</string>
|
||||
<string name="drawer_open">open</string>
|
||||
<string name="drawer_close">close</string>
|
||||
<string name="pass_problem">Sorry, but there was a problem processing this Passbook. If you want you can send me this passbook so I can check what the problem is and improve the software.</string>
|
||||
<string name="problem">Problem</string>
|
||||
<string name="send">Send</string>
|
||||
|
||||
</resources>
|
Loading…
Reference in a new issue