Skip to content

Commit

Permalink
Refactor: Clean up RequiresApi to not use VANILLA_ICE_CREAM
Browse files Browse the repository at this point in the history
  • Loading branch information
CreativeCodeCat committed Feb 22, 2025
1 parent bbf5c62 commit 3e1beb9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import android.widget.Filterable
import android.widget.FrameLayout
import android.widget.LinearLayout
import android.widget.TextView
import androidx.annotation.RequiresApi
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.view.updatePadding
import androidx.recyclerview.widget.RecyclerView
Expand Down Expand Up @@ -72,7 +71,6 @@ class AppDrawerAdapter(
return ViewHolder(binding)
}

@RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM)
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
if (appFilteredList.size == 0) return
val appModel = appFilteredList[holder.absoluteAdapterPosition]
Expand All @@ -87,8 +85,6 @@ class AppDrawerAdapter(

holder.appSaveRename.setOnClickListener {
val name = holder.appRenameEdit.text.toString().trim()
/* TODO looks like suboptimal direction of data flow. The update is better to be written
to the database (which is prefs?), and then propagated from there */
appModel.customLabel = name
notifyItemChanged(holder.absoluteAdapterPosition)
appRenameListener(appModel.activityPackage, appModel.customLabel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
}


@RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM)
@RequiresApi(Build.VERSION_CODES.Q)
override fun onStart() {
super.onStart()
if (prefs.showStatusBar) showStatusBar(requireActivity()) else hideStatusBar(requireActivity())
Expand All @@ -147,8 +147,10 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
privateSpaceReceiver = PrivateSpaceReceiver()
/* register private Space changes */
try {
val filter = IntentFilter(Intent.ACTION_PROFILE_AVAILABLE)
requireContext().registerReceiver(privateSpaceReceiver, filter)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
val filter = IntentFilter(Intent.ACTION_PROFILE_AVAILABLE)
requireContext().registerReceiver(privateSpaceReceiver, filter)
}
} catch (e: Exception) {
e.printStackTrace()
}
Expand Down

0 comments on commit 3e1beb9

Please sign in to comment.