refactor: remove image tag
This commit is contained in:
@@ -76,12 +76,6 @@ class ImageFragment : Fragment() {
|
||||
}
|
||||
true
|
||||
}
|
||||
R.id.tags_menu_btn -> {
|
||||
val tagBottomSheet = TagBottomSheet(post?.tags)
|
||||
tagBottomSheet.show(activityContext.supportFragmentManager,TagBottomSheet.TAG)
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
else -> {false}
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.lsp.view.ui.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.flexbox.FlexDirection
|
||||
import com.google.android.flexbox.FlexWrap
|
||||
import com.google.android.flexbox.FlexboxLayoutManager
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import com.lsp.view.R
|
||||
import com.lsp.view.ui.activity.MainActivity
|
||||
import com.lsp.view.ui.fragment.adapter.TagsAdapter
|
||||
|
||||
class TagBottomSheet(val tags:String?): BottomSheetDialogFragment() {
|
||||
private val activityContext : MainActivity by lazy {
|
||||
requireActivity() as MainActivity
|
||||
}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
return inflater.inflate(R.layout.fragment_bottom_sheet, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val tagList = view.findViewById<RecyclerView>(R.id.tag_list)
|
||||
// val layoutManager = LinearLayoutManager(activityContext)
|
||||
val flManager = FlexboxLayoutManager(activityContext)
|
||||
flManager.flexWrap = FlexWrap.WRAP
|
||||
flManager.flexDirection = FlexDirection.ROW
|
||||
|
||||
Log.e(TAG,tags.toString())
|
||||
val split = tags?.split(" ")?.toList()
|
||||
if (split!=null){
|
||||
val adapter = TagsAdapter(split)
|
||||
tagList.layoutManager = flManager
|
||||
tagList.adapter = adapter
|
||||
}
|
||||
|
||||
}
|
||||
companion object {
|
||||
const val TAG = "TagBottomSheet"
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/standard_bottom_sheet"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/tag_list"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -10,10 +10,6 @@
|
||||
android:title="@string/title_collect"
|
||||
android:icon="@drawable/ic_baseline_favorite_24"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item android:id="@+id/tags_menu_btn"
|
||||
android:title="@string/tags"
|
||||
android:icon="@drawable/ic_baseline_label_24"
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
|
||||
</menu>
|
||||
Reference in New Issue
Block a user