blur background for ExploreWokaActivity according to android version

Ui for ExploreWokaActivity
activity transitions
This commit is contained in:
2024-05-30 16:53:44 +05:30
parent 023a7532fb
commit 2182c0393d
58 changed files with 364 additions and 25 deletions

View File

@@ -4,18 +4,6 @@
<value>
<entry key="app">
<State>
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="SERIAL_NUMBER" />
<value value="adb-RZCW41EJRPN-wiByj3._adb-tls-connect._tcp." />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-05-29T15:12:13.123709Z" />
<targetsSelectedWithDialog>
<Target>
<type value="QUICK_BOOT_TARGET" />

View File

@@ -1,14 +1,10 @@
package com.woka.home
import android.graphics.RenderEffect
import android.graphics.Shader
import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.View.OnAttachStateChangeListener
import android.view.WindowManager
import android.transition.Fade
import android.view.Window
import androidx.activity.enableEdgeToEdge
import androidx.annotation.RequiresApi
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
@@ -16,8 +12,7 @@ import com.woka.R
import com.woka.databinding.ActivityExploreWokaBinding
import com.woka.utils.WokaBaseActivity
import com.woka.utils.lightStatusBar
import java.util.function.Consumer
import com.woka.utils.toast
class ExploreWokaActivity : WokaBaseActivity() {
@@ -25,6 +20,12 @@ class ExploreWokaActivity : WokaBaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
with(window){
lightStatusBar()
requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS)
enterTransition = Fade().apply { duration = 200 }
}
enableEdgeToEdge()
binding = ActivityExploreWokaBinding.inflate(layoutInflater)
setContentView(binding.root)
@@ -34,9 +35,26 @@ class ExploreWokaActivity : WokaBaseActivity() {
insets
}
window.lightStatusBar()
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S){
binding.root.setBackgroundColor(ContextCompat.getColor(this, R.color.black_50))
}
binding.root.setRenderEffect(RenderEffect.createBlurEffect(50f, 50f, Shader.TileMode.MIRROR))
clickEvents()
}
private fun clickEvents() {
binding.apply {
closeBtn.setOnClickListener {
finish()
}
root.setOnClickListener {
finish()
}
wokaFm.setOnClickListener {
}
}
}
}

View File

@@ -1,17 +1,23 @@
package com.woka.home
import android.app.ActivityOptions
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.RenderEffect
import android.graphics.Shader
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.WindowManager
import android.view.animation.Animation
import androidx.activity.enableEdgeToEdge
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.view.GravityCompat
import androidx.core.view.ViewCompat
@@ -124,6 +130,16 @@ class HomeActivity : WokaBaseActivity(),
}
}
override fun onResume() {
super.onResume()
if (viewModel.isHomeBackgroundBlurred){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){
viewModel.isHomeBackgroundBlurred = false
binding.root.setRenderEffect(null)
}
}
}
override fun onBackPressed() {
if (binding.bottomNav.getSelectedTab() != HOME){
binding.bottomNav.selectTab(HOME)
@@ -186,6 +202,10 @@ class HomeActivity : WokaBaseActivity(),
selectTheme(userPrefs?.appTheme?: Theme.THEME_ONE, true)
selectLanguage(userPrefs?.appLanguage?: LOCALE_ENGLISH, true)
if (viewModel.isHomeBackgroundBlurred){
blurBackground()
}
}
private fun clickEvents() {
@@ -305,19 +325,34 @@ class HomeActivity : WokaBaseActivity(),
.replace(R.id.fc_home, Home1Fragment.newInstance())
.commit()
}
updateBackground()
viewModel.selectedBottomTab = tab
}
EXPLORE_WOKA -> {
startActivity(Intent(this, ExploreWokaActivity::class.java))
blurBackground()
startActivity(Intent(this, ExploreWokaActivity::class.java)
, ActivityOptions.makeSceneTransitionAnimation(this).toBundle())
}
MY_LIST -> {
supportFragmentManager.beginTransaction()
.replace(R.id.fc_home, MyListFragment.newInstance())
.commit()
updateBackground()
viewModel.selectedBottomTab = tab
}
}
}
updateBackground()
viewModel.selectedBottomTab = tab
// blurring root view
private fun blurBackground(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && !viewModel.isHomeBackgroundBlurred){
binding.root.setRenderEffect(RenderEffect.createBlurEffect(60f, 60f, Shader.TileMode.REPEAT))
viewModel.isHomeBackgroundBlurred = true
}
}
// updating background

View File

