aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarvin Borner2018-09-03 01:29:16 +0200
committerMarvin Borner2018-09-03 01:29:16 +0200
commit06f713b5ee38b93ca33aec46d86c92865d3c8e4c (patch)
tree378c2c3ed43906aa573fd1f4ce08cf71f416b4f1
parent54f8d30ef2e689bf8d923e85ada7b8aa110ebd52 (diff)
Added basic introduction activity
-rw-r--r--app/build.gradle1
-rw-r--r--app/src/main/AndroidManifest.xml4
-rw-r--r--app/src/main/java/me/texx/Texx/IntroActivity.kt46
-rw-r--r--app/src/main/java/me/texx/Texx/RoutingActivity.kt15
-rw-r--r--app/src/main/res/drawable/logo_placeholder.xml9
5 files changed, 69 insertions, 6 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 27e2c87..761fc0a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -24,6 +24,7 @@ android {
}
dependencies {
+ implementation 'com.github.apl-devs:appintro:v4.2.3'
implementation 'com.otaliastudios:cameraview:1.5.1'
implementation 'com.github.mukeshsolanki:easypreferences:1.0.6'
implementation 'com.kazakago.cryptore:cryptore:1.3.0'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 87001df..753026a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -11,7 +11,6 @@
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
@@ -45,7 +44,8 @@
android:value="me.texx.Texx.MainActivity" />
</activity>
<activity android:name=".CameraActivity" />
- <activity android:name=".PhotoEditorActivity"></activity>
+ <activity android:name=".PhotoEditorActivity" />
+ <activity android:name=".IntroActivity" />
</application>
</manifest> \ No newline at end of file
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>()
+ }
+
}
/**
diff --git a/app/src/main/res/drawable/logo_placeholder.xml b/app/src/main/res/drawable/logo_placeholder.xml
new file mode 100644
index 0000000..20d5f0c
--- /dev/null
+++ b/app/src/main/res/drawable/logo_placeholder.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="100dp"
+ android:height="100dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71 -0.2,-0.2 -0.51,-0.2 -0.71,0l-1.48,1.48C13.85,1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z" />
+</vector>