diff options
author | Kenny Root <kenny@the-b.org> | 2008-11-20 09:43:28 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2008-11-20 09:43:28 +0000 |
commit | 8c27256ce99583f97ede7994a5e722f1e1da52bb (patch) | |
tree | c084da4d07ea895e2ca81de55c421182936c5534 | |
parent | aac615d56a76533c47f71aebbdac96d9838492bb (diff) | |
download | connectbot-8c27256ce99583f97ede7994a5e722f1e1da52bb.tar.gz connectbot-8c27256ce99583f97ede7994a5e722f1e1da52bb.tar.bz2 connectbot-8c27256ce99583f97ede7994a5e722f1e1da52bb.zip |
Change things from public and protected to protected and private where they should be (being private helps with dead code detection in Eclipse)
-rw-r--r-- | src/org/connectbot/ConsoleActivity.java | 34 | ||||
-rw-r--r-- | src/org/connectbot/GeneratePubkeyActivity.java | 2 | ||||
-rw-r--r-- | src/org/connectbot/HostEditorActivity.java | 13 | ||||
-rw-r--r-- | src/org/connectbot/HostListActivity.java | 14 | ||||
-rw-r--r-- | src/org/connectbot/PortForwardListActivity.java | 8 | ||||
-rw-r--r-- | src/org/connectbot/PubkeyListActivity.java | 10 | ||||
-rw-r--r-- | src/org/connectbot/TerminalView.java | 8 | ||||
-rw-r--r-- | src/org/connectbot/WizardActivity.java | 2 | ||||
-rw-r--r-- | src/org/connectbot/bean/AbstractBean.java | 2 | ||||
-rw-r--r-- | src/org/connectbot/bean/PortForwardBean.java | 7 | ||||
-rw-r--r-- | src/org/connectbot/service/PromptHelper.java | 8 | ||||
-rw-r--r-- | src/org/connectbot/service/TerminalBridge.java | 46 | ||||
-rw-r--r-- | src/org/connectbot/service/TerminalManager.java | 9 | ||||
-rw-r--r-- | src/org/connectbot/util/UpdateHelper.java | 8 |
14 files changed, 77 insertions, 94 deletions
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java index 5ca4f4c..f4e1bf8 100644 --- a/src/org/connectbot/ConsoleActivity.java +++ b/src/org/connectbot/ConsoleActivity.java @@ -75,27 +75,27 @@ public class ConsoleActivity extends Activity { protected TerminalManager bound = null; protected LayoutInflater inflater = null; - protected SharedPreferences prefs = null; + private SharedPreferences prefs = null; - protected PowerManager.WakeLock wakelock = null; + private PowerManager.WakeLock wakelock = null; - protected String PREF_KEEPALIVE = null; + private String PREF_KEEPALIVE = null; protected Uri requested; protected ClipboardManager clipboard; - protected RelativeLayout stringPromptGroup; + private RelativeLayout stringPromptGroup; protected EditText stringPrompt; - protected RelativeLayout booleanPromptGroup; - protected TextView booleanPrompt; - protected Button booleanYes, booleanNo; + private RelativeLayout booleanPromptGroup; + private TextView booleanPrompt; + private Button booleanYes, booleanNo; - protected TextView empty; + private TextView empty; - protected Animation slide_left_in, slide_left_out, slide_right_in, slide_right_out, fade_stay_hidden, fade_out; + private Animation slide_left_in, slide_left_out, slide_right_in, slide_right_out, fade_stay_hidden, fade_out; - protected MenuItem disconnect, copy, paste, portForward, resize; + private MenuItem disconnect, copy, paste, portForward, resize; protected boolean copying = false; protected TerminalView copySource = null; @@ -184,7 +184,7 @@ public class ConsoleActivity extends Activity { } }; - public Handler promptHandler = new Handler() { + protected Handler promptHandler = new Handler() { @Override public void handleMessage(Message msg) { // someone below us requested to display a prompt @@ -192,7 +192,7 @@ public class ConsoleActivity extends Activity { } }; - public Handler disconnectHandler = new Handler() { + protected Handler disconnectHandler = new Handler() { @Override public void handleMessage(Message msg) { Log.d(TAG, "Someone sending HANDLE_DISCONNECT to parentHandler"); @@ -234,6 +234,7 @@ public class ConsoleActivity extends Activity { } } + // TODO review use (apparently unused) protected void createPortForward(TerminalView target, String nickname, String type, String source, String dest) { String summary = getString(R.string.portforward_problem); try { @@ -251,12 +252,14 @@ public class ConsoleActivity extends Activity { Toast.makeText(ConsoleActivity.this, summary, Toast.LENGTH_LONG).show(); } + protected View findCurrentView(int id) { View view = flip.getCurrentView(); if(view == null) return null; return view.findViewById(id); } + // TODO review use (apparently unused) protected HostBean getCurrentHost() { View view = findCurrentView(R.id.console_flip); if(!(view instanceof TerminalView)) return null; @@ -367,9 +370,8 @@ public class ConsoleActivity extends Activity { fade_stay_hidden = AnimationUtils.loadAnimation(this, R.anim.fade_stay_hidden); // detect fling gestures to switch between terminals - final GestureDetector detect = new GestureDetector(new GestureDetector.SimpleOnGestureListener() { - - public float totalY = 0; + final GestureDetector detect = new GestureDetector(new GestureDetector.SimpleOnGestureListener() { + private float totalY = 0; @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { @@ -735,7 +737,7 @@ public class ConsoleActivity extends Activity { * saved back down into {@link TerminalManager} where we can read it again * later. */ - protected void updateDefault() { + private void updateDefault() { // update the current default terminal View view = findCurrentView(R.id.console_flip); if(!(view instanceof TerminalView)) return; diff --git a/src/org/connectbot/GeneratePubkeyActivity.java b/src/org/connectbot/GeneratePubkeyActivity.java index 5e0e31d..1c80173 100644 --- a/src/org/connectbot/GeneratePubkeyActivity.java +++ b/src/org/connectbot/GeneratePubkeyActivity.java @@ -57,7 +57,7 @@ public class GeneratePubkeyActivity extends Activity implements OnEntropyGathere final static int DEFAULT_BITS = 1024; - protected LayoutInflater inflater = null; + private LayoutInflater inflater = null; private EditText nickname; private RadioGroup keyTypeGroup; diff --git a/src/org/connectbot/HostEditorActivity.java b/src/org/connectbot/HostEditorActivity.java index 3c5367d..c0a6229 100644 --- a/src/org/connectbot/HostEditorActivity.java +++ b/src/org/connectbot/HostEditorActivity.java @@ -41,10 +41,7 @@ import android.preference.PreferenceActivity; import android.util.Log; public class HostEditorActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener { - - public class CursorPreferenceHack implements SharedPreferences { - protected final String table; protected final long id; @@ -101,7 +98,7 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr public class Editor implements SharedPreferences.Editor { - public ContentValues update = new ContentValues(); + private ContentValues update = new ContentValues(); public SharedPreferences.Editor clear() { Log.d(this.getClass().toString(), "clear()"); @@ -189,7 +186,7 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr return values.get(key); } - public List<OnSharedPreferenceChangeListener> listeners = new LinkedList<OnSharedPreferenceChangeListener>(); + protected List<OnSharedPreferenceChangeListener> listeners = new LinkedList<OnSharedPreferenceChangeListener>(); public void registerOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener) { listeners.add(listener); @@ -209,9 +206,9 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr } protected HostDatabase hostdb = null; - protected PubkeyDatabase pubkeydb = null; + private PubkeyDatabase pubkeydb = null; - protected CursorPreferenceHack pref; + private CursorPreferenceHack pref; @Override public void onCreate(Bundle icicle) { @@ -269,7 +266,7 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr } } - public void updateSummaries() { + private void updateSummaries() { // for all text preferences, set hint as current database value for(String key : this.pref.values.keySet()) { if(key.equals("postlogin")) continue; diff --git a/src/org/connectbot/HostListActivity.java b/src/org/connectbot/HostListActivity.java index 666a9ef..9e4f1b6 100644 --- a/src/org/connectbot/HostListActivity.java +++ b/src/org/connectbot/HostListActivity.java @@ -66,16 +66,16 @@ public class HostListActivity extends ListActivity { protected TerminalManager bound = null; protected HostDatabase hostdb; - protected List<HostBean> hosts; + private List<HostBean> hosts; protected LayoutInflater inflater = null; - public boolean sortedByColor = false; + protected boolean sortedByColor = false; - public MenuItem sortcolor; + private MenuItem sortcolor; - public MenuItem sortlast; + private MenuItem sortlast; - public Handler updateHandler = new Handler() { + protected Handler updateHandler = new Handler() { @Override public void handleMessage(Message msg) { HostListActivity.this.updateList(); @@ -130,7 +130,7 @@ public class HostListActivity extends ListActivity { public final static int REQUEST_EDIT = 1; public final static int REQUEST_EULA = 2; - protected SharedPreferences prefs = null; + private SharedPreferences prefs = null; @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { @@ -450,7 +450,7 @@ public class HostListActivity extends ListActivity { /** * Check if we're connected to a terminal with the given host. */ - protected int getConnectedState(HostBean host) { + private int getConnectedState(HostBean host) { // always disconnected if we dont have backend service if (this.manager == null) return STATE_UNKNOWN; diff --git a/src/org/connectbot/PortForwardListActivity.java b/src/org/connectbot/PortForwardListActivity.java index 688669d..26fe490 100644 --- a/src/org/connectbot/PortForwardListActivity.java +++ b/src/org/connectbot/PortForwardListActivity.java @@ -33,7 +33,6 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.ServiceConnection; -import android.database.Cursor; import android.graphics.Paint; import android.os.Bundle; import android.os.Handler; @@ -68,10 +67,9 @@ public class PortForwardListActivity extends ListActivity { protected HostDatabase hostdb; - protected Cursor hosts; - protected List<PortForwardBean> portForwards; + private List<PortForwardBean> portForwards; - protected ServiceConnection connection = null; + private ServiceConnection connection = null; protected TerminalBridge hostBridge = null; protected LayoutInflater inflater = null; @@ -349,7 +347,7 @@ public class PortForwardListActivity extends ListActivity { }); } - public Handler updateHandler = new Handler() { + protected Handler updateHandler = new Handler() { @Override public void handleMessage(Message msg) { PortForwardListActivity.this.updateList(); diff --git a/src/org/connectbot/PubkeyListActivity.java b/src/org/connectbot/PubkeyListActivity.java index 332d452..fb3df54 100644 --- a/src/org/connectbot/PubkeyListActivity.java +++ b/src/org/connectbot/PubkeyListActivity.java @@ -79,9 +79,9 @@ public class PubkeyListActivity extends ListActivity implements EventListener { public final static String TAG = PubkeyListActivity.class.toString(); protected PubkeyDatabase pubkeydb; - protected Cursor pubkeys; + private Cursor pubkeys; - protected int COL_ID, COL_NICKNAME, COL_TYPE, COL_PRIVATE, COL_PUBLIC, COL_ENCRYPTED, COL_STARTUP; + private int COL_ID, COL_NICKNAME, COL_TYPE, COL_PRIVATE, COL_PUBLIC, COL_ENCRYPTED, COL_STARTUP; protected ClipboardManager clipboard; @@ -174,7 +174,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener { /** * Read given file into memory as <code>byte[]</code>. */ - public static byte[] readRaw(File file) throws Exception { + protected static byte[] readRaw(File file) throws Exception { InputStream is = new FileInputStream(file); ByteArrayOutputStream os = new ByteArrayOutputStream(); @@ -336,7 +336,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener { } - protected MenuItem onstartToggle = null; + private MenuItem onstartToggle = null; @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { @@ -476,7 +476,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener { } - public Handler updateHandler = new Handler() { + protected Handler updateHandler = new Handler() { @Override public void handleMessage(Message msg) { PubkeyListActivity.this.updateCursor(); diff --git a/src/org/connectbot/TerminalView.java b/src/org/connectbot/TerminalView.java index 01fae16..ea8c229 100644 --- a/src/org/connectbot/TerminalView.java +++ b/src/org/connectbot/TerminalView.java @@ -38,15 +38,15 @@ import android.widget.Toast; */ public class TerminalView extends View { - protected final Context context; + private final Context context; protected final TerminalBridge bridge; - protected final Paint paint; - protected final Paint cursorPaint; + private final Paint paint; + private final Paint cursorPaint; private Toast notification = null; private String lastNotification = null; - public int top = -1, bottom = -1, left = -1, right = -1; + protected int top = -1, bottom = -1, left = -1, right = -1; public void resetSelected() { this.top = -1; diff --git a/src/org/connectbot/WizardActivity.java b/src/org/connectbot/WizardActivity.java index 871e6ca..abfcdd5 100644 --- a/src/org/connectbot/WizardActivity.java +++ b/src/org/connectbot/WizardActivity.java @@ -37,7 +37,7 @@ import android.widget.ViewFlipper; */ public class WizardActivity extends Activity { protected ViewFlipper flipper = null; - protected Button next, prev; + private Button next, prev; @Override public void onCreate(Bundle savedInstanceState) { diff --git a/src/org/connectbot/bean/AbstractBean.java b/src/org/connectbot/bean/AbstractBean.java index 3f855ad..13dd285 100644 --- a/src/org/connectbot/bean/AbstractBean.java +++ b/src/org/connectbot/bean/AbstractBean.java @@ -27,7 +27,7 @@ import android.content.ContentValues; * @author Kenny Root * */ -public abstract class AbstractBean { +abstract class AbstractBean { public abstract ContentValues getValues(); public String toXML() { diff --git a/src/org/connectbot/bean/PortForwardBean.java b/src/org/connectbot/bean/PortForwardBean.java index 50d9a3b..ecf9c44 100644 --- a/src/org/connectbot/bean/PortForwardBean.java +++ b/src/org/connectbot/bean/PortForwardBean.java @@ -59,13 +59,6 @@ public class PortForwardBean extends AbstractBean { } /** - * - */ - public PortForwardBean(long hostId) { - this.hostId = hostId; - } - - /** * @param type One of the port forward types from {@link HostDatabase} * @param source Source port number * @param dest Destination is "host:port" format diff --git a/src/org/connectbot/service/PromptHelper.java b/src/org/connectbot/service/PromptHelper.java index 7732e2e..a1dc891 100644 --- a/src/org/connectbot/service/PromptHelper.java +++ b/src/org/connectbot/service/PromptHelper.java @@ -13,13 +13,13 @@ import android.os.Message; */ public class PromptHelper { - protected final Object tag; + private final Object tag; public PromptHelper(Object tag) { this.tag = tag; } - protected Handler handler = null; + private Handler handler = null; /** * Register a user interface handler, if available. @@ -28,12 +28,12 @@ public class PromptHelper { this.handler = handler; } - protected Semaphore promptResponse = new Semaphore(0); + private Semaphore promptResponse = new Semaphore(0); public String promptHint = null; public Object promptRequested = null; - protected Object response = null; + private Object response = null; /** * Set an incoming value from an above user interface. Will automatically diff --git a/src/org/connectbot/service/TerminalBridge.java b/src/org/connectbot/service/TerminalBridge.java index 20bcb92..14a3644 100644 --- a/src/org/connectbot/service/TerminalBridge.java +++ b/src/org/connectbot/service/TerminalBridge.java @@ -79,16 +79,14 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal public final static String TAG = TerminalBridge.class.toString(); - public final static int TERM_WIDTH_CHARS = 80, - TERM_HEIGHT_CHARS = 24, - DEFAULT_FONT_SIZE = 10; + public final static int DEFAULT_FONT_SIZE = 10; public final static String ENCODING = "ASCII"; public static final String AUTH_PUBLICKEY = "publickey", AUTH_PASSWORD = "password", AUTH_KEYBOARDINTERACTIVE = "keyboard-interactive"; - public final static int AUTH_TRIES = 20; + protected final static int AUTH_TRIES = 20; private int darken(int color) { return Color.argb(0xFF, @@ -103,7 +101,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal public int color[] = { Color.BLACK, Color.RED, Color.GREEN, Color.YELLOW, Color.BLUE, Color.MAGENTA, Color.CYAN, Color.WHITE, }; - public int darkerColor[] = new int[color.length]; + private int darkerColor[] = new int[color.length]; public final static int COLOR_FG_STD = 7; public final static int COLOR_BG_STD = 0; @@ -115,23 +113,23 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal public final Connection connection; protected Session session; - protected final Paint defaultPaint; + private final Paint defaultPaint; protected OutputStream stdin; protected InputStream stdout; private InputStream stderr; - protected Thread relay; + private Thread relay; - protected final String emulation; - protected final int scrollback; + private final String emulation; + private final int scrollback; public Bitmap bitmap = null; public VDUBuffer buffer = null; - protected TerminalView parent = null; - protected Canvas canvas = new Canvas(); + private TerminalView parent = null; + private Canvas canvas = new Canvas(); private boolean ctrlPressed = false; private boolean altPressed = false; @@ -148,27 +146,23 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal private int termWidth; private int termHeight; - public String keymode = null; + private String keymode = null; - public KeyCharacterMap keymap = KeyCharacterMap.load(KeyCharacterMap.BUILT_IN_KEYBOARD); + protected KeyCharacterMap keymap = KeyCharacterMap.load(KeyCharacterMap.BUILT_IN_KEYBOARD); public int charWidth = -1; public int charHeight = -1; - public int charDescent = -1; + private int charDescent = -1; - protected float fontSize = -1; + private float fontSize = -1; /** * Flag indicating if we should perform a full-screen redraw during our next * rendering pass. */ - protected boolean fullRedraw = false; - - public long drawTolerance = 100; - - public long lastDraw = 0; + private boolean fullRedraw = false; public PromptHelper promptHelper; @@ -292,7 +286,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal /** * Spawn thread to open connection and start login process. */ - public void startConnection() { + protected void startConnection() { new Thread(new Runnable() { public void run() { try { @@ -329,7 +323,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal * @throws InvalidKeySpecException * @throws IOException */ - public boolean tryPublicKey(Cursor c) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException { + private boolean tryPublicKey(Cursor c) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException { int COL_NICKNAME = c.getColumnIndexOrThrow(PubkeyDatabase.FIELD_PUBKEY_NICKNAME), COL_TYPE = c.getColumnIndexOrThrow(PubkeyDatabase.FIELD_PUBKEY_TYPE), COL_PRIVATE = c.getColumnIndexOrThrow(PubkeyDatabase.FIELD_PUBKEY_PRIVATE), @@ -390,7 +384,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal } - protected boolean tryPublicKey(String username, String keyNickname, Object trileadKey) throws IOException { + private boolean tryPublicKey(String username, String keyNickname, Object trileadKey) throws IOException { //outputLine(String.format("Attempting 'publickey' with key '%s' [%s]...", keyNickname, trileadKey.toString())); boolean success = connection.authenticateWithPublicKey(username, trileadKey); if(!success) @@ -398,7 +392,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal return success; } - public void handleAuthentication() { + protected void handleAuthentication() { try { if (connection.authenticateWithNone(host.getUsername())) { finishConnection(); @@ -515,7 +509,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal * Internal method to request actual PTY terminal once we've finished * authentication. If called before authenticated, it will just fail. */ - protected void finishConnection() { + private void finishConnection() { setAuthenticated(true); // Start up predefined port forwards @@ -822,7 +816,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal * Request a different font size. Will make call to parentChanged() to make * sure we resize PTY if needed. */ - protected void setFontSize(float size) { + private void setFontSize(float size) { defaultPaint.setTextSize(size); fontSize = size; diff --git a/src/org/connectbot/service/TerminalManager.java b/src/org/connectbot/service/TerminalManager.java index 18c5233..a316936 100644 --- a/src/org/connectbot/service/TerminalManager.java +++ b/src/org/connectbot/service/TerminalManager.java @@ -63,11 +63,11 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen protected Resources res; - public HostDatabase hostdb; + protected HostDatabase hostdb; protected PubkeyDatabase pubkeydb; protected SharedPreferences prefs; - protected String pref_emulation, pref_scrollback, pref_keymode, pref_memkeys; + private String pref_emulation, pref_scrollback, pref_keymode, pref_memkeys; @Override public void onCreate() { @@ -131,7 +131,7 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen /** * Open a new SSH session using the given parameters. */ - public void openConnection(HostBean host) throws Exception { + private void openConnection(HostBean host) throws Exception { // throw exception if terminal already open if (this.findBridge(host) != null) { throw new Exception("Connection already open for that nickname"); @@ -192,7 +192,7 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen * Update the last-connected value for the given nickname by passing through * to {@link HostDatabase}. */ - protected void touchHost(HostBean host) { + private void touchHost(HostBean host) { hostdb.touchHost(host); } @@ -250,7 +250,6 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen return this.loadedPubkeys.get(nickname); } - public class TerminalBinder extends Binder { public TerminalManager getService() { return TerminalManager.this; diff --git a/src/org/connectbot/util/UpdateHelper.java b/src/org/connectbot/util/UpdateHelper.java index 973e087..24cdfd8 100644 --- a/src/org/connectbot/util/UpdateHelper.java +++ b/src/org/connectbot/util/UpdateHelper.java @@ -70,10 +70,10 @@ public class UpdateHelper implements Runnable { protected Context context; - protected String packageName, versionName; + private String packageName, versionName; protected int versionCode; - protected String userAgent; + private String userAgent; /** * Constructor will automatically spawn thread to check for updates. @@ -147,7 +147,7 @@ public class UpdateHelper implements Runnable { * Handler that will parse the JSON response and show dialog to user if an * update is available. */ - public Handler versionHandler = new Handler() { + private Handler versionHandler = new Handler() { @Override public void handleMessage(Message msg) { @@ -184,7 +184,7 @@ public class UpdateHelper implements Runnable { * Read contents of a URL and return as a String. Handles any server * downtime with a 6-second timeout. */ - public static String getUrl(String tryUrl, String userAgent) throws Exception { + private static String getUrl(String tryUrl, String userAgent) throws Exception { URL url = new URL(tryUrl); URLConnection connection = url.openConnection(); |