@@ -16,6 +16,7 @@ class HomeViewModel: ViewModel(){
private val userRepository = UserRepository(RetrofitHelper.getRetrofit().create(UserApiService::class.java))
var selectedBottomTab: Int = HOME
var isHomeBackgroundBlurred: Boolean = false
private val _localeChangeLiveData = MutableLiveData<String>()
val localeChangeLiveData: LiveData<String>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:bottomLeftRadius="25dp"
android:bottomRightRadius="25dp"
/>
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="25dp"/>
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:topLeftRadius="25dp"
android:topRightRadius="25dp"/>
<solid android:color="@color/white"/>
</shape>

View File

@@ -5,9 +5,278 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
tools:context=".home.ExploreWokaActivity">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/close_btn"
android:layout_marginBottom="5dp"
>
<LinearLayout
android:id="@+id/woka_fm"
android:layout_width="@dimen/_180sdp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingVertical="10dp"
android:background="@drawable/top_round_25_white"
android:backgroundTint="#C8B400"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:contentDescription="@string/woka_fm"
android:src="@drawable/img_woka_fm_exp"
android:layout_marginStart="@dimen/_25sdp"
android:layout_marginEnd="@dimen/_10ssp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/woka_fm"
android:textColor="@color/white"
android:fontFamily="@font/exo_2_bold"
android:textSize="@dimen/_12ssp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="@dimen/_180sdp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingVertical="10dp"
android:background="#00A2DE"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:contentDescription="@string/woka_live_tv"
android:src="@drawable/img_live_tv_exp"
android:layout_marginStart="@dimen/_25sdp"
android:layout_marginEnd="@dimen/_10ssp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/woka_live_tv"
android:textColor="@color/white"
android:fontFamily="@font/exo_2_bold"
/>
</LinearLayout>
<LinearLayout
android:layout_width="@dimen/_180sdp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingVertical="10dp"
android:background="#5E1FC4"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:contentDescription="@string/web_series"
android:src="@drawable/img_web_series_exp"
android:layout_marginStart="@dimen/_25sdp"
android:layout_marginEnd="@dimen/_10ssp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/web_series"
android:textColor="@color/white"
android:fontFamily="@font/exo_2_bold"
/>
</LinearLayout>
<LinearLayout
android:layout_width="@dimen/_180sdp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingVertical="10dp"
android:background="#F38600"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:contentDescription="@string/games"
android:src="@drawable/img_games_exp"
android:layout_marginStart="@dimen/_25sdp"
android:layout_marginEnd="@dimen/_10ssp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/games"
android:textColor="@color/white"
android:fontFamily="@font/exo_2_bold"
/>
</LinearLayout>
<LinearLayout
android:layout_width="@dimen/_180sdp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingVertical="10dp"
android:background="#007AC0"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:contentDescription="@string/audio_books"
android:src="@drawable/img_audio_book_exp"
android:layout_marginStart="@dimen/_25sdp"
android:layout_marginEnd="@dimen/_10ssp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/audio_books"
android:textColor="@color/white"
android:fontFamily="@font/exo_2_bold"
/>
</LinearLayout>
<LinearLayout
android:layout_width="@dimen/_180sdp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingVertical="10dp"
android:background="#019a4a"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:contentDescription="@string/blogs"
android:src="@drawable/img_blogs_exp"
android:layout_marginStart="@dimen/_25sdp"
android:layout_marginEnd="@dimen/_10ssp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/blogs"
android:textColor="@color/white"
android:fontFamily="@font/exo_2_bold"
/>
</LinearLayout>
<LinearLayout
android:layout_width="@dimen/_180sdp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingVertical="10dp"
android:background="#CC4A1C"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:contentDescription="@string/karaoke"
android:src="@drawable/img_karaoke_exp"
android:layout_marginStart="@dimen/_25sdp"
android:layout_marginEnd="@dimen/_10ssp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/karaoke"
android:textColor="@color/white"
android:fontFamily="@font/exo_2_bold"
/>
</LinearLayout>
<LinearLayout
android:layout_width="@dimen/_180sdp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingVertical="10dp"
android:background="@drawable/bottom_round_25"
android:backgroundTint="#8BAC2C"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:contentDescription="@string/shop"
android:src="@drawable/img_shop_exp"
android:layout_marginStart="@dimen/_25sdp"
android:layout_marginEnd="@dimen/_10ssp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/shop"
android:textColor="@color/white"
android:fontFamily="@font/exo_2_bold"
/>
</LinearLayout>
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/ic_heart_filled"
android:contentDescription="@string/image"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-15dp"
app:tint="#8BAC2C" />
</LinearLayout>
<ImageView
android:id="@+id/close_btn"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/image"

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#FF000000</color>
<color name="black_50">#80000000</color>
<color name="white">#FFFFFFFF</color>
<color name="white_50">#80FFFFFF</color>
<color name="color_primary">#09005D</color>

View File

@@ -134,4 +134,6 @@
<string name="woka_fm">WOKA FM</string>
<string name="games">GAMES</string>
<string name="coming_soonn_on_woka">Coming soonn on Woka</string>
<string name="woka_live_tv">WOKA LIVE TV</string>
<string name="blogs">BLOGS</string>
</resources>