sarbajitsaha / Batch-Uninstaller

Batch Uninstaller app for Android (works on rooted as well as non-rooted phones)
GNU General Public License v3.0
68 stars 16 forks source link

Kotlin & AndroidX conversion #19

Closed Doomsdayrs closed 4 years ago

Doomsdayrs commented 4 years ago
sarbajitsaha commented 4 years ago

I am getting the following error while trying to run this change.

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.saha.batchuninstaller/com.saha.batchuninstaller.activities.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference

Seems like in this line

private val mPrefs: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(applicationContext)

applicationContext is null?

Have you tried running your changes in a device?

Doomsdayrs commented 4 years ago

That should fix it~

sarbajitsaha commented 4 years ago

Thanks! The code looks good. I just need a couple more changes, and I can merge it to master.

  1. Running Code inspection shows that we have unnecessary safe calls on mEditor. Can you please remove the ? wherever mEditor is read. Those aren't needed.

  2. This isn't related to your change, but would be great if I can merge together. The day and night modes often didn't work properly on this application. Based on this link, seem like replacing applicationContext with this@MainActivity in the AppInfo adapter does the trick. If possible, please change that as well,

In line 130, mAdapter = AppInfoAdapter(applicationContext, mApps) change applicationContext to this@MainActivity

Once done, let me know. I will merge.

Doomsdayrs commented 4 years ago

:+1:

sarbajitsaha commented 4 years ago

Merged to master. Thanks for the change!