Skip to content

Commit 61cb9be

Browse files
committed
Merge pull request #96 from SandroMachado/feature/add-intro-slides
Add intro slides
2 parents 80e3d47 + 03452f7 commit 61cb9be

36 files changed

+273
-51
lines changed

app/app.iml

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="androidVTS" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
2+
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="android-vts" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
33
<component name="FacetManager">
44
<facet type="android-gradle" name="Android-Gradle">
55
<configuration>
@@ -64,46 +64,41 @@
6464
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
6565
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
6666
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
67-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
6867
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
69-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
68+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/debug" />
7069
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
7170
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
72-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
73-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/jars" />
74-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.1.0/jars" />
75-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.1.0/jars" />
76-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.1.0/jars" />
77-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/jars" />
71+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.1/jars" />
72+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.1.1/jars" />
73+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.1.1/jars" />
74+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.1.1/jars" />
75+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.1/jars" />
7876
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.github.afollestad.material-dialogs/core/0.8.5.0/jars" />
77+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.github.paolorotolo/appintro/3.3.0/jars" />
7978
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/me.zhanghai.android.materialprogressbar/library/1.1.4/jars" />
8079
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
81-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
82-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
83-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
84-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
8580
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
86-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
8781
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
88-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
8982
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
9083
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
9184
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
85+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
9286
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
9387
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
9488
</content>
9589
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
9690
<orderEntry type="sourceFolder" forTests="false" />
9791
<orderEntry type="library" exported="" name="xz-1.2" level="project" />
98-
<orderEntry type="library" exported="" name="recyclerview-v7-23.1.0" level="project" />
99-
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
100-
<orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" />
101-
<orderEntry type="library" exported="" name="design-23.1.0" level="project" />
92+
<orderEntry type="library" exported="" name="recyclerview-v7-23.1.1" level="project" />
93+
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
94+
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
95+
<orderEntry type="library" exported="" name="design-23.1.1" level="project" />
96+
<orderEntry type="library" exported="" name="appcompat-v7-23.1.1" level="project" />
10297
<orderEntry type="library" exported="" name="library-1.1.4" level="project" />
10398
<orderEntry type="library" exported="" name="core-0.8.5.0" level="project" />
99+
<orderEntry type="library" exported="" name="appintro-3.3.0" level="project" />
100+
<orderEntry type="library" exported="" name="cardview-v7-23.1.1" level="project" />
104101
<orderEntry type="library" exported="" name="commons-io-2.4" level="project" />
105-
<orderEntry type="library" exported="" name="cardview-v7-23.1.0" level="project" />
106-
<orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" />
107102
<orderEntry type="library" exported="" name="commons-compress-1.5" level="project" />
108103
</component>
109104
</module>

