forked from anitab-org/mentorship-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add intro slider when signing in (anitab-org#531)
* feat: added intro slider * Update AndroidManifest.xml * Update build.gradle
- Loading branch information
1 parent
998036e
commit 314c102
Showing
13 changed files
with
608 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.systers.mentorship.dsl | ||
|
||
import android.content.Context | ||
import android.util.TypedValue | ||
|
||
fun Context.getColorAttr(colorResId: Int): Int { | ||
val typedValue = TypedValue() | ||
val typedArray = obtainStyledAttributes(typedValue.data, intArrayOf(colorResId)) | ||
val color = typedArray.getColor(0, 0) | ||
typedArray.recycle() | ||
return color | ||
} |
67 changes: 67 additions & 0 deletions
67
app/src/main/java/org/systers/mentorship/view/activities/IntroActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package org.systers.mentorship.view.activities | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.fragment.app.Fragment | ||
import com.github.paolorotolo.appintro.AppIntro2 | ||
import com.github.paolorotolo.appintro.AppIntro2Fragment | ||
import com.github.paolorotolo.appintro.model.SliderPage | ||
import org.systers.mentorship.R | ||
import org.systers.mentorship.dsl.getColorAttr | ||
|
||
class IntroActivity : AppIntro2() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
// Hide status bar | ||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN | ||
|
||
val page1 = SliderPage( | ||
title = getString(R.string.page_1_title), | ||
description = getString(R.string.page_1_description), | ||
bgColor = getColorAttr(R.attr.colorPrimary), | ||
imageDrawable = R.drawable.ic_undraw_shared_workspace | ||
) | ||
|
||
val page2 = SliderPage( | ||
title = getString(R.string.page_2_title), | ||
description = getString(R.string.page_2_description), | ||
bgColor = getColorAttr(R.attr.colorPrimaryDark), | ||
imageDrawable = R.drawable.ic_undraw_proud_self | ||
) | ||
|
||
val page3 = SliderPage( | ||
title = getString(R.string.page_3_title), | ||
description = getString(R.string.page_3_description), | ||
bgColor = getColorAttr(R.attr.colorPrimary), | ||
imageDrawable = R.drawable.ic_undraw_a_day_off | ||
) | ||
|
||
val page4 = SliderPage( | ||
title = getString(R.string.page_4_title), | ||
description = getString(R.string.page_4_description), | ||
bgColor = getColorAttr(R.attr.colorPrimaryDark), | ||
imageDrawable = R.drawable.ic_undraw_people | ||
) | ||
|
||
addSlide(AppIntro2Fragment.newInstance(page1)) | ||
addSlide(AppIntro2Fragment.newInstance(page2)) | ||
addSlide(AppIntro2Fragment.newInstance(page3)) | ||
addSlide(AppIntro2Fragment.newInstance(page4)) | ||
skipButtonEnabled = false | ||
setColorTransitionsEnabled(true) | ||
} | ||
|
||
override fun onDonePressed(currentFragment: Fragment?) { | ||
startActivity(Intent(this, LoginActivity::class.java)) | ||
finish() | ||
val preferences = | ||
getSharedPreferences(getString(R.string.intro_prefs), Context.MODE_PRIVATE) | ||
val editor = preferences.edit() | ||
editor.putBoolean(getString(R.string.intro_prefs_first_run), false) | ||
editor.apply() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="849dp" | ||
android:height="798.1313dp" | ||
android:viewportWidth="849" | ||
android:viewportHeight="798.1313"> | ||
<path | ||
android:pathData="M169.957,644.109c0.174,17.794 -10.344,24.11 -23.392,24.237q-0.455,0.004 -0.905,-0.001 -0.907,-0.011 -1.796,-0.065c-11.784,-0.719 -20.998,-7.161 -21.16,-23.709 -0.167,-17.126 21.51,-38.951 23.136,-40.565l0.003,-0.001c0.062,-0.062 0.093,-0.092 0.093,-0.092S169.784,626.316 169.957,644.109Z" | ||
android:fillColor="#8d2165"/> | ||
<path | ||
android:pathData="M542.957,643.109c0.174,17.794 -10.344,24.11 -23.392,24.237q-0.455,0.004 -0.905,-0.001 -0.907,-0.011 -1.796,-0.065c-11.784,-0.719 -20.998,-7.161 -21.16,-23.709 -0.167,-17.126 21.51,-38.951 23.136,-40.565l0.003,-0.001c0.062,-0.062 0.093,-0.092 0.093,-0.092S542.784,625.316 542.957,643.109Z" | ||
android:fillColor="#8d2165"/> | ||
<path | ||
android:pathData="M0,666.066h849v2h-849z" | ||
android:fillColor="#3f3d56"/> | ||
<path | ||
android:pathData="M173,166m-166,0a166,166 0,1 1,332 0a166,166 0,1 1,-332 0" | ||
android:fillColor="#8d2165"/> | ||
<path | ||
android:pathData="M375,518h0A150,150 0,0 1,525 668V668a0,0 0,0 1,0 0H290a0,0 0,0 1,0 0V603A85,85 0,0 1,375 518Z" | ||
android:fillColor="#3f3d56"/> | ||
<path | ||
android:pathData="M700.9,320.059s6.843,88.957 -2.737,91.694 -43.794,23.266 -98.537,17.791c0,0 -53.374,28.74 -45.163,1.369s45.163,-20.529 45.163,-20.529 65.691,-13.686 68.428,-23.266 -8.211,-49.268 -4.106,-50.637S700.9,320.059 700.9,320.059Z" | ||
android:fillColor="#a0616a"/> | ||
<path | ||
android:pathData="M618.925,475.157s5.335,128.516 13.547,147.676c6.84,15.96 10.831,68.002 11.973,84.943 0.229,3.397 0.344,5.383 0.344,5.383s21.897,0 23.266,-5.474 5.474,-65.691 0,-84.851 6.982,-151.782 6.982,-151.782Z" | ||
android:fillColor="#2f2e41"/> | ||
<path | ||
android:pathData="M650.263,706.315s-13.686,4.106 -16.423,9.58 -47.9,15.054 -34.214,21.897 54.743,-5.474 54.743,-5.474 21.897,-1.369 20.529,-9.58 -6.353,-18.329 -6.353,-18.329Z" | ||
android:fillColor="#2f2e41"/> | ||
<path | ||
android:pathData="M688.583,721.05s-13.686,4.106 -16.423,9.58 -47.9,15.054 -34.214,21.897 54.743,-5.474 54.743,-5.474 21.897,-1.369 20.529,-9.58 -6.353,-18.329 -6.353,-18.329Z" | ||
android:fillColor="#2f2e41"/> | ||
<path | ||
android:pathData="M631.103,471.97l19.16,32.846 31.977,114.198s-3.237,104.773 0.869,104.773 26.003,6.843 27.371,0c1.156,-5.78 16.484,-61.151 8.844,-98.006a471.273,471.273 0,0 1,-9.563 -70.705L706.374,491.13s13.686,-24.634 -1.369,-28.74S631.103,471.97 631.103,471.97Z" | ||
android:fillColor="#2f2e41"/> | ||
<path | ||
android:pathData="M648.894,228.365m-32.846,0a32.846,32.846 0,1 1,65.691 0a32.846,32.846 0,1 1,-65.691 0" | ||
android:fillColor="#a0616a"/> | ||
<path | ||
android:pathData="M644.788,250.262s5.474,43.794 4.106,46.531 32.846,-30.109 32.846,-30.109 -12.317,-19.16 -9.58,-28.74Z" | ||
android:fillColor="#a0616a"/> | ||
<path | ||
android:pathData="M721.428,294.057s-38.32,-27.371 -39.688,-32.846l-28.74,24.634 -4.884,-5.813s-22.488,22.236 -22.488,31.816 -1.369,38.32 2.737,46.531S616.048,470.602 616.048,470.602s13.686,12.317 15.054,13.686 56.111,-8.211 56.111,-8.211 27.371,-2.737 27.371,-6.843 -8.211,-65.691 -5.474,-82.114S721.428,294.057 721.428,294.057Z" | ||
android:fillColor="#575a89"/> | ||
<path | ||
android:pathData="M729.64,332.376s6.843,88.957 -2.737,91.694 -43.794,23.266 -98.537,17.791c0,0 -53.374,28.74 -45.163,1.369s45.163,-20.529 45.163,-20.529 65.691,-13.686 68.428,-23.266 -8.211,-49.268 -4.106,-50.637S729.64,332.376 729.64,332.376Z" | ||
android:fillColor="#a0616a"/> | ||
<path | ||
android:pathData="M634.864,211.957c4.49,-1.598 9.443,-2.419 14.021,-1.094 6.479,1.875 10.966,7.554 15.806,12.252s11.627,8.86 18,6.651a10.553,10.553 0,0 1,2.016 -7.794,7.168 7.168,0 0,0 1.79,-2.979c0.272,-1.759 -1.207,-3.276 -1.651,-5 -0.777,-3.021 1.354,-7.157 -1.266,-8.85 -0.692,-0.447 -1.567,-0.549 -2.242,-1.021 -2.649,-1.851 0.293,-6.456 -1.459,-9.172a5.601,5.601 0,0 0,-1.99 -1.66c-12.699,-7.41 -28.23,-7.43 -42.932,-7.244 -2.047,0.026 -4.896,1.043 -4.319,3.006 -2.778,-1.994 -6.417,0.806 -8.656,3.391l-4.584,5.291a40.76,40.76 0,0 0,-5.602 7.578c-1.4,2.678 -1.71,6.795 1.077,7.962 -2.072,-0.868 -4.585,11.404 4.966,9.385C623.389,221.486 628.828,214.106 634.864,211.957Z" | ||
android:fillColor="#2f2e41"/> | ||
<path | ||
android:pathData="M699.531,296.794l21.897,-2.737s21.897,42.426 9.58,49.268 -43.794,12.317 -43.794,9.58S699.531,296.794 699.531,296.794Z" | ||
android:fillColor="#575a89"/> | ||
<path | ||
android:pathData="M399.425,306.103s6.532,21.463 2.799,27.995 6.532,20.53 23.329,13.997 17.73,-13.997 17.73,-13.997 -6.532,-10.265 -8.398,-31.728Z" | ||
android:fillColor="#ffb9b9"/> | ||
<path | ||
android:pathData="M314.04,516.531s-33.594,16.797 -18.663,39.193c8.679,13.018 25.239,38.332 37.587,57.249a190.929,190.929 0,0 1,23.516 51.271l2.352,8.125 9.332,11.198L387.76,661.171s-28.928,-53.19 -28.928,-63.455 -23.329,-42.925 -23.329,-42.925l23.329,-14.931S332.703,509.999 314.04,516.531Z" | ||
android:fillColor="#ffb9b9"/> | ||
<path | ||
android:pathData="M423.22,574.387s0.933,26.129 1.866,36.393c0.77,8.468 -6.717,32.18 -4.121,58.559a247.96,247.96 0,0 1,-0.566 51.278L416.688,754.488l27.995,2.799 9.332,-76.519s5.599,-54.123 2.799,-71.854l0.933,-37.326S437.218,564.123 423.22,574.387Z" | ||
android:fillColor="#ffb9b9"/> | ||
<path | ||
android:pathData="M373.296,465.674s-65.321,41.992 -66.255,55.057c0,0 37.327,-3.733 38.26,28.928 0,0 22.396,-8.398 27.995,-10.265s35.46,-21.463 35.46,-21.463 12.131,9.332 12.131,24.262 -0.933,41.059 0,42.925 22.396,-25.195 40.126,-1.866l12.131,-64.388s3.733,-39.193 -3.733,-41.992l-52.257,-19.596Z" | ||
android:fillColor="#2f2e41"/> | ||
<path | ||
android:pathData="M412.955,289.773m-27.995,0a27.995,27.995 0,1 1,55.99 0a27.995,27.995 0,1 1,-55.99 0" | ||
android:fillColor="#ffb9b9"/> | ||
<path | ||
android:pathData="M405.957,338.764s31.577,8.34 35.851,-7.495c0,0 38.802,7.495 45.334,32.69s-15.864,85.851 -15.864,87.717 18.663,13.064 10.265,18.663 -15.864,-0.933 -12.131,6.532 10.265,9.332 4.666,11.198 -39.193,-27.062 -65.321,-19.596 -39.193,1.866 -39.193,1.866L357.847,369.081a23.391,23.391 0,0 1,8.316 -20.759c5.848,-4.813 13.607,-10.014 21.13,-11.424 14.931,-2.799 15.551,-4.332 15.551,-4.332Z" | ||
android:fillColor="#d0cde1"/> | ||
<path | ||
android:pathData="M376.095,502.067s8.398,47.591 19.596,41.059 -2.799,-41.059 -2.799,-41.059Z" | ||
android:fillColor="#ffb9b9"/> | ||
<path | ||
android:pathData="M415.078,508.226s-14.552,46.084 -1.603,45.468 16.497,-37.703 16.497,-37.703Z" | ||
android:fillColor="#ffb9b9"/> | ||
<path | ||
android:pathData="M363.498,670.503s-6.532,-7.465 -10.265,2.799S339.236,696.632 339.236,696.632s-22.396,25.195 -6.532,26.129 38.26,-22.396 38.26,-22.396l26.129,-24.262s-8.66,-21.09 -12.728,-21.277S381.228,679.835 363.498,670.503Z" | ||
android:fillColor="#2f2e41"/> | ||
<path | ||
android:pathData="M424.153,747.956s-6.576,1.92 -6.088,-6.039c0,0 -23.774,12.571 -17.241,21.903s13.997,18.663 13.997,18.663 34.527,19.596 37.326,14.931 2.799,-13.997 0.933,-17.73 -11.198,-10.265 -8.398,-15.864 -0.933,-20.53 -5.599,-20.53S424.153,747.956 424.153,747.956Z" | ||
android:fillColor="#2f2e41"/> | ||
<path | ||
android:pathData="M388.525,266.051s9.006,-19.512 26.267,-15.009 27.017,11.257 27.767,18.011 -0.375,16.886 -0.375,16.886 -1.876,-13.884 -13.884,-10.882 -30.769,0.75 -30.769,0.75l-3.002,27.017s-3.377,-4.878 -7.129,-1.876S376.517,272.055 388.525,266.051Z" | ||
android:fillColor="#2f2e41"/> | ||
<path | ||
android:pathData="M471.278,363.026s-22.396,60.656 -20.53,68.121 0,8.398 -2.799,10.265 -10.265,21.463 -10.265,21.463 -4.666,11.198 -8.398,13.997 -3.733,10.265 -3.733,10.265 -9.332,9.332 -7.465,11.198 1.866,4.666 -1.866,7.465 -7.465,6.532 -5.599,7.465 14.931,11.198 18.663,10.265 -1.866,-4.666 2.799,-6.532 7.465,-4.666 5.599,-5.599 -7.465,-0.933 -1.866,-2.799 25.195,-13.997 31.728,-28.928 37.83,-105.264 18.915,-117.953C486.46,361.718 478.743,351.828 471.278,363.026Z" | ||
android:fillColor="#d0cde1"/> | ||
<path | ||
android:pathData="M367.697,352.761l-0.379,0.158a23.498,23.498 0,0 0,-13.96 16.897c-2.038,9.753 -4.043,23.86 -2.457,37.069 2.799,23.329 4.666,33.594 8.398,41.059s4.666,4.666 3.733,10.265 -5.599,0.933 -0.933,8.398 7.465,5.599 5.599,9.332 -4.666,3.733 -0.933,8.398 3.733,6.532 4.666,8.398 3.733,15.864 3.733,15.864 14.931,-4.666 23.329,-2.799c0,0 -7.465,-13.064 -5.599,-15.864s4.666,-3.733 1.866,-6.532 -7.465,-1.866 -2.799,-4.666 -3.733,-31.728 -3.733,-31.728Z" | ||
android:fillColor="#d0cde1"/> | ||
<path | ||
android:pathData="M189,666l-34,0l15.5,-525l18.5,525z" | ||
android:fillColor="#3f3d56"/> | ||
<path | ||
android:pathData="M173.5,240.5l36.5,-50.5l-37,63l-4,-7l4.5,-5.5z" | ||
android:fillColor="#3f3d56"/> | ||
<path | ||
android:pathData="M169.5,291.5l-36.5,-50.5l37,63l4,-7l-4.5,-5.5z" | ||
android:fillColor="#3f3d56"/> | ||
<path | ||
android:pathData="M171.773,402.42l16.454,-9.5l5,8.66l-16.454,9.5z" | ||
android:fillColor="#3f3d56"/> | ||
</vector> |
Oops, something went wrong.