make splash use popUpTo property instead

This commit is contained in:
eleith 2019-01-24 14:17:57 -08:00
parent 5bf42c58a5
commit 38cf129221
18 changed files with 79 additions and 77 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.idea/
.gradle/
local.properties

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ apply plugin: 'androidx.navigation.safeargs'
android {
compileSdkVersion 28
defaultConfig {
applicationId "abdulla.com.hashtagit"
applicationId 'com.eleith.hashtagit'
minSdkVersion 22
targetSdkVersion 28
versionCode 1
@ -22,26 +22,24 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.material:material:1.0.0'
// navigation hasnt moved to x yet
implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha09'
implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0-alpha09'
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
}

View File

@ -1,4 +1,4 @@
package abdulla.com.hashtagit
package com.eleith.hashtagit
import androidx.test.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4
@ -19,6 +19,6 @@ class ExampleInstrumentedTest {
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getTargetContext()
assertEquals("abdulla.com.hashtagit", appContext.packageName)
assertEquals("com.eleith.hashtagit", appContext.packageName)
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="abdulla.com.hashtagit">
package="com.eleith.hashtagit">
<application
android:allowBackup="true"

View File

@ -1,4 +1,4 @@
package abdulla.com.hashtagit
package com.eleith.hashtagit
import androidx.lifecycle.MutableLiveData

View File

@ -1,4 +1,4 @@
package abdulla.com.hashtagit
package com.eleith.hashtagit
import android.content.Context
import android.content.SharedPreferences
@ -42,5 +42,4 @@ class HashTagItActivity : AppCompatActivity() {
}
}
}
}

View File

@ -1,4 +1,4 @@
package abdulla.com.hashtagit
package com.eleith.hashtagit
import android.content.pm.ActivityInfo
import android.os.Bundle
@ -13,13 +13,6 @@ class InputFragment: Fragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// if havent seen splash, show it once!
(activity as? HashTagItActivity)?.sharedPrefs?.apply {
if (!this.contains("seenSplash")) {
findNavController().navigate(InputFragmentDirections.actionInputFragmentToSplashFragment())
}
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
@ -28,7 +21,6 @@ class InputFragment: Fragment() {
override fun onStart() {
super.onStart()
button.setOnClickListener {
val directions = InputFragmentDirections.actionInputFragmentToSubmissionFragment()
directions.writtenText = mEditText.text.toString()

View File

@ -1,4 +1,4 @@
package abdulla.com.hashtagit
package com.eleith.hashtagit
import android.os.Bundle
import android.view.LayoutInflater
@ -20,15 +20,9 @@ class SplashFragment: Fragment() {
override fun onStart() {
super.onStart()
// splash fragment is in charge of setting that it has seen it
// because there could always be a navigation trouble and user has actually seen this yet
(activity as? HashTagItActivity)?.sharedPrefs?.apply {
this.edit().putBoolean("seenSplash", true).apply()
}
uiScope.launch {
withContext(Dispatchers.IO) {
delay(5000)
delay(2000)
findNavController().navigate(SplashFragmentDirections.actionSplashFragmentToInputFragment())
}
}

View File

@ -1,4 +1,4 @@
package abdulla.com.hashtagit
package com.eleith.hashtagit
import android.animation.ObjectAnimator
import android.animation.ValueAnimator

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -2,12 +2,14 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:theme="@style/AppTheme"
android:orientation="vertical"
android:id="@+id/splashFragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_marginStart="8dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginEnd="8dp"
@ -18,11 +20,12 @@
app:layout_constraintBottom_toTopOf="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="tell em whats yo name">
app:helperText="what do you want to say?"
android:hint="message">
<com.google.android.material.textfield.TextInputEditText
style="@style/Widget.MaterialComponents.TextInputEditText.OutlinedBox"
android:id="@+id/mEditText"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
@ -30,8 +33,8 @@
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.TextButton"
android:text="Tell Em'!"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:text="Hash it"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/button"

View File

@ -1,16 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary">
<ImageView android:layout_height="226dp"
android:layout_width="300dp"
android:src="@drawable/hashitnow"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:text="SPLLLASH!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView2" app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="8dp" app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp" android:layout_marginTop="8dp"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mobile_navigation" app:startDestination="@id/inputFragment">
android:id="@+id/mobile_navigation" app:startDestination="@id/splashFragment">
<fragment android:id="@+id/inputFragment"
android:name="abdulla.com.hashtagit.InputFragment"
android:name="com.eleith.hashtagit.InputFragment"
android:label="InputFragment">
<action android:id="@+id/action_inputFragment_to_submissionFragment"
@ -15,18 +15,21 @@
</fragment>
<fragment android:id="@+id/submissionFragment"
android:name="abdulla.com.hashtagit.SubmissionFragment"
android:name="com.eleith.hashtagit.SubmissionFragment"
android:label="SubmissionFragment">
<argument android:name="writtenText"
app:argType="string"
android:defaultValue="May-Ling"/>
android:defaultValue="message"/>
</fragment>
<fragment android:id="@+id/splashFragment"
android:name="abdulla.com.hashtagit.SplashFragment"
android:name="com.eleith.hashtagit.SplashFragment"
android:label="SplashFragment">
<action android:id="@+id/action_splashFragment_to_inputFragment"
app:destination="@id/inputFragment"/>
app:destination="@id/inputFragment"
app:popUpTo="@id/splashFragment"
app:popUpToInclusive="true"/>
</fragment>
</navigation>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="colorPrimary">#FF5722</color>
<color name="colorPrimaryDark">#000000</color>
<color name="colorAccent">#FFC107</color>
</resources>

View File

@ -1,4 +1,4 @@
package abdulla.com.hashtagit
package com.eleith.hashtagit
import org.junit.Test

19
hashTagItNow.iml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="hashTagItNow" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,10 +0,0 @@
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/Users/kabdulla/Library/Android/sdk