Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit f21cc05

Browse files
committed
Merge pull request #478 from MirakelX/survey
Survey
2 parents 860ba00 + 370fe1e commit f21cc05

File tree

13 files changed

+136
-47
lines changed

13 files changed

+136
-47
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
artifactUrls "file:~/.m2/"
88
}
99
}
10-
classpath 'com.android.tools.build:gradle:0.14.0'
10+
classpath 'com.android.tools.build:gradle:1.2.0'
1111
// classpath 'com.jakewharton.hugo:hugo-plugin:1.0.+'
1212
classpath 'org.robolectric:robolectric-gradle-plugin:0.13.+'
1313
}

changelog/res/raw/changelog.xml

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
2020

2121
<changelog>
22+
<version name="2.8.2" date="2015-05-25" code="74">
23+
<text><![CDATA[Preparing the release of Mirakel 3.0 we would like to do a small survey to learn more about our users.
24+
Mirakel 3.0 and therefore the new user interface will be released soon.]]></text>
25+
<feature>Nothing new here</feature>
26+
</version>
2227
<version name="2.8.1" date="2014-11-25" code="72">
2328
<feature>Bugfix release</feature>
2429
</version>

changelog/src/de/azapps/changelog/Changelog.java

+24-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
package de.azapps.changelog;
22

