Skip to content

Commit

Permalink
Splashscreen API integrated!
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandra-Sekhar-Bala committed Nov 19, 2023
1 parent 9a3bba0 commit aa1ca8e
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 16 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ dependencies {
//Glide
implementation 'com.github.bumptech.glide:glide:4.16.0'

// Splashscreen
implementation("androidx.core:core-splashscreen:1.0.1")

}
kapt {
correctErrorTypes true
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.CryptoApp"
android:theme="@style/Crypto.Splash"
tools:targetApi="31">
<activity
android:name=".ui.MainActivity"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/cryptoapp/demo/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.cryptoapp.demo.ui

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.navigation.findNavController
import androidx.navigation.ui.setupWithNavController
import com.cryptoapp.demo.R
Expand All @@ -12,6 +13,7 @@ import dagger.hilt.android.AndroidEntryPoint
class MainActivity : AppCompatActivity() {
private val binding: ActivityMainBinding by lazy { ActivityMainBinding.inflate(layoutInflater) }
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
setContentView(binding.root)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,21 @@ class ExchangeFragment : Fragment() {
binding.byCmcRank.setOnClickListener {
hideFilter()
viewModel.sortDataByCMCRank()
binding.rcyView.scrollToPosition(0)
}


binding.byPrice.setOnClickListener {
hideFilter()
viewModel.sortDataByPrice()
binding.rcyView.scrollToPosition(0)
}


binding.byTime.setOnClickListener {
hideFilter()
viewModel.sortDataByTime()
binding.rcyView.scrollToPosition(0)
}

binding.homeLayout.setOnClickListener {
Expand All @@ -87,13 +90,11 @@ class ExchangeFragment : Fragment() {
if (!lock) {
showFirstDataToCard(updatedDataList[0])
lock = !lock
binding.progress.visibility = View.GONE
}
} catch (_: Exception) {
}
adapter?.submitList(updatedDataList)
if (binding.progress.visibility == View.VISIBLE) {
binding.progress.visibility = View.GONE
}
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions app/src/main/res/layout/fragment_exchange.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,6 @@
tools:listitem="@layout/item_crypto"
app:layout_constraintTop_toBottomOf="@+id/top_crypto_txt" />

<ProgressBar
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.AppCompat.Light.DropDownItem.Spinner"
app:layout_constraintStart_toStartOf="@+id/rcyView"
app:layout_constraintEnd_toEndOf="@id/rcyView"
app:layout_constraintTop_toTopOf="@id/rcyView"
app:layout_constraintBottom_toBottomOf="@id/rcyView"
/>

<LinearLayout
android:id="@+id/filter_option"
android:layout_width="wrap_content"
Expand Down Expand Up @@ -290,4 +279,15 @@
</LinearLayout>


<ProgressBar
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/constraintLayout" />


</androidx.constraintlayout.widget.ConstraintLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="white_chip">#F6F6F6</color>
<color name="bottom_nav">#0B0B0B</color>
<color name="grey">#595555</color>
<color name="Light_grey">#60595555</color>
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>
<!-- Base application theme. -->
<style name="Base.Theme.CryptoApp" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>

<style name="Theme.CryptoApp" parent="Base.Theme.CryptoApp" />

<style name="Crypto.Splash" parent="Theme.SplashScreen">
<item name="windowSplashScreenAnimatedIcon">@drawable/crypto_logo</item>
<item name="windowSplashScreenAnimationDuration">1000</item>
<item name="windowSplashScreenBackground">@color/white_chip</item>
<item name="postSplashScreenTheme">@style/Theme.CryptoApp</item>
</style>
</resources>

0 comments on commit aa1ca8e

Please sign in to comment.