Skip to content

Commit

Permalink
search fix and uninstalled app handled
Browse files Browse the repository at this point in the history
  • Loading branch information
Miihir79 committed Apr 10, 2023
1 parent febe2a6 commit 2e9d48f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ fun String.getDisplayNameFromPackageName(context: Context): String {
val appName = context.packageManager.getApplicationLabel(info)
return appName.toString()
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
return "Uninstalled App"
}
return ""
}

fun String.getAppIconAsBitmapFromPackageName(context: Context): Bitmap? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AdapterAppWise(val onItemClick: ((packageName: String) -> Unit)) :
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.bind(packageNameData[position])
holder.bind(currentList[position])
}

var filter: CharSequence = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AdapterSearchText : ListAdapter<NotifInfo, AdapterSearchText.ViewHolder>(I
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.bind(notifInfoData[position])
holder.bind(currentList[position])
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.pm.PackageManager
import android.widget.ImageView
import android.widget.TextView
import androidx.databinding.BindingAdapter
import com.mihir.notificationtracker.R
import com.mihir.notificationtracker.helper.getDisplayNameFromPackageName
import java.text.SimpleDateFormat
import java.util.*
Expand All @@ -20,6 +21,7 @@ fun ImageView.getImageFromPackageName(packageName: String) {
val icon = context.packageManager.getApplicationIcon(packageName)
this.setImageDrawable(icon)
} catch (e: PackageManager.NameNotFoundException) {
this.setImageResource(R.drawable.ic_nav_app_notif)
e.printStackTrace()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class AppWiseNotificationFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.rvAppWiseNotifs.adapter = adapter
// TODO: fix search, current search is done on package name, change it to Display name/ app name
binding.searchApps.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextChange(p0: String): Boolean {
adapter.filter = p0
Expand Down

0 comments on commit 2e9d48f

Please sign in to comment.