Compare commits

..

2 Commits

  1. 4
      app/src/main/java/sushi/hardcore/droidfs/adapters/IconTextDialogAdapter.kt
  2. 3
      app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt
  3. 5
      app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt
  4. 4
      app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityDrop.kt
  5. 4
      app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityPick.kt

4
app/src/main/java/sushi/hardcore/droidfs/adapters/IconTextDialogAdapter.kt

@ -7,7 +7,7 @@ import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.ContextCompat
import sushi.hardcore.droidfs.R
open class IconTextDialogAdapter(private val context: Context): BaseAdapter() {
@ -19,7 +19,7 @@ open class IconTextDialogAdapter(private val context: Context): BaseAdapter() {
val text = view.findViewById<TextView>(R.id.text)
text.text = context.getString(items[position][1] as Int)
val icon = view.findViewById<ImageView>(R.id.icon)
icon.setImageDrawable(AppCompatResources.getDrawable(context, items[position][2] as Int))
icon.setImageDrawable(ContextCompat.getDrawable(context, items[position][2] as Int))
return view
}

3
app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt

@ -497,7 +497,7 @@ open class BaseExplorerActivity : BaseActivity(), ExplorerElementAdapter.Listene
}
}
protected fun handleMenuItems(menu: Menu){
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menu.findItem(R.id.rename).isVisible = false
menu.findItem(R.id.open_as)?.isVisible = false
if (usf_open){
@ -522,6 +522,7 @@ open class BaseExplorerActivity : BaseActivity(), ExplorerElementAdapter.Listene
}
}
}
return super.onCreateOptionsMenu(menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {

5
app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt

@ -258,11 +258,12 @@ class ExplorerActivity : BaseExplorerActivity() {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.explorer, menu)
val result = super.onCreateOptionsMenu(menu)
if (currentItemAction != ItemsActions.NONE) {
menu.findItem(R.id.validate).isVisible = true
menu.findItem(R.id.close).isVisible = false
supportActionBar?.setDisplayHomeAsUpEnabled(true)
} else {
handleMenuItems(menu)
if (usf_share){
menu.findItem(R.id.share).isVisible = false
}
@ -285,7 +286,7 @@ class ExplorerActivity : BaseExplorerActivity() {
}
}
}
return true
return result
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {

4
app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityDrop.kt

@ -21,9 +21,9 @@ class ExplorerActivityDrop : BaseExplorerActivity() {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.explorer_drop, menu)
handleMenuItems(menu)
val result = super.onCreateOptionsMenu(menu)
menu.findItem(R.id.validate).isVisible = explorerAdapter.selectedItems.isEmpty()
return true
return result
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {

4
app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityPick.kt

@ -45,11 +45,11 @@ class ExplorerActivityPick : BaseExplorerActivity() {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.explorer_pick, menu)
handleMenuItems(menu)
val result = super.onCreateOptionsMenu(menu)
val anyItemSelected = explorerAdapter.selectedItems.isNotEmpty()
menu.findItem(R.id.select_all).isVisible = anyItemSelected
menu.findItem(R.id.validate).isVisible = anyItemSelected
return true
return result
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {

Loading…
Cancel
Save