Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Activity Transition Animations #35

Merged
merged 4 commits into from
Jun 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Whooby/app/src/main/java/com/example/whooby/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
package com.example.whooby

import CustomAdapter
import android.os.Bundle
import android.speech.tts.TextToSpeech
import android.util.Log
import android.view.View
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.widget.*
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import java.util.*
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
Expand Down Expand Up @@ -155,6 +150,10 @@ class MainActivity : AppCompatActivity(), TextToSpeech.OnInitListener,AdapterVie
override fun onNothingSelected(p0: AdapterView<*>?) {
TODO("Not yet implemented")
}
override fun onBackPressed() {
super.onBackPressed()
overridePendingTransition(R.anim.empty,R.anim.zoom_out)
}


}
11 changes: 2 additions & 9 deletions Whooby/app/src/main/java/com/example/whooby/opening.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Opening : AppCompatActivity() {
val whooby = findViewById<Button>(R.id.whooby_button)
whooby.startAnimation(animation)
startActivity(intent3)
overridePendingTransition(R.anim.right_left1, R.anim.right_left2)
overridePendingTransition(R.anim.zoom_in, R.anim.empty)
// val handler = Handler()
// handler.postDelayed(Runnable {
//
Expand All @@ -135,14 +135,7 @@ class Opening : AppCompatActivity() {
val whooby = findViewById<Button>(R.id.whooby_reads)
whooby.startAnimation(animation);
startActivity(intent4);
overridePendingTransition(R.anim.zoom_in, R.anim.empty)
overridePendingTransition(R.anim.zoom_in,R.anim.empty)
}
}

override fun onBackPressed() {

overridePendingTransition(R.anim.top_bottom1, R.anim.top_bottom2)
finish()

}
}
12 changes: 7 additions & 5 deletions Whooby/app/src/main/java/com/example/whooby/splashscreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ class splashscreen : AppCompatActivity() {
)

Handler().postDelayed({
val intent = Intent(this, Opening::class.java)
startActivity(intent)
finish()
}, 3000)
}
Intent(this, Opening::class.java).also {
startActivity(it)
finish()
overridePendingTransition(R.anim.right_left1, R.anim.right_left2)
}
}, 2500)
}
}
11 changes: 6 additions & 5 deletions Whooby/app/src/main/java/com/example/whooby/whooby.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class whooby : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.whooby)

backgroundSceneView = findViewById(R.id.backgroundSceneView);
backgroundSceneView = findViewById(R.id.backgroundSceneView)


loadModels();
Expand Down Expand Up @@ -64,7 +64,7 @@ class whooby : AppCompatActivity() {
val data = ArrayList<ItemsViewModel>()

for (i in 1..20) {
data.add(ItemsViewModel("Item " + i))
data.add(ItemsViewModel("Item $i"))
}


Expand Down Expand Up @@ -146,8 +146,9 @@ class whooby : AppCompatActivity() {
}
null
}



}
override fun onBackPressed() {
super.onBackPressed()
overridePendingTransition(R.anim.empty,R.anim.zoom_out)
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="200">
<translate
android:fromYDelta="-100"
android:toYDelta="0"/>
android:duration="400">

<translate
android:fromXDelta="-100%"
android:toXDelta="0%"/>
</set>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="200">
android:duration="400">

<translate
android:fromYDelta="0"
android:toYDelta="100"/>
android:fromXDelta="0%"
android:toXDelta="100%"/>

</set>
1 change: 0 additions & 1 deletion Whooby/app/src/main/res/anim/right_left1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
<translate
android:fromXDelta="100%"
android:toXDelta="0%"/>

</set>