Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
Cleaned up log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
DreierF committed Jan 12, 2018
1 parent c2152ea commit a490dca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import de.dreier.mytargets.shared.models.IRecursiveModel
import de.dreier.mytargets.utils.multiselector.MultiSelector
import de.dreier.mytargets.utils.multiselector.OnItemLongClickListener
import de.dreier.mytargets.utils.multiselector.SelectableViewHolder
import timber.log.Timber

/**
* @param <T> Model of the item which is managed within the fragment.
Expand All @@ -45,8 +44,8 @@ abstract class EditableListFragmentBase<T, U : ListAdapterBase<*, T>> : ListFrag

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Timber.d("onCreate: %b", selector.selectable)

// Restore action mode after fragment recreation
if(savedInstanceState != null) {
selector.restoreSelectionStates(savedInstanceState.getBundle(KEY_SELECTOR)!!)
if(selector.selectable) {
Expand Down Expand Up @@ -101,11 +100,8 @@ abstract class EditableListFragmentBase<T, U : ListAdapterBase<*, T>> : ListFrag
}

override fun onClick(holder: SelectableViewHolder<T>, item: T?) {
Timber.d("onClick: ")
if (!actionModeCallback!!.click(holder)) {
Timber.d("item: ")
if (item != null) {
Timber.d("onSelected: ")
onSelected(item)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import android.view.MenuItem
import de.dreier.mytargets.R
import de.dreier.mytargets.utils.multiselector.MultiSelector
import de.dreier.mytargets.utils.multiselector.SelectableViewHolder
import timber.log.Timber


typealias EditCallback = (Long) -> Unit
Expand Down Expand Up @@ -57,7 +56,6 @@ class ItemActionModeCallback(
}

override fun onCreateActionMode(mode: ActionMode, menu: Menu): Boolean {
Timber.d("onCreateActionMode")
selector.selectable = true
actionMode = mode
mode.menuInflater.inflate(R.menu.context_menu_edit_delete, menu)
Expand Down Expand Up @@ -87,16 +85,13 @@ class ItemActionModeCallback(
}

override fun onDestroyActionMode(mode: ActionMode) {
Timber.d("onDestroyActionMode")
selector.selectable = false
selector.clearSelections()
actionMode = null
}

fun longClick(holder: SelectableViewHolder<*>) {
Timber.d("longClick")
if (actionMode == null) {
Timber.d("startActionMode")
val activity = fragment.getActivity() as AppCompatActivity?
activity!!.startSupportActionMode(this)
}
Expand All @@ -105,7 +100,6 @@ class ItemActionModeCallback(
}

fun restartActionMode() {
Timber.d("restartActionMode")
val activity = fragment.getActivity() as AppCompatActivity?
activity!!.startSupportActionMode(this)
updateTitle()
Expand All @@ -115,7 +109,6 @@ class ItemActionModeCallback(
* Returns true if the click has been handled.
*/
fun click(holder: SelectableViewHolder<*>): Boolean {
Timber.d("IAMC#click")
if (selector.tapSelection(holder)) {
updateTitle()
return true
Expand All @@ -124,7 +117,6 @@ class ItemActionModeCallback(
}

private fun updateTitle() {
Timber.d("updateTitle")
if (actionMode == null) {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class MultiSelector : SelectorBase() {
private val selections = HashSet<Long>()

val selectedItemCount: Int
get() = selections.size
get() = selections.size

val selectedIds: ArrayList<Long>
get() = ArrayList(selections)
val selectedIds: List<Long>
get() = selections.toList()

override fun setSelected(id: Long, isSelected: Boolean) {
if (isSelected) {
Expand Down

0 comments on commit a490dca

Please sign in to comment.