mirror of
https://github.com/IllusionMan1212/NPS-Browser.git
synced 2026-10-24 02:12:37 +00:00
Stylize apps list and single app activities (not the final look ofc)
This commit is contained in:
@@ -24,6 +24,10 @@
|
||||
tools:ignore="LockedOrientationActivity">
|
||||
</activity>
|
||||
<activity android:name=".activities.AppsListActivity" />
|
||||
<activity
|
||||
android:name=".activities.SingleAppActivity"
|
||||
android:screenOrientation="portrait"
|
||||
tools:ignore="LockedOrientationActivity" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,5 +1,5 @@
|
||||
package com.illusionware.npsbrowser
|
||||
|
||||
data class AppData(val TitleID: String?, val Region: String?, val Title : String?, val link : String?,
|
||||
data class AppData(val titleID: String?, val region: String?, val title : String?, val link : String?,
|
||||
val license : String?, val contentID : String?, val lastDateTime: String?,
|
||||
val fileSize : Number?, val SHA256 : String?, val minFW : String?)
|
||||
val fileSize : Number?, val sha256 : String?, val minFW : String?)
|
||||
@@ -21,10 +21,10 @@ class AppsListActivity : AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val binding = ActivityAppsListBinding.inflate(layoutInflater);
|
||||
val binding = ActivityAppsListBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
viewAdapter = AppAdapter(apps)
|
||||
viewAdapter = AppAdapter(apps, applicationContext)
|
||||
|
||||
recyclerView = binding.appsRecycler
|
||||
recyclerView.apply {
|
||||
|
||||
@@ -86,7 +86,7 @@ class MainActivity : AppCompatActivity() {
|
||||
fileSize ?: 0, sha256 ?: "MISSING", minFW)
|
||||
apps.add(app)
|
||||
}
|
||||
apps.sortBy { it.Title }
|
||||
apps.sortBy { it.title }
|
||||
AppsListActivity.apps = apps
|
||||
startActivity(myIntent)
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ class SingleAppActivity: AppCompatActivity() {
|
||||
}
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val binding = ActivitySingleAppBinding.inflate(layoutInflater);
|
||||
val binding = ActivitySingleAppBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
binding.titleID.text = app.TitleID
|
||||
binding.gameTitle.text = app.Title;
|
||||
binding.titleID.text = app.titleID
|
||||
binding.gameTitle.text = app.title
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,23 @@
|
||||
package com.illusionware.npsbrowser.adapters
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.illusionware.npsbrowser.AppData
|
||||
import com.illusionware.npsbrowser.R
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class AppAdapter(private val appsList: ArrayList<AppData>) : RecyclerView.Adapter<AppAdapter.ViewHolder>() {
|
||||
class AppAdapter(private val appsList: ArrayList<AppData>, val context : Context) : RecyclerView.Adapter<AppAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
var appTitle: TextView = view.findViewById(R.id.appItem)
|
||||
var appTitle: TextView = view.findViewById(R.id.appTitle)
|
||||
var appRegion: TextView = view.findViewById(R.id.appRegion)
|
||||
var appMinFW: TextView = view.findViewById(R.id.appMinFW)
|
||||
var appLastDate: TextView = view.findViewById(R.id.appLastDate)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
@@ -19,7 +25,16 @@ class AppAdapter(private val appsList: ArrayList<AppData>) : RecyclerView.Adapte
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
holder.appTitle.text = appsList[position].Title
|
||||
holder.appTitle.text = appsList[position].title
|
||||
holder.appRegion.text = appsList[position].region
|
||||
holder.appMinFW.text = appsList[position].minFW
|
||||
holder.appMinFW.background = null;
|
||||
|
||||
if (holder.appMinFW.text.isNotBlank()) {
|
||||
val drawable = ResourcesCompat.getDrawable(context.resources, R.drawable.rect_red, null)
|
||||
holder.appMinFW.background = drawable;
|
||||
}
|
||||
holder.appLastDate.text = appsList[position].lastDateTime
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<stroke android:width="2dip" android:color="#4fa5d5"/>
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<stroke android:width="2dip" android:color="@android:color/holo_red_dark"/>
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
@@ -1,11 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/appsRecycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="vertical" />
|
||||
android:scrollbars="vertical"
|
||||
tools:listitem="@layout/list_item" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -2,6 +2,7 @@
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
@@ -9,34 +10,57 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
android:padding="0dp">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:contentPadding="20dp">
|
||||
app:cardBackgroundColor="@color/colorPrimary"
|
||||
app:cardElevation="4dp"
|
||||
app:cardUseCompatPadding="false"
|
||||
app:contentPadding="15dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/appItem"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/appRegion"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="64dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:background="@drawable/rect_light_blue"
|
||||
android:paddingStart="4dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:text="US"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/colorOnSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/appMinFW"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/appTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:ellipsize="marquee"
|
||||
android:focusable="auto"
|
||||
android:focusableInTouchMode="true"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:padding="10dp"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
android:text="Placeholder"
|
||||
android:textAlignment="viewStart"
|
||||
android:textSize="24sp"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:textColor="@color/colorOnPrimary"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
@@ -44,10 +68,32 @@
|
||||
android:layout_width="62dp"
|
||||
android:layout_height="56dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/appItem"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_games_black_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/appMinFW"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:background="@drawable/rect_red"
|
||||
android:padding="4dp"
|
||||
android:text="3.60"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/colorOnSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/appRegion" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/appLastDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="2020-5-5"
|
||||
android:textColor="@color/colorOnSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
Reference in New Issue
Block a user