Allow staring any Gist
Don't remove delete option if not owner, only hide it.
@@ -205,19 +205,15 @@ class GistFragment : BaseFragment(), OnItemClickListener, DialogResultListener {
override fun onPrepareOptionsMenu(menu: Menu) {
super.onPrepareOptionsMenu(menu)
- val owner = isOwner
- if (!owner) {
- menu.removeItem(R.id.m_delete)
+ menu.findItem(R.id.m_delete).isVisible = isOwner
+
val starItem = menu.findItem(R.id.m_star)
- starItem.isEnabled = loadFinished && !owner
+ starItem.isEnabled = loadFinished
if (starred) {
starItem.setTitle(R.string.unstar)
} else {
starItem.setTitle(R.string.star)
}
- } else {
- menu.removeItem(R.id.m_star)
- }
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
