|
|
@ -5,6 +5,7 @@ import android.view.LayoutInflater |
|
|
|
import android.view.View |
|
|
|
import android.view.View |
|
|
|
import android.view.ViewGroup |
|
|
|
import android.view.ViewGroup |
|
|
|
import android.widget.PopupMenu |
|
|
|
import android.widget.PopupMenu |
|
|
|
|
|
|
|
import com.google.android.flexbox.FlexboxLayout |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
import io.legado.app.base.adapter.RecyclerAdapter |
|
|
|
import io.legado.app.base.adapter.RecyclerAdapter |
|
|
@ -56,18 +57,18 @@ class ExploreAdapter(context: Context, private val scope: CoroutineScope, val ca |
|
|
|
item.getExploreKinds() |
|
|
|
item.getExploreKinds() |
|
|
|
}.onSuccess { kindList -> |
|
|
|
}.onSuccess { kindList -> |
|
|
|
if (!kindList.isNullOrEmpty()) { |
|
|
|
if (!kindList.isNullOrEmpty()) { |
|
|
|
glChild.visible() |
|
|
|
flexbox.visible() |
|
|
|
glChild.removeAllViews() |
|
|
|
flexbox.removeAllViews() |
|
|
|
kindList.map { kind -> |
|
|
|
kindList.map { kind -> |
|
|
|
val tv = ItemFilletTextBinding.inflate( |
|
|
|
val tv = ItemFilletTextBinding.inflate( |
|
|
|
LayoutInflater.from(context), |
|
|
|
LayoutInflater.from(context), |
|
|
|
glChild, |
|
|
|
flexbox, |
|
|
|
false |
|
|
|
false |
|
|
|
) |
|
|
|
).root |
|
|
|
glChild.addView(tv.root) |
|
|
|
flexbox.addView(tv) |
|
|
|
tv.textView.text = kind.title |
|
|
|
tv.text = kind.title |
|
|
|
if (!kind.url.isNullOrEmpty()) { |
|
|
|
if (!kind.url.isNullOrEmpty()) { |
|
|
|
tv.textView.setOnClickListener { |
|
|
|
tv.setOnClickListener { |
|
|
|
callBack.openExplore( |
|
|
|
callBack.openExplore( |
|
|
|
item.bookSourceUrl, |
|
|
|
item.bookSourceUrl, |
|
|
|
kind.title, |
|
|
|
kind.title, |
|
|
@ -75,6 +76,10 @@ class ExploreAdapter(context: Context, private val scope: CoroutineScope, val ca |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
val lp = tv.layoutParams as FlexboxLayout.LayoutParams |
|
|
|
|
|
|
|
lp.let { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}.onFinally { |
|
|
|
}.onFinally { |
|
|
@ -87,7 +92,7 @@ class ExploreAdapter(context: Context, private val scope: CoroutineScope, val ca |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
binding.ivStatus.setImageResource(R.drawable.ic_arrow_right) |
|
|
|
binding.ivStatus.setImageResource(R.drawable.ic_arrow_right) |
|
|
|
binding.rotateLoading.hide() |
|
|
|
binding.rotateLoading.hide() |
|
|
|
binding.glChild.gone() |
|
|
|
binding.flexbox.gone() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|