Skip to content

Commit

Permalink
Add support for square home launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
jahirfiquitiva committed Jun 7, 2020
1 parent 741148c commit 28946e9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/src/main/res/values/supported_launchers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<item>smart</item>
<item>smartpro</item>
<item>solo</item>
<item>square</item>
<item>tsf</item>
</string-array>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ enum class Launcher(
R.drawable.ic_smart_pro
),
SOLO("solo", "Solo Launcher", arrayOf("home.solo.launcher.free"), R.drawable.ic_solo),
SQUARE(
"square",
"Square Home Launcher",
arrayOf("com.ss.squarehome2"),
R.drawable.ic_square_home
),
TSF("tsf", "TSF Launcher", arrayOf("com.tsf.shell"), R.drawable.ic_tsf);

val cleanAppName: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ fun Context.executeLauncherIntent(launcher: Launcher?) {
Launcher.SMART -> executeSmartLauncherIntent()
Launcher.SMART_PRO -> executeSmartLauncherProIntent()
Launcher.SOLO -> executeSoloLauncherIntent()
Launcher.SQUARE -> executeSquareHomeIntent()
Launcher.TSF -> executeTsfLauncherIntent()
else -> showLauncherApplyError()
}
Expand Down Expand Up @@ -245,7 +246,10 @@ private fun Context.executeNovaLauncherIntent() {
private fun Context.executeOnePlusLauncherIntent() {
attemptApply {
Intent().apply {
component = ComponentName("net.oneplus.launcher", "net.oneplus.launcher.IconPackSelectorActivity")
component = ComponentName(
"net.oneplus.launcher",
"net.oneplus.launcher.IconPackSelectorActivity"
)
}
}
}
Expand Down Expand Up @@ -286,6 +290,16 @@ private fun Context.executeSoloLauncherIntent() {
}
}

private fun Context.executeSquareHomeIntent() {
attemptApply {
Intent("com.ss.squarehome2.ACTION_APPLY_ICONPACK").apply {
component =
ComponentName.unflattenFromString("com.ss.squarehome2/.ApplyThemeActivity")
putExtra("com.ss.squarehome2.EXTRA_ICONPACK", packageName)
}
}
}

private fun Context.executeTsfLauncherIntent() {
attemptApply {
packageManager.getLaunchIntentForPackage("com.tsf.shell").also {
Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values/supported_launchers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<item>smart</item>
<item>smartpro</item>
<item>solo</item>
<item>square</item>
<item>tsf</item>
</string-array>
</resources>

0 comments on commit 28946e9

Please sign in to comment.