Add EditorChoice apps bulletins & description
This commit is contained in:
@@ -172,7 +172,7 @@ dependencies {
|
||||
implementation "com.github.topjohnwu.libsu:core:${versions.libsu}"
|
||||
|
||||
//Love <3
|
||||
api("com.gitlab.AuroraOSS:gplayapi:d7ebd3855a")
|
||||
api("com.gitlab.AuroraOSS:gplayapi:bac20177ce")
|
||||
}
|
||||
|
||||
Properties props = new Properties()
|
||||
|
||||
@@ -30,13 +30,10 @@ import com.aurora.store.view.epoxy.views.EditorImageViewModel_
|
||||
class EditorChoiceModelGroup(
|
||||
editorChoiceCluster: EditorChoiceCluster,
|
||||
callbacks: EditorChoiceController.Callbacks
|
||||
) :
|
||||
EpoxyModelGroup(
|
||||
R.layout.model_editorchoice_group, buildModels(
|
||||
editorChoiceCluster,
|
||||
callbacks
|
||||
)
|
||||
) {
|
||||
) : EpoxyModelGroup(
|
||||
R.layout.model_editorchoice_group,
|
||||
buildModels(editorChoiceCluster, callbacks)
|
||||
) {
|
||||
companion object {
|
||||
private fun buildModels(
|
||||
editorChoiceCluster: EditorChoiceCluster,
|
||||
@@ -61,6 +58,7 @@ class EditorChoiceModelGroup(
|
||||
EditorHeadViewModel_()
|
||||
.id("header_${idPrefix}")
|
||||
.title(editorChoiceCluster.clusterTitle)
|
||||
.click { _ -> callbacks.onClick(editorChoiceCluster) }
|
||||
)
|
||||
|
||||
editorChoiceCluster.clusterArtwork
|
||||
|
||||
@@ -22,6 +22,8 @@ package com.aurora.store.view.epoxy.views
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.core.text.HtmlCompat
|
||||
import com.airbnb.epoxy.CallbackProp
|
||||
import com.airbnb.epoxy.ModelProp
|
||||
import com.airbnb.epoxy.ModelView
|
||||
import com.aurora.store.R
|
||||
@@ -56,6 +58,11 @@ class EditorHeadView : RelativeLayout {
|
||||
B = ViewEditorHeadBinding.bind(view)
|
||||
}
|
||||
|
||||
@CallbackProp
|
||||
fun click(onClickListener: OnClickListener?) {
|
||||
B.root.setOnClickListener(onClickListener)
|
||||
}
|
||||
|
||||
@ModelProp
|
||||
fun title(title: String) {
|
||||
B.title.text = title
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Aurora Store
|
||||
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
|
||||
*
|
||||
* Aurora Store is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Aurora Store is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.aurora.store.view.epoxy.views
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.RelativeLayout
|
||||
import com.airbnb.epoxy.ModelView
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.databinding.ViewDividerBinding
|
||||
|
||||
@ModelView(
|
||||
autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
|
||||
baseModelClass = BaseView::class
|
||||
)
|
||||
class HorizontalDividerView : RelativeLayout {
|
||||
|
||||
private lateinit var B: ViewDividerBinding
|
||||
|
||||
constructor(context: Context?) : super(context) {
|
||||
init(context, null)
|
||||
}
|
||||
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
|
||||
init(context, attrs)
|
||||
}
|
||||
|
||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attrs,
|
||||
defStyleAttr
|
||||
) {
|
||||
init(context, attrs)
|
||||
}
|
||||
|
||||
private fun init(context: Context?, attrs: AttributeSet?) {
|
||||
val view = inflate(context, R.layout.view_divider, this)
|
||||
B = ViewDividerBinding.bind(view)
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,8 @@ import com.aurora.gplayapi.data.models.App
|
||||
import com.aurora.store.databinding.ActivityGenericRecyclerBinding
|
||||
import com.aurora.store.util.extensions.close
|
||||
import com.aurora.store.view.epoxy.groups.CarouselHorizontalModel_
|
||||
import com.aurora.store.view.epoxy.views.EditorHeadViewModel_
|
||||
import com.aurora.store.view.epoxy.views.HorizontalDividerViewModel_
|
||||
import com.aurora.store.view.epoxy.views.app.AppListViewModel_
|
||||
import com.aurora.store.view.epoxy.views.details.MiniScreenshotView
|
||||
import com.aurora.store.view.epoxy.views.details.MiniScreenshotViewModel_
|
||||
@@ -95,10 +97,10 @@ class EditorStreamBrowseActivity : BaseActivity() {
|
||||
)
|
||||
}
|
||||
} else {
|
||||
appList.forEach {
|
||||
appList.forEach { app ->
|
||||
val screenshotsViewModels = mutableListOf<EpoxyModel<*>>()
|
||||
|
||||
for ((position, artwork) in it.screenshots.withIndex()) {
|
||||
for ((position, artwork) in app.screenshots.withIndex()) {
|
||||
screenshotsViewModels.add(
|
||||
MiniScreenshotViewModel_()
|
||||
.id(artwork.url)
|
||||
@@ -106,25 +108,54 @@ class EditorStreamBrowseActivity : BaseActivity() {
|
||||
.artwork(artwork)
|
||||
.callback(object : MiniScreenshotView.ScreenshotCallback {
|
||||
override fun onClick(position: Int) {
|
||||
openScreenshotActivity(it, position)
|
||||
openScreenshotActivity(app, position)
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
add(
|
||||
AppListViewModel_()
|
||||
.id("app_${app.id}")
|
||||
.app(app)
|
||||
.click { _ -> openDetailsActivity(app) }
|
||||
)
|
||||
|
||||
app.editorReason?.let { editorReason ->
|
||||
add(
|
||||
EditorHeadViewModel_()
|
||||
.id("bulletin_${app.id}")
|
||||
.title(
|
||||
editorReason.bulletins
|
||||
.joinToString(transform = { "\n• $it" })
|
||||
.substringAfter(delimiter = "\n")
|
||||
)
|
||||
.click { _ -> openDetailsActivity(app) }
|
||||
)
|
||||
}
|
||||
|
||||
if (screenshotsViewModels.isNotEmpty()) {
|
||||
add(
|
||||
CarouselHorizontalModel_()
|
||||
.id("${it.id}_screenshots")
|
||||
.id("screenshots_${app.id}")
|
||||
.models(screenshotsViewModels)
|
||||
)
|
||||
}
|
||||
|
||||
app.editorReason?.let { editorReason ->
|
||||
if (editorReason.description.isNotEmpty()) {
|
||||
add(
|
||||
EditorHeadViewModel_()
|
||||
.id("description_${app.id}")
|
||||
.title(editorReason.description)
|
||||
.click { _ -> openDetailsActivity(app) }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
add(
|
||||
AppListViewModel_()
|
||||
.id(it.packageName.hashCode())
|
||||
.app(it)
|
||||
.click { _ -> openDetailsActivity(it) }
|
||||
HorizontalDividerViewModel_()
|
||||
.id("divider_${app.id}")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class EditorBrowseViewModel(application: Application) : BaseAndroidViewModel(app
|
||||
streamHelper.getNextStreamResponse(browseResponse.browseTab.listUrl)
|
||||
|
||||
listResponse.itemList.forEach {
|
||||
it?.let{
|
||||
it?.let {
|
||||
it.subItemList.forEach {
|
||||
appList.addAll(streamHelper.getAppsFromItem(it))
|
||||
}
|
||||
|
||||
32
app/src/main/res/layout/view_divider.xml
Normal file
32
app/src/main/res/layout/view_divider.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Aurora Store
|
||||
~ Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
|
||||
~
|
||||
~ Aurora Store is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 2 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ Aurora Store is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/padding_small">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/title"
|
||||
android:backgroundTint="?colorControlNormal"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="2dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/divider_line" />
|
||||
</RelativeLayout>
|
||||
@@ -27,9 +27,5 @@
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:maxLines="4"
|
||||
android:singleLine="false"
|
||||
android:textAppearance="@style/TextAppearance.Aurora.Line1"
|
||||
app:drawableTint="?colorControlNormal" />
|
||||
android:layout_centerInParent="true"/>
|
||||
</RelativeLayout>
|
||||
Reference in New Issue
Block a user