3-
import java.io.BufferedReader;
4-
import java.io.IOException;
5-
import java.io.InputStream;
6-
import java.io.InputStreamReader;
7-
import java.util.ArrayList;
8-
import java.util.List;
9-
10-
import org.xmlpull.v1.XmlPullParser;
11-
import org.xmlpull.v1.XmlPullParserException;
12-
import org.xmlpull.v1.XmlPullParserFactory;
13-
143
import android.app.AlertDialog;
154
import android.content.Context;
165
import android.content.DialogInterface;
@@ -23,6 +12,18 @@
2312
import android.preference.PreferenceManager;
2413
import android.view.ContextThemeWrapper;
2514
import android.webkit.WebView;
15+
16+
import org.xmlpull.v1.XmlPullParser;
17+
import org.xmlpull.v1.XmlPullParserException;
18+
import org.xmlpull.v1.XmlPullParserFactory;
19+
20+
import java.io.BufferedReader;
21+
import java.io.IOException;
22+
import java.io.InputStream;
23+
import java.io.InputStreamReader;
24+
import java.util.ArrayList;
25+
import java.util.List;
26+
2627
import de.azapps.mirakel.changelog.R;
2728
import de.azapps.mirakel.helper.MirakelCommonPreferences;
2829
import de.azapps.tools.Log;
@@ -52,6 +53,11 @@ public class Changelog {
5253
private static final String TAG = "de.azapps.changelog";
5354
private final Context context;
5455
private final SharedPreferences settings;
56+
private OnChangelogShown listener;
57+
58+
public interface OnChangelogShown{
59+
public void changelogShown();
60+
}
5561

5662
public Changelog(final Context context) {
5763
this.settings = PreferenceManager.getDefaultSharedPreferences(context);
@@ -70,6 +76,10 @@ public boolean isUpdated() {
7076
return this.current_version > this.last_version;
7177
}
7278

79+
public void setOnShowChangelog(final OnChangelogShown listener){
80+
this.listener=listener;
81+
}
82+
7383
public void showChangelog() {
7484
showChangelog(this.last_version);
7585
}
@@ -123,6 +133,9 @@ private AlertDialog getDialog(String changelog, final int sinceVersion) {
123133
public void onClick(final DialogInterface dialog,
124134
final int which) {
125135
dialog.cancel();
136+
if(listener!=null){
137+
listener.changelogShown();
138+
}
126139
}
127140
});
128141
// "more …" button

main/AndroidManifest.xml

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2121
xmlns:tools="http://schemas.android.com/tools"
2222
package="de.azapps.mirakelandroid"
23-
android:versionCode="72"
24-
android:versionName="2.8.1" >
23+
android:versionCode="74"
24+
android:versionName="2.8.2" >
2525

2626
<!-- TODO Remove Unused Permissions -->
2727
<uses-permission android:name="android.permission.INTERNET" />
@@ -149,6 +149,10 @@
149149
android:finishOnTaskLaunch="true"
150150
android:launchMode="singleInstance"
151151
android:theme="@style/Dialog" />
152+
<activity
153+
android:name="de.azapps.mirakel.static_activities.SurveyActivity"
154+
android:parentActivityName="de.azapps.mirakel.main_activity.MainActivity"
155+
android:theme="@style/AppTheme"/>
152156

153157
<receiver android:name="de.azapps.mirakel.widget.MainWidgetProvider" >
154158
<intent-filter>

main/build.gradle

+2-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apply plugin: 'com.android.application'
22
//apply plugin: 'hugo'
3-
apply plugin: 'robolectric'
3+
//apply plugin: 'robolectric'
44

55
def getVersionCode() {
66
def manifestFile = file("AndroidManifest.xml")
@@ -34,7 +34,7 @@ android {
3434
testApplicationId "de.azapps.mirakelandroid.test"
3535
//testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
3636
minSdkVersion 14
37-
targetSdkVersion 21
37+
targetSdkVersion 22
3838
}
3939
signingConfigs {
4040
release {
@@ -99,25 +99,7 @@ android {
9999
}
100100

101101

102-
robolectric {
103-
// configure the set of classes for JUnit tests
104-
include '**/*Test.class'
105-
//exclude '**/espresso/**/*.class'
106102

107-
// configure max heap size of the test JVM
108-
//maxHeapSize = '2048m'
109-
110-
// configure the test JVM arguments
111-
//jvmArgs '-Xmx1024m', '-XX:MaxPermSize=256m', '-XX:+HeapDumpOnOutOfMemoryError'
112-
113-
// configure whether failing tests should fail the build
114-
//ignoreFailures false
115-
116-
// use afterTest to listen to the test execution results
117-
afterTest { descriptor, result ->
118-
println "Executing test for {$descriptor.name} with result: ${result.resultType}"
119-
}
120-
}
121103

122104
dependencies {
123105
compile project(':model')

main/res/menu/activity_list.xml

+4
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,8 @@
5353
android:id="@+id/menu_settings"
5454
android:title="@string/menu_settings"
5555
android:showAsAction="never"/>
56+
<item
57+
android:id="@+id/menu_survey"
58+
android:title="@string/mirakel_survey"
59+
android:showAsAction="never"/>
5660
</menu>

main/res/menu/activity_task.xml

+4
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,9 @@
6767
android:id="@+id/menu_settings"
6868
android:title="@string/menu_settings"
6969
android:showAsAction="never"/>
70+
<item
71+
android:id="@+id/menu_survey"
72+
android:title="@string/mirakel_survey"
73+
android:showAsAction="never"/>
7074

7175
</menu>

main/res/menu/tablet_right.xml

+4
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,9 @@
8282
android:id="@+id/menu_settings"
8383
android:showAsAction="never"
8484
android:title="@string/menu_settings"/>
85+
<item
86+
android:id="@+id/menu_survey"
87+
android:title="@string/mirakel_survey"
88+
android:showAsAction="never"/>
8589

8690
</menu>

main/res/menu/tasks.xml

+4
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,9 @@
6868
android:id="@+id/menu_settings"
6969
android:title="@string/action_settings"
7070
android:showAsAction="never"/>
71+
<item
72+
android:id="@+id/menu_survey"
73+
android:title="@string/mirakel_survey"
74+
android:showAsAction="never"/>
7175

7276
</menu>

main/res/values/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,6 @@
102102
</string-array>
103103

104104
<string name="delete_caldav_lists">It\'s not allowed to delete lists of a caldav account.</string>
105+
<string name="mirakel_survey">Mirakel Survey</string>
105106

106107
</resources>

main/src/de/azapps/mirakel/main_activity/MainActivity.java

+29-13
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@
100100
import de.azapps.mirakel.model.task.TaskVanishedException;
101101
import de.azapps.mirakel.services.NotificationService;
102102
import de.azapps.mirakel.settings.SettingsActivity;
103+
import de.azapps.mirakel.static_activities.SurveyActivity;
103104
import de.azapps.mirakel.widget.MainWidgetProvider;
104105
import de.azapps.mirakelandroid.R;
105106
import de.azapps.tools.Log;
106107
import de.azapps.tools.OptionalUtils;
107108

108-
import static com.google.common.base.Optional.absent;
109109
import static com.google.common.base.Optional.of;
110110
import static de.azapps.tools.OptionalUtils.withOptional;
111111

@@ -601,15 +601,15 @@ private void handleDestroySubtasks(final Task task) {
601601
@Override
602602
public void onClick(final DialogInterface dialog, final int which) {
603603
switch (which) {
604-
case 0: // Only this task
605-
task.destroy();
606-
updateAfterDestroy();
607-
break;
608-
case 1: // also subtasks
609-
task.destroySubtasks();
610-
task.destroy();
611-
updateAfterDestroy();
612-
break;
604+
case 0: // Only this task
605+
task.destroy();
606+
updateAfterDestroy();
607+
break;
608+
case 1: // also subtasks
609+
task.destroySubtasks();
610+
task.destroy();
611+
updateAfterDestroy();
612+
break;
613613
}
614614
}
615615
}).show();
@@ -622,12 +622,13 @@ private void updateAfterDestroy() {
622622

623623
private void handleDestroyRecurringTask(final Task task) {
624624
TaskDialogHelpers.handleChangeRecurringTask(this, getString(R.string.destroy_recurring_task,
625-
task.getName()), new TaskDialogHelpers.OnRecurrenceChange() {
625+
task.getName()), new TaskDialogHelpers.OnRecurrenceChange() {
626626
@Override
627627
public void handleSingleChange() {
628628
task.destroy();
629629
updateAfterDestroy();
630630
}
631+
631632
@Override
632633
public void handleMultiChange() {
633634
Optional<Task> master = task.getRecurrenceMaster();
@@ -998,11 +999,11 @@ public void run() {
998999
inflater.inflate(newmenu, MainActivity.this.menu);
9991000
if (MainActivity.this.menu.findItem(R.id.menu_sync_now) != null) {
10001001
MainActivity.this.menu.findItem(R.id.menu_sync_now)
1001-
.setVisible(MirakelModelPreferences.useSync());
1002+
.setVisible(MirakelModelPreferences.useSync());
10021003
}
10031004
if (MainActivity.this.menu.findItem(R.id.menu_contact) != null) {
10041005
MainActivity.this.menu.findItem(R.id.menu_contact)
1005-
.setVisible(BuildHelper.isBeta());
1006+
.setVisible(BuildHelper.isBeta());
10061007
}
10071008
if (!fromShare) {
10081009
updateShare();
@@ -1220,6 +1221,12 @@ private void initConfiguration() {
12201221
private void initThirdParty() {
12211222
// Show ChangeLog
12221223
final Changelog cl = new Changelog(this);
1224+
cl.setOnShowChangelog(new Changelog.OnChangelogShown() {
1225+
@Override
1226+
public void changelogShown(){
1227+
showSurvey();
1228+
}
1229+
});
12231230
cl.showChangelog();
12241231
final ILoveFS ilfs = new ILoveFS(this, "[email protected]",
12251232
DefinitionsHelper.APK_NAME);
@@ -1238,6 +1245,12 @@ public void onClick(final DialogInterface dialog,
12381245
}
12391246
}
12401247

1248+
private void showSurvey() {
1249+
final Intent intent = new Intent(MainActivity.this,
1250+
SurveyActivity.class);
1251+
startActivity(intent);
1252+
}
1253+
12411254
@Override
12421255
protected void onCreate(final Bundle savedInstanceState) {
12431256
initFirst();
@@ -1407,6 +1420,9 @@ public void run() {
14071420
Log.wtf(MainActivity.TAG, "List vanished on task cloning");
14081421
}
14091422
break;
1423+
case R.id.menu_survey:
1424+
showSurvey();
1425+
break;
14101426
default:
14111427
return super.onOptionsItemSelected(item);
14121428
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package de.azapps.mirakel.static_activities;
2+
3+
import android.os.Bundle;
4+
import android.support.v4.app.FragmentActivity;
5+
6+
import de.azapps.mirakel.helper.MirakelCommonPreferences;
7+
import de.azapps.mirakelandroid.R;
8+
import android.widget.Toast;
9+
10+
/**
11+
* Created by gsemmler1 on 25.05.15.
12+
*/
13+
public class SurveyActivity extends FragmentActivity {
14+
15+
@Override
16+
public void onCreate(Bundle savedInstanceState) {
17+
if (MirakelCommonPreferences.isDark()) {
18+
setTheme(R.style.AppBaseThemeDARK);
19+
} else {
20+
setTheme(R.style.AppBaseTheme);
21+
}
22+
super.onCreate(savedInstanceState);
23+
getSupportFragmentManager().beginTransaction()
24+
.add(android.R.id.content, new SurveyFragment(), "foo")
25+
.commit();
26+
setTitle("Mirakel survey");
27+
28+
Toast.makeText(this, "Please help us improving Mirakel by participating in this short survey", Toast.LENGTH_SHORT).show();
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package de.azapps.mirakel.static_activities;
2+
3+
import android.os.Bundle;
4+
import android.support.v4.app.Fragment;
5+
import android.view.LayoutInflater;
6+
import android.view.View;
7+
import android.view.ViewGroup;
8+
import android.webkit.WebView;
9+
10+
11+
public class SurveyFragment extends Fragment {
12+
13+
@Override
14+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
15+
WebView webView=new WebView(getActivity());
16+
webView.getSettings().setJavaScriptEnabled(true);
17+
webView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
18+
webView.loadUrl("https://mirakel1.typeform.com/to/Vr5TU4");
19+
getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
20+
return webView;
21+
}
22+
}

0 commit comments

Comments
 (0)