From 9274339be8fd42240487c7b528f6273912feb54a Mon Sep 17 00:00:00 2001 From: Branden Archer Date: Sun, 18 Jun 2017 23:01:47 -0400 Subject: [PATCH] Add intro wizard for application --- .travis.yml | 18 +++---- app/build.gradle | 9 ++-- app/src/main/AndroidManifest.xml | 4 ++ .../protect/card_locker/IntroActivity.java | 43 +++++++++++++++ .../java/protect/card_locker/IntroSlide.java | 25 +++++++++ .../protect/card_locker/MainActivity.java | 22 +++++++- .../main/res/drawable-hdpi/app_icon_intro.png | Bin 0 -> 6577 bytes .../main/res/drawable-hdpi/intro2_image.png | Bin 0 -> 19045 bytes .../main/res/drawable-hdpi/intro3_image.png | Bin 0 -> 17349 bytes .../main/res/drawable-hdpi/intro4_image.png | Bin 0 -> 16530 bytes .../main/res/drawable-hdpi/intro5_image.png | Bin 0 -> 30524 bytes .../main/res/drawable-mdpi/app_icon_intro.png | Bin 0 -> 5780 bytes .../main/res/drawable-mdpi/intro2_image.png | Bin 0 -> 10140 bytes .../main/res/drawable-mdpi/intro3_image.png | Bin 0 -> 10950 bytes .../main/res/drawable-mdpi/intro4_image.png | Bin 0 -> 9756 bytes .../main/res/drawable-mdpi/intro5_image.png | Bin 0 -> 17586 bytes .../res/drawable-xhdpi/app_icon_intro.png | Bin 0 -> 9881 bytes .../main/res/drawable-xhdpi/intro2_image.png | Bin 0 -> 21094 bytes .../main/res/drawable-xhdpi/intro3_image.png | Bin 0 -> 25648 bytes .../main/res/drawable-xhdpi/intro4_image.png | Bin 0 -> 24833 bytes .../main/res/drawable-xhdpi/intro5_image.png | Bin 0 -> 47191 bytes .../res/drawable-xxhdpi/app_icon_intro.png | Bin 0 -> 19417 bytes .../main/res/drawable-xxhdpi/intro2_image.png | Bin 0 -> 39271 bytes .../main/res/drawable-xxhdpi/intro3_image.png | Bin 0 -> 41146 bytes .../main/res/drawable-xxhdpi/intro4_image.png | Bin 0 -> 38240 bytes .../main/res/drawable-xxhdpi/intro5_image.png | Bin 0 -> 77371 bytes .../res/drawable-xxxhdpi/app_icon_intro.png | Bin 0 -> 27031 bytes .../res/drawable-xxxhdpi/intro2_image.png | Bin 0 -> 39728 bytes .../res/drawable-xxxhdpi/intro3_image.png | Bin 0 -> 64003 bytes .../res/drawable-xxxhdpi/intro4_image.png | Bin 0 -> 58305 bytes .../res/drawable-xxxhdpi/intro5_image.png | Bin 0 -> 116305 bytes app/src/main/res/layout/intro1_layout.xml | 51 ++++++++++++++++++ app/src/main/res/layout/intro2_layout.xml | 51 ++++++++++++++++++ app/src/main/res/layout/intro3_layout.xml | 51 ++++++++++++++++++ app/src/main/res/layout/intro4_layout.xml | 51 ++++++++++++++++++ app/src/main/res/layout/intro5_layout.xml | 51 ++++++++++++++++++ app/src/main/res/layout/intro6_layout.xml | 51 ++++++++++++++++++ app/src/main/res/menu/main_menu.xml | 4 ++ app/src/main/res/values-cs/strings.xml | 14 +++++ app/src/main/res/values-de/strings.xml | 13 +++++ app/src/main/res/values-fr/strings.xml | 14 +++++ app/src/main/res/values-it/strings.xml | 14 +++++ app/src/main/res/values-lt/strings.xml | 14 +++++ app/src/main/res/values-nl/strings.xml | 14 +++++ app/src/main/res/values/strings.xml | 13 +++++ .../protect/card_locker/MainActivityTest.java | 40 +++++++++++++- build.gradle | 1 + originals/intro2_image.xcf | Bin 0 -> 104774 bytes originals/intro3_image.png | Bin 0 -> 52738 bytes originals/intro4_image.png | Bin 0 -> 53414 bytes originals/intro5_image.png | Bin 0 -> 140169 bytes 51 files changed, 551 insertions(+), 17 deletions(-) create mode 100644 app/src/main/java/protect/card_locker/IntroActivity.java create mode 100644 app/src/main/java/protect/card_locker/IntroSlide.java create mode 100644 app/src/main/res/drawable-hdpi/app_icon_intro.png create mode 100644 app/src/main/res/drawable-hdpi/intro2_image.png create mode 100644 app/src/main/res/drawable-hdpi/intro3_image.png create mode 100644 app/src/main/res/drawable-hdpi/intro4_image.png create mode 100644 app/src/main/res/drawable-hdpi/intro5_image.png create mode 100644 app/src/main/res/drawable-mdpi/app_icon_intro.png create mode 100644 app/src/main/res/drawable-mdpi/intro2_image.png create mode 100644 app/src/main/res/drawable-mdpi/intro3_image.png create mode 100644 app/src/main/res/drawable-mdpi/intro4_image.png create mode 100644 app/src/main/res/drawable-mdpi/intro5_image.png create mode 100644 app/src/main/res/drawable-xhdpi/app_icon_intro.png create mode 100644 app/src/main/res/drawable-xhdpi/intro2_image.png create mode 100644 app/src/main/res/drawable-xhdpi/intro3_image.png create mode 100644 app/src/main/res/drawable-xhdpi/intro4_image.png create mode 100644 app/src/main/res/drawable-xhdpi/intro5_image.png create mode 100644 app/src/main/res/drawable-xxhdpi/app_icon_intro.png create mode 100644 app/src/main/res/drawable-xxhdpi/intro2_image.png create mode 100644 app/src/main/res/drawable-xxhdpi/intro3_image.png create mode 100644 app/src/main/res/drawable-xxhdpi/intro4_image.png create mode 100644 app/src/main/res/drawable-xxhdpi/intro5_image.png create mode 100644 app/src/main/res/drawable-xxxhdpi/app_icon_intro.png create mode 100644 app/src/main/res/drawable-xxxhdpi/intro2_image.png create mode 100644 app/src/main/res/drawable-xxxhdpi/intro3_image.png create mode 100644 app/src/main/res/drawable-xxxhdpi/intro4_image.png create mode 100644 app/src/main/res/drawable-xxxhdpi/intro5_image.png create mode 100644 app/src/main/res/layout/intro1_layout.xml create mode 100644 app/src/main/res/layout/intro2_layout.xml create mode 100644 app/src/main/res/layout/intro3_layout.xml create mode 100644 app/src/main/res/layout/intro4_layout.xml create mode 100644 app/src/main/res/layout/intro5_layout.xml create mode 100644 app/src/main/res/layout/intro6_layout.xml create mode 100644 originals/intro2_image.xcf create mode 100644 originals/intro3_image.png create mode 100644 originals/intro4_image.png create mode 100644 originals/intro5_image.png diff --git a/.travis.yml b/.travis.yml index ea112264..dfa408c7 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 a79fcac7..9ea4de95 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 59b46dad..6c8e5d2a 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 00000000..465f694a --- /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 00000000..7fff1f35 --- /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 bf48e351..aeafa5d1 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.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 @@ protected void onCreate(Bundle savedInstanceState) 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 boolean onOptionsItemSelected(MenuItem item) return true; } + if(id == R.id.action_intro) + { + startIntro(); + return true; + } + if(id == R.id.action_about) { displayAboutDialog(); @@ -168,7 +181,8 @@ private void displayAboutDialog() "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("