Release: Change Mirror Server
This commit is contained in:
@ -1,13 +1,19 @@
|
|||||||
package io.neoterm.customize
|
package io.neoterm.customize
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kiva
|
* @author kiva
|
||||||
*/
|
*/
|
||||||
object NeoTermPath {
|
object NeoTermPath {
|
||||||
|
@SuppressLint("SdCardPath")
|
||||||
const val ROOT_PATH = "/data/data/io.neoterm/files"
|
const val ROOT_PATH = "/data/data/io.neoterm/files"
|
||||||
const val USR_PATH = "$ROOT_PATH/usr"
|
const val USR_PATH = "$ROOT_PATH/usr"
|
||||||
const val HOME_PATH = "$ROOT_PATH/home"
|
const val HOME_PATH = "$ROOT_PATH/home"
|
||||||
|
|
||||||
const val EKS_PATH = "$USR_PATH/share/eks"
|
const val EKS_PATH = "$USR_PATH/share/eks"
|
||||||
const val EKS_DEFAULT_FILE = "$EKS_PATH/default.eks"
|
const val EKS_DEFAULT_FILE = "$EKS_PATH/default.eks"
|
||||||
|
|
||||||
|
const val SERVER_BASE_URL = "http://mirror.neoterm.studio"
|
||||||
|
const val SERVER_BOOT_URL = "$SERVER_BASE_URL/boot"
|
||||||
}
|
}
|
@ -22,7 +22,6 @@ import java.util.zip.ZipInputStream;
|
|||||||
import io.neoterm.R;
|
import io.neoterm.R;
|
||||||
import io.neoterm.backend.EmulatorDebug;
|
import io.neoterm.backend.EmulatorDebug;
|
||||||
import io.neoterm.customize.NeoTermPath;
|
import io.neoterm.customize.NeoTermPath;
|
||||||
import io.neoterm.preference.NeoTermPreference;
|
|
||||||
|
|
||||||
public final class BaseFileInstaller {
|
public final class BaseFileInstaller {
|
||||||
public interface ResultListener {
|
public interface ResultListener {
|
||||||
@ -136,10 +135,10 @@ public final class BaseFileInstaller {
|
|||||||
|
|
||||||
private static URL determineZipUrl() throws MalformedURLException {
|
private static URL determineZipUrl() throws MalformedURLException {
|
||||||
String archName = determineArchName();
|
String archName = determineArchName();
|
||||||
return new URL("https://neoterm.kernel19.cc/boot/" + archName + ".zip");
|
return new URL(NeoTermPath.SERVER_BOOT_URL + "/" + archName + ".zip");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String determineArchName() {
|
private static String determineArchName() {
|
||||||
for (String androidArch : Build.SUPPORTED_ABIS) {
|
for (String androidArch : Build.SUPPORTED_ABIS) {
|
||||||
switch (androidArch) {
|
switch (androidArch) {
|
||||||
case "arm64-v8a":
|
case "arm64-v8a":
|
||||||
|
@ -123,16 +123,15 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val menu = tabSwitcher.toolbarMenu
|
val menu = tabSwitcher.toolbarMenu
|
||||||
if (menu != null) {
|
if (menu != null && !tabSwitcherButtonInit) {
|
||||||
tabSwitcherButtonInit = true
|
tabSwitcherButtonInit = true
|
||||||
val tabSwitcherButton = menu.findItem(R.id.toggle_tab_switcher_menu_item).actionView as TabSwitcherButton
|
TabSwitcher.setupWithMenu(tabSwitcher, menu, View.OnClickListener {
|
||||||
tabSwitcherButton.setOnClickListener {
|
|
||||||
if (tabSwitcher.isSwitcherShown) {
|
if (tabSwitcher.isSwitcherShown) {
|
||||||
tabSwitcher.hideSwitcher()
|
tabSwitcher.hideSwitcher()
|
||||||
} else {
|
} else {
|
||||||
tabSwitcher.showSwitcher()
|
tabSwitcher.showSwitcher()
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +145,6 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onTabAdded(tabSwitcher: TabSwitcher, index: Int, tab: Tab, animation: Animation) {
|
override fun onTabAdded(tabSwitcher: TabSwitcher, index: Int, tab: Tab, animation: Animation) {
|
||||||
updateTabSwitcherButton()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTabRemoved(tabSwitcher: TabSwitcher, index: Int, tab: Tab, animation: Animation) {
|
override fun onTabRemoved(tabSwitcher: TabSwitcher, index: Int, tab: Tab, animation: Animation) {
|
||||||
@ -155,7 +153,6 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection {
|
|||||||
removeFinishedSession(tab.termSession)
|
removeFinishedSession(tab.termSession)
|
||||||
tab.cleanup()
|
tab.cleanup()
|
||||||
}
|
}
|
||||||
updateTabSwitcherButton()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAllTabsRemoved(tabSwitcher: TabSwitcher, tabs: Array<out Tab>, animation: Animation) {
|
override fun onAllTabsRemoved(tabSwitcher: TabSwitcher, tabs: Array<out Tab>, animation: Animation) {
|
||||||
@ -264,14 +261,6 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection {
|
|||||||
termService!!.removeTermSession(finishedSession)
|
termService!!.removeTermSession(finishedSession)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTabSwitcherButton() {
|
|
||||||
val menu = tabSwitcher.toolbarMenu
|
|
||||||
if (menu != null) {
|
|
||||||
val switcherButton = menu.findItem(R.id.toggle_tab_switcher_menu_item).actionView as TabSwitcherButton
|
|
||||||
switcherButton.setCount(tabSwitcher.count)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getStoredCurrentSessionOrLast(): TerminalSession? {
|
private fun getStoredCurrentSessionOrLast(): TerminalSession? {
|
||||||
val stored = NeoTermPreference.getCurrentSession(termService)
|
val stored = NeoTermPreference.getCurrentSession(termService)
|
||||||
if (stored != null) return stored
|
if (stored != null) return stored
|
||||||
|
@ -9,7 +9,7 @@ import io.neoterm.view.ExtraKeysView;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class TextButton extends ExtraButton {
|
public class TextButton extends ExtraButton {
|
||||||
boolean withEnter = false;
|
private boolean withEnter = false;
|
||||||
|
|
||||||
public TextButton(String text) {
|
public TextButton(String text) {
|
||||||
this(text, false);
|
this(text, false);
|
||||||
|
@ -7,6 +7,7 @@ import android.support.v7.widget.Toolbar
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.inputmethod.InputMethodManager
|
||||||
import de.mrapp.android.tabswitcher.Tab
|
import de.mrapp.android.tabswitcher.Tab
|
||||||
import de.mrapp.android.tabswitcher.TabSwitcher
|
import de.mrapp.android.tabswitcher.TabSwitcher
|
||||||
import de.mrapp.android.tabswitcher.TabSwitcherDecorator
|
import de.mrapp.android.tabswitcher.TabSwitcherDecorator
|
||||||
@ -23,11 +24,16 @@ class TermTabDecorator(val context: NeoTermActivity) : TabSwitcherDecorator() {
|
|||||||
override fun onInflateView(inflater: LayoutInflater, parent: ViewGroup?, viewType: Int): View {
|
override fun onInflateView(inflater: LayoutInflater, parent: ViewGroup?, viewType: Int): View {
|
||||||
val view = inflater.inflate(R.layout.term, parent, false)
|
val view = inflater.inflate(R.layout.term, parent, false)
|
||||||
val toolbar = view.findViewById(R.id.terminal_toolbar) as Toolbar
|
val toolbar = view.findViewById(R.id.terminal_toolbar) as Toolbar
|
||||||
|
|
||||||
toolbar.inflateMenu(R.menu.tab_switcher)
|
toolbar.inflateMenu(R.menu.tab_switcher)
|
||||||
|
|
||||||
toolbar.setOnMenuItemClickListener(context.createToolbarMenuListener())
|
toolbar.setOnMenuItemClickListener(context.createToolbarMenuListener())
|
||||||
val menu = toolbar.menu
|
val menu = toolbar.menu
|
||||||
TabSwitcher.setupWithMenu(context.tabSwitcher, menu, {
|
TabSwitcher.setupWithMenu(context.tabSwitcher, menu, {
|
||||||
|
toolbar.visibility = View.GONE
|
||||||
|
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
|
if (imm.isActive) {
|
||||||
|
imm.hideSoftInputFromWindow(view.windowToken, InputMethodManager.HIDE_NOT_ALWAYS)
|
||||||
|
}
|
||||||
context.tabSwitcher.showSwitcher()
|
context.tabSwitcher.showSwitcher()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user