You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SmsForwarder/app/src/main/java/com/idormy/sms/forwarder/adapter/spinner/AppListAdapterItem.kt

46 lines
1.3 KiB
Kotlin

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.idormy.sms.forwarder.adapter.spinner
import android.graphics.drawable.Drawable
import com.xuexiang.xui.utils.ResUtils
@Suppress("unused")
class AppListAdapterItem {
var name: String = ""
var icon: Drawable? = null
var packageName: String? = null
//var packagePath: String? = null
//var versionName: String? = null
//var versionCode: Int = 0
//var isSystem: Boolean = false
constructor(name: String, icon: Drawable?, packageName: String?) {
this.name = name
this.icon = icon
this.packageName = packageName
}
constructor(name: String) : this(name, null, null)
constructor(name: String, drawableId: Int, packageName: String) : this(name, ResUtils.getDrawable(drawableId), packageName)
//TODO:注意自定义实体需要重写对象的toString方法
override fun toString(): String {
return name
}
companion object {
fun of(name: String): AppListAdapterItem {
return AppListAdapterItem(name)
}
fun arrayof(title: Array<String>): Array<AppListAdapterItem?> {
val array = arrayOfNulls<AppListAdapterItem>(title.size)
for (i in array.indices) {
array[i] = AppListAdapterItem(title[i])
}
return array
}
}
}