diff --git a/.travis.yml b/.travis.yml
index ea1122643..dfa408c7b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,17 +1,13 @@
language: android
sudo: true
-android:
- components:
- # Uncomment the lines below if you want to
- # use the latest revision of Android SDK Tools
- - platform-tools
- - tools
- # The BuildTools version used by your project
- - build-tools-23.0.2
-
- # The SDK version used to compile your project
- - android-23
+install:
+- echo y | android update sdk -u -a -t tools
+- echo y | android update sdk -u -a -t platform-tools
+- echo y | android update sdk -u -a -t build-tools-25.0.2
+- echo y | android update sdk -u -a -t android-25
+- echo y | android update sdk -u -a -t extra-google-m2repository
+- echo y | android update sdk -u -a -t extra-android-m2repository
script: ./gradlew assembleRelease testReleaseUnitTest lintRelease findbugs
diff --git a/app/build.gradle b/app/build.gradle
index a79fcac75..9ea4de950 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -7,8 +7,8 @@ findbugs {
}
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.2"
+ compileSdkVersion 25
+ buildToolsVersion "25.0.2"
defaultConfig {
applicationId "protect.card_locker"
@@ -35,12 +35,13 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:23.1.1'
- compile 'com.android.support:design:23.1.1'
+ compile 'com.android.support:appcompat-v7:25.3.1'
+ compile 'com.android.support:design:25.3.1'
compile 'com.journeyapps:zxing-android-embedded:3.5.0@aar'
compile 'com.google.zxing:core:3.3.0'
compile 'org.apache.commons:commons-csv:1.2'
compile group: 'com.google.guava', name: 'guava', version: '18.0'
+ compile 'com.github.apl-devs:appintro:v4.2.0'
testCompile 'junit:junit:4.12'
testCompile "org.robolectric:robolectric:3.0"
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 59b46dad5..6c8e5d2a7 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -48,6 +48,10 @@
android:label="@string/importExport"
android:configChanges="orientation|screenSize"
android:theme="@style/AppTheme.NoActionBar"/>
+
diff --git a/app/src/main/java/protect/card_locker/IntroActivity.java b/app/src/main/java/protect/card_locker/IntroActivity.java
new file mode 100644
index 000000000..465f694a7
--- /dev/null
+++ b/app/src/main/java/protect/card_locker/IntroActivity.java
@@ -0,0 +1,43 @@
+package protect.card_locker;
+
+import android.os.Bundle;
+import android.support.annotation.LayoutRes;
+import android.support.v4.app.Fragment;
+
+import com.github.paolorotolo.appintro.AppIntro;
+
+
+public class IntroActivity extends AppIntro
+{
+ @Override
+ public void init(Bundle savedInstanceState)
+ {
+ addIntroSlide(R.layout.intro1_layout);
+ addIntroSlide(R.layout.intro2_layout);
+ addIntroSlide(R.layout.intro3_layout);
+ addIntroSlide(R.layout.intro4_layout);
+ addIntroSlide(R.layout.intro5_layout);
+ addIntroSlide(R.layout.intro6_layout);
+ }
+
+ private void addIntroSlide(@LayoutRes int layout)
+ {
+ Fragment slide = new IntroSlide();
+ Bundle args = new Bundle();
+ args.putInt("layout", layout);
+ slide.setArguments(args);
+ addSlide(slide);
+ }
+
+ @Override
+ public void onSkipPressed(Fragment fragment) {
+ finish();
+ }
+
+ @Override
+ public void onDonePressed(Fragment fragment) {
+ finish();
+ }
+}
+
+
diff --git a/app/src/main/java/protect/card_locker/IntroSlide.java b/app/src/main/java/protect/card_locker/IntroSlide.java
new file mode 100644
index 000000000..7fff1f357
--- /dev/null
+++ b/app/src/main/java/protect/card_locker/IntroSlide.java
@@ -0,0 +1,25 @@
+package protect.card_locker;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class IntroSlide extends Fragment
+{
+ int _layout;
+
+ @Override
+ public void setArguments(Bundle bundle)
+ {
+ _layout = bundle.getInt("layout");
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
+ {
+ View v = inflater.inflate(_layout, container, false);
+ return v;
+ }
+}
diff --git a/app/src/main/java/protect/card_locker/MainActivity.java b/app/src/main/java/protect/card_locker/MainActivity.java
index bf48e3512..aeafa5d1c 100644
--- a/app/src/main/java/protect/card_locker/MainActivity.java
+++ b/app/src/main/java/protect/card_locker/MainActivity.java
@@ -4,6 +4,7 @@ import android.content.ClipData;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ClipboardManager;
+import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
@@ -41,6 +42,12 @@ public class MainActivity extends AppCompatActivity
setSupportActionBar(toolbar);
updateLoyaltyCardList();
+
+ SharedPreferences prefs = getSharedPreferences("protect.card_locker", MODE_PRIVATE);
+ if (prefs.getBoolean("firstrun", true)) {
+ startIntro();
+ prefs.edit().putBoolean("firstrun", false).commit();
+ }
}
@Override
@@ -152,6 +159,12 @@ public class MainActivity extends AppCompatActivity
return true;
}
+ if(id == R.id.action_intro)
+ {
+ startIntro();
+ return true;
+ }
+
if(id == R.id.action_about)
{
displayAboutDialog();
@@ -168,7 +181,8 @@ public class MainActivity extends AppCompatActivity
"Commons CSV", "https://commons.apache.org/proper/commons-csv/",
"Guava", "https://github.com/google/guava",
"ZXing", "https://github.com/zxing/zxing",
- "ZXing Android Embedded", "https://github.com/journeyapps/zxing-android-embedded"
+ "ZXing Android Embedded", "https://github.com/journeyapps/zxing-android-embedded",
+ "AppIntro", "https://github.com/apl-devs/AppIntro"
);
StringBuilder libs = new StringBuilder().append("
");
@@ -230,4 +244,10 @@ public class MainActivity extends AppCompatActivity
})
.show();
}
+
+ private void startIntro()
+ {
+ Intent intent = new Intent(this, IntroActivity.class);
+ startActivity(intent);
+ }
}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-hdpi/app_icon_intro.png b/app/src/main/res/drawable-hdpi/app_icon_intro.png
new file mode 100644
index 000000000..db2620608
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/app_icon_intro.png differ
diff --git a/app/src/main/res/drawable-hdpi/intro2_image.png b/app/src/main/res/drawable-hdpi/intro2_image.png
new file mode 100644
index 000000000..efaa5ec79
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/intro2_image.png differ
diff --git a/app/src/main/res/drawable-hdpi/intro3_image.png b/app/src/main/res/drawable-hdpi/intro3_image.png
new file mode 100644
index 000000000..9cde72e2f
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/intro3_image.png differ
diff --git a/app/src/main/res/drawable-hdpi/intro4_image.png b/app/src/main/res/drawable-hdpi/intro4_image.png
new file mode 100644
index 000000000..54ad08327
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/intro4_image.png differ
diff --git a/app/src/main/res/drawable-hdpi/intro5_image.png b/app/src/main/res/drawable-hdpi/intro5_image.png
new file mode 100644
index 000000000..a6c34fa0b
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/intro5_image.png differ
diff --git a/app/src/main/res/drawable-mdpi/app_icon_intro.png b/app/src/main/res/drawable-mdpi/app_icon_intro.png
new file mode 100644
index 000000000..88a08fbba
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/app_icon_intro.png differ
diff --git a/app/src/main/res/drawable-mdpi/intro2_image.png b/app/src/main/res/drawable-mdpi/intro2_image.png
new file mode 100644
index 000000000..4a40585ab
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/intro2_image.png differ
diff --git a/app/src/main/res/drawable-mdpi/intro3_image.png b/app/src/main/res/drawable-mdpi/intro3_image.png
new file mode 100644
index 000000000..791e8eb98
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/intro3_image.png differ
diff --git a/app/src/main/res/drawable-mdpi/intro4_image.png b/app/src/main/res/drawable-mdpi/intro4_image.png
new file mode 100644
index 000000000..cb107c0c3
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/intro4_image.png differ
diff --git a/app/src/main/res/drawable-mdpi/intro5_image.png b/app/src/main/res/drawable-mdpi/intro5_image.png
new file mode 100644
index 000000000..625ce0519
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/intro5_image.png differ
diff --git a/app/src/main/res/drawable-xhdpi/app_icon_intro.png b/app/src/main/res/drawable-xhdpi/app_icon_intro.png
new file mode 100644
index 000000000..59dec4ec8
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/app_icon_intro.png differ
diff --git a/app/src/main/res/drawable-xhdpi/intro2_image.png b/app/src/main/res/drawable-xhdpi/intro2_image.png
new file mode 100644
index 000000000..1e6526cee
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/intro2_image.png differ
diff --git a/app/src/main/res/drawable-xhdpi/intro3_image.png b/app/src/main/res/drawable-xhdpi/intro3_image.png
new file mode 100644
index 000000000..ce0033a79
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/intro3_image.png differ
diff --git a/app/src/main/res/drawable-xhdpi/intro4_image.png b/app/src/main/res/drawable-xhdpi/intro4_image.png
new file mode 100644
index 000000000..2f2a89844
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/intro4_image.png differ
diff --git a/app/src/main/res/drawable-xhdpi/intro5_image.png b/app/src/main/res/drawable-xhdpi/intro5_image.png
new file mode 100644
index 000000000..3d71835fb
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/intro5_image.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/app_icon_intro.png b/app/src/main/res/drawable-xxhdpi/app_icon_intro.png
new file mode 100644
index 000000000..453cb3bf3
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/app_icon_intro.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/intro2_image.png b/app/src/main/res/drawable-xxhdpi/intro2_image.png
new file mode 100644
index 000000000..89b5ecb9f
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/intro2_image.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/intro3_image.png b/app/src/main/res/drawable-xxhdpi/intro3_image.png
new file mode 100644
index 000000000..fabefb6b9
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/intro3_image.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/intro4_image.png b/app/src/main/res/drawable-xxhdpi/intro4_image.png
new file mode 100644
index 000000000..c8f121989
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/intro4_image.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/intro5_image.png b/app/src/main/res/drawable-xxhdpi/intro5_image.png
new file mode 100644
index 000000000..e9670d8a7
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/intro5_image.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/app_icon_intro.png b/app/src/main/res/drawable-xxxhdpi/app_icon_intro.png
new file mode 100644
index 000000000..7ffd47a36
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/app_icon_intro.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/intro2_image.png b/app/src/main/res/drawable-xxxhdpi/intro2_image.png
new file mode 100644
index 000000000..c7bfe2d4a
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/intro2_image.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/intro3_image.png b/app/src/main/res/drawable-xxxhdpi/intro3_image.png
new file mode 100644
index 000000000..350beb215
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/intro3_image.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/intro4_image.png b/app/src/main/res/drawable-xxxhdpi/intro4_image.png
new file mode 100644
index 000000000..08e818bd0
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/intro4_image.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/intro5_image.png b/app/src/main/res/drawable-xxxhdpi/intro5_image.png
new file mode 100644
index 000000000..a3babc0d1
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/intro5_image.png differ
diff --git a/app/src/main/res/layout/intro1_layout.xml b/app/src/main/res/layout/intro1_layout.xml
new file mode 100644
index 000000000..9cfe98263
--- /dev/null
+++ b/app/src/main/res/layout/intro1_layout.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/intro2_layout.xml b/app/src/main/res/layout/intro2_layout.xml
new file mode 100644
index 000000000..608be6857
--- /dev/null
+++ b/app/src/main/res/layout/intro2_layout.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/intro3_layout.xml b/app/src/main/res/layout/intro3_layout.xml
new file mode 100644
index 000000000..5f327bc11
--- /dev/null
+++ b/app/src/main/res/layout/intro3_layout.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/intro4_layout.xml b/app/src/main/res/layout/intro4_layout.xml
new file mode 100644
index 000000000..30b7ae061
--- /dev/null
+++ b/app/src/main/res/layout/intro4_layout.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/intro5_layout.xml b/app/src/main/res/layout/intro5_layout.xml
new file mode 100644
index 000000000..29c29f9ed
--- /dev/null
+++ b/app/src/main/res/layout/intro5_layout.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/intro6_layout.xml b/app/src/main/res/layout/intro6_layout.xml
new file mode 100644
index 000000000..973b15b59
--- /dev/null
+++ b/app/src/main/res/layout/intro6_layout.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/main_menu.xml b/app/src/main/res/menu/main_menu.xml
index 6124664f2..5b851c125 100644
--- a/app/src/main/res/menu/main_menu.xml
+++ b/app/src/main/res/menu/main_menu.xml
@@ -12,6 +12,10 @@
android:icon="@drawable/ic_import_export_white_24dp"
android:title="@string/importExport"
app:showAsAction="ifRoom"/>
+
- Import ze stejné složky souborového systému do níž se zapisuje při exportu.
Použít složku exportu
Odeslat…
+
+ Start Intro
+ Welcome to Loyalty Card Keychain\n
+ Manage your barcode-based store/loyalty cards on your phone!\n\n
+ Adding Cards\n
+ Add a new card by touching the plus from the card list.\n\n
+ Adding Cards\n
+ To add the barcode, either capture with the camera or type in manually.\n\n
+ Show Card\n
+ To display a card, click on the store name from the main screen\n\n
+ Backup\n
+ The cards can be backed-up. To export or import card data touch Import/Export in the menu on the main page.\n\n
+ Feedback\n
+ This app is free, ad-free, and open source. See details by touching About in the menu on the main page.\n\nPlease leave feedback in the app store! (:
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 0ee352e07..cfb290fb0 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -66,4 +66,17 @@
Verwende die exportierte Stelle
Senden…
+ Start Intro
+ Welcome to Loyalty Card Keychain\n
+ Manage your barcode-based store/loyalty cards on your phone!\n\n
+ Adding Cards\n
+ Add a new card by touching the plus from the card list.\n\n
+ Adding Cards\n
+ To add the barcode, either capture with the camera or type in manually.\n\n
+ Show Card\n
+ To display a card, click on the store name from the main screen\n\n
+ Backup\n
+ The cards can be backed-up. To export or import card data touch Import/Export in the menu on the main page.\n\n
+ Feedback\n
+ This app is free, ad-free, and open source. See details by touching About in the menu on the main page.\n\nPlease leave feedback in the app store! (:
\ No newline at end of file
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index 782dc7389..8942a8950 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -77,5 +77,19 @@
Importe les données depuis le même emplacement que celui défini pour l\'export.
Utiliser l\'emplacement de l\'export
Envoyer…
+
+ Start Intro
+ Welcome to Loyalty Card Keychain\n
+ Manage your barcode-based store/loyalty cards on your phone!\n\n
+ Adding Cards\n
+ Add a new card by touching the plus from the card list.\n\n
+ Adding Cards\n
+ To add the barcode, either capture with the camera or type in manually.\n\n
+ Show Card\n
+ To display a card, click on the store name from the main screen\n\n
+ Backup\n
+ The cards can be backed-up. To export or import card data touch Import/Export in the menu on the main page.\n\n
+ Feedback\n
+ This app is free, ad-free, and open source. See details by touching About in the menu on the main page.\n\nPlease leave feedback in the app store! (:
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index f9709f0f7..6bf828721 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -73,4 +73,18 @@
Importa dallo stesso posto del file system dove si è esportato.
Usa luogo dell\'esportazione
Invia…
+
+ Start Intro
+ Welcome to Loyalty Card Keychain\n
+ Manage your barcode-based store/loyalty cards on your phone!\n\n
+ Adding Cards\n
+ Add a new card by touching the plus from the card list.\n\n
+ Adding Cards\n
+ To add the barcode, either capture with the camera or type in manually.\n\n
+ Show Card\n
+ To display a card, click on the store name from the main screen\n\n
+ Backup\n
+ The cards can be backed-up. To export or import card data touch Import/Export in the menu on the main page.\n\n
+ Feedback\n
+ This app is free, ad-free, and open source. See details by touching About in the menu on the main page.\n\nPlease leave feedback in the app store! (:
diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml
index 61a03f937..ec1ba1c72 100644
--- a/app/src/main/res/values-lt/strings.xml
+++ b/app/src/main/res/values-lt/strings.xml
@@ -77,4 +77,18 @@
Import from the same location on the filesystem that is written to on export.
Use export location
Send…
+
+ Start Intro
+ Welcome to Loyalty Card Keychain\n
+ Manage your barcode-based store/loyalty cards on your phone!\n\n
+ Adding Cards\n
+ Add a new card by touching the plus from the card list.\n\n
+ Adding Cards\n
+ To add the barcode, either capture with the camera or type in manually.\n\n
+ Show Card\n
+ To display a card, click on the store name from the main screen\n\n
+ Backup\n
+ The cards can be backed-up. To export or import card data touch Import/Export in the menu on the main page.\n\n
+ Feedback\n
+ This app is free, ad-free, and open source. See details by touching About in the menu on the main page.\n\nPlease leave feedback in the app store! (:
diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml
index 149b4cc5a..416080fb3 100644
--- a/app/src/main/res/values-nl/strings.xml
+++ b/app/src/main/res/values-nl/strings.xml
@@ -74,4 +74,18 @@
Importeer van zelfde locatie op het filesysteem waar tijdens exporteren naar geschreven is.
gebruik exporteerlocaite
Verzend…
+
+ Start Intro
+ Welcome to Loyalty Card Keychain\n
+ Manage your barcode-based store/loyalty cards on your phone!\n\n
+ Adding Cards\n
+ Add a new card by touching the plus from the card list.\n\n
+ Adding Cards\n
+ To add the barcode, either capture with the camera or type in manually.\n\n
+ Show Card\n
+ To display a card, click on the store name from the main screen\n\n
+ Backup\n
+ The cards can be backed-up. To export or import card data touch Import/Export in the menu on the main page.\n\n
+ Feedback\n
+ This app is free, ad-free, and open source. See details by touching About in the menu on the main page.\n\nPlease leave feedback in the app store! (:
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 06efec725..05f5b51b4 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -78,4 +78,17 @@
Card ID copied to clipboard
+ Start Intro
+ Welcome to Loyalty Card Keychain\n
+ Manage your barcode-based store/loyalty cards on your phone!\n\n
+ Adding Cards\n
+ Add a new card by touching the plus from the card list.\n\n
+ Adding Cards\n
+ To add the barcode, either capture with the camera or type in manually.\n\n
+ Show Card\n
+ To display a card, click on the store name from the main screen\n\n
+ Backup\n
+ The cards can be backed-up. To export or import card data touch Import/Export in the menu on the main page.\n\n
+ Feedback\n
+ This app is free, ad-free, and open source. See details by touching About in the menu on the main page.\n\nPlease leave feedback in the app store! (:
diff --git a/app/src/test/java/protect/card_locker/MainActivityTest.java b/app/src/test/java/protect/card_locker/MainActivityTest.java
index 7d7821f65..022df00f0 100644
--- a/app/src/test/java/protect/card_locker/MainActivityTest.java
+++ b/app/src/test/java/protect/card_locker/MainActivityTest.java
@@ -2,8 +2,11 @@ package protect.card_locker;
import android.app.Activity;
import android.content.ComponentName;
+import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.database.Cursor;
+import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.ListView;
@@ -11,10 +14,12 @@ import android.widget.TextView;
import com.google.zxing.BarcodeFormat;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
+import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.util.ActivityController;
@@ -28,6 +33,16 @@ import static org.robolectric.Shadows.shadowOf;
@Config(constants = BuildConfig.class, sdk = 17)
public class MainActivityTest
{
+ private SharedPreferences prefs;
+
+ @Before
+ public void setUp()
+ {
+ // Assume that this is not the first launch
+ prefs = RuntimeEnvironment.application.getSharedPreferences("protect.card_locker", Context.MODE_PRIVATE);
+ prefs.edit().putBoolean("firstrun", false).commit();
+ }
+
@Test
public void initiallyNoLoyaltyCards() throws Exception
{
@@ -50,10 +65,11 @@ public class MainActivityTest
assertTrue(menu != null);
// The settings and add button should be present
- assertEquals(menu.size(), 3);
+ assertEquals(menu.size(), 4);
assertEquals("Add", menu.findItem(R.id.action_add).getTitle().toString());
assertEquals("Import/Export", menu.findItem(R.id.action_import_export).getTitle().toString());
+ assertEquals("Start Intro", menu.findItem(R.id.action_intro).getTitle().toString());
assertEquals("About", menu.findItem(R.id.action_about).getTitle().toString());
}
@@ -100,4 +116,26 @@ public class MainActivityTest
Cursor cursor = (Cursor)list.getAdapter().getItem(0);
assertNotNull(cursor);
}
+
+ @Test
+ public void testFirstRunStartsIntro()
+ {
+ prefs.edit().remove("firstrun").commit();
+
+ ActivityController controller = Robolectric.buildActivity(MainActivity.class).create();
+ Activity activity = (Activity)controller.get();
+
+ assertTrue(activity.isFinishing() == false);
+
+ Intent next = shadowOf(activity).getNextStartedActivity();
+
+ ComponentName componentName = next.getComponent();
+ String name = componentName.flattenToShortString();
+ assertEquals("protect.card_locker/.IntroActivity", name);
+
+ Bundle extras = next.getExtras();
+ assertNull(extras);
+
+ assertEquals(false, prefs.getBoolean("firstrun", true));
+ }
}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 77ce66ea3..448809074 100644
--- a/build.gradle
+++ b/build.gradle
@@ -15,6 +15,7 @@ buildscript {
allprojects {
repositories {
jcenter()
+ maven { url 'https://jitpack.io' }
}
}
diff --git a/originals/intro2_image.xcf b/originals/intro2_image.xcf
new file mode 100644
index 000000000..024365e57
Binary files /dev/null and b/originals/intro2_image.xcf differ
diff --git a/originals/intro3_image.png b/originals/intro3_image.png
new file mode 100644
index 000000000..674a94e89
Binary files /dev/null and b/originals/intro3_image.png differ
diff --git a/originals/intro4_image.png b/originals/intro4_image.png
new file mode 100644
index 000000000..322034d5f
Binary files /dev/null and b/originals/intro4_image.png differ
diff --git a/originals/intro5_image.png b/originals/intro5_image.png
new file mode 100644
index 000000000..d6eeae510
Binary files /dev/null and b/originals/intro5_image.png differ