Preference: move to config package
This commit is contained in:
parent
7da71ecab4
commit
ac3b942d36
@ -9,7 +9,7 @@ import android.net.Uri
|
||||
import android.view.Gravity
|
||||
import android.widget.Toast
|
||||
import io.neoterm.component.NeoInitializer
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.ui.bonus.BonusActivity
|
||||
import io.neoterm.utils.CrashHandler
|
||||
|
||||
|
@ -4,10 +4,9 @@ import android.content.Context
|
||||
import io.neoterm.App
|
||||
import io.neoterm.R
|
||||
import io.neoterm.component.codegen.CodeGenComponent
|
||||
import io.neoterm.component.config.ConfigureComponent
|
||||
import io.neoterm.frontend.component.ComponentManager
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.preference.NeoTermPath
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoTermPath
|
||||
import io.neoterm.frontend.component.NeoComponent
|
||||
import io.neoterm.frontend.logging.NLog
|
||||
import io.neoterm.utils.AssetsUtils
|
||||
|
@ -3,7 +3,7 @@ package io.neoterm.component.eks
|
||||
import android.content.Context
|
||||
import io.neoterm.App
|
||||
import io.neoterm.frontend.logging.NLog
|
||||
import io.neoterm.frontend.preference.NeoTermPath
|
||||
import io.neoterm.frontend.config.NeoTermPath
|
||||
import io.neoterm.frontend.component.NeoComponent
|
||||
import io.neoterm.utils.AssetsUtils
|
||||
import io.neoterm.frontend.terminal.eks.ExtraKeysView
|
||||
|
@ -2,13 +2,12 @@ package io.neoterm.component.font
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
import android.view.View
|
||||
import io.neoterm.App
|
||||
import io.neoterm.R
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.preference.NeoTermPath
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoTermPath
|
||||
import io.neoterm.frontend.component.NeoComponent
|
||||
import io.neoterm.frontend.preference.DefaultPreference
|
||||
import io.neoterm.frontend.config.DefaultPreference
|
||||
import io.neoterm.frontend.terminal.TerminalView
|
||||
import io.neoterm.frontend.terminal.eks.ExtraKeysView
|
||||
import io.neoterm.utils.AssetsUtils
|
||||
|
@ -2,7 +2,7 @@ package io.neoterm.component.pm
|
||||
|
||||
import io.neoterm.App
|
||||
import io.neoterm.R
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
|
||||
/**
|
||||
* @author kiva
|
||||
|
@ -2,8 +2,8 @@ package io.neoterm.component.pm
|
||||
|
||||
import io.neoterm.R
|
||||
import io.neoterm.frontend.logging.NLog
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.preference.NeoTermPath
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoTermPath
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
|
||||
|
@ -5,7 +5,7 @@ import android.system.Os
|
||||
import io.neoterm.App
|
||||
import io.neoterm.frontend.component.NeoComponent
|
||||
import io.neoterm.frontend.logging.NLog
|
||||
import io.neoterm.frontend.preference.NeoTermPath
|
||||
import io.neoterm.frontend.config.NeoTermPath
|
||||
import io.neoterm.utils.AssetsUtils
|
||||
import java.io.File
|
||||
|
||||
|
@ -6,7 +6,7 @@ import android.content.Context
|
||||
import io.neoterm.Globals
|
||||
import io.neoterm.frontend.component.NeoComponent
|
||||
import io.neoterm.frontend.logging.NLog
|
||||
import io.neoterm.frontend.preference.NeoTermPath
|
||||
import io.neoterm.frontend.config.NeoTermPath
|
||||
import io.neoterm.frontend.session.shell.ShellParameter
|
||||
import io.neoterm.frontend.session.shell.ShellTermSession
|
||||
import io.neoterm.frontend.session.xorg.XParameter
|
||||
|
@ -23,8 +23,8 @@ import java.util.zip.ZipInputStream;
|
||||
import io.neoterm.R;
|
||||
import io.neoterm.backend.EmulatorDebug;
|
||||
import io.neoterm.frontend.logging.NLog;
|
||||
import io.neoterm.frontend.preference.NeoPreference;
|
||||
import io.neoterm.frontend.preference.NeoTermPath;
|
||||
import io.neoterm.frontend.config.NeoPreference;
|
||||
import io.neoterm.frontend.config.NeoTermPath;
|
||||
|
||||
public final class BaseFileInstaller {
|
||||
public interface ResultListener {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.frontend.preference
|
||||
package io.neoterm.frontend.config
|
||||
|
||||
import io.neoterm.component.color.DefaultColorScheme
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.frontend.preference
|
||||
package io.neoterm.frontend.config
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Activity
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.frontend.preference
|
||||
package io.neoterm.frontend.config
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
@ -109,7 +109,7 @@ object NeoPreference {
|
||||
|
||||
fun storeCurrentSession(session: TerminalSession) {
|
||||
preference!!.edit()
|
||||
.putString(NeoPreference.KEY_CURRENT_SESSION, session.mHandle)
|
||||
.putString(KEY_CURRENT_SESSION, session.mHandle)
|
||||
.apply()
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ object NeoPreference {
|
||||
}
|
||||
|
||||
fun getFontSize(): Int {
|
||||
return loadInt(NeoPreference.KEY_FONT_SIZE,
|
||||
return loadInt(KEY_FONT_SIZE,
|
||||
DefaultPreference.fontSize)
|
||||
}
|
||||
|
||||
@ -224,22 +224,22 @@ object NeoPreference {
|
||||
}
|
||||
|
||||
fun isExplicitExtraKeysWeightEnabled() :Boolean {
|
||||
return NeoPreference.loadBoolean(R.string.key_ui_eks_weight_explicit,
|
||||
return loadBoolean(R.string.key_ui_eks_weight_explicit,
|
||||
DefaultPreference.enableExplicitExtraKeysWeight)
|
||||
}
|
||||
|
||||
fun isFullScreenEnabled() : Boolean {
|
||||
return NeoPreference.loadBoolean(R.string.key_ui_fullscreen,
|
||||
return loadBoolean(R.string.key_ui_fullscreen,
|
||||
DefaultPreference.enableFullScreen)
|
||||
}
|
||||
|
||||
fun isHideToolbarEnabled() :Boolean {
|
||||
return NeoPreference.loadBoolean(R.string.key_ui_hide_toolbar,
|
||||
return loadBoolean(R.string.key_ui_hide_toolbar,
|
||||
DefaultPreference.enableAutoHideToolbar)
|
||||
}
|
||||
|
||||
fun isNextTabEnabled() :Boolean {
|
||||
return NeoPreference.loadBoolean(R.string.key_ui_next_tab_anim,
|
||||
return loadBoolean(R.string.key_ui_next_tab_anim,
|
||||
DefaultPreference.enableSwitchNextTab)
|
||||
}
|
||||
|
38
app/src/main/java/io/neoterm/frontend/config/NeoTermPath.kt
Normal file
38
app/src/main/java/io/neoterm/frontend/config/NeoTermPath.kt
Normal file
@ -0,0 +1,38 @@
|
||||
package io.neoterm.frontend.config
|
||||
|
||||
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 APT_BIN_PATH = "${USR_PATH}/bin/apt"
|
||||
const val LIB_PATH = "${USR_PATH}/lib"
|
||||
|
||||
const val CUSTOM_PATH = "${HOME_PATH}/.neoterm"
|
||||
const val NEOTERM_SHELL_PATH = "${CUSTOM_PATH}/shell"
|
||||
const val EKS_PATH = "${CUSTOM_PATH}/eks"
|
||||
const val EKS_DEFAULT_FILE = "${EKS_PATH}/default.nl"
|
||||
const val FONT_PATH = "${CUSTOM_PATH}/font"
|
||||
const val COLORS_PATH = "${CUSTOM_PATH}/color"
|
||||
const val USER_SCRIPT_PATH = "${CUSTOM_PATH}/script"
|
||||
|
||||
const val SOURCE_FILE = "${USR_PATH}/etc/apt/sources.list"
|
||||
const val PACKAGE_LIST_DIR = "${USR_PATH}/var/lib/apt/lists"
|
||||
|
||||
const val SOURCE = "http://neoterm.studio"
|
||||
|
||||
val DEFAULT_SOURCE: String
|
||||
val SERVER_BASE_URL: String
|
||||
val SERVER_BOOT_URL: String
|
||||
|
||||
init {
|
||||
DEFAULT_SOURCE = SOURCE
|
||||
SERVER_BASE_URL = DEFAULT_SOURCE
|
||||
SERVER_BOOT_URL = "${SERVER_BASE_URL}/boot"
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package io.neoterm.frontend.preference
|
||||
|
||||
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 APT_BIN_PATH = "$USR_PATH/bin/apt"
|
||||
const val LIB_PATH = "$USR_PATH/lib"
|
||||
|
||||
const val CUSTOM_PATH = "$HOME_PATH/.neoterm"
|
||||
const val NEOTERM_SHELL_PATH = "$CUSTOM_PATH/shell"
|
||||
const val EKS_PATH = "$CUSTOM_PATH/eks"
|
||||
const val EKS_DEFAULT_FILE = "$EKS_PATH/default.nl"
|
||||
const val FONT_PATH = "$CUSTOM_PATH/font"
|
||||
const val COLORS_PATH = "$CUSTOM_PATH/color"
|
||||
const val USER_SCRIPT_PATH = "$CUSTOM_PATH/script"
|
||||
|
||||
const val SOURCE_FILE = "$USR_PATH/etc/apt/sources.list"
|
||||
const val PACKAGE_LIST_DIR = "$USR_PATH/var/lib/apt/lists"
|
||||
|
||||
const val SOURCE = "http://neoterm.studio"
|
||||
|
||||
val DEFAULT_SOURCE: String
|
||||
val SERVER_BASE_URL: String
|
||||
val SERVER_BOOT_URL: String
|
||||
|
||||
init {
|
||||
DEFAULT_SOURCE = SOURCE
|
||||
SERVER_BASE_URL = DEFAULT_SOURCE
|
||||
SERVER_BOOT_URL = "$SERVER_BASE_URL/boot"
|
||||
}
|
||||
}
|
@ -3,8 +3,8 @@ package io.neoterm.frontend.session.shell
|
||||
import io.neoterm.component.color.ColorSchemeComponent
|
||||
import io.neoterm.component.font.FontComponent
|
||||
import io.neoterm.frontend.component.ComponentManager
|
||||
import io.neoterm.frontend.preference.DefaultPreference
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.config.DefaultPreference
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
|
||||
/**
|
||||
* @author kiva
|
||||
|
@ -4,8 +4,8 @@ import android.content.Context
|
||||
import io.neoterm.App
|
||||
import io.neoterm.R
|
||||
import io.neoterm.backend.TerminalSession
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.preference.NeoTermPath
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoTermPath
|
||||
import io.neoterm.frontend.session.shell.client.TermSessionCallback
|
||||
import java.io.File
|
||||
|
||||
|
@ -5,7 +5,7 @@ import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import io.neoterm.backend.TerminalSession
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.terminal.TerminalView
|
||||
import io.neoterm.frontend.terminal.TerminalViewClient
|
||||
|
||||
|
@ -3,12 +3,7 @@ package io.neoterm.frontend.session.shell.client
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.media.SoundPool
|
||||
import android.os.Vibrator
|
||||
import io.neoterm.R
|
||||
import io.neoterm.backend.TerminalSession
|
||||
import io.neoterm.frontend.preference.DefaultPreference
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.session.shell.ShellTermSession
|
||||
|
||||
/**
|
||||
|
@ -7,13 +7,11 @@ import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import io.neoterm.R
|
||||
import io.neoterm.backend.KeyHandler
|
||||
import io.neoterm.backend.TerminalSession
|
||||
import io.neoterm.component.eks.ExtraKeysComponent
|
||||
import io.neoterm.frontend.component.ComponentManager
|
||||
import io.neoterm.frontend.preference.DefaultPreference
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.session.shell.ShellTermSession
|
||||
import io.neoterm.frontend.terminal.TerminalViewClient
|
||||
|
||||
|
@ -8,9 +8,8 @@ import android.widget.GridLayout
|
||||
import android.widget.LinearLayout
|
||||
import io.neoterm.R
|
||||
import io.neoterm.component.eks.NeoExtraKey
|
||||
import io.neoterm.frontend.preference.DefaultPreference
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.preference.NeoTermPath
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoTermPath
|
||||
import io.neoterm.frontend.session.shell.client.event.ToggleImeEvent
|
||||
import io.neoterm.frontend.terminal.eks.button.ControlButton
|
||||
import io.neoterm.frontend.terminal.eks.button.IExtraButton
|
||||
|
@ -20,7 +20,7 @@ import android.widget.FrameLayout
|
||||
|
||||
import io.neoterm.R
|
||||
import io.neoterm.backend.TerminalSession
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.session.shell.ShellParameter
|
||||
import io.neoterm.frontend.terminal.TerminalView
|
||||
|
||||
|
@ -6,7 +6,7 @@ import android.support.v7.widget.Toolbar
|
||||
import android.view.MenuItem
|
||||
import io.neoterm.R
|
||||
import io.neoterm.backend.TerminalSession
|
||||
import io.neoterm.frontend.preference.NeoTermPath
|
||||
import io.neoterm.frontend.config.NeoTermPath
|
||||
import io.neoterm.frontend.session.shell.ShellParameter
|
||||
import io.neoterm.frontend.session.shell.client.BasicSessionCallback
|
||||
import io.neoterm.frontend.session.shell.client.BasicViewClient
|
||||
|
@ -1,7 +1,6 @@
|
||||
package io.neoterm.ui.customize
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
@ -14,7 +13,7 @@ import io.neoterm.R
|
||||
import io.neoterm.component.color.ColorSchemeComponent
|
||||
import io.neoterm.component.font.FontComponent
|
||||
import io.neoterm.frontend.component.ComponentManager
|
||||
import io.neoterm.frontend.preference.NeoTermPath
|
||||
import io.neoterm.frontend.config.NeoTermPath
|
||||
import io.neoterm.utils.FileUtils
|
||||
import io.neoterm.utils.MediaUtils
|
||||
import java.io.File
|
||||
|
@ -20,8 +20,8 @@ import io.neoterm.component.pm.SourceManager
|
||||
import io.neoterm.component.pm.SourceUtils
|
||||
import io.neoterm.frontend.component.ComponentManager
|
||||
import io.neoterm.frontend.floating.TerminalDialog
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.preference.NeoTermPath
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoTermPath
|
||||
import io.neoterm.ui.pm.adapter.PackageAdapter
|
||||
import io.neoterm.ui.pm.model.PackageModel
|
||||
import io.neoterm.utils.PackageUtils
|
||||
|
@ -4,8 +4,7 @@ import android.app.AlertDialog
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import io.neoterm.R
|
||||
import io.neoterm.frontend.preference.DefaultPreference
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.utils.PackageUtils
|
||||
|
||||
/**
|
||||
|
@ -21,12 +21,11 @@ import io.neoterm.App
|
||||
import io.neoterm.R
|
||||
import io.neoterm.backend.TerminalSession
|
||||
import io.neoterm.component.setup.BaseFileInstaller
|
||||
import io.neoterm.frontend.preference.DefaultPreference
|
||||
import io.neoterm.frontend.session.shell.client.TermSessionCallback
|
||||
import io.neoterm.frontend.session.shell.client.TermViewClient
|
||||
import io.neoterm.frontend.session.shell.client.event.*
|
||||
import io.neoterm.frontend.preference.NeoPermission
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoPermission
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.session.shell.ShellParameter
|
||||
import io.neoterm.frontend.session.xorg.XParameter
|
||||
import io.neoterm.frontend.session.xorg.XSession
|
||||
|
@ -16,7 +16,7 @@ import io.neoterm.component.script.UserScript
|
||||
import io.neoterm.component.script.UserScriptComponent
|
||||
import io.neoterm.frontend.session.shell.client.TermSessionCallback
|
||||
import io.neoterm.frontend.component.ComponentManager
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.session.shell.ShellParameter
|
||||
import io.neoterm.services.NeoTermService
|
||||
import io.neoterm.utils.MediaUtils
|
||||
|
@ -4,8 +4,8 @@ import android.content.Context
|
||||
import io.neoterm.R
|
||||
import io.neoterm.backend.TerminalSession
|
||||
import io.neoterm.frontend.floating.TerminalDialog
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.preference.NeoTermPath
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoTermPath
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
|
@ -2,14 +2,12 @@ package io.neoterm.utils
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import io.neoterm.R
|
||||
import io.neoterm.backend.TerminalSession
|
||||
import io.neoterm.component.font.FontComponent
|
||||
import io.neoterm.component.session.SessionComponent
|
||||
import io.neoterm.frontend.component.ComponentManager
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
import io.neoterm.frontend.config.NeoPreference
|
||||
import io.neoterm.frontend.session.shell.ShellParameter
|
||||
import io.neoterm.frontend.session.shell.ShellTermSession
|
||||
import io.neoterm.frontend.session.xorg.XParameter
|
||||
import io.neoterm.frontend.session.xorg.XSession
|
||||
import io.neoterm.frontend.terminal.TerminalView
|
||||
|
Loading…
x
Reference in New Issue
Block a user