Feature: App shortcuts support
This commit is contained in:
parent
62e04d09f1
commit
2ee2c9837a
@ -2,6 +2,13 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="io.neoterm">
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.software.leanback"
|
||||
android:required="false" />
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
@ -12,6 +19,7 @@
|
||||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:banner="@drawable/banner"
|
||||
android:extractNativeLibs="true"
|
||||
android:fullBackupContent="@xml/backup_config"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
@ -30,6 +38,14 @@
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.app.shortcuts"
|
||||
android:resource="@xml/app_shortcuts" />
|
||||
</activity>
|
||||
|
||||
<activity-alias
|
||||
|
@ -78,9 +78,6 @@ class AboutActivity : AppCompatActivity() {
|
||||
.setPositiveButton(R.string.support_donate_alipay, { _, _ ->
|
||||
Donation.donateByAlipay(this, "FKX025062MBLAG6E90RYBC")
|
||||
})
|
||||
.setNegativeButton(R.string.support_donate_qq, { _, _ ->
|
||||
Donation.donateByQQ(this)
|
||||
})
|
||||
.setNeutralButton(android.R.string.no, null)
|
||||
.show()
|
||||
}
|
||||
|
@ -20,15 +20,6 @@ object Donation {
|
||||
return startIntentUrl(activity, INTENT_URL_FORMAT.replace("{payCode}", payCode))
|
||||
}
|
||||
|
||||
fun donateByQQ(context: Context) {
|
||||
val qrImage = ImageView(context)
|
||||
qrImage.setImageResource(R.drawable.donation_qq)
|
||||
AlertDialog.Builder(context)
|
||||
.setView(qrImage)
|
||||
.setPositiveButton(android.R.string.yes, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun startIntentUrl(activity: Activity, intentFullUrl: String): Boolean {
|
||||
return try {
|
||||
val intent = Intent.parseUri(
|
||||
|
@ -339,10 +339,9 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection, SharedPreference
|
||||
if (!tabSwitcher.isSwitcherShown) {
|
||||
toggleSwitcher(showSwitcher = true, easterEgg = false)
|
||||
}
|
||||
val index = tabSwitcher.count
|
||||
|
||||
// Fore system shell mode to be enabled.
|
||||
addNewSession("NeoTerm #" + index, true, createRevealAnimation())
|
||||
addNewSession(null, true, createRevealAnimation())
|
||||
}
|
||||
|
||||
private fun enterMain() {
|
||||
@ -352,11 +351,19 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection, SharedPreference
|
||||
for (session in termService!!.sessions) {
|
||||
addNewSession(session)
|
||||
}
|
||||
switchToSession(getStoredCurrentSessionOrLast())
|
||||
|
||||
if (intent?.action == Intent.ACTION_RUN) {
|
||||
// app shortcuts
|
||||
addNewSession(null,
|
||||
false, createRevealAnimation())
|
||||
} else {
|
||||
switchToSession(getStoredCurrentSessionOrLast());
|
||||
}
|
||||
|
||||
} else {
|
||||
toggleSwitcher(showSwitcher = true, easterEgg = false)
|
||||
// Fore system shell mode to be disabled.
|
||||
addNewSession("NeoTerm #0", false, createRevealAnimation())
|
||||
addNewSession(null, false, createRevealAnimation())
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,8 +404,7 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection, SharedPreference
|
||||
if (!tabSwitcher.isSwitcherShown) {
|
||||
toggleSwitcher(showSwitcher = true, easterEgg = false)
|
||||
}
|
||||
val index = tabSwitcher.count
|
||||
addNewSession("NeoTerm #" + index, getSystemShellMode(), createRevealAnimation())
|
||||
addNewSession(null, getSystemShellMode(), createRevealAnimation())
|
||||
}
|
||||
|
||||
private fun addNewSession(session: TerminalSession?) {
|
||||
@ -433,9 +439,7 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection, SharedPreference
|
||||
.systemShell(systemShell)
|
||||
val session = termService!!.createTermSession(parameter)
|
||||
|
||||
if (sessionName != null) {
|
||||
session.mSessionName = sessionName
|
||||
}
|
||||
session.mSessionName = sessionName ?: "NeoTerm #${termService!!.sessions.size}"
|
||||
|
||||
val tab = createTab(sessionName) as TermTab
|
||||
tab.termData.initializeSessionWith(session, sessionCallback, viewClient)
|
||||
|
BIN
app/src/main/res/drawable/banner.png
Normal file
BIN
app/src/main/res/drawable/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 155 KiB |
17
app/src/main/res/drawable/ic_new_session.xml
Normal file
17
app/src/main/res/drawable/ic_new_session.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
|
||||
<path
|
||||
android:fillColor="#FFF"
|
||||
android:pathData="M 12, 12
|
||||
m -10.5, 0
|
||||
a 10.5,10.5 0 1,0 21,0
|
||||
a 10.5,10.5 0 1,0 -21,0"/>
|
||||
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13h-4v4h-2v-4L7,13v-2h4L11,7h2v4h4v2z"/>
|
||||
</vector>
|
@ -109,9 +109,8 @@
|
||||
<string name="support_donate_description">如果你喜欢这个app,你可以考虑请作者喝杯咖啡</string>
|
||||
<string name="about_developers">Kiva 维护\nCrixec 图标设计</string>
|
||||
<string name="about_credits_label">特别鸣谢</string>
|
||||
<string name="about_credits">nullptr 时刻支持我\n酷安用户 @NimaQu 赞助服务器\nQQ用户 @My 提供免费网络</string>
|
||||
<string name="about_credits">酷安用户 @NimaQu 赞助服务器\nQQ用户 @My 提供免费网络</string>
|
||||
<string name="support_donate_dialog_text">这个app是我在课余时间制作的,一个人不仅要维护app,还要维护各种软件包和服务器,如果能得到你的支持,我将更有动力继续将app完善下去</string>
|
||||
<string name="support_donate_qq">QQ</string>
|
||||
<string name="support_donate_alipay">支付宝</string>
|
||||
<string name="new_color_scheme">新建配色方案</string>
|
||||
<string name="faq">常见问题</string>
|
||||
|
@ -106,8 +106,7 @@
|
||||
<string name="support_donate_description">如果你喜歡這個app,你可以考慮請作者喝杯咖啡</string>
|
||||
<string name="about_developers">Kiva 維護\nCrixec 圖標設計</string>
|
||||
<string name="about_credits_label">特別鳴謝</string>
|
||||
<string name="about_credits">nullptr 時刻支持我\n酷安用戶 @NimaQu 贊助服務器\nQQ用戶 @My 提供免費網絡</string>
|
||||
<string name="about_credits">酷安用戶 @NimaQu 贊助服務器\nQQ用戶 @My 提供免費網絡</string>
|
||||
<string name="support_donate_dialog_text">這個app是我在課餘時間製作的,一個人不僅要維護app,還要維護各種套裝軟體和服務器,如果能得到你的支持,我將更有動力繼續完善下去</string>
|
||||
<string name="support_donate_qq">QQ</string>
|
||||
<string name="support_donate_alipay">支付寶</string>
|
||||
</resources>
|
@ -113,11 +113,10 @@
|
||||
<string name="support_donate_label">Donate</string>
|
||||
<string name="support_donate_description">If you like this app, you can offer developers a cup of coffee</string>
|
||||
<string name="support_donate_dialog_text">This app is made in my spare time. Not only me needs to develop app, but also maintains various software packages and servers. If you can support me, I will be more motivated to improve this app.</string>
|
||||
<string name="support_donate_qq">QQ</string>
|
||||
<string name="support_donate_alipay">Alipay</string>
|
||||
<string name="about_developers">Kiva for Maintaining\nCrixec for Icon Design</string>
|
||||
<string name="about_credits_label">Acknowledgements</string>
|
||||
<string name="about_credits">nullptr for accompanying me\nCoolApk User @NimaQu for providing server\nQQ User @My for providing free network</string>
|
||||
<string name="about_credits">CoolApk User @NimaQu for providing server\nQQ User @My for providing free network</string>
|
||||
<string name="new_color_scheme">New Color Scheme</string>
|
||||
<string name="faq">FAQ</string>
|
||||
<string name="new_source">New</string>
|
||||
|
14
app/src/main/res/xml/app_shortcuts.xml
Normal file
14
app/src/main/res/xml/app_shortcuts.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<shortcuts xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<shortcut
|
||||
android:shortcutId="new_session"
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/ic_new_session"
|
||||
android:shortcutShortLabel="@string/new_session"
|
||||
tools:targetApi="n_mr1">
|
||||
<intent
|
||||
android:action="android.intent.action.RUN"
|
||||
android:targetPackage="io.neoterm"
|
||||
android:targetClass="io.neoterm.ui.term.NeoTermActivity"/>
|
||||
</shortcut>
|
||||
</shortcuts>
|
Loading…
Reference in New Issue
Block a user