Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
peyman-mohtashami committed May 22, 2023
1 parent 7729c82 commit 7d15534
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 24 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.fragment:fragment-ktx:1.5.7'

testImplementation 'junit:junit:4.13.2'
testRuntimeOnly 'org.slf4j:slf4j-simple:2.0.6'
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/org/radarcns/detail/LoginActivityImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import android.widget.Button
import android.widget.FrameLayout
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import androidx.fragment.app.commit
import com.google.android.material.textfield.TextInputLayout
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.remoteconfig.FirebaseRemoteConfigException
Expand Down Expand Up @@ -249,9 +249,9 @@ class LoginActivityImpl : LoginActivity(), NetworkConnectedReceiver.NetworkConne
this.id = id
layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
})
val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
fragmentTransaction.add(id, fragment)
fragmentTransaction.commit()
supportFragmentManager.commit {
add(id, fragment)
}
}

override fun onAcceptPrivacyPolicy() {
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/java/org/radarcns/detail/MainActivityViewImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,6 @@ class MainActivityViewImpl(
}
}
}

// rows = p.map {
// SourceRowView(mainActivity, it, root).apply {
// update()
// }
// }
}
actionsCells.applyIfChanged(currentActions) { actionList ->
if (actionList.isNotEmpty()) {
Expand Down
16 changes: 3 additions & 13 deletions app/src/main/java/org/radarcns/detail/RadarApplicationImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.drawable.Drawable
import android.util.Log
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.graphics.drawable.toBitmap
import androidx.lifecycle.*
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.crashlytics.FirebaseCrashlytics
Expand Down Expand Up @@ -60,7 +62,7 @@ class RadarApplicationImpl : AbstractRadarApplication(), LifecycleEventObserver
private set

val largeIcon: Bitmap
get() = getBitmapFromDrawable(getDrawable(R.mipmap.ic_launcher)!!)
get() = AppCompatResources.getDrawable(this, R.mipmap.ic_launcher)!!.toBitmap()

val smallIcon = R.drawable.ic_bt_connected

Expand Down Expand Up @@ -97,16 +99,4 @@ class RadarApplicationImpl : AbstractRadarApplication(), LifecycleEventObserver
else -> isInForeground
}
}

private fun getBitmapFromDrawable(drawable: Drawable): Bitmap {
val bmp = Bitmap.createBitmap(
drawable.intrinsicWidth,
drawable.intrinsicHeight,
Bitmap.Config.ARGB_8888
)
val canvas = Canvas(bmp)
drawable.setBounds(0, 0, canvas.width, canvas.height)
drawable.draw(canvas)
return bmp
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.radarcns.detail.MainActivityBootStarter.Companion.BOOT_START_NOTIFICA
import org.radarcns.detail.databinding.ActivitySplashBinding

class SplashActivityImpl : SplashActivity() {
override val delayMs: Long = 5000L
override val delayMs: Long = 0L
private var notifyResume = false
private lateinit var binding: ActivitySplashBinding

Expand Down

0 comments on commit 7d15534

Please sign in to comment.