AppDetails: Do not clear menu instead don not inflate if not required
This commit is contained in:
@@ -117,7 +117,6 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
|
|||||||
|
|
||||||
private var downloadStatus = DownloadStatus.UNAVAILABLE
|
private var downloadStatus = DownloadStatus.UNAVAILABLE
|
||||||
private var isUpdatable: Boolean = false
|
private var isUpdatable: Boolean = false
|
||||||
private var uninstallActionEnabled = false
|
|
||||||
|
|
||||||
private val tags = mutableSetOf<String>()
|
private val tags = mutableSetOf<String>()
|
||||||
|
|
||||||
@@ -192,7 +191,6 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
|
|||||||
app.apply {
|
app.apply {
|
||||||
// Check whether app is installed or not
|
// Check whether app is installed or not
|
||||||
isInstalled = PackageUtil.isInstalled(requireContext(), app.packageName)
|
isInstalled = PackageUtil.isInstalled(requireContext(), app.packageName)
|
||||||
uninstallActionEnabled = isInstalled
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the basic app details, while the rest of the data is being fetched
|
// Show the basic app details, while the rest of the data is being fetched
|
||||||
@@ -227,6 +225,8 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
|
|||||||
|
|
||||||
// Fetch Exodus Privacy Report
|
// Fetch Exodus Privacy Report
|
||||||
viewModel.fetchAppReport(app.packageName)
|
viewModel.fetchAppReport(app.packageName)
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toast(getString(R.string.status_unavailable))
|
toast(getString(R.string.status_unavailable))
|
||||||
// TODO: Redirect to App Unavailable Fragment
|
// TODO: Redirect to App Unavailable Fragment
|
||||||
@@ -402,11 +402,10 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear Menu, so that it clears the previous menu items before inflating new ones
|
if (menu.size() == 0) {
|
||||||
menu.clear()
|
// Inflate Menu only if it is not already inflated
|
||||||
|
inflateMenu(R.menu.menu_details)
|
||||||
// Inflate Menu
|
}
|
||||||
inflateMenu(R.menu.menu_details)
|
|
||||||
|
|
||||||
// Adjust Menu Items
|
// Adjust Menu Items
|
||||||
menu.let {
|
menu.let {
|
||||||
@@ -697,10 +696,6 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!uninstallActionEnabled) {
|
|
||||||
binding.layoutDetailsToolbar.toolbar.invalidateMenu()
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (downloadStatus in DownloadStatus.running) {
|
if (downloadStatus in DownloadStatus.running) {
|
||||||
updateProgress(-1)
|
updateProgress(-1)
|
||||||
@@ -732,10 +727,6 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
|
|||||||
startDownload()
|
startDownload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uninstallActionEnabled) {
|
|
||||||
binding.layoutDetailsToolbar.toolbar.invalidateMenu()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user