Add missing app info extras
This commit is contained in:
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* 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.details
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import com.airbnb.epoxy.ModelProp
|
||||||
|
import com.airbnb.epoxy.ModelView
|
||||||
|
import com.airbnb.epoxy.OnViewRecycled
|
||||||
|
import com.aurora.store.R
|
||||||
|
import com.aurora.store.databinding.ViewInfoBinding
|
||||||
|
import com.aurora.store.view.epoxy.views.BaseView
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
@ModelView(
|
||||||
|
autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
|
||||||
|
baseModelClass = BaseView::class
|
||||||
|
)
|
||||||
|
class InfoView : RelativeLayout {
|
||||||
|
|
||||||
|
private lateinit var B: ViewInfoBinding
|
||||||
|
|
||||||
|
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_info, this)
|
||||||
|
B = ViewInfoBinding.bind(view)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModelProp
|
||||||
|
fun badge(info: Map.Entry<String, String>) {
|
||||||
|
B.txtTitle.text = info.key
|
||||||
|
.replace("_", " ")
|
||||||
|
.toLowerCase(Locale.getDefault())
|
||||||
|
.capitalize(Locale.getDefault())
|
||||||
|
B.txtSubtitle.text = info.value
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnViewRecycled
|
||||||
|
fun clear() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,8 +33,10 @@ import com.aurora.store.view.epoxy.views.HeaderViewModel_
|
|||||||
import com.aurora.store.view.epoxy.views.app.NoAppAltViewModel_
|
import com.aurora.store.view.epoxy.views.app.NoAppAltViewModel_
|
||||||
import com.aurora.store.view.epoxy.views.details.AppDependentViewModel_
|
import com.aurora.store.view.epoxy.views.details.AppDependentViewModel_
|
||||||
import com.aurora.store.view.epoxy.views.details.FileViewModel_
|
import com.aurora.store.view.epoxy.views.details.FileViewModel_
|
||||||
|
import com.aurora.store.view.epoxy.views.details.InfoViewModel_
|
||||||
import com.aurora.store.view.epoxy.views.details.MoreBadgeViewModel_
|
import com.aurora.store.view.epoxy.views.details.MoreBadgeViewModel_
|
||||||
import com.aurora.store.view.ui.commons.BaseActivity
|
import com.aurora.store.view.ui.commons.BaseActivity
|
||||||
|
import com.google.protobuf.MapEntry
|
||||||
import nl.komponents.kovenant.task
|
import nl.komponents.kovenant.task
|
||||||
import nl.komponents.kovenant.ui.failUi
|
import nl.komponents.kovenant.ui.failUi
|
||||||
import nl.komponents.kovenant.ui.successUi
|
import nl.komponents.kovenant.ui.successUi
|
||||||
@@ -135,6 +137,21 @@ class DetailsMoreActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (app.appInfo.appInfoMap.isNotEmpty()){
|
||||||
|
add(
|
||||||
|
HeaderViewModel_()
|
||||||
|
.id("info_header")
|
||||||
|
.title("Info")
|
||||||
|
)
|
||||||
|
app.appInfo.appInfoMap.forEach{
|
||||||
|
add(
|
||||||
|
InfoViewModel_()
|
||||||
|
.id(it.key)
|
||||||
|
.badge(it)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
51
app/src/main/res/layout/view_info.xml
Normal file
51
app/src/main/res/layout/view_info.xml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?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"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minWidth="72dp"
|
||||||
|
android:padding="@dimen/padding_small">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:weightSum="2"
|
||||||
|
tools:ignore="UselessParent">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/txt_title"
|
||||||
|
style="@style/AuroraTextStyle.Line1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
tools:text="Title" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/txt_subtitle"
|
||||||
|
style="@style/AuroraTextStyle.Line2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textAlignment="viewEnd"
|
||||||
|
tools:text="Subtitle" />
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
||||||
Reference in New Issue
Block a user