Skip to content

Commit

Permalink
update target api
Browse files Browse the repository at this point in the history
  • Loading branch information
MehdiNosrati committed Sep 1, 2023
1 parent 2c39f14 commit 6a82eda
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 70 deletions.
Binary file added app/release/app-release.aab
Binary file not shown.
9 changes: 5 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

<application
android:name=".App"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:allowBackup">
<activity android:name=".ui.LaunchActivity" android:theme="@style/AppTheme.LaunchTheme">
android:theme="@style/AppTheme">
<activity
android:name=".ui.LaunchActivity"
android:exported="true"
android:theme="@style/AppTheme.LaunchTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
59 changes: 28 additions & 31 deletions app/src/main/java/io/mns/base/app/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package io.mns.base.app.ui
import android.graphics.Bitmap
import android.graphics.Canvas
import android.os.Bundle
import android.os.Handler
import android.view.View
import android.view.ViewAnimationUtils
import androidx.activity.viewModels
Expand All @@ -30,6 +29,7 @@ class MainActivity : AppCompatActivity() {
init()
}

@Deprecated("Deprecated in Java")
override fun onBackPressed() {
if (navController.navigateUp()) {
binding.bottomBar.setActiveItem(0)
Expand Down Expand Up @@ -74,41 +74,38 @@ class MainActivity : AppCompatActivity() {
if (viewModel.bitmap != null) {
themeChanged()
} else {
binding.imageView.isVisible = false
binding.imageView.visibility = View.INVISIBLE
}
}

private fun themeChanged() {
Handler().postDelayed(
{
try {
binding.imageView.setImageBitmap(viewModel.bitmap)
binding.imageView.isVisible = true
val w = binding.container.measuredWidth
val h = binding.container.measuredHeight
val finalRadius = hypot(w.toFloat(), h.toFloat())
val cx = resources.getDimensionPixelSize(R.dimen.moon_left)
val cy = resources.getDimensionPixelSize(R.dimen.moon_top)
val anim = ViewAnimationUtils.createCircularReveal(
binding.imageView,
cx,
cy,
finalRadius,
0f
)
anim.duration = 400L
anim.doOnEnd {
binding.imageView.setImageDrawable(null)
binding.imageView.isVisible = false
}
anim.start()
} catch (e: Exception) {
binding.imageView.isVisible = false
binding.imageView.setImageBitmap(null)
runOnUiThread {
try {
binding.imageView.setImageBitmap(viewModel.bitmap)
binding.imageView.isVisible = true
val w = binding.container.measuredWidth
val h = binding.container.measuredHeight
val finalRadius = hypot(w.toFloat(), h.toFloat())
val cx = resources.getDimensionPixelSize(R.dimen.moon_left)
val cy = resources.getDimensionPixelSize(R.dimen.moon_top)
val anim = ViewAnimationUtils.createCircularReveal(
binding.imageView,
cx,
cy,
0f,
finalRadius
)
anim.duration = 100L
anim.doOnEnd {
binding.imageView.setImageDrawable(null)
binding.imageView.visibility = View.INVISIBLE
}
},
50
)
anim.start()
} catch (e: Exception) {
binding.imageView.visibility = View.INVISIBLE
binding.imageView.setImageBitmap(null)
}
}
}

fun toggleTheme() {
Expand Down
21 changes: 7 additions & 14 deletions app/src/main/java/io/mns/base/app/ui/fragments/AddFragment.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.mns.base.app.ui.fragments

import android.os.Bundle
import android.os.Handler
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -44,12 +43,9 @@ class AddFragment private constructor(private val insert: OnInsert) : BottomShee
Observer {
if (it) {
viewModel.backHandled()
Handler().postDelayed(
{
dismiss()
},
200
)
requireActivity().runOnUiThread {
dismiss()
}
}
}
)
Expand All @@ -64,13 +60,10 @@ class AddFragment private constructor(private val insert: OnInsert) : BottomShee
val title = binding.title
if (title != null && title.isNotEmpty()) {
binding.add.setOnClickListener(null)
Handler().postDelayed(
{
insert(title)
dismiss()
},
200
)
requireActivity().runOnUiThread {
insert(title)
dismiss()
}
}
}
}
Expand Down
12 changes: 4 additions & 8 deletions app/src/main/java/io/mns/base/app/ui/fragments/HomeFragment.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.mns.base.app.ui.fragments

import android.os.Bundle
import android.os.Handler
import android.view.View
import androidx.fragment.app.viewModels
import androidx.lifecycle.Observer
Expand Down Expand Up @@ -61,7 +60,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(R.layout.fragment_home),

private fun addTodo(title: String) {
viewModel.insertItem(title)
Handler().post {
requireActivity().runOnUiThread {
binding.list.layoutManager?.scrollToPosition(0)
}
}
Expand All @@ -84,11 +83,8 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(R.layout.fragment_home),
}

override fun todoDone(todo: TodoItem) {
Handler().postDelayed(
{
viewModel.done(todo)
},
800
)
requireActivity().runOnUiThread {
viewModel.done(todo)
}
}
}
19 changes: 9 additions & 10 deletions app/src/main/java/io/mns/base/app/ui/fragments/SettingFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package io.mns.base.app.ui.fragments
import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle
import android.os.Handler
import android.view.View
import androidx.core.content.edit
import androidx.fragment.app.viewModels
Expand All @@ -24,7 +23,10 @@ class SettingFragment : BaseFragment<FragmentSettingBinding>(R.layout.fragment_s
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
binding.vm = viewModel
sharedPreferences =
requireContext().applicationContext.getSharedPreferences(THEME_PREFS_NAME, Context.MODE_PRIVATE)
requireContext().applicationContext.getSharedPreferences(
THEME_PREFS_NAME,
Context.MODE_PRIVATE
)
observeBack()
handleThemeChange()
}
Expand All @@ -35,17 +37,14 @@ class SettingFragment : BaseFragment<FragmentSettingBinding>(R.layout.fragment_s
Observer {
if (it) {
viewModel.themeToggled()
if (activity != null) {
requireActivity().runOnUiThread {
(activity as MainActivity).toggleTheme()
}
}
sharedPreferences.edit {
putBoolean(IS_DARK, !resources.isDark())
}
Handler().postDelayed(
{
if (activity != null) {
(activity as MainActivity).toggleTheme()
}
},
200
)
}
}
)
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Coordinates.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const val PUBLISHING_GROUP = "io.mns.mtodo"
object AppCoordinates {
const val APP_ID = "dev.mahdins.mtodo"

const val APP_VERSION_NAME = "1.0.0"
const val APP_VERSION_CODE = 21010800
const val APP_VERSION_NAME = "1.1.0"
const val APP_VERSION_CODE = 23090100
}

object LibraryAndroidCoordinates {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
object Sdk {
const val MIN_SDK_VERSION = 21
const val TARGET_SDK_VERSION = 30
const val TARGET_SDK_VERSION = 33
const val COMPILE_SDK_VERSION = 30
}

Expand Down

0 comments on commit 6a82eda

Please sign in to comment.