-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from gatheringhallstudios/talisman-bank
Talisman bank features and swipe to delete
- Loading branch information
Showing
60 changed files
with
1,837 additions
and
999 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/src/main/java/com/ghstudios/android/ClickListeners/ASBSetClickListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.ghstudios.android.ClickListeners | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.view.View | ||
import com.ghstudios.android.features.armorsetbuilder.detail.ASBDetailPagerActivity | ||
import com.ghstudios.android.features.armorsetbuilder.list.ASBSetListFragment | ||
|
||
/** | ||
* Click listener used to navigate to an armor set. | ||
*/ | ||
class ASBSetClickListener( | ||
val context: Context, | ||
val id: Long | ||
) : View.OnClickListener { | ||
|
||
override fun onClick(v: View?) { | ||
val i = Intent(context, ASBDetailPagerActivity::class.java) | ||
i.putExtra(ASBSetListFragment.EXTRA_ASB_SET_ID, id) | ||
context.startActivity(i) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/ghstudios/android/adapter/common/SwipeReorderTouchHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.ghstudios.android.adapter.common | ||
|
||
import android.support.v7.widget.RecyclerView | ||
import android.support.v7.widget.helper.ItemTouchHelper | ||
|
||
/** | ||
* ItemTouchHelper used to add swipe and reorder functionality to recyclerviews. | ||
*/ | ||
class SwipeReorderTouchHelper( | ||
val afterSwiped: (position: RecyclerView.ViewHolder) -> Unit | ||
) : ItemTouchHelper.SimpleCallback( | ||
0, //ItemTouchHelper.UP or ItemTouchHelper.DOWN, | ||
ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT | ||
) { | ||
override fun onMove(recyclerView: RecyclerView?, viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | ||
// Called every time order is swapped mid-drag. | ||
// Update the recyclerview's backing data but don't actually call onMove until done (different callback) | ||
val originalIdx = viewHolder.adapterPosition | ||
val targetIdx = target.adapterPosition | ||
//Log.d("SWIPE", "MOVED $originalIdx to $targetIdx") | ||
// todo: actually implement | ||
//return true | ||
return false | ||
} | ||
|
||
/** | ||
* Callback called every time an item has been swiped away | ||
*/ | ||
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { | ||
afterSwiped(viewHolder) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.