Skip to content

Instantly share code, notes, and snippets.

To delete your account, please reach out to eeddeellee@gmail.com from the email address that is associated with the account you wish to delete. Specify the app name as well. Thanks!
If the ViewHolder is still being drawn on the RecyclerView even after calling notifyItemRemoved(), it's possible that the RecyclerView is not properly recycling the ViewHolder instances.
One common reason for this is that the RecyclerView is unable to correctly identify the view type of the ViewHolder instance that should be recycled. When you override the getItemViewType() method of your RecyclerView.Adapter, make sure that you are returning the correct view type for each item in your dataset.
Another reason could be that the RecyclerView is not properly removing the ViewHolder instance from its internal cache. This could happen if you have implemented custom animations that prevent the ViewHolder from being properly removed, or if there is a memory leak in your code that is preventing the ViewHolder from being garbage collected.
To troubleshoot this issue, you can try the following:
Check if you're accidentally creating multiple instances of the same item. If the same item is present multiple times in y
class NewInboxTodoWidgetProvider : AppWidgetProvider() {
override fun onReceive(context: Context, intent: Intent) {
Timber.d("[AppWidget] NewInboxTodoWidgetProvider.onReceive()")
super.onReceive(context, intent)
}
override fun onUpdate(
context: Context,
appWidgetManager: AppWidgetManager,
<receiver
android:name=".TodayListWidgetProvider"
android:exported="true"
android:label="Today"
>
<intent-filter>
<!-- Only broadcast that you must explicitly declare. The AppWidgetManager automatically sends all other App Widget broadcasts to the AppWidgetProvider as necessary. -->
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data
2022-04-10 08:30:38.324 10324-10442/com.compscieddy.writeaday E/NoopPersistenceManager: Caught Throwable.
java.lang.OutOfMemoryError: Failed to allocate a 32 byte allocation with 137128 free bytes and 133KB until OOM, target footprint 201326592, growth limit 201326592; giving up on allocation because <1% of heap free after GC.
at com.google.firebase.database.collection.LLRBBlackValueNode.copy(LLRBBlackValueNode.java:67)
at com.google.firebase.database.collection.LLRBValueNode.remove(LLRBValueNode.java:126)
at com.google.firebase.database.collection.LLRBValueNode.remove(LLRBValueNode.java:126)
at com.google.firebase.database.collection.LLRBValueNode.remove(LLRBValueNode.java:103)
at com.google.firebase.database.collection.LLRBValueNode.remove(LLRBValueNode.java:103)
at com.google.firebase.database.collection.LLRBValueNode.remove(LLRBValueNode.java:103)
at com.google.firebase.database.collection.LLRBValueNode.remove(LLRBValueNode.java:103)
at c
@eddieberklee
eddieberklee / HabitDayFS.kt
Created April 1, 2022 08:57
HabitDay Firestore Model
class HabitDayFS {
lateinit var id: String
lateinit var habitId: String
@get:PropertyName("isCompleted")
@set:PropertyName("isCompleted")
var isCompleted: Boolean = false
var noteText: String = ""
@eddieberklee
eddieberklee / gist:99cd55c7fc10464688b3fbb477f42e8f
Created January 5, 2022 04:17
Using sensor to translation animate view
val sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager
sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)?.let { accelerometer ->
sensorManager.registerListener(object : SensorEventListener {
override fun onSensorChanged(event: SensorEvent) {
val x = event.values[0]
val y = event.values[1]
val z = event.values[2]
Timber.d("x: $x y: $y z: $z")
val xAnimation = SpringAnimation(binding.root, DynamicAnimation.TRANSLATION_X).apply {
@eddieberklee
eddieberklee / RemoteConfigUtil.java
Created September 10, 2020 06:08
Wrapper around Remote Config to simplify fetching config values.
public class RemoteConfigUtil {
public static final String SHOULD_REQUIRE_LOGIN = "should_require_login";
public static void init() {
Map<String, Object> defaultsMap = getDefaultsMap();
FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setMinimumFetchIntervalInSeconds(BuildConfig.DEBUG ? 15 : 3600)
-ea
-server
-Xms1g
-Xmx1g
-Xss16m
-XX:PermSize=256m
-XX:MaxPermSize=256m
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+UnlockExperimentalVMOptions
@eddieberklee
eddieberklee / vmoptions
Last active August 17, 2017 16:53
best_vmoptions
# custom Android Studio VM options, see http://tools.android.com/tech-docs/configuration
-Xms1024m
-Xmx2048m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=800m
-XX:+UseCompressedOops
-XX:+HeapDumpOnOutOfMemoryError
# Sets the size of the allocated class metadata space that will trigger a GC the first time it is exceeded, default max value is 350m