Skip to content

Commit 69d61df

Browse files
authored
Merge pull request #51 from dividiti/issue-50
Issue 50
2 parents 9f25d2d + fd57a3b commit 69d61df

File tree

4 files changed

+46
-15
lines changed

4 files changed

+46
-15
lines changed

app/src/main/java/openscience/crowdsource/video/experiments/AppConfigService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ public class AppConfigService {
3030
private final static String APP_CONFIG_DIR = "/sdcard/openscience/"; //todo get log dir from common config service
3131
private final static String APP_CONFIG_FILE_PATH = APP_CONFIG_DIR + "app_config.json";
3232

33+
public final static String URL_SDK = "http://github.com/ctuning/ck";
34+
public final static String URL_ABOUT = "https://github.com/ctuning/ck/wiki/Advanced_usage_crowdsourcing";
35+
public final static String URL_CROWD_RESULTS = "http://cknowledge.org/repo/web.php?action=index&module_uoa=wfe&native_action=show&native_module_uoa=program.optimization&scenario=experiment.bench.dnn.mobile";
36+
public final static String URL_USERS = "http://cTuning.org/crowdtuning-timeline";
37+
3338
public static final String PLEASE_WAIT = "Please wait ...";
3439

3540
public static final String ACKNOWLEDGE_YOUR_CONTRIBUTIONS = "acknowledge your contributions!";

app/src/main/java/openscience/crowdsource/video/experiments/InfoActivity.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import android.app.AlertDialog;
44
import android.content.DialogInterface;
55
import android.content.Intent;
6-
import android.content.pm.ActivityInfo;
76
import android.net.Uri;
87
import android.os.Bundle;
98
import android.support.v7.app.AppCompatActivity;
@@ -15,6 +14,10 @@
1514
import android.widget.EditText;
1615

1716
import static openscience.crowdsource.video.experiments.AppConfigService.ACKNOWLEDGE_YOUR_CONTRIBUTIONS;
17+
import static openscience.crowdsource.video.experiments.AppConfigService.URL_ABOUT;
18+
import static openscience.crowdsource.video.experiments.AppConfigService.URL_SDK;
19+
import static openscience.crowdsource.video.experiments.AppConfigService.URL_CROWD_RESULTS;
20+
import static openscience.crowdsource.video.experiments.AppConfigService.URL_USERS;
1821

1922
/**
2023
* Screen with additional features like
@@ -61,12 +64,6 @@ public void onClick(View v) {
6164

6265
/*************************************************************************/
6366
private void addListenersOnButtons() {
64-
//todo move out to AppConfigService
65-
final String url_sdk = "http://github.com/ctuning/ck";
66-
final String url_about = "https://github.com/ctuning/ck/wiki/Advanced_usage_crowdsourcing";
67-
final String url_stats = "http://cknowledge.org/repo/web.php?action=index&module_uoa=wfe&native_action=show&native_module_uoa=program.optimization&scenario=experiment.bench.dnn.mobile";
68-
final String url_users = "http://cTuning.org/crowdtuning-timeline";
69-
7067
Button b_sdk = (Button) findViewById(R.id.b_sdk);
7168
Button b_about = (Button) findViewById(R.id.b_about_app);
7269
Button b_stats = (Button) findViewById(R.id.b_results);
@@ -76,7 +73,7 @@ private void addListenersOnButtons() {
7673
@SuppressWarnings({"unused", "unchecked"})
7774
@Override
7875
public void onClick(View arg0) {
79-
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url_sdk));
76+
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(URL_SDK));
8077
startActivity(browserIntent);
8178
}
8279
});
@@ -85,10 +82,10 @@ public void onClick(View arg0) {
8582
@SuppressWarnings({"unused", "unchecked"})
8683
@Override
8784
public void onClick(View arg0) {
88-
AppLogger.logMessage("Opening " + url_about + " ...");
85+
AppLogger.logMessage("Opening " + URL_ABOUT + " ...");
8986

9087
Intent browserIntent =
91-
new Intent(Intent.ACTION_VIEW, Uri.parse(url_about));
88+
new Intent(Intent.ACTION_VIEW, Uri.parse(URL_ABOUT));
9289

9390
startActivity(browserIntent);
9491
}
@@ -98,10 +95,10 @@ public void onClick(View arg0) {
9895
@SuppressWarnings({"unused", "unchecked"})
9996
@Override
10097
public void onClick(View arg0) {
101-
AppLogger.logMessage("Opening " + url_stats + " ...");
98+
AppLogger.logMessage("Opening " + URL_CROWD_RESULTS + " ...");
10299

103100
Intent browserIntent =
104-
new Intent(Intent.ACTION_VIEW, Uri.parse(url_stats));
101+
new Intent(Intent.ACTION_VIEW, Uri.parse(URL_CROWD_RESULTS));
105102

106103
startActivity(browserIntent);
107104
}
@@ -111,10 +108,10 @@ public void onClick(View arg0) {
111108
@SuppressWarnings({"unused", "unchecked"})
112109
@Override
113110
public void onClick(View arg0) {
114-
AppLogger.logMessage("Opening " + url_users + " ...");
111+
AppLogger.logMessage("Opening " + URL_USERS + " ...");
115112

116113
Intent browserIntent =
117-
new Intent(Intent.ACTION_VIEW, Uri.parse(url_users));
114+
new Intent(Intent.ACTION_VIEW, Uri.parse(URL_USERS));
118115

119116
startActivity(browserIntent);
120117
}

app/src/main/java/openscience/crowdsource/video/experiments/ResultActivity.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.content.Intent;
66
import android.graphics.Bitmap;
77
import android.graphics.BitmapFactory;
8+
import android.net.Uri;
89
import android.os.AsyncTask;
910
import android.os.Bundle;
1011
import android.support.v7.app.AppCompatActivity;
@@ -30,6 +31,7 @@
3031
import java.io.ByteArrayOutputStream;
3132
import java.io.File;
3233

34+
import static openscience.crowdsource.video.experiments.AppConfigService.URL_CROWD_RESULTS;
3335
import static openscience.crowdsource.video.experiments.Utils.decodeSampledBitmapFromResource;
3436
import static openscience.crowdsource.video.experiments.Utils.validateReturnCode;
3537

@@ -78,6 +80,21 @@ public void onClick(View v) {
7880
updateImageView(actualImagePath);
7981
}
8082

83+
final TextView crowdResultURL = (TextView) findViewById(R.id.crowdResultURL);
84+
crowdResultURL.setText(Html.fromHtml("<a href=\"" + AppConfigService.URL_CROWD_RESULTS + "\">View your results in the public repositor</a>"));
85+
crowdResultURL.setOnClickListener(new View.OnClickListener() {
86+
@SuppressWarnings({"unused", "unchecked"})
87+
@Override
88+
public void onClick(View arg0) {
89+
AppLogger.logMessage("Opening " + URL_CROWD_RESULTS + " ...");
90+
91+
Intent browserIntent =
92+
new Intent(Intent.ACTION_VIEW, Uri.parse(URL_CROWD_RESULTS));
93+
94+
startActivity(browserIntent);
95+
}
96+
});
97+
8198
final ViewGroup resultRadioGroup = (ViewGroup) findViewById(R.id.rgSelectResultList);
8299

83100
String recognitionResultText = AppConfigService.getRecognitionResultText();

app/src/main/res/layout/activity_result.xml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@
6565
android:adjustViewBounds="true"
6666
android:scaleType="centerCrop"
6767
/>
68+
<TextView
69+
android:id="@+id/crowdResultURL"
70+
android:text="View result"
71+
android:textColor="@color/colorTextGreen"
72+
android:layout_width="wrap_content"
73+
android:layout_height="wrap_content"
74+
android:layout_marginTop="30dp"
75+
android:layout_marginLeft="0dp"
76+
android:layout_below="@+id/imageView1"
77+
android:minHeight="28dp"
78+
android:textSize="14sp"
79+
/>
6880

6981
<TextView
7082
android:id="@+id/selectResultText"
@@ -74,7 +86,7 @@
7486
android:layout_height="wrap_content"
7587
android:layout_marginTop="30dp"
7688
android:layout_marginLeft="0dp"
77-
android:layout_below="@+id/imageView1"
89+
android:layout_below="@+id/crowdResultURL"
7890
android:minHeight="28dp"
7991
android:textSize="14sp"
8092
/>

0 commit comments

Comments
 (0)