Skip to content

Commit

Permalink
Updated AppIntro for using FastAdapter for managing RecyclerView
Browse files Browse the repository at this point in the history
In addition, the required layout for landscape was created and functional.
This commit affords issues #3, #1 and #8
  • Loading branch information
Javinator9889 committed Apr 26, 2020
1 parent 1f38ee9 commit 4e7712c
Show file tree
Hide file tree
Showing 28 changed files with 551 additions and 473 deletions.
16 changes: 0 additions & 16 deletions ads/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,9 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':app')
implementation "androidx.core:core-ktx:1.2.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

// https://developer.android.com/kotlin/ktx#play-core
implementation 'com.google.android.play:core-ktx:1.7.0'
// https://firebase.google.com/docs/admob/android/quick-start#import_the_mobile_ads_sdk
implementation 'com.google.firebase:firebase-ads:19.1.0'
// https://developer.android.com/studio/build/multidex
implementation 'androidx.multidex:multidex:2.0.1'
// https://github.com/JakeWharton/timber
implementation 'com.jakewharton.timber:timber:4.7.1'
// https://firebase.google.com/docs/android/setup#add-sdks
implementation 'com.google.firebase:firebase-core:17.3.0'
implementation 'com.google.firebase:firebase-common-ktx:19.3.0'
implementation 'com.google.firebase:firebase-analytics:17.3.0'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta04'
implementation 'com.google.firebase:firebase-perf:19.0.6'
// https://developer.android.com/jetpack/androidx/releases/cardview
implementation 'androidx.cardview:cardview:1.0.0'
}
repositories {
mavenCentral()
Expand Down
50 changes: 26 additions & 24 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,56 +104,58 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
api 'androidx.appcompat:appcompat:1.1.0'
api 'androidx.core:core-ktx:1.2.0'
api 'androidx.legacy:legacy-support-v4:1.0.0'
api 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

// https://github.com/Javinator9889/LocaleManager
implementation 'com.github.javinator9889:localemanager:1.1X'
api 'com.github.javinator9889:localemanager:1.1X'
// https://material.io/develop/android/docs/getting-started/
implementation 'com.google.android.material:material:1.1.0'
api 'com.google.android.material:material:1.1.0'
// https://developers.google.com/android/guides/setup
implementation 'com.google.android.gms:play-services-location:17.0.0'
// https://developer.android.com/jetpack/androidx/releases/annotation
implementation 'androidx.annotation:annotation:1.1.0'
api 'androidx.annotation:annotation:1.1.0'
// https://developer.android.com/jetpack/androidx/releases/cardview
implementation 'androidx.cardview:cardview:1.0.0'
api 'androidx.cardview:cardview:1.0.0'
// https://developer.android.com/jetpack/androidx/releases/recyclerview
implementation 'androidx.recyclerview:recyclerview:1.1.0'
api 'androidx.recyclerview:recyclerview:1.1.0'
// https://developer.android.com/studio/build/multidex
implementation 'androidx.multidex:multidex:2.0.1'
api 'androidx.multidex:multidex:2.0.1'
// https://github.com/mikepenz/Android-Iconics
implementation 'com.mikepenz:iconics-core:5.0.2'
implementation 'com.mikepenz:iconics-views:5.0.2'
api 'com.mikepenz:iconics-core:5.0.2'
api 'com.mikepenz:iconics-views:5.0.2'
//noinspection GradleDependency
implementation 'com.mikepenz:google-material-typeface:3.0.1.4.original-kotlin@aar'
implementation 'com.mikepenz:ionicons-typeface:2.0.1.5-kotlin@aar'
api 'com.mikepenz:google-material-typeface:3.0.1.4.original-kotlin@aar'
api 'com.mikepenz:ionicons-typeface:2.0.1.5-kotlin@aar'
// https://github.com/mikepenz/AboutLibraries
implementation "com.mikepenz:aboutlibraries-core:${latestAboutLibsRelease}"
implementation "com.mikepenz:aboutlibraries:${latestAboutLibsRelease}"
// https://developer.android.com/kotlin/ktx#play-core
implementation 'com.google.android.play:core-ktx:1.7.0'
api 'com.google.android.play:core:1.7.2'
api 'com.google.android.play:core-ktx:1.7.0'
// https://developer.android.com/kotlin/ktx#collection
implementation 'androidx.collection:collection-ktx:1.1.0'
// https://kotlinlang.org/docs/reference/reflection.html
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
// https://firebase.google.com/docs/android/setup#add-sdks
implementation 'com.google.firebase:firebase-common-ktx:19.3.0'
implementation 'com.google.firebase:firebase-analytics:17.3.0'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta04'
implementation 'com.google.firebase:firebase-perf:19.0.6'
api 'com.google.firebase:firebase-common-ktx:19.3.0'
api 'com.google.firebase:firebase-analytics:17.3.0'
api 'com.google.firebase:firebase-crashlytics:17.0.0-beta04'
api 'com.google.firebase:firebase-perf:19.0.6'
// http://airbnb.io/lottie/#/android?id=getting-started
implementation "com.airbnb.android:lottie:3.4.0"
api "com.airbnb.android:lottie:3.4.0"
// https://firebase.google.com/docs/remote-config/use-config-android
implementation 'com.google.firebase:firebase-config:19.1.3'
implementation 'com.google.firebase:firebase-config-ktx:19.1.3'
// https://mvnrepository.com/artifact/androidx.emoji/emoji/1.0.0
implementation 'androidx.emoji:emoji:1.0.0'
implementation 'androidx.emoji:emoji-appcompat:1.0.0'
api 'androidx.emoji:emoji:1.0.0'
api 'androidx.emoji:emoji-appcompat:1.0.0'
// https://github.com/mikepenz/FastAdapter
implementation "com.mikepenz:fastadapter:${latestFastAdapterRelease}"
// https://developer.android.com/kotlin/ktx#lifecycle
Expand All @@ -165,13 +167,13 @@ dependencies {
// https://developer.android.com/kotlin/ktx#livedata
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
// https://github.com/JakeWharton/timber
implementation 'com.jakewharton.timber:timber:4.7.1'
api 'com.jakewharton.timber:timber:4.7.1'
// https://developer.android.com/jetpack/androidx/releases/lifecycle#declaring_dependencies
implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0'
// https://developer.android.com/reference/kotlin/androidx/preference/package-summary
implementation 'androidx.preference:preference:1.1.1'
// https://github.com/bumptech/glide
implementation 'com.github.bumptech.glide:glide:4.11.0'
api 'com.github.bumptech.glide:glide:4.11.0'
kapt 'com.github.bumptech.glide:compiler:4.11.0'
// https://github.com/afollestad/material-dialogs/
implementation 'com.afollestad.material-dialogs:core:3.3.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@
import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;

import androidx.annotation.DrawableRes;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;

/**
* Sub-class of ImageView which automatically notifies the drawable when it is
* being displayed.
*/
public class RecyclingImageView extends AppCompatImageView {
@DrawableRes
private Integer mSavedDrawableRes = null;

public RecyclingImageView(Context context) {
super(context);
Expand All @@ -36,11 +40,39 @@ public RecyclingImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}

public void setSavedDrawableRes(@Nullable @DrawableRes Integer mSavedDrawableRes) {
this.mSavedDrawableRes = mSavedDrawableRes;
}

@Nullable
@DrawableRes
public Integer getSavedDrawableRes() {
return mSavedDrawableRes;
}

@Override
protected void onWindowVisibilityChanged(int visibility) {
super.onWindowVisibilityChanged(visibility);
if (mSavedDrawableRes != null &&
visibility == VISIBLE &&
getDrawable() == null) {
try {
GlideApp.with(this)
.load(mSavedDrawableRes)
.centerInside()
.into(this);
} catch (Exception ignored) {
setImageResource(mSavedDrawableRes);
}
} else if (visibility == INVISIBLE || visibility == GONE)
onDetachedFromWindow();
}

/**
* @see android.widget.ImageView#onDetachedFromWindow()
*/
@Override
protected void onDetachedFromWindow() {
public void onDetachedFromWindow() {
// This has been detached from Window, so clear the drawable
setImageDrawable(null);

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
tools:context=".activities.MainActivity">

<include
android:id="@+id/include"
android:id="@+id/bar"
layout="@layout/appbar_layout"
app:layout_constraintBottom_toTopOf="@+id/mainContent"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -21,7 +21,7 @@
app:layout_constraintBottom_toTopOf="@+id/menu"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/include" />
app:layout_constraintTop_toBottomOf="@+id/bar" />

<com.google.android.material.bottomnavigation.BottomNavigationView
style="@style/Widget.MaterialComponents.BottomNavigationView"
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
en el volante &#128663;, así que lávate las manos lo antes que puedas
para evitar enfermedades &#128166;&#128079;
</string>
<string name="title_appintro">Intro de Handwashing reminder</string>
<string name="privacy_policy_title">Política de privacidad</string>
<string name="tos_title">Términos y condiciones</string>
<string name="firebase_analytics_policy">Permite que la aplicación
Expand All @@ -45,7 +44,6 @@
<string name="firebase_performance_policy">Permite que la aplicación
monitorice el rendimiento de la misma y envíe datos anónimos para
mejorar la experiencia de usuario</string>
<string name="title_ads">Anuncios</string>
<string name="ad_attribution">Ad</string>
<string name="dynamic_module_loading_title">Construyendo tu
aplicación…</string>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
try to wash your hands as soon as you can for avoiding diseases
&#128166;&#128079;
</string>
<string name="title_appintro">Handwashing reminder intro</string>
<string name="title_appintro" translatable="false">Handwashing reminder intro</string>
<string name="privacy_policy_title">Privacy policy</string>
<string name="tos_title">Terms and conditions</string>
<string name="firebase_analytics_policy">Allow the application to
Expand All @@ -45,7 +45,7 @@
<string name="firebase_performance_policy">Allow the application to
track its performance and send anonymous data for improving
in-app experience</string>
<string name="title_ads">Ads</string>
<string name="title_ads" translatable="false">Ads</string>
<string name="ad_attribution">Ad</string>
<string name="dynamic_module_loading_title">Building your app…</string>
<string name="dynamic_module_loading_text">We are adding new
Expand Down
38 changes: 3 additions & 35 deletions appintro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,41 +40,9 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':app')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
// https://developers.google.com/android/guides/setup
implementation 'com.google.android.gms:play-services-location:17.0.0'
// https://material.io/develop/android/docs/getting-started/
implementation 'com.google.android.material:material:1.1.0'
// https://github.com/Javinator9889/LocaleManager
implementation 'com.github.javinator9889:localemanager:1.1X'

// https://github.com/AppIntro/AppIntro
implementation 'com.github.AppIntro:AppIntro:5.1.0'
// https://developer.android.com/jetpack/androidx/releases/cardview
implementation 'androidx.cardview:cardview:1.0.0'
// https://developer.android.com/jetpack/androidx/releases/recyclerview
implementation 'androidx.recyclerview:recyclerview:1.1.0'
// https://github.com/mikepenz/Android-Iconics
implementation 'com.mikepenz:iconics-core:5.0.2'
implementation 'com.mikepenz:iconics-views:5.0.2'
//noinspection GradleDependency
implementation 'com.mikepenz:google-material-typeface:3.0.1.4.original-kotlin@aar'
implementation 'com.mikepenz:ionicons-typeface:2.0.1.5-kotlin@aar'
// https://developer.android.com/kotlin/ktx#play-core
implementation 'com.google.android.play:core-ktx:1.7.0'
// https://developer.android.com/studio/build/multidex
implementation 'androidx.multidex:multidex:2.0.1'
// http://airbnb.io/lottie/#/android?id=getting-started
implementation "com.airbnb.android:lottie:3.4.0"
// https://github.com/JakeWharton/timber
implementation 'com.jakewharton.timber:timber:4.7.1'
// https://firebase.google.com/docs/android/setup#add-sdks
implementation 'com.google.firebase:firebase-common-ktx:19.3.0'
implementation 'com.google.firebase:firebase-analytics:17.3.0'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta04'
implementation 'com.google.firebase:firebase-perf:19.0.6'
// https://github.com/bumptech/glide
implementation 'com.github.bumptech.glide:glide:4.11.0'
// https://github.com/mikepenz/FastAdapter
implementation "com.mikepenz:fastadapter:${latestFastAdapterRelease}"
}
12 changes: 6 additions & 6 deletions appintro/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

<application
tools:ignore="LockedOrientationActivity">
<activity android:name=".IntroActivity"
android:screenOrientation="portrait"
android:configChanges="orientation" />
<activity android:name=".config.TimeConfigActivity"
android:screenOrientation="portrait"
android:configChanges="orientation" />
<activity android:name=".IntroActivity" />
<!-- android:screenOrientation="portrait"-->
<!-- android:configChanges="orientation" />-->
<activity android:name=".config.TimeConfigActivity" />
<!-- android:screenOrientation="portrait"-->
<!-- android:configChanges="orientation" />-->
</application>
</manifest>

Loading

0 comments on commit 4e7712c

Please sign in to comment.