Added scrollbars to recyclerview dialog, fixed a crash on Marshmallow caused by casting to AnimatedVectorDrawable instead of AnimatedVectorDrawableCompat, fixed a bug that tinted the status bar blue instead of white/dark on certain devices while in light mode

This commit is contained in:
Deniz Düzgören
2019-08-11 20:25:01 +02:00
parent 60831aa2b2
commit eb758ed077
6 changed files with 11 additions and 6 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ android {
applicationId "com.denizd.substitutionplan" applicationId "com.denizd.substitutionplan"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 28
versionCode 21 versionCode 22
versionName "2.1.4" versionName "2.1.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
@@ -74,6 +74,7 @@ class CardAdapter(private var mSubst: List<Subst>) : RecyclerView.Adapter<CardAd
psa = true psa = true
holder.mDate.visibility = View.GONE holder.mDate.visibility = View.GONE
holder.mDate.text = currentItem.date holder.mDate.text = currentItem.date
holder.mTime.text = " "
holder.mImageView.setImageResource(R.drawable.ic_idea) holder.mImageView.setImageResource(R.drawable.ic_idea)
holder.mCard.setCardBackgroundColor(ContextCompat.getColor(holder.mImageView.context, R.color.colorAccent)) holder.mCard.setCardBackgroundColor(ContextCompat.getColor(holder.mImageView.context, R.color.colorAccent))
} else { } else {
@@ -38,6 +38,7 @@ class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
AppCompatDelegate.MODE_NIGHT_NO, AppCompatDelegate.MODE_NIGHT_UNSPECIFIED -> { AppCompatDelegate.MODE_NIGHT_NO, AppCompatDelegate.MODE_NIGHT_UNSPECIFIED -> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
window.statusBarColor = ContextCompat.getColor(this, R.color.colorBackground)
window.navigationBarColor = ContextCompat.getColor(this, R.color.colorBackground) window.navigationBarColor = ContextCompat.getColor(this, R.color.colorBackground)
} else { } else {
window.statusBarColor = ContextCompat.getColor(this, R.color.legacyBlack) window.statusBarColor = ContextCompat.getColor(this, R.color.legacyBlack)
@@ -120,7 +121,7 @@ class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
} }
}) })
handler.postDelayed({ handler.postDelayed({
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
val mImgCheck = findViewById<ImageView>(R.id.imageView).drawable as AnimatedVectorDrawable val mImgCheck = findViewById<ImageView>(R.id.imageView).drawable as AnimatedVectorDrawable
mImgCheck.start() mImgCheck.start()
} else { } else {
@@ -64,6 +64,7 @@ class Main : AppCompatActivity(R.layout.app_bar_main) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
window.statusBarColor = ContextCompat.getColor(this, R.color.colorBackground)
window.navigationBarColor = ContextCompat.getColor(this, R.color.colorBackground) window.navigationBarColor = ContextCompat.getColor(this, R.color.colorBackground)
} else { } else {
window.statusBarColor = ContextCompat.getColor(this, R.color.legacyBlack) window.statusBarColor = ContextCompat.getColor(this, R.color.legacyBlack)
+2 -1
View File
@@ -5,7 +5,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:paddingStart="16dp" android:paddingStart="16dp"
android:paddingEnd="16dp" android:paddingEnd="16dp"
android:paddingBottom="8dp"> android:paddingBottom="8dp"
android:scrollbars="vertical">
<TableRow <TableRow
android:layout_width="match_parent" android:layout_width="match_parent"
+2 -1
View File
@@ -24,7 +24,8 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"
android:scrollbars="vertical"/>
</RelativeLayout> </RelativeLayout>