aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/me
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/me')
-rw-r--r--app/src/main/java/me/texx/Texx/IntroActivity.kt46
-rw-r--r--app/src/main/java/me/texx/Texx/RoutingActivity.kt15
2 files changed, 57 insertions, 4 deletions
diff --git a/app/src/main/java/me/texx/Texx/IntroActivity.kt b/app/src/main/java/me/texx/Texx/IntroActivity.kt
new file mode 100644
index 0000000..816317a
--- /dev/null
+++ b/app/src/main/java/me/texx/Texx/IntroActivity.kt
@@ -0,0 +1,46 @@
+package me.texx.Texx
+
+import android.Manifest
+import android.graphics.Color
+import android.os.Bundle
+import android.support.v4.app.Fragment
+import android.view.WindowManager
+import com.github.paolorotolo.appintro.AppIntro2
+import com.github.paolorotolo.appintro.AppIntro2Fragment
+import org.jetbrains.anko.startActivity
+
+
+/**
+ * Activity to show basic information and ask for permissions
+ */
+class IntroActivity : AppIntro2() {
+ /**
+ * Set initial configuration
+ */
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
+ createSlides()
+ setPermissionRequests()
+ showSkipButton(false)
+ setColorTransitionsEnabled(true)
+ }
+
+ private fun setPermissionRequests() {
+ askForPermissions(arrayOf(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE), 2)
+ setSwipeLock(false)
+ }
+
+ private fun createSlides() {
+ addSlide(AppIntro2Fragment.newInstance("Texx", "For the people", R.drawable.logo_placeholder, Color.parseColor("#304ffe")))
+ addSlide(AppIntro2Fragment.newInstance("Camera", "If you want to take and upload pictures, please allow us to do so.",
+ R.drawable.logo_placeholder, Color.parseColor("#1976d2")))
+ addSlide(AppIntro2Fragment.newInstance("Log in", "Please register or login now.", R.drawable.logo_placeholder, Color.parseColor("#29b6f6")))
+ }
+
+ override fun onDonePressed(currentFragment: Fragment) {
+ super.onDonePressed(currentFragment)
+ startActivity<RoutingActivity>()
+ }
+
+}
diff --git a/app/src/main/java/me/texx/Texx/RoutingActivity.kt b/app/src/main/java/me/texx/Texx/RoutingActivity.kt
index 9e1c273..d316c07 100644
--- a/app/src/main/java/me/texx/Texx/RoutingActivity.kt
+++ b/app/src/main/java/me/texx/Texx/RoutingActivity.kt
@@ -28,10 +28,17 @@ class RoutingActivity : AppCompatActivity() {
dressCodeName = getThemeName(this)
FuelManager.instance.basePath = "http://$serverAddress"
- alert("Logging you in.", "Loading...") {
- isCancelable = false
- }.show()
- verifyLogin()
+
+ if (EasyPrefrences(this@RoutingActivity).getBoolean("previously_started")) {
+ alert("Logging you in.", "Loading...") {
+ isCancelable = false
+ }.show()
+ verifyLogin()
+ } else {
+ EasyPrefrences(this@RoutingActivity).putBoolean("previously_started", true)
+ startActivity<IntroActivity>()
+ }
+
}
/**