Skip to content

Commit

Permalink
add support for setting default pack, show when no icon packs are ins…
Browse files Browse the repository at this point in the history
…talled
  • Loading branch information
Peketr committed Mar 4, 2023
1 parent 4dc3988 commit b075ecf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "com.huep.asusiconpackapplyer"
minSdk 30
targetSdk 33
versionCode 2
versionName "1.1"
versionCode 3
versionName "1.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class IconPackListAdapter(private val context: Activity, private val _package: A
val imageView = rowView.findViewById(R.id.icon) as ImageView
val subtitleText = rowView.findViewById(R.id.description) as TextView

titleText.text = getName(_package[position])
if (_package[position].packageName == "com.asus.launcher")
titleText.text = "Default Icons"
else
titleText.text = getName(_package[position])
val icon = _package[position].loadIcon(getContext().packageManager)
imageView.setImageDrawable(icon)
subtitleText.text = _package[position].packageName
Expand Down
12 changes: 9 additions & 3 deletions app/src/main/java/com/huep/asusiconpackapplyer/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.huep.asusiconpackapplyer

import android.annotation.SuppressLint
import android.content.ActivityNotFoundException
import android.content.Intent
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.os.Bundle
import android.view.View
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.ListView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -39,10 +37,18 @@ class MainActivity : AppCompatActivity() {
val listView = findViewById<ListView>(R.id.listview)

for (packageInfo in packages) {
if (isIconPack(packageInfo)){
if (isIconPack(packageInfo) || packageInfo.packageName.contains("com.asus.launcher")){
packItems.add(packageInfo)
}
}

if (packItems.size == 0){
var placeholder = ApplicationInfo()
placeholder.packageName="No Icon Packs installed"
packItems.add(placeholder)

}

listView.adapter = IconPackListAdapter(this,packItems)
(listView.adapter as IconPackListAdapter).notifyDataSetChanged()

Expand Down

0 comments on commit b075ecf

Please sign in to comment.