app/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ repositories {
4040

4141
dependencies {
4242
compile fileTree(dir: 'libs', include: ['*.jar'])
43-
compile 'com.android.support:appcompat-v7:23.1.0'
44-
compile 'org.apache.commons:commons-compress:1.5'
43+
compile 'com.android.support:appcompat-v7:23.1.1'
44+
compile 'com.android.support:cardview-v7:23.1.1'
45+
compile 'com.android.support:design:23.1.1'
46+
compile 'com.github.paolorotolo:appintro:3.3.0'
4547
compile 'commons-io:commons-io:2.4'
46-
compile 'com.android.support:cardview-v7:23.1.0'
47-
compile 'com.android.support:design:23.1.0'
48+
compile 'org.apache.commons:commons-compress:1.5'
4849
compile('com.github.afollestad.material-dialogs:core:0.8.5.0@aar') {
4950
transitive = true
5051
}

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
android:theme="@style/AppTheme" >
1414

1515
<activity
16-
android:name="fuzion24.device.vulnerability.test.ui.MainActivity"
16+
android:name="fuzion24.device.vulnerability.test.ui.SplashScreenActivity"
1717
android:configChanges="orientation|screenSize|keyboardHidden"
1818
android:launchMode="singleTask"
1919
android:label="@string/app_name" >
@@ -24,6 +24,9 @@
2424
</intent-filter>
2525
</activity>
2626

27+
<activity android:name="fuzion24.device.vulnerability.test.ui.MainActivity"/>
28+
<activity android:name="fuzion24.device.vulnerability.test.ui.AppIntroActivity"/>
29+
2730
<receiver android:name="fuzion24.device.vulnerability.broadcastreceiver.ApplicationUpdateBroadcastReceiver">
2831
<intent-filter>
2932
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package fuzion24.device.vulnerability.test.ui;
2+
3+
import android.content.Intent;
4+
import android.graphics.Color;
5+
import android.os.Bundle;
6+
7+
import com.afollestad.materialdialogs.DialogAction;
8+
import com.afollestad.materialdialogs.MaterialDialog;
9+
import com.github.paolorotolo.appintro.AppIntro;
10+
import com.github.paolorotolo.appintro.AppIntroFragment;
11+
import com.nowsecure.android.vts.R;
12+
13+
import fuzion24.device.vulnerability.util.SharedPreferencesUtils;
14+
15+
public class AppIntroActivity extends AppIntro {
16+
17+
@Override
18+
public void init(Bundle savedInstanceState) {
19+
addSlide(AppIntroFragment.newInstance(getString(R.string.appintro_security), getString(R.string.appintro_security_description), R.drawable.ic_security, Color.parseColor("#33394F")));
20+
addSlide(AppIntroFragment.newInstance(getString(R.string.appintro_issues), getString(R.string.appintro_issues_description), R.drawable.ic_bug, Color.parseColor("#33394F")));
21+
addSlide(AppIntroFragment.newInstance(getString(R.string.appintro_antivirus), getString(R.string.appintro_antivirus_description), R.drawable.ic_action_lock_open, Color.parseColor("#33394F")));
22+
addSlide(AppIntroFragment.newInstance(getString(R.string.appintro_sharing), getString(R.string.appintro_sharing_description), R.drawable.ic_file_cloud_upload, Color.parseColor("#33394F")));
23+
24+
showSkipButton(false);
25+
showDoneButton(true);
26+
}
27+
28+
@Override
29+
public void onSkipPressed() {
30+
}
31+
32+
@Override
33+
public void onDonePressed() {
34+
new MaterialDialog.Builder(this)
35+
.title(R.string.dialog_automatic_sharing_title)
36+
.content(R.string.dialog_automatic_sharing_description)
37+
.positiveText(R.string.global_sharing)
38+
.negativeText(R.string.global_notsharing)
39+
.onPositive(new MaterialDialog.SingleButtonCallback() {
40+
@Override
41+
public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
42+
SharedPreferencesUtils.setIsAutomaticSharingEnable(AppIntroActivity.this, true);
43+
}
44+
})
45+
.onNegative(new MaterialDialog.SingleButtonCallback() {
46+
@Override
47+
public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
48+
SharedPreferencesUtils.setIsAutomaticSharingEnable(AppIntroActivity.this, false);
49+
}
50+
})
51+
.onAny(new MaterialDialog.SingleButtonCallback() {
52+
@Override
53+
public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
54+
SharedPreferencesUtils.disableFirstRun(AppIntroActivity.this);
55+
56+
Intent mainIntent = new Intent(AppIntroActivity.this, MainActivity.class);
57+
58+
AppIntroActivity.this.startActivity(mainIntent);
59+
AppIntroActivity.this.finish();
60+
}
61+
})
62+
.show();
63+
}
64+
65+
@Override
66+
public void onSlideChanged() {
67+
}
68+
69+
@Override
70+
public void onNextPressed() {
71+
}
72+
73+
}

app/src/main/java/fuzion24/device/vulnerability/test/ui/MainActivity.java

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import fuzion24.device.vulnerability.test.VulnerabilityTestRunner;
3535
import fuzion24.device.vulnerability.test.adapter.RecyclerAdapter;
3636
import fuzion24.device.vulnerability.util.DeviceInfo;
37+
import fuzion24.device.vulnerability.util.SharedPreferencesUtils;
3738
import fuzion24.device.vulnerability.vulnerabilities.VulnerabilityResultSerialzier;
3839

3940
public class MainActivity extends AppCompatActivity {
@@ -116,6 +117,8 @@ public void onClick(View v) {
116117
public boolean onCreateOptionsMenu(Menu menu) {
117118
getMenuInflater().inflate(R.menu.main_menu, menu);
118119

120+
menu.getItem(2).setChecked(SharedPreferencesUtils.isAutomaticSharingEnable(MainActivity.this));
121+
119122
return true;
120123
}
121124

@@ -161,6 +164,34 @@ public void onClick(View v) {
161164

162165
return true;
163166

167+
case R.id.menu_automatic_share_results:
168+
new MaterialDialog.Builder(this)
169+
.title(R.string.dialog_automatic_sharing_title)
170+
.content(R.string.dialog_automatic_sharing_description)
171+
.positiveText(R.string.global_sharing)
172+
.negativeText(R.string.global_notsharing)
173+
.onPositive(new MaterialDialog.SingleButtonCallback() {
174+
@Override
175+
public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
176+
SharedPreferencesUtils.setIsAutomaticSharingEnable(MainActivity.this, true);
177+
}
178+
})
179+
.onNegative(new MaterialDialog.SingleButtonCallback() {
180+
@Override
181+
public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
182+
SharedPreferencesUtils.setIsAutomaticSharingEnable(MainActivity.this, false);
183+
}
184+
})
185+
.onAny(new MaterialDialog.SingleButtonCallback() {
186+
@Override
187+
public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
188+
invalidateOptionsMenu();
189+
}
190+
})
191+
.show();
192+
193+
return true;
194+
164195
default:
165196
return super.onOptionsItemSelected(item);
166197
}
@@ -199,7 +230,24 @@ private void showScanResume(final List<VulnerabilityTestResult> results) {
199230
MaterialDialog.Builder dialogBuilder = new MaterialDialog.Builder(this)
200231
.title(R.string.scan_details)
201232
.customView(R.layout.dialog_scan_details_layout, true)
202-
.positiveText(R.string.dismiss);
233+
.positiveText(R.string.dismiss)
234+
.onAny(new MaterialDialog.SingleButtonCallback() {
235+
@Override
236+
public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
237+
if (SharedPreferencesUtils.isAutomaticSharingEnable(MainActivity.this)) {
238+
try {
239+
JSONObject json = VulnerabilityResultSerialzier.serializeResultsToJson(testResults, devInfo);
240+
241+
Uri formUri = new ShareViaGoogleForm(json).buildUri();
242+
Intent intent = new Intent(Intent.ACTION_VIEW, formUri);
243+
244+
startActivity(Intent.createChooser(intent, getString(R.string.share_results_via)));
245+
} catch (JSONException exception) {
246+
exception.printStackTrace();
247+
}
248+
}
249+
}
250+
});
203251

204252
if (numberOfFailed > 0) {
205253
dialogBuilder.negativeText(R.string.my_device_is_vulnerable_info)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package fuzion24.device.vulnerability.test.ui;
2+
3+
import android.app.Activity;
4+
import android.content.Intent;
5+
import android.os.Bundle;
6+
import android.os.Handler;
7+
8+
import com.nowsecure.android.vts.R;
9+
10+
import fuzion24.device.vulnerability.util.SharedPreferencesUtils;
11+
12+
public class SplashScreenActivity extends Activity {
13+
14+
private final int SPLASH_DISPLAY_LENGTH = 2000;
15+
16+
@Override
17+
public void onCreate(Bundle icicle) {
18+
super.onCreate(icicle);
19+
setContentView(R.layout.splashscreen_layout);
20+
21+
new Handler().postDelayed(new Runnable(){
22+
@Override
23+
public void run() {
24+
if (SharedPreferencesUtils.isTheFirstRun(SplashScreenActivity.this)) {
25+
Intent mainIntent = new Intent(SplashScreenActivity.this, AppIntroActivity.class);
26+
SplashScreenActivity.this.startActivity(mainIntent);
27+
SplashScreenActivity.this.finish();
28+
29+
return;
30+
}
31+
32+
Intent mainIntent = new Intent(SplashScreenActivity.this, MainActivity.class);
33+
SplashScreenActivity.this.startActivity(mainIntent);
34+
SplashScreenActivity.this.finish();
35+
36+
}
37+
}, SPLASH_DISPLAY_LENGTH);
38+
}
39+
40+
}

app/src/main/java/fuzion24/device/vulnerability/util/SharedPreferencesUtils.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,32 @@
1111
public class SharedPreferencesUtils {
1212

1313
private static final String PREFS_LAST_LIST_OF_SCANS = "PREFS_LIST_OF_SCANS";
14-
14+
private static final String PREFS_FIRST_RUN = "PREFS_FIRST_RUN";
15+
private static final String PREFS_AUTOMATIC_SHARING_ENABLE = "PREFS_AUTOMATIC_SHARING_ENABLE";
1516

1617
private static final String PREFS_NAME = "com.nowsecure.android.vts.PREFERENCE_FILE_KEY";
1718

1819
private static SharedPreferences getPreferences(Context context) {
1920
return context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
2021
}
2122

23+
public static Boolean isAutomaticSharingEnable(Context context) {
24+
return getPreferences(context).getBoolean(PREFS_AUTOMATIC_SHARING_ENABLE, false);
25+
}
26+
27+
public static void setIsAutomaticSharingEnable(Context context, Boolean isAutomaticSharingEnable) {
28+
getPreferences(context).edit().putBoolean(PREFS_AUTOMATIC_SHARING_ENABLE, isAutomaticSharingEnable).commit();
29+
}
30+
31+
public static Boolean isTheFirstRun(Context context) {
32+
return getPreferences(context).getBoolean(PREFS_FIRST_RUN, true);
33+
}
34+
35+
public static void disableFirstRun(Context context) {
36+
getPreferences(context).edit().putBoolean(PREFS_FIRST_RUN, false).commit();
37+
}
38+
39+
2240
public static List<String> getTheListOfScansAvailable(Context context) {
2341
Set<String> listOfPreviousScans = getPreferences(context).getStringSet(PREFS_LAST_LIST_OF_SCANS, null);
2442

5.07 KB
Loading
5.62 KB
Loading
5.63 KB
Loading

0 commit comments

Comments
 (0)