Update: refactoring the architecture.
This commit is contained in:
parent
7a3ec1c924
commit
9e88b7b6b7
@ -11,7 +11,7 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".NeoTermActivity"
|
||||
android:name=".ui.NeoTermActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize|stateAlwaysVisible">
|
||||
@ -23,7 +23,7 @@
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name=".NeoTermService"
|
||||
android:name=".services.NeoTermService"
|
||||
android:enabled="true" />
|
||||
</application>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
/** A circular byte buffer allowing one producer and one consumer thread. */
|
||||
final class ByteQueue {
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
import android.util.Log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
/**
|
||||
* Native methods for creating and managing pseudoterminal subprocesses. C code is in jni/termux.c.
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
/**
|
||||
* A circular buffer of {@link TerminalRow}:s which keeps notes about what is visible on a logical screen and the scroll
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
/** Current terminal colors (if different from default). */
|
||||
public final class TerminalColors {
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Handler;
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
/**
|
||||
* <p>
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.terminal;
|
||||
package io.neoterm.backend;
|
||||
|
||||
/**
|
||||
* Implementation of wcwidth(3) for Unicode 9.
|
@ -2,10 +2,8 @@ package io.neoterm.preference
|
||||
|
||||
import android.content.Context
|
||||
import android.preference.PreferenceManager
|
||||
|
||||
import io.neoterm.NeoTermActivity
|
||||
import io.neoterm.NeoTermService
|
||||
import io.neoterm.terminal.TerminalSession
|
||||
import io.neoterm.backend.TerminalSession
|
||||
import io.neoterm.services.NeoTermService
|
||||
|
||||
/**
|
||||
* @author kiva
|
||||
@ -15,7 +13,10 @@ object NeoTermPreference {
|
||||
var CURRENT_SESSION_KEY = "neoterm_current_session"
|
||||
|
||||
fun storeCurrentSession(context: Context, session: TerminalSession) {
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putString(NeoTermPreference.CURRENT_SESSION_KEY, session.mHandle).apply()
|
||||
PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.edit()
|
||||
.putString(NeoTermPreference.CURRENT_SESSION_KEY, session.mHandle)
|
||||
.apply()
|
||||
}
|
||||
|
||||
fun getCurrentSession(termService: NeoTermService?): TerminalSession? {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm;
|
||||
package io.neoterm.services;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
@ -15,8 +15,10 @@ import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.neoterm.terminal.EmulatorDebug;
|
||||
import io.neoterm.terminal.TerminalSession;
|
||||
import io.neoterm.ui.NeoTermActivity;
|
||||
import io.neoterm.R;
|
||||
import io.neoterm.backend.EmulatorDebug;
|
||||
import io.neoterm.backend.TerminalSession;
|
||||
|
||||
/**
|
||||
* @author kiva
|
||||
@ -78,7 +80,7 @@ public class NeoTermService extends Service {
|
||||
return mTerminalSessions;
|
||||
}
|
||||
|
||||
TerminalSession createTermSession(String executablePath, String[] arguments, String cwd, String[] env, TerminalSession.SessionChangedCallback sessionCallback) {
|
||||
public TerminalSession createTermSession(String executablePath, String[] arguments, String cwd, String[] env, TerminalSession.SessionChangedCallback sessionCallback) {
|
||||
if (cwd == null) cwd = getFilesDir().getAbsolutePath();
|
||||
|
||||
boolean isLoginShell = false;
|
@ -1,7 +1,6 @@
|
||||
package io.neoterm
|
||||
package io.neoterm.ui
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.ServiceConnection
|
||||
import android.os.Bundle
|
||||
@ -11,18 +10,18 @@ import android.support.v4.view.OnApplyWindowInsetsListener
|
||||
import android.support.v4.view.ViewCompat
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.support.v7.widget.Toolbar
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.ImageButton
|
||||
import de.mrapp.android.tabswitcher.*
|
||||
import de.mrapp.android.tabswitcher.view.TabSwitcherButton
|
||||
import io.neoterm.R
|
||||
import io.neoterm.preference.NeoTermPreference
|
||||
import io.neoterm.tab.TermSessionChangedCallback
|
||||
import io.neoterm.tab.TermTab
|
||||
import io.neoterm.tab.TermTabDecorator
|
||||
import io.neoterm.tab.TermViewClient
|
||||
import io.neoterm.terminal.TerminalSession
|
||||
import io.neoterm.services.NeoTermService
|
||||
import io.neoterm.view.tab.TermSessionChangedCallback
|
||||
import io.neoterm.view.tab.TermTab
|
||||
import io.neoterm.view.tab.TermTabDecorator
|
||||
import io.neoterm.view.tab.TermViewClient
|
||||
import io.neoterm.backend.TerminalSession
|
||||
|
||||
|
||||
class NeoTermActivity : AppCompatActivity(), ServiceConnection {
|
@ -11,7 +11,7 @@ import android.widget.GridLayout;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import io.neoterm.R;
|
||||
import io.neoterm.terminal.TerminalSession;
|
||||
import io.neoterm.backend.TerminalSession;
|
||||
|
||||
/**
|
||||
* A view showing extra keys (such as Escape, Ctrl, Alt) not normally available on an Android soft
|
||||
|
@ -5,11 +5,11 @@ import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
|
||||
import io.neoterm.terminal.TerminalBuffer;
|
||||
import io.neoterm.terminal.TerminalEmulator;
|
||||
import io.neoterm.terminal.TerminalRow;
|
||||
import io.neoterm.terminal.TextStyle;
|
||||
import io.neoterm.terminal.WcWidth;
|
||||
import io.neoterm.backend.TerminalBuffer;
|
||||
import io.neoterm.backend.TerminalEmulator;
|
||||
import io.neoterm.backend.TerminalRow;
|
||||
import io.neoterm.backend.TextStyle;
|
||||
import io.neoterm.backend.WcWidth;
|
||||
|
||||
/**
|
||||
* Renderer of a {@link TerminalEmulator} into a {@link Canvas}.
|
||||
|
@ -30,11 +30,11 @@ import android.view.inputmethod.InputConnection;
|
||||
import android.widget.Scroller;
|
||||
|
||||
import io.neoterm.R;
|
||||
import io.neoterm.terminal.EmulatorDebug;
|
||||
import io.neoterm.terminal.KeyHandler;
|
||||
import io.neoterm.terminal.TerminalBuffer;
|
||||
import io.neoterm.terminal.TerminalEmulator;
|
||||
import io.neoterm.terminal.TerminalSession;
|
||||
import io.neoterm.backend.EmulatorDebug;
|
||||
import io.neoterm.backend.KeyHandler;
|
||||
import io.neoterm.backend.TerminalBuffer;
|
||||
import io.neoterm.backend.TerminalEmulator;
|
||||
import io.neoterm.backend.TerminalSession;
|
||||
|
||||
/** View displaying and interacting with a {@link TerminalSession}. */
|
||||
public final class TerminalView extends View {
|
||||
|
@ -4,7 +4,7 @@ import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ScaleGestureDetector;
|
||||
|
||||
import io.neoterm.terminal.TerminalSession;
|
||||
import io.neoterm.backend.TerminalSession;
|
||||
|
||||
/**
|
||||
* Input and scale listener which may be set on a {@link TerminalView} through
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.neoterm.tab
|
||||
package io.neoterm.view.tab
|
||||
|
||||
import io.neoterm.terminal.TerminalSession
|
||||
import io.neoterm.backend.TerminalSession
|
||||
import io.neoterm.view.TerminalView
|
||||
|
||||
/**
|
@ -1,10 +1,10 @@
|
||||
package io.neoterm.tab
|
||||
package io.neoterm.view.tab
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.support.v7.widget.Toolbar
|
||||
import de.mrapp.android.tabswitcher.Tab
|
||||
import io.neoterm.terminal.TerminalSession
|
||||
import io.neoterm.backend.TerminalSession
|
||||
|
||||
/**
|
||||
* @author kiva
|
@ -1,4 +1,4 @@
|
||||
package io.neoterm.tab
|
||||
package io.neoterm.view.tab
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
@ -10,7 +10,7 @@ import android.view.ViewGroup
|
||||
import de.mrapp.android.tabswitcher.Tab
|
||||
import de.mrapp.android.tabswitcher.TabSwitcher
|
||||
import de.mrapp.android.tabswitcher.TabSwitcherDecorator
|
||||
import io.neoterm.NeoTermActivity
|
||||
import io.neoterm.ui.NeoTermActivity
|
||||
import io.neoterm.R
|
||||
import io.neoterm.view.ExtraKeysView
|
||||
import io.neoterm.view.TerminalView
|
@ -1,11 +1,11 @@
|
||||
package io.neoterm.tab
|
||||
package io.neoterm.view.tab
|
||||
|
||||
import android.content.Context
|
||||
import android.view.InputDevice
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import io.neoterm.terminal.TerminalSession
|
||||
import io.neoterm.backend.TerminalSession
|
||||
import io.neoterm.view.ExtraKeysView
|
||||
import io.neoterm.view.TerminalView
|
||||
import io.neoterm.view.TerminalViewClient
|
Loading…
Reference in New Issue
Block a user