-
Notifications
You must be signed in to change notification settings - Fork 18
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 #120 from AlanCheen/demo
Demo
- Loading branch information
Showing
67 changed files
with
959 additions
and
1,108 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
100 changes: 100 additions & 0 deletions
100
app/src/main/java/me/yifeiyuan/flapdev/ConfigMenuView.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,100 @@ | ||
package me.yifeiyuan.flapdev | ||
|
||
import android.content.Context | ||
import android.view.LayoutInflater | ||
import android.widget.FrameLayout | ||
import android.widget.SeekBar | ||
import androidx.recyclerview.widget.RecyclerView | ||
import me.yifeiyuan.flapdev.databinding.DebugMenuBinding | ||
|
||
/** | ||
* Created by 程序亦非猿 on 2022/10/11. | ||
*/ | ||
class ConfigMenuView : FrameLayout { | ||
|
||
constructor(context: Context) : super(context) | ||
|
||
private val binding: DebugMenuBinding = DebugMenuBinding.inflate(LayoutInflater.from(context), this, true) | ||
|
||
init { | ||
|
||
binding.orientationGroup.setOnCheckedChangeListener { group, checkedId -> | ||
when (checkedId) { | ||
R.id.horizontal -> { | ||
callback?.onOrientationChanged(RecyclerView.HORIZONTAL) | ||
} | ||
R.id.vertical -> { | ||
callback?.onOrientationChanged(RecyclerView.VERTICAL) | ||
} | ||
} | ||
} | ||
|
||
//0 Linear | ||
//1 Grid | ||
//2 Staggered | ||
//3 IndexedStaggered | ||
binding.layoutManagerGroup.setOnCheckedChangeListener { group, checkedId -> | ||
when (checkedId) { | ||
R.id.linear -> { | ||
callback?.onLayoutManagerChanged(0) | ||
} | ||
R.id.grid -> { | ||
callback?.onLayoutManagerChanged(1) | ||
} | ||
R.id.staggered -> { | ||
callback?.onLayoutManagerChanged(2) | ||
} | ||
R.id.indexedStaggered -> { | ||
callback?.onLayoutManagerChanged(3) | ||
} | ||
} | ||
} | ||
|
||
binding.clearAll.setOnClickListener { | ||
callback?.onClearAllData() | ||
} | ||
binding.addTopData.setOnClickListener { | ||
callback?.onAddDataToTop() | ||
} | ||
binding.resetData.setOnClickListener { | ||
callback?.onResetData() | ||
} | ||
binding.appendData.setOnClickListener { | ||
callback?.onAppendData() | ||
} | ||
binding.addZeroHeightData.setOnClickListener { | ||
callback?.onAddZeroHeightData() | ||
} | ||
|
||
binding.spanCount.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { | ||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { | ||
} | ||
|
||
override fun onStartTrackingTouch(seekBar: SeekBar) { | ||
} | ||
|
||
override fun onStopTrackingTouch(seekBar: SeekBar) { | ||
callback?.onSpanCountChanged(seekBar.progress) | ||
} | ||
}) | ||
|
||
binding.toggleSkeleton.setOnCheckedChangeListener { buttonView, isChecked -> | ||
callback?.onSkeletonVisibilityChanged(isChecked) | ||
} | ||
} | ||
|
||
var callback: Callback? = null | ||
|
||
interface Callback { | ||
fun onOrientationChanged(orientation: Int) | ||
fun onLayoutManagerChanged(type: Int) | ||
fun onPreloadChanged(direction: Int, enable: Boolean) | ||
fun onClearAllData() | ||
fun onAddDataToTop() | ||
fun onResetData() | ||
fun onAppendData() | ||
fun onSpanCountChanged(spanCount: Int) | ||
fun onSkeletonVisibilityChanged(show: Boolean) | ||
fun onAddZeroHeightData() | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package me.yifeiyuan.flapdev | ||
|
||
/** | ||
* Created by 程序亦非猿 on 2022/10/11. | ||
*/ | ||
interface IMenuView { | ||
fun showMenu() | ||
} |
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.