Release: Change Mirror Server

This commit is contained in:
zt515
2017-06-17 17:36:16 +08:00
parent 9bc8a27fb1
commit 576a8cd4a0
5 changed files with 19 additions and 19 deletions

View File

@ -1,13 +1,19 @@
package io.neoterm.customize
import android.annotation.SuppressLint
/**
* @author kiva
*/
object NeoTermPath {
@SuppressLint("SdCardPath")
const val ROOT_PATH = "/data/data/io.neoterm/files"
const val USR_PATH = "$ROOT_PATH/usr"
const val HOME_PATH = "$ROOT_PATH/home"
const val EKS_PATH = "$USR_PATH/share/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"
}

View File

@ -22,7 +22,6 @@ import java.util.zip.ZipInputStream;
import io.neoterm.R;
import io.neoterm.backend.EmulatorDebug;
import io.neoterm.customize.NeoTermPath;
import io.neoterm.preference.NeoTermPreference;
public final class BaseFileInstaller {
public interface ResultListener {
@ -136,10 +135,10 @@ public final class BaseFileInstaller {
private static URL determineZipUrl() throws MalformedURLException {
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) {
switch (androidArch) {
case "arm64-v8a":

View File

@ -123,16 +123,15 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection {
}
val menu = tabSwitcher.toolbarMenu
if (menu != null) {
if (menu != null && !tabSwitcherButtonInit) {
tabSwitcherButtonInit = true
val tabSwitcherButton = menu.findItem(R.id.toggle_tab_switcher_menu_item).actionView as TabSwitcherButton
tabSwitcherButton.setOnClickListener {
TabSwitcher.setupWithMenu(tabSwitcher, menu, View.OnClickListener {
if (tabSwitcher.isSwitcherShown) {
tabSwitcher.hideSwitcher()
} else {
tabSwitcher.showSwitcher()
}
}
})
}
}
@ -146,7 +145,6 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection {
}
override fun onTabAdded(tabSwitcher: TabSwitcher, index: Int, tab: Tab, animation: Animation) {
updateTabSwitcherButton()
}
override fun onTabRemoved(tabSwitcher: TabSwitcher, index: Int, tab: Tab, animation: Animation) {
@ -155,7 +153,6 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection {
removeFinishedSession(tab.termSession)
tab.cleanup()
}
updateTabSwitcherButton()
}
override fun onAllTabsRemoved(tabSwitcher: TabSwitcher, tabs: Array<out Tab>, animation: Animation) {
@ -264,14 +261,6 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection {
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? {
val stored = NeoTermPreference.getCurrentSession(termService)
if (stored != null) return stored

View File

@ -9,7 +9,7 @@ import io.neoterm.view.ExtraKeysView;
*/
public class TextButton extends ExtraButton {
boolean withEnter = false;
private boolean withEnter = false;
public TextButton(String text) {
this(text, false);

View File

@ -7,6 +7,7 @@ import android.support.v7.widget.Toolbar
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import de.mrapp.android.tabswitcher.Tab
import de.mrapp.android.tabswitcher.TabSwitcher
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 {
val view = inflater.inflate(R.layout.term, parent, false)
val toolbar = view.findViewById(R.id.terminal_toolbar) as Toolbar
toolbar.inflateMenu(R.menu.tab_switcher)
toolbar.setOnMenuItemClickListener(context.createToolbarMenuListener())
val menu = toolbar.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()
})