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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user