aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/org/connectbot/ConsoleActivity.java80
-rw-r--r--app/src/main/java/org/connectbot/GeneratePubkeyActivity.java4
-rw-r--r--app/src/main/java/org/connectbot/HelpActivity.java2
-rw-r--r--app/src/main/java/org/connectbot/HostEditorActivity.java28
-rw-r--r--app/src/main/java/org/connectbot/HostListActivity.java26
-rw-r--r--app/src/main/java/org/connectbot/PortForwardListActivity.java10
-rw-r--r--app/src/main/java/org/connectbot/PubkeyListActivity.java32
-rw-r--r--app/src/main/java/org/connectbot/TerminalView.java4
-rw-r--r--app/src/main/java/org/connectbot/WizardActivity.java8
-rw-r--r--app/src/main/java/org/connectbot/bean/HostBean.java4
-rw-r--r--app/src/main/java/org/connectbot/bean/SelectionArea.java2
-rw-r--r--app/src/main/java/org/connectbot/service/ConnectionNotifier.java2
-rw-r--r--app/src/main/java/org/connectbot/service/PromptHelper.java8
-rw-r--r--app/src/main/java/org/connectbot/service/TerminalBridge.java26
-rw-r--r--app/src/main/java/org/connectbot/service/TerminalKeyListener.java18
-rw-r--r--app/src/main/java/org/connectbot/service/TerminalManager.java10
-rw-r--r--app/src/main/java/org/connectbot/transport/AbsTransport.java7
-rw-r--r--app/src/main/java/org/connectbot/transport/SSH.java34
-rw-r--r--app/src/main/java/org/connectbot/util/EastAsianWidth.java2
-rw-r--r--app/src/main/java/org/connectbot/util/Encryptor.java4
-rw-r--r--app/src/main/java/org/connectbot/util/EntropyView.java6
-rw-r--r--app/src/main/java/org/connectbot/util/HostDatabase.java2
-rw-r--r--app/src/main/java/org/connectbot/util/PubkeyUtils.java2
-rw-r--r--app/src/main/java/org/connectbot/util/UberColorPickerDialog.java130
-rw-r--r--app/src/main/java/org/connectbot/util/VolumePreference.java2
-rw-r--r--config/quality/checkstyle/checkstyle.xml11
26 files changed, 245 insertions, 219 deletions
diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java
index c801d13..2116d92 100644
--- a/app/src/main/java/org/connectbot/ConsoleActivity.java
+++ b/app/src/main/java/org/connectbot/ConsoleActivity.java
@@ -163,7 +163,7 @@ public class ConsoleActivity extends Activity {
try {
Log.d(TAG, String.format("We couldnt find an existing bridge with URI=%s (nickname=%s), so creating one now", requested.toString(), requestedNickname));
requestedBridge = bound.openConnection(requested);
- } catch(Exception e) {
+ } catch (Exception e) {
Log.e(TAG, "Problem while trying to create new requested bridge from URI", e);
}
}
@@ -184,7 +184,7 @@ public class ConsoleActivity extends Activity {
public void onServiceDisconnected(ComponentName className) {
// tell each bridge to forget about our prompt handler
synchronized (bound.bridges) {
- for(TerminalBridge bridge : bound.bridges)
+ for (TerminalBridge bridge : bound.bridges)
bridge.promptHelper.setHandler(null);
}
@@ -209,7 +209,7 @@ public class ConsoleActivity extends Activity {
// someone below us requested to display a password dialog
// they are sending nickname and requested
- TerminalBridge bridge = (TerminalBridge)msg.obj;
+ TerminalBridge bridge = (TerminalBridge) msg.obj;
if (bridge.isAwaitingClose())
closeBridge(bridge);
@@ -250,14 +250,14 @@ public class ConsoleActivity extends Activity {
protected View findCurrentView(int id) {
View view = flip.getCurrentView();
- if(view == null) return null;
+ if (view == null) return null;
return view.findViewById(id);
}
protected PromptHelper getCurrentPromptHelper() {
View view = findCurrentView(R.id.console_flip);
- if(!(view instanceof TerminalView)) return null;
- return ((TerminalView)view).bridge.promptHelper;
+ if (!(view instanceof TerminalView)) return null;
+ return ((TerminalView) view).bridge.promptHelper;
}
protected void hideAllPrompts() {
@@ -308,7 +308,7 @@ public class ConsoleActivity extends Activity {
hardKeyboard = getResources().getConfiguration().keyboard ==
Configuration.KEYBOARD_QWERTY;
- clipboard = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE);
+ clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
prefs = PreferenceManager.getDefaultSharedPreferences(this);
titleBarHide = prefs.getBoolean(PreferenceConstants.TITLEBARHIDE, false);
@@ -332,22 +332,22 @@ public class ConsoleActivity extends Activity {
inflater = LayoutInflater.from(this);
- flip = (ViewFlipper)findViewById(R.id.console_flip);
- empty = (TextView)findViewById(android.R.id.empty);
+ flip = (ViewFlipper) findViewById(R.id.console_flip);
+ empty = (TextView) findViewById(android.R.id.empty);
stringPromptGroup = (RelativeLayout) findViewById(R.id.console_password_group);
stringPromptInstructions = (TextView) findViewById(R.id.console_password_instructions);
- stringPrompt = (EditText)findViewById(R.id.console_password);
+ stringPrompt = (EditText) findViewById(R.id.console_password);
stringPrompt.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
- if(event.getAction() == KeyEvent.ACTION_UP) return false;
- if(keyCode != KeyEvent.KEYCODE_ENTER) return false;
+ if (event.getAction() == KeyEvent.ACTION_UP) return false;
+ if (keyCode != KeyEvent.KEYCODE_ENTER) return false;
// pass collected password down to current terminal
String value = stringPrompt.getText().toString();
PromptHelper helper = getCurrentPromptHelper();
- if(helper == null) return false;
+ if (helper == null) return false;
helper.setResponse(value);
// finally clear password for next user
@@ -359,23 +359,23 @@ public class ConsoleActivity extends Activity {
});
booleanPromptGroup = (RelativeLayout) findViewById(R.id.console_boolean_group);
- booleanPrompt = (TextView)findViewById(R.id.console_prompt);
+ booleanPrompt = (TextView) findViewById(R.id.console_prompt);
- booleanYes = (Button)findViewById(R.id.console_prompt_yes);
+ booleanYes = (Button) findViewById(R.id.console_prompt_yes);
booleanYes.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
PromptHelper helper = getCurrentPromptHelper();
- if(helper == null) return;
+ if (helper == null) return;
helper.setResponse(Boolean.TRUE);
updatePromptVisible();
}
});
- booleanNo = (Button)findViewById(R.id.console_prompt_no);
+ booleanNo = (Button) findViewById(R.id.console_prompt_no);
booleanNo.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
PromptHelper helper = getCurrentPromptHelper();
- if(helper == null) return;
+ if (helper == null) return;
helper.setResponse(Boolean.FALSE);
updatePromptVisible();
}
@@ -415,7 +415,7 @@ public class ConsoleActivity extends Activity {
public void onClick(View view) {
View flip = findCurrentView(R.id.console_flip);
if (flip == null) return;
- TerminalView terminal = (TerminalView)flip;
+ TerminalView terminal = (TerminalView) flip;
TerminalKeyListener handler = terminal.bridge.getKeyHandler();
handler.metaPress(TerminalKeyListener.OUR_CTRL_ON, true);
@@ -428,7 +428,7 @@ public class ConsoleActivity extends Activity {
public void onClick(View view) {
View flip = findCurrentView(R.id.console_flip);
if (flip == null) return;
- TerminalView terminal = (TerminalView)flip;
+ TerminalView terminal = (TerminalView) flip;
TerminalKeyListener handler = terminal.bridge.getKeyHandler();
handler.sendEscape();
@@ -499,13 +499,13 @@ public class ConsoleActivity extends Activity {
if (Math.abs(e1.getX() - e2.getX()) < ViewConfiguration.getTouchSlop() * 4) {
View flip = findCurrentView(R.id.console_flip);
- if(flip == null) return false;
- TerminalView terminal = (TerminalView)flip;
+ if (flip == null) return false;
+ TerminalView terminal = (TerminalView) flip;
// estimate how many rows we have scrolled through
// accumulate distance that doesn't trigger immediate scroll
totalY += distanceY;
- final int moved = (int)(totalY / terminal.bridge.charHeight);
+ final int moved = (int) (totalY / terminal.bridge.charHeight);
// consume as scrollback only if towards right half of screen
if (e2.getX() > flip.getWidth() / 2) {
@@ -518,12 +518,12 @@ public class ConsoleActivity extends Activity {
} else {
// otherwise consume as pgup/pgdown for every 5 lines
if (moved > 5) {
- ((vt320)terminal.bridge.buffer).keyPressed(vt320.KEY_PAGE_DOWN, ' ', 0);
+ ((vt320) terminal.bridge.buffer).keyPressed(vt320.KEY_PAGE_DOWN, ' ', 0);
terminal.bridge.tryKeyVibrate();
totalY = 0;
return true;
} else if (moved < -5) {
- ((vt320)terminal.bridge.buffer).keyPressed(vt320.KEY_PAGE_UP, ' ', 0);
+ ((vt320) terminal.bridge.buffer).keyPressed(vt320.KEY_PAGE_UP, ' ', 0);
terminal.bridge.tryKeyVibrate();
totalY = 0;
return true;
@@ -546,8 +546,8 @@ public class ConsoleActivity extends Activity {
// when copying, highlight the area
if (copySource != null && copySource.isSelectingForCopy()) {
- int row = (int)Math.floor(event.getY() / copySource.charHeight);
- int col = (int)Math.floor(event.getX() / copySource.charWidth);
+ int row = (int) Math.floor(event.getY() / copySource.charHeight);
+ int col = (int) Math.floor(event.getX() / copySource.charWidth);
SelectionArea area = copySource.getSelectionArea();
@@ -935,10 +935,10 @@ public class ConsoleActivity extends Activity {
// If we didn't find the requested connection, try opening it
try {
- Log.d(TAG, String.format("We couldnt find an existing bridge with URI=%s (nickname=%s),"+
+ Log.d(TAG, String.format("We couldnt find an existing bridge with URI=%s (nickname=%s)," +
"so creating one now", requested.toString(), requested.getFragment()));
requestedBridge = bound.openConnection(requested);
- } catch(Exception e) {
+ } catch (Exception e) {
Log.e(TAG, "Problem while trying to create new requested bridge from URI", e);
// TODO: We should display an error dialog here.
return;
@@ -1007,10 +1007,10 @@ public class ConsoleActivity extends Activity {
private void updateDefault() {
// update the current default terminal
View view = findCurrentView(R.id.console_flip);
- if(!(view instanceof TerminalView)) return;
+ if (!(view instanceof TerminalView)) return;
- TerminalView terminal = (TerminalView)view;
- if(bound == null) return;
+ TerminalView terminal = (TerminalView) view;
+ if (bound == null) return;
bound.defaultBridge = terminal.bridge;
}
@@ -1029,13 +1029,13 @@ public class ConsoleActivity extends Activity {
// Hide all the prompts in case a prompt request was canceled
hideAllPrompts();
- if(!(view instanceof TerminalView)) {
+ if (!(view instanceof TerminalView)) {
// we dont have an active view, so hide any prompts
return;
}
- PromptHelper prompt = ((TerminalView)view).bridge.promptHelper;
- if(String.class.equals(prompt.promptRequested)) {
+ PromptHelper prompt = ((TerminalView) view).bridge.promptHelper;
+ if (String.class.equals(prompt.promptRequested)) {
stringPromptGroup.setVisibility(View.VISIBLE);
String instructions = prompt.promptInstructions;
@@ -1048,7 +1048,7 @@ public class ConsoleActivity extends Activity {
stringPrompt.setHint(prompt.promptHint);
stringPrompt.requestFocus();
- } else if(Boolean.class.equals(prompt.promptRequested)) {
+ } else if (Boolean.class.equals(prompt.promptRequested)) {
booleanPromptGroup.setVisibility(View.VISIBLE);
booleanPrompt.setText(prompt.promptHint);
booleanYes.requestFocus();
@@ -1097,9 +1097,9 @@ public class ConsoleActivity extends Activity {
if (bound != null) {
if (forcedOrientation &&
(newConfig.orientation != Configuration.ORIENTATION_LANDSCAPE &&
- getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) ||
+ getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) ||
(newConfig.orientation != Configuration.ORIENTATION_PORTRAIT &&
- getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT))
+ getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT))
bound.setResizeAllowed(false);
else
bound.setResizeAllowed(true);
@@ -1121,10 +1121,10 @@ public class ConsoleActivity extends Activity {
bridge.promptHelper.setHandler(promptHandler);
// inflate each terminal view
- RelativeLayout view = (RelativeLayout)inflater.inflate(R.layout.item_terminal, flip, false);
+ RelativeLayout view = (RelativeLayout) inflater.inflate(R.layout.item_terminal, flip, false);
// set the terminal overlay text
- TextView overlay = (TextView)view.findViewById(R.id.terminal_overlay);
+ TextView overlay = (TextView) view.findViewById(R.id.terminal_overlay);
overlay.setText(bridge.host.getNickname());
// and add our terminal view control, using index to place behind overlay
diff --git a/app/src/main/java/org/connectbot/GeneratePubkeyActivity.java b/app/src/main/java/org/connectbot/GeneratePubkeyActivity.java
index 4d7c756..d7664c6 100644
--- a/app/src/main/java/org/connectbot/GeneratePubkeyActivity.java
+++ b/app/src/main/java/org/connectbot/GeneratePubkeyActivity.java
@@ -230,7 +230,7 @@ public class GeneratePubkeyActivity extends Activity implements OnEntropyGathere
private void startEntropyGather() {
final View entropyView = inflater.inflate(R.layout.dia_gatherentropy, null, false);
- ((EntropyView)entropyView.findViewById(R.id.entropy)).addOnEntropyGatheredListener(GeneratePubkeyActivity.this);
+ ((EntropyView) entropyView.findViewById(R.id.entropy)).addOnEntropyGatheredListener(GeneratePubkeyActivity.this);
entropyDialog = new EntropyDialog(GeneratePubkeyActivity.this, entropyView);
entropyDialog.show();
}
@@ -248,7 +248,7 @@ public class GeneratePubkeyActivity extends Activity implements OnEntropyGathere
for (int i = 0; i < 20; i++)
numSetBits += measureNumberOfSetBits(this.entropy[i]);
- Log.d(TAG, "Entropy distribution=" + (int)(100.0 * numSetBits / 160.0) + "%");
+ Log.d(TAG, "Entropy distribution=" + (int) (100.0 * numSetBits / 160.0) + "%");
Log.d(TAG, "entropy gathered; attemping to generate key...");
startKeyGen();
diff --git a/app/src/main/java/org/connectbot/HelpActivity.java b/app/src/main/java/org/connectbot/HelpActivity.java
index d82777d..f56a1c0 100644
--- a/app/src/main/java/org/connectbot/HelpActivity.java
+++ b/app/src/main/java/org/connectbot/HelpActivity.java
@@ -49,7 +49,7 @@ public class HelpActivity extends Activity {
getResources().getText(R.string.title_help)));
AssetManager am = this.getAssets();
- LinearLayout content = (LinearLayout)this.findViewById(R.id.topics);
+ LinearLayout content = (LinearLayout) findViewById(R.id.topics);
try {
for (String name : am.list(HELPDIR)) {
diff --git a/app/src/main/java/org/connectbot/HostEditorActivity.java b/app/src/main/java/org/connectbot/HostEditorActivity.java
index 4e8427f..d1e5487 100644
--- a/app/src/main/java/org/connectbot/HostEditorActivity.java
+++ b/app/src/main/java/org/connectbot/HostEditorActivity.java
@@ -73,9 +73,9 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr
new String[] { String.valueOf(id) }, null, null, null);
if (cursor.moveToFirst()) {
- for(int i = 0; i < cursor.getColumnCount(); i++) {
+ for (int i = 0; i < cursor.getColumnCount(); i++) {
String key = cursor.getColumnName(i);
- if(key.equals(HostDatabase.FIELD_HOST_HOSTKEY)) continue;
+ if (key.equals(HostDatabase.FIELD_HOST_HOSTKEY)) continue;
String value = cursor.getString(i);
values.put(key, value);
}
@@ -124,7 +124,7 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr
cacheValues();
// and update any listeners
- for(OnSharedPreferenceChangeListener listener : listeners) {
+ for (OnSharedPreferenceChangeListener listener : listeners) {
listener.onSharedPreferenceChanged(CursorPreferenceHack.this, null);
}
@@ -198,7 +198,7 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr
public String getString(String key, String defValue) {
//Log.d(this.getClass().toString(), String.format("getString(key=%s, defValue=%s)", key, defValue));
- if(!values.containsKey(key)) return defValue;
+ if (!values.containsKey(key)) return defValue;
return values.get(key);
}
@@ -269,7 +269,7 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr
// add all existing pubkeys to our listpreference for user to choose from
// TODO: may be an issue here when this activity is recycled after adding a new pubkey
// TODO: should consider moving into onStart, but we dont have a good way of resetting the listpref after filling once
- ListPreference pubkeyPref = (ListPreference)this.findPreference(HostDatabase.FIELD_HOST_PUBKEYID);
+ ListPreference pubkeyPref = (ListPreference) findPreference(HostDatabase.FIELD_HOST_PUBKEYID);
List<CharSequence> pubkeyNicks = new LinkedList<CharSequence>(Arrays.asList(pubkeyPref.getEntries()));
pubkeyNicks.addAll(pubkeydb.allValues(PubkeyDatabase.FIELD_PUBKEY_NICKNAME));
@@ -306,10 +306,10 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr
bindService(new Intent(this, TerminalManager.class), connection, Context.BIND_AUTO_CREATE);
- if(this.hostdb == null)
+ if (this.hostdb == null)
this.hostdb = new HostDatabase(this);
- if(this.pubkeydb == null)
+ if (this.pubkeydb == null)
this.pubkeydb = new PubkeyDatabase(this);
}
@@ -319,12 +319,12 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr
unbindService(connection);
- if(this.hostdb != null) {
+ if (this.hostdb != null) {
this.hostdb.close();
this.hostdb = null;
}
- if(this.pubkeydb != null) {
+ if (this.pubkeydb != null) {
this.pubkeydb.close();
this.pubkeydb = null;
}
@@ -333,10 +333,10 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr
private void updateSummaries() {
// for all text preferences, set hint as current database value
for (String key : this.pref.values.keySet()) {
- if(key.equals(HostDatabase.FIELD_HOST_POSTLOGIN)) continue;
+ if (key.equals(HostDatabase.FIELD_HOST_POSTLOGIN)) continue;
Preference pref = this.findPreference(key);
- if(pref == null) continue;
- if(pref instanceof CheckBoxPreference) continue;
+ if (pref == null) continue;
+ if (pref instanceof CheckBoxPreference) continue;
CharSequence value = this.pref.getString(key, "");
if (key.equals(HostDatabase.FIELD_HOST_PUBKEYID)) {
@@ -344,9 +344,9 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr
int pubkeyId = Integer.parseInt((String) value);
if (pubkeyId >= 0)
pref.setSummary(pubkeydb.getNickname(pubkeyId));
- else if(pubkeyId == HostDatabase.PUBKEYID_ANY)
+ else if (pubkeyId == HostDatabase.PUBKEYID_ANY)
pref.setSummary(R.string.list_pubkeyids_any);
- else if(pubkeyId == HostDatabase.PUBKEYID_NEVER)
+ else if (pubkeyId == HostDatabase.PUBKEYID_NEVER)
pref.setSummary(R.string.list_pubkeyids_none);
continue;
} catch (NumberFormatException nfe) {
diff --git a/app/src/main/java/org/connectbot/HostListActivity.java b/app/src/main/java/org/connectbot/HostListActivity.java
index c97e69e..33bee52 100644
--- a/app/src/main/java/org/connectbot/HostListActivity.java
+++ b/app/src/main/java/org/connectbot/HostListActivity.java
@@ -115,7 +115,7 @@ public class HostListActivity extends ListActivity {
// start the terminal manager service
this.bindService(new Intent(this, TerminalManager.class), connection, Context.BIND_AUTO_CREATE);
- if(this.hostdb == null)
+ if (this.hostdb == null)
this.hostdb = new HostDatabase(this);
}
@@ -124,7 +124,7 @@ public class HostListActivity extends ListActivity {
super.onStop();
this.unbindService(connection);
- if(this.hostdb != null) {
+ if (this.hostdb != null) {
this.hostdb.close();
this.hostdb = null;
}
@@ -138,7 +138,7 @@ public class HostListActivity extends ListActivity {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_EULA) {
- if(resultCode == Activity.RESULT_OK) {
+ if (resultCode == Activity.RESULT_OK) {
// yay they agreed, so store that info
Editor edit = prefs.edit();
edit.putBoolean(PreferenceConstants.EULA, true);
@@ -188,7 +188,7 @@ public class HostListActivity extends ListActivity {
// check for eula agreement
boolean agreed = prefs.getBoolean(PreferenceConstants.EULA, false);
- if(!agreed) {
+ if (!agreed) {
this.startActivityForResult(new Intent(this, WizardActivity.class), REQUEST_EULA);
}
@@ -241,14 +241,14 @@ public class HostListActivity extends ListActivity {
public boolean onKey(View v, int keyCode, KeyEvent event) {
- if(event.getAction() == KeyEvent.ACTION_UP) return false;
- if(keyCode != KeyEvent.KEYCODE_ENTER) return false;
+ if (event.getAction() == KeyEvent.ACTION_UP) return false;
+ if (keyCode != KeyEvent.KEYCODE_ENTER) return false;
return startConsoleActivity();
}
});
- transportSpinner = (Spinner)findViewById(R.id.transport_selection);
+ transportSpinner = (Spinner) findViewById(R.id.transport_selection);
transportSpinner.setVisibility(makingShortcut ? View.GONE : View.VISIBLE);
ArrayAdapter<String> transportSelection = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, TransportFactory.getTransportNames());
@@ -288,7 +288,7 @@ public class HostListActivity extends ListActivity {
super.onCreateOptionsMenu(menu);
// don't offer menus when creating shortcut
- if(makingShortcut) return true;
+ if (makingShortcut) return true;
// add host, ssh keys, about
sortcolor = menu.add(R.string.list_menu_sortcolor);
@@ -386,7 +386,7 @@ public class HostListActivity extends ListActivity {
.setPositiveButton(R.string.delete_pos, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// make sure we disconnect
- if(bridge != null)
+ if (bridge != null)
bridge.dispatchDisconnect(true);
hostdb.deleteHost(host);
@@ -506,9 +506,9 @@ public class HostListActivity extends ListActivity {
holder = new ViewHolder();
- holder.nickname = (TextView)convertView.findViewById(android.R.id.text1);
- holder.caption = (TextView)convertView.findViewById(android.R.id.text2);
- holder.icon = (ImageView)convertView.findViewById(android.R.id.icon);
+ holder.nickname = (TextView) convertView.findViewById(android.R.id.text1);
+ holder.caption = (TextView) convertView.findViewById(android.R.id.text2);
+ holder.icon = (ImageView) convertView.findViewById(android.R.id.icon);
convertView.setTag(holder);
} else
@@ -562,7 +562,7 @@ public class HostListActivity extends ListActivity {
String nice = context.getString(R.string.bind_never);
if (host.getLastConnect() > 0) {
- int minutes = (int)((now - host.getLastConnect()) / 60);
+ int minutes = (int) ((now - host.getLastConnect()) / 60);
if (minutes >= 60) {
int hours = (minutes / 60);
if (hours >= 24) {
diff --git a/app/src/main/java/org/connectbot/PortForwardListActivity.java b/app/src/main/java/org/connectbot/PortForwardListActivity.java
index f9982e4..ff4f7d2 100644
--- a/app/src/main/java/org/connectbot/PortForwardListActivity.java
+++ b/app/src/main/java/org/connectbot/PortForwardListActivity.java
@@ -84,7 +84,7 @@ public class PortForwardListActivity extends ListActivity {
this.bindService(new Intent(this, TerminalManager.class), connection, Context.BIND_AUTO_CREATE);
- if(this.hostdb == null)
+ if (this.hostdb == null)
this.hostdb = new HostDatabase(this);
}
@@ -94,7 +94,7 @@ public class PortForwardListActivity extends ListActivity {
this.unbindService(connection);
- if(this.hostdb != null) {
+ if (this.hostdb != null) {
this.hostdb.close();
this.hostdb = null;
}
@@ -177,7 +177,7 @@ public class PortForwardListActivity extends ListActivity {
// build dialog to prompt user about updating
final View portForwardView = inflater.inflate(R.layout.dia_portforward, null, false);
final EditText destEdit = (EditText) portForwardView.findViewById(R.id.portforward_destination);
- final Spinner typeSpinner = (Spinner)portForwardView.findViewById(R.id.portforward_type);
+ final Spinner typeSpinner = (Spinner) portForwardView.findViewById(R.id.portforward_type);
typeSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> value, View view,
@@ -403,8 +403,8 @@ public class PortForwardListActivity extends ListActivity {
convertView = inflater.inflate(R.layout.item_portforward, null, false);
holder = new ViewHolder();
- holder.nickname = (TextView)convertView.findViewById(android.R.id.text1);
- holder.caption = (TextView)convertView.findViewById(android.R.id.text2);
+ holder.nickname = (TextView) convertView.findViewById(android.R.id.text1);
+ holder.caption = (TextView) convertView.findViewById(android.R.id.text2);
convertView.setTag(holder);
} else
diff --git a/app/src/main/java/org/connectbot/PubkeyListActivity.java b/app/src/main/java/org/connectbot/PubkeyListActivity.java
index 226794f..52e18af 100644
--- a/app/src/main/java/org/connectbot/PubkeyListActivity.java
+++ b/app/src/main/java/org/connectbot/PubkeyListActivity.java
@@ -120,7 +120,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
bindService(new Intent(this, TerminalManager.class), connection, Context.BIND_AUTO_CREATE);
- if(pubkeydb == null)
+ if (pubkeydb == null)
pubkeydb = new PubkeyDatabase(this);
}
@@ -130,7 +130,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
unbindService(connection);
- if(pubkeydb != null) {
+ if (pubkeydb != null) {
pubkeydb.close();
pubkeydb = null;
}
@@ -158,7 +158,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
boolean loaded = bound.isKeyLoaded(pubkey.getNickname());
// handle toggling key in-memory on/off
- if(loaded) {
+ if (loaded) {
bound.removeKey(pubkey.getNickname());
updateList();
} else {
@@ -168,7 +168,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
}
});
- clipboard = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE);
+ clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
inflater = LayoutInflater.from(this);
}
@@ -240,7 +240,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
protected void handleAddKey(final PubkeyBean pubkey) {
if (pubkey.isEncrypted()) {
final View view = inflater.inflate(R.layout.dia_password, null);
- final EditText passwordField = (EditText)view.findViewById(android.R.id.text1);
+ final EditText passwordField = (EditText) view.findViewById(android.R.id.text1);
new AlertDialog.Builder(PubkeyListActivity.this)
.setView(view)
@@ -257,11 +257,11 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
protected void handleAddKey(PubkeyBean keybean, String password) {
KeyPair pair = null;
- if(PubkeyDatabase.KEY_TYPE_IMPORTED.equals(keybean.getType())) {
+ if (PubkeyDatabase.KEY_TYPE_IMPORTED.equals(keybean.getType())) {
// load specific key using pem format
try {
pair = PEMDecoder.decode(new String(keybean.getPrivateKey()).toCharArray(), password);
- } catch(Exception e) {
+ } catch (Exception e) {
String message = getResources().getString(R.string.pubkey_failed_add, keybean.getNickname());
Log.e(TAG, message, e);
Toast.makeText(PubkeyListActivity.this, message, Toast.LENGTH_LONG).show();
@@ -312,7 +312,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
MenuItem load = menu.add(loaded ? R.string.pubkey_memory_unload : R.string.pubkey_memory_load);
load.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
- if(loaded) {
+ if (loaded) {
bound.removeKey(pubkey.getNickname());
updateList();
} else {
@@ -380,15 +380,15 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
changePassword.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
final View changePasswordView = inflater.inflate(R.layout.dia_changepassword, null, false);
- ((TableRow)changePasswordView.findViewById(R.id.old_password_prompt))
+ ((TableRow) changePasswordView.findViewById(R.id.old_password_prompt))
.setVisibility(pubkey.isEncrypted() ? View.VISIBLE : View.GONE);
new AlertDialog.Builder(PubkeyListActivity.this)
.setView(changePasswordView)
.setPositiveButton(R.string.button_change, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
- String oldPassword = ((EditText)changePasswordView.findViewById(R.id.old_password)).getText().toString();
- String password1 = ((EditText)changePasswordView.findViewById(R.id.password1)).getText().toString();
- String password2 = ((EditText)changePasswordView.findViewById(R.id.password2)).getText().toString();
+ String oldPassword = ((EditText) changePasswordView.findViewById(R.id.old_password)).getText().toString();
+ String password1 = ((EditText) changePasswordView.findViewById(R.id.password1)).getText().toString();
+ String password2 = ((EditText) changePasswordView.findViewById(R.id.password2)).getText().toString();
if (!password1.equals(password2)) {
new AlertDialog.Builder(PubkeyListActivity.this)
@@ -446,7 +446,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
public void onClick(DialogInterface dialog, int which) {
// dont forget to remove from in-memory
- if(loaded)
+ if (loaded)
bound.removeKey(pubkey.getNickname());
// delete from backend database and update gui
@@ -550,7 +550,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
pubkeydb.savePubkey(pubkey);
updateList();
- } catch(Exception e) {
+ } catch (Exception e) {
Log.e(TAG, "Problem parsing imported private key", e);
Toast.makeText(PubkeyListActivity.this, R.string.pubkey_import_parse_problem, Toast.LENGTH_LONG).show();
}
@@ -578,8 +578,8 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
{
File[] files = sdcard.listFiles();
if (files != null) {
- for(File file : sdcard.listFiles()) {
- if(file.isDirectory()) continue;
+ for (File file : sdcard.listFiles()) {
+ if (file.isDirectory()) continue;
names.add(file.getName());
}
}
diff --git a/app/src/main/java/org/connectbot/TerminalView.java b/app/src/main/java/org/connectbot/TerminalView.java
index 1762141..88fa90d 100644
--- a/app/src/main/java/org/connectbot/TerminalView.java
+++ b/app/src/main/java/org/connectbot/TerminalView.java
@@ -173,7 +173,7 @@ public class TerminalView extends View implements FontSizeChangedListener {
@Override
public void onDraw(Canvas canvas) {
- if(bridge.bitmap != null) {
+ if (bridge.bitmap != null) {
// draw the bitmap
bridge.onDraw();
@@ -213,7 +213,7 @@ public class TerminalView extends View implements FontSizeChangedListener {
final int deadKey = bridge.getKeyHandler().getDeadKey();
if (deadKey != 0) {
- canvas.drawText(new char[] { (char)deadKey }, 0, 1, 0, 0, cursorStrokePaint);
+ canvas.drawText(new char[] { (char) deadKey }, 0, 1, 0, 0, cursorStrokePaint);
}
// Make sure we scale our decorations to the correct size.
diff --git a/app/src/main/java/org/connectbot/WizardActivity.java b/app/src/main/java/org/connectbot/WizardActivity.java
index b9ab66e..4069c50 100644
--- a/app/src/main/java/org/connectbot/WizardActivity.java
+++ b/app/src/main/java/org/connectbot/WizardActivity.java
@@ -54,10 +54,10 @@ public class WizardActivity extends Activity {
flipper.addView(new HelpTopicView(this).setTopic(topic));
}
- next = (Button)this.findViewById(R.id.action_next);
+ next = (Button) findViewById(R.id.action_next);
next.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
- if(isLastDisplayed()) {
+ if (isLastDisplayed()) {
// user walked past end of wizard, so return okay
WizardActivity.this.setResult(Activity.RESULT_OK);
WizardActivity.this.finish();
@@ -69,10 +69,10 @@ public class WizardActivity extends Activity {
}
});
- prev = (Button)this.findViewById(R.id.action_prev);
+ prev = (Button) findViewById(R.id.action_prev);
prev.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
- if(isFirstDisplayed()) {
+ if (isFirstDisplayed()) {
// user walked past beginning of wizard, so return that they cancelled
WizardActivity.this.setResult(Activity.RESULT_CANCELED);
WizardActivity.this.finish();
diff --git a/app/src/main/java/org/connectbot/bean/HostBean.java b/app/src/main/java/org/connectbot/bean/HostBean.java
index 2fd7bfb..32ecf89 100644
--- a/app/src/main/java/org/connectbot/bean/HostBean.java
+++ b/app/src/main/java/org/connectbot/bean/HostBean.java
@@ -243,7 +243,7 @@ public class HostBean extends AbstractBean {
if (o == null || !(o instanceof HostBean))
return false;
- HostBean host = (HostBean)o;
+ HostBean host = (HostBean) o;
if (id != -1 && host.getId() != -1)
return host.getId() == id;
@@ -283,7 +283,7 @@ public class HostBean extends AbstractBean {
int hash = 7;
if (id != -1)
- return (int)id;
+ return (int) id;
hash = 31 * hash + (null == nickname ? 0 : nickname.hashCode());
hash = 31 * hash + (null == protocol ? 0 : protocol.hashCode());
diff --git a/app/src/main/java/org/connectbot/bean/SelectionArea.java b/app/src/main/java/org/connectbot/bean/SelectionArea.java
index 4e6207d..1bd78c1 100644
--- a/app/src/main/java/org/connectbot/bean/SelectionArea.java
+++ b/app/src/main/java/org/connectbot/bean/SelectionArea.java
@@ -148,7 +148,7 @@ public class SelectionArea {
StringBuffer buffer = new StringBuffer(size);
- for(int y = getTop(); y <= getBottom(); y++) {
+ for (int y = getTop(); y <= getBottom(); y++) {
int lastNonSpace = buffer.length();
for (int x = getLeft(); x <= getRight(); x++) {
diff --git a/app/src/main/java/org/connectbot/service/ConnectionNotifier.java b/app/src/main/java/org/connectbot/service/ConnectionNotifier.java
index aedbd61..e42525d 100644
--- a/app/src/main/java/org/connectbot/service/ConnectionNotifier.java
+++ b/app/src/main/java/org/connectbot/service/ConnectionNotifier.java
@@ -53,7 +53,7 @@ public abstract class ConnectionNotifier {
}
protected NotificationManager getNotificationManager(Context context) {
- return (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
+ return (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
}
protected Notification newNotification(Context context) {
diff --git a/app/src/main/java/org/connectbot/service/PromptHelper.java b/app/src/main/java/org/connectbot/service/PromptHelper.java
index f0a37be..9c34f1a 100644
--- a/app/src/main/java/org/connectbot/service/PromptHelper.java
+++ b/app/src/main/java/org/connectbot/service/PromptHelper.java
@@ -122,8 +122,8 @@ public class PromptHelper {
public String requestStringPrompt(String instructions, String hint) {
String value = null;
try {
- value = (String)this.requestPrompt(instructions, hint, String.class);
- } catch(Exception e) {
+ value = (String) requestPrompt(instructions, hint, String.class);
+ } catch (Exception e) {
}
return value;
}
@@ -137,8 +137,8 @@ public class PromptHelper {
public Boolean requestBooleanPrompt(String instructions, String hint) {
Boolean value = null;
try {
- value = (Boolean)this.requestPrompt(instructions, hint, Boolean.class);
- } catch(Exception e) {
+ value = (Boolean) requestPrompt(instructions, hint, Boolean.class);
+ } catch (Exception e) {
}
return value;
}
diff --git a/app/src/main/java/org/connectbot/service/TerminalBridge.java b/app/src/main/java/org/connectbot/service/TerminalBridge.java
index 6b87b74..ea19e34 100644
--- a/app/src/main/java/org/connectbot/service/TerminalBridge.java
+++ b/app/src/main/java/org/connectbot/service/TerminalBridge.java
@@ -288,7 +288,7 @@ public class TerminalBridge implements VDUDisplay {
*/
public String[] replyToChallenge(String name, String instruction, int numPrompts, String[] prompt, boolean[] echo) {
String[] responses = new String[numPrompts];
- for(int i = 0; i < numPrompts; i++) {
+ for (int i = 0; i < numPrompts; i++) {
// request response from user for each prompt
responses[i] = promptHelper.requestStringPrompt(instruction, prompt[i]);
}
@@ -490,15 +490,15 @@ public class TerminalBridge implements VDUDisplay {
// read new metrics to get exact pixel dimensions
FontMetrics fm = defaultPaint.getFontMetrics();
- charTop = (int)Math.ceil(fm.top);
+ charTop = (int) Math.ceil(fm.top);
float[] widths = new float[1];
defaultPaint.getTextWidths("X", widths);
- charWidth = (int)Math.ceil(widths[0]);
- charHeight = (int)Math.ceil(fm.descent - fm.top);
+ charWidth = (int) Math.ceil(widths[0]);
+ charHeight = (int) Math.ceil(fm.descent - fm.top);
// refresh any bitmap with new font size
- if(parent != null)
+ if (parent != null)
parentChanged(parent);
for (FontSizeChangedListener ofscl : fontSizeChangedListeners)
@@ -571,7 +571,7 @@ public class TerminalBridge implements VDUDisplay {
// reallocate new bitmap if needed
boolean newBitmap = (bitmap == null);
- if(bitmap != null)
+ if (bitmap != null)
newBitmap = (bitmap.getWidth() != width || bitmap.getHeight() != height);
if (newBitmap) {
@@ -603,9 +603,9 @@ public class TerminalBridge implements VDUDisplay {
buffer.setScreenSize(columns, rows, true);
}
- if(transport != null)
+ if (transport != null)
transport.setDimensions(columns, rows, width, height);
- } catch(Exception e) {
+ } catch (Exception e) {
Log.e(TAG, "Problem while trying to resize screen or PTY", e);
}
@@ -664,7 +664,7 @@ public class TerminalBridge implements VDUDisplay {
boolean isWideCharacter = false;
// walk through all lines in the buffer
- for(int l = 0; l < buffer.height; l++) {
+ for (int l = 0; l < buffer.height; l++) {
// check if this line is dirty and needs to be repainted
// also check for entire-buffer dirty flags
@@ -713,7 +713,7 @@ public class TerminalBridge implements VDUDisplay {
addr++;
else {
// determine the amount of continuous characters with the same settings and print them all at once
- while(c + addr < buffer.width
+ while (c + addr < buffer.width
&& buffer.charAttributes[buffer.windowBase + l][c + addr] == currAttr) {
addr++;
}
@@ -739,7 +739,7 @@ public class TerminalBridge implements VDUDisplay {
// write the text string starting at 'c' for 'addr' number of characters
defaultPaint.setColor(fg);
- if((currAttr & VDUBuffer.INVISIBLE) == 0)
+ if ((currAttr & VDUBuffer.INVISIBLE) == 0)
canvas.drawText(buffer.charArray[buffer.windowBase + l], c,
addr, c * charWidth, (l * charHeight) - charTop,
defaultPaint);
@@ -820,8 +820,8 @@ public class TerminalBridge implements VDUDisplay {
float[] widths = new float[1];
defaultPaint.getTextWidths("X", widths);
- int termWidth = (int)widths[0] * cols;
- int termHeight = (int)Math.ceil(fm.descent - fm.top) * rows;
+ int termWidth = (int) widths[0] * cols;
+ int termHeight = (int) Math.ceil(fm.descent - fm.top) * rows;
Log.d("fontsize", String.format("font size %f resulted in %d x %d", size, termWidth, termHeight));
diff --git a/app/src/main/java/org/connectbot/service/TerminalKeyListener.java b/app/src/main/java/org/connectbot/service/TerminalKeyListener.java
index 4764261..2a911a8 100644
--- a/app/src/main/java/org/connectbot/service/TerminalKeyListener.java
+++ b/app/src/main/java/org/connectbot/service/TerminalKeyListener.java
@@ -182,7 +182,7 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
bridge.increaseFontSize();
return true;
- } else if(keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
+ } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
bridge.decreaseFontSize();
return true;
}
@@ -355,15 +355,15 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
String camera = manager.prefs.getString(
PreferenceConstants.CAMERA,
PreferenceConstants.CAMERA_CTRLA_SPACE);
- if(PreferenceConstants.CAMERA_CTRLA_SPACE.equals(camera)) {
+ if (PreferenceConstants.CAMERA_CTRLA_SPACE.equals(camera)) {
bridge.transport.write(0x01);
bridge.transport.write(' ');
- } else if(PreferenceConstants.CAMERA_CTRLA.equals(camera)) {
+ } else if (PreferenceConstants.CAMERA_CTRLA.equals(camera)) {
bridge.transport.write(0x01);
- } else if(PreferenceConstants.CAMERA_ESC.equals(camera)) {
- ((vt320)buffer).keyTyped(vt320.KEY_ESCAPE, ' ', 0);
- } else if(PreferenceConstants.CAMERA_ESC_A.equals(camera)) {
- ((vt320)buffer).keyTyped(vt320.KEY_ESCAPE, ' ', 0);
+ } else if (PreferenceConstants.CAMERA_ESC.equals(camera)) {
+ ((vt320) buffer).keyTyped(vt320.KEY_ESCAPE, ' ', 0);
+ } else if (PreferenceConstants.CAMERA_ESC_A.equals(camera)) {
+ ((vt320) buffer).keyTyped(vt320.KEY_ESCAPE, ' ', 0);
bridge.transport.write('a');
}
@@ -374,7 +374,7 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
getStateForBuffer());
return true;
case KeyEvent.KEYCODE_ENTER:
- ((vt320)buffer).keyTyped(vt320.KEY_ENTER, ' ', 0);
+ ((vt320) buffer).keyTyped(vt320.KEY_ENTER, ' ', 0);
return true;
case KeyEvent.KEYCODE_DPAD_LEFT:
@@ -480,7 +480,7 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
}
public void sendEscape() {
- ((vt320)buffer).keyTyped(vt320.KEY_ESCAPE, ' ', 0);
+ ((vt320) buffer).keyTyped(vt320.KEY_ESCAPE, ' ', 0);
}
/**
diff --git a/app/src/main/java/org/connectbot/service/TerminalManager.java b/app/src/main/java/org/connectbot/service/TerminalManager.java
index 369d79a..928c5f5 100644
--- a/app/src/main/java/org/connectbot/service/TerminalManager.java
+++ b/app/src/main/java/org/connectbot/service/TerminalManager.java
@@ -172,12 +172,12 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
disconnectAll(true);
- if(hostdb != null) {
+ if (hostdb != null) {
hostdb.close();
hostdb = null;
}
- if(pubkeydb != null) {
+ if (pubkeydb != null) {
pubkeydb.close();
pubkeydb = null;
}
@@ -261,7 +261,7 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
int scrollback = 140;
try {
scrollback = Integer.parseInt(prefs.getString(PreferenceConstants.SCROLLBACK, "140"));
- } catch(Exception e) {
+ } catch (Exception e) {
}
return scrollback;
}
@@ -400,7 +400,7 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
public boolean removeKey(byte[] publicKey) {
String nickname = null;
- for (Entry<String,KeyHolder> entry : loadedKeypairs.entrySet()) {
+ for (Entry<String, KeyHolder> entry : loadedKeypairs.entrySet()) {
if (Arrays.equals(entry.getValue().openSSHPubkey, publicKey)) {
nickname = entry.getKey();
break;
@@ -431,7 +431,7 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
}
public String getKeyNickname(byte[] publicKey) {
- for (Entry<String,KeyHolder> entry : loadedKeypairs.entrySet()) {
+ for (Entry<String, KeyHolder> entry : loadedKeypairs.entrySet()) {
if (Arrays.equals(entry.getValue().openSSHPubkey, publicKey))
return entry.getKey();
}
diff --git a/app/src/main/java/org/connectbot/transport/AbsTransport.java b/app/src/main/java/org/connectbot/transport/AbsTransport.java
index 18397ea..bc19b92 100644
--- a/app/src/main/java/org/connectbot/transport/AbsTransport.java
+++ b/app/src/main/java/org/connectbot/transport/AbsTransport.java
@@ -40,7 +40,8 @@ public abstract class AbsTransport {
String emulation;
- public AbsTransport() {}
+ public AbsTransport() {
+ }
public AbsTransport(HostBean host, TerminalBridge bridge, TerminalManager manager) {
this.host = host;
@@ -120,11 +121,11 @@ public abstract class AbsTransport {
*/
public abstract void setDimensions(int columns, int rows, int width, int height);
- public void setOptions(Map<String,String> options) {
+ public void setOptions(Map<String, String> options) {
// do nothing
}
- public Map<String,String> getOptions() {
+ public Map<String, String> getOptions() {
return null;
}
diff --git a/app/src/main/java/org/connectbot/transport/SSH.java b/app/src/main/java/org/connectbot/transport/SSH.java
index e02b4af..9a97596 100644
--- a/app/src/main/java/org/connectbot/transport/SSH.java
+++ b/app/src/main/java/org/connectbot/transport/SSH.java
@@ -168,8 +168,8 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
bridge.outputLine(manager.res.getString(R.string.host_fingerprint, algorithmName, fingerprint));
result = bridge.promptHelper.requestBooleanPrompt(null, manager.res.getString(R.string.prompt_continue_connecting));
- if(result == null) return false;
- if(result.booleanValue()) {
+ if (result == null) return false;
+ if (result.booleanValue()) {
// save this key in known database
manager.hostdb.saveKnownHost(hostname, port, serverHostKeyAlgorithm, serverHostKey);
}
@@ -192,8 +192,8 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
// Users have no way to delete keys, so we'll prompt them for now.
result = bridge.promptHelper.requestBooleanPrompt(null, manager.res.getString(R.string.prompt_continue_connecting));
- if(result == null) return false;
- if(result.booleanValue()) {
+ if (result == null) return false;
+ if (result.booleanValue()) {
// save this key in known database
manager.hostdb.saveKnownHost(hostname, port, serverHostKeyAlgorithm, serverHostKey);
}
@@ -212,7 +212,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
finishConnection();
return;
}
- } catch(Exception e) {
+ } catch (Exception e) {
Log.d(TAG, "Host does not support 'none' authentication.");
}
@@ -262,7 +262,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
// it blocks until authentication finishes
bridge.outputLine(manager.res.getString(R.string.terminal_auth_ki));
interactiveCanContinue = false;
- if(connection.authenticateWithKeyboardInteractive(host.getUsername(), this)) {
+ if (connection.authenticateWithKeyboardInteractive(host.getUsername(), this)) {
finishConnection();
} else {
bridge.outputLine(manager.res.getString(R.string.terminal_auth_ki_fail));
@@ -283,7 +283,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
} catch (IllegalStateException e) {
Log.e(TAG, "Connection went away while we were trying to authenticate", e);
return;
- } catch(Exception e) {
+ } catch (Exception e) {
Log.e(TAG, "Problem during handleAuthentication()", e);
}
}
@@ -299,7 +299,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
private boolean tryPublicKey(PubkeyBean pubkey) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException {
KeyPair pair = null;
- if(manager.isKeyLoaded(pubkey.getNickname())) {
+ if (manager.isKeyLoaded(pubkey.getNickname())) {
// load this key from memory if its already there
Log.d(TAG, String.format("Found unlocked key '%s' already in-memory", pubkey.getNickname()));
@@ -321,7 +321,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
return false;
}
- if(PubkeyDatabase.KEY_TYPE_IMPORTED.equals(pubkey.getType())) {
+ if (PubkeyDatabase.KEY_TYPE_IMPORTED.equals(pubkey.getType())) {
// load specific key using pem format
pair = PEMDecoder.decode(new String(pubkey.getPrivateKey()).toCharArray(), password);
} else {
@@ -356,7 +356,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
private boolean tryPublicKey(String username, String keyNickname, KeyPair pair) throws IOException {
//bridge.outputLine(String.format("Attempting 'publickey' with key '%s' [%s]...", keyNickname, trileadKey.toString()));
boolean success = connection.authenticateWithPublicKey(username, pair);
- if(!success)
+ if (!success)
bridge.outputLine(manager.res.getString(R.string.terminal_auth_pubkey_fail, keyNickname));
return success;
}
@@ -468,7 +468,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
// sleep to make sure we dont kill system
Thread.sleep(1000);
}
- } catch(Exception e) {
+ } catch (Exception e) {
Log.e(TAG, "Problem in SSH connection thread during authentication", e);
}
}
@@ -668,7 +668,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
if (HostDatabase.PORTFORWARD_LOCAL.equals(portForward.getType())) {
LocalPortForwarder lpf = null;
- lpf = (LocalPortForwarder)portForward.getIdentifier();
+ lpf = (LocalPortForwarder) portForward.getIdentifier();
if (!portForward.isEnabled() || lpf == null) {
Log.d(TAG, String.format("Could not disable %s; it appears to be not enabled or have no handler", portForward.getNickname()));
@@ -698,7 +698,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
return true;
} else if (HostDatabase.PORTFORWARD_DYNAMIC5.equals(portForward.getType())) {
DynamicPortForwarder dpf = null;
- dpf = (DynamicPortForwarder)portForward.getIdentifier();
+ dpf = (DynamicPortForwarder) portForward.getIdentifier();
if (!portForward.isEnabled() || dpf == null) {
Log.d(TAG, String.format("Could not disable %s; it appears to be not enabled or have no handler", portForward.getNickname()));
@@ -796,7 +796,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
public String[] replyToChallenge(String name, String instruction, int numPrompts, String[] prompt, boolean[] echo) {
interactiveCanContinue = true;
String[] responses = new String[numPrompts];
- for(int i = 0; i < numPrompts; i++) {
+ for (int i = 0; i < numPrompts; i++) {
// request response from user for each prompt
responses[i] = bridge.promptHelper.requestStringPrompt(instruction, prompt[i]);
}
@@ -859,10 +859,10 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
this.useAuthAgent = useAuthAgent;
}
- public Map<String,byte[]> retrieveIdentities() {
- Map<String,byte[]> pubKeys = new HashMap<String,byte[]>(manager.loadedKeypairs.size());
+ public Map<String, byte[]> retrieveIdentities() {
+ Map<String, byte[]> pubKeys = new HashMap<String, byte[]>(manager.loadedKeypairs.size());
- for (Entry<String,KeyHolder> entry : manager.loadedKeypairs.entrySet()) {
+ for (Entry<String, KeyHolder> entry : manager.loadedKeypairs.entrySet()) {
KeyPair pair = entry.getValue().pair;
try {
diff --git a/app/src/main/java/org/connectbot/util/EastAsianWidth.java b/app/src/main/java/org/connectbot/util/EastAsianWidth.java
index da710fb..ea80cdd 100644
--- a/app/src/main/java/org/connectbot/util/EastAsianWidth.java
+++ b/app/src/main/java/org/connectbot/util/EastAsianWidth.java
@@ -56,7 +56,7 @@ public abstract class EastAsianWidth {
paint.getTextWidths(charArray, start, end, mWidths);
final int N = end - start;
for (int i = 0; i < N; i++)
- wideAttribute[i] = (byte) (((int)mWidths[i] != charWidth) ?
+ wideAttribute[i] = (byte) (((int) mWidths[i] != charWidth) ?
AndroidCharacter.EAST_ASIAN_WIDTH_WIDE :
AndroidCharacter.EAST_ASIAN_WIDTH_NARROW);
}
diff --git a/app/src/main/java/org/connectbot/util/Encryptor.java b/app/src/main/java/org/connectbot/util/Encryptor.java
index 9d21454..11a71d6 100644
--- a/app/src/main/java/org/connectbot/util/Encryptor.java
+++ b/app/src/main/java/org/connectbot/util/Encryptor.java
@@ -59,8 +59,8 @@ public final class Encryptor
/**
* Private constructor that should never be called.
*/
- private Encryptor()
- {}
+ private Encryptor() {
+ }
/**
diff --git a/app/src/main/java/org/connectbot/util/EntropyView.java b/app/src/main/java/org/connectbot/util/EntropyView.java
index c988673..3fb2a90 100644
--- a/app/src/main/java/org/connectbot/util/EntropyView.java
+++ b/app/src/main/java/org/connectbot/util/EntropyView.java
@@ -88,7 +88,7 @@ public class EntropyView extends View {
@Override
public void onDraw(Canvas c) {
String prompt = String.format(getResources().getString(R.string.pubkey_touch_prompt),
- (int)(100.0 * (mEntropyByteIndex / 20.0)) + (int)(5.0 * (mEntropyBitIndex / 8.0)));
+ (int) (100.0 * (mEntropyByteIndex / 20.0)) + (int) (5.0 * (mEntropyBitIndex / 8.0)));
if (splitText > 0 ||
mPaint.measureText(prompt) > (getWidth() * 0.8)) {
if (splitText == 0)
@@ -132,9 +132,9 @@ public class EntropyView extends View {
// Get the lowest 4 bits of each X, Y input and concat to the entropy-gathering
// string.
if (mFlipFlop)
- input = (byte)((((int)lastX & 0x0F) << 4) | ((int)lastY & 0x0F));
+ input = (byte) ((((int) lastX & 0x0F) << 4) | ((int) lastY & 0x0F));
else
- input = (byte)((((int)lastY & 0x0F) << 4) | ((int)lastX & 0x0F));
+ input = (byte) ((((int) lastY & 0x0F) << 4) | ((int) lastX & 0x0F));
mFlipFlop = !mFlipFlop;
for (int i = 0; i < 4 && mEntropyByteIndex < SHA1_MAX_BYTES; i++) {
diff --git a/app/src/main/java/org/connectbot/util/HostDatabase.java b/app/src/main/java/org/connectbot/util/HostDatabase.java
index 2a92bab..1d31f6b 100644
--- a/app/src/main/java/org/connectbot/util/HostDatabase.java
+++ b/app/src/main/java/org/connectbot/util/HostDatabase.java
@@ -546,7 +546,7 @@ public class HostDatabase extends RobustSQLiteOpenHelper {
try {
known.addHostkey(new String[] { String.format("%s:%d", hostname, port) }, hostkeyalgo, hostkey);
- } catch(Exception e) {
+ } catch (Exception e) {
Log.e(TAG, "Problem while adding a known host from database", e);
}
}
diff --git a/app/src/main/java/org/connectbot/util/PubkeyUtils.java b/app/src/main/java/org/connectbot/util/PubkeyUtils.java
index e7922bd..53f2481 100644
--- a/app/src/main/java/org/connectbot/util/PubkeyUtils.java
+++ b/app/src/main/java/org/connectbot/util/PubkeyUtils.java
@@ -85,7 +85,7 @@ public class PubkeyUtils {
private PubkeyUtils() {
}
- public static String formatKey(Key key){
+ public static String formatKey(Key key) {
String algo = key.getAlgorithm();
String fmt = key.getFormat();
byte[] encoded = key.getEncoded();
diff --git a/app/src/main/java/org/connectbot/util/UberColorPickerDialog.java b/app/src/main/java/org/connectbot/util/UberColorPickerDialog.java
index 407edfd..c19d959 100644
--- a/app/src/main/java/org/connectbot/util/UberColorPickerDialog.java
+++ b/app/src/main/java/org/connectbot/util/UberColorPickerDialog.java
@@ -58,7 +58,7 @@ import android.view.View;
/**
* UberColorPickerDialog is a seriously enhanced version of the UberColorPickerDialog
* class provided in the Android API Demos.<p>
- *
+ * <p/>
* NOTE (from Kenny Root): This is a VERY slimmed down version custom for ConnectBot.
* Visit Keith's site for the full version at the URL listed in the author line.<p>
*
@@ -77,14 +77,15 @@ public class UberColorPickerDialog extends Dialog {
/**
* Ctor
+ *
* @param context
* @param listener
* @param initialColor
- * @param showTitle If true, a title is shown across the top of the dialog. If false a toast is shown instead.
+ * @param showTitle If true, a title is shown across the top of the dialog. If false a toast is shown instead.
*/
public UberColorPickerDialog(Context context,
- OnColorChangedListener listener,
- int initialColor) {
+ OnColorChangedListener listener,
+ int initialColor) {
super(context);
mListener = listener;
@@ -113,20 +114,19 @@ public class UberColorPickerDialog extends Dialog {
try {
setContentView(new ColorPickerView(getContext(), l, screenWidth, screenHeight, mInitialColor));
- }
- catch (Exception e) {
+ } catch (Exception e) {
//There is currently only one kind of ctor exception, that where no methods are enabled.
- dismiss(); //This doesn't work! The dialog is still shown (its title at least, the layout is empty from the exception being thrown). <sigh>
+ dismiss(); //This doesn't work! The dialog is still shown (its title at least, the layout is empty from the exception being thrown). <sigh>
}
}
/**
* ColorPickerView is the meat of this color picker (as opposed to the enclosing class).
* All the heavy lifting is done directly by this View subclass.
- * <P>
+ * <p/>
* You can enable/disable whichever color chooser methods you want by modifying the ENABLED_METHODS switches. They *should*
* do all the work required to properly enable/disable methods without losing track of what goes with what and what maps to what.
- * <P>
+ * <p/>
* If you add a new color chooser method, do a text search for "NEW_METHOD_WORK_NEEDED_HERE". That tag indicates all
* the locations in the code that will have to be amended in order to properly add a new color chooser method.
* I highly recommend adding new methods to the end of the list. If you want to try to reorder the list, you're on your own.
@@ -152,7 +152,7 @@ public class UberColorPickerDialog extends Dialog {
//NEW_METHOD_WORK_NEEDED_HERE
//Add a new entry to the list for each controller in the new method
- private static final int TRACKED_NONE = -1; //No object on screen is currently being tracked
+ private static final int TRACKED_NONE = -1; //No object on screen is currently being tracked
private static final int TRACK_SWATCH_OLD = 10;
private static final int TRACK_SWATCH_NEW = 11;
private static final int TRACK_HS_PALETTE = 30;
@@ -167,7 +167,7 @@ public class UberColorPickerDialog extends Dialog {
private static final float PI = 3.141592653589793f;
private int mMethod = METHOD_HS_V_PALETTE;
- private int mTracking = TRACKED_NONE; //What object on screen is currently being tracked for movement
+ private int mTracking = TRACKED_NONE; //What object on screen is currently being tracked for movement
//Zillions of persistant Paint objecs for drawing the View
@@ -198,30 +198,31 @@ public class UberColorPickerDialog extends Dialog {
private Rect mVerSliderRect = new Rect();
private int[] mSpectrumColorsRev;
- private int mOriginalColor = 0; //The color passed in at the beginning, which can be reverted to at any time by tapping the old swatch.
+ private int mOriginalColor = 0; //The color passed in at the beginning, which can be reverted to at any time by tapping the old swatch.
private float[] mHSV = new float[3];
private int[] mRGB = new int[3];
private float[] mYUV = new float[3];
private String mHexStr = "";
- private boolean mHSVenabled = true; //Only true if an HSV method is enabled
- private boolean mRGBenabled = true; //Only true if an RGB method is enabled
- private boolean mYUVenabled = true; //Only true if a YUV method is enabled
- private boolean mHexenabled = true; //Only true if an RGB method is enabled
- private int[] mCoord = new int[3]; //For drawing slider/palette markers
- private int mFocusedControl = -1; //Which control receives trackball events.
+ private boolean mHSVenabled = true; //Only true if an HSV method is enabled
+ private boolean mRGBenabled = true; //Only true if an RGB method is enabled
+ private boolean mYUVenabled = true; //Only true if a YUV method is enabled
+ private boolean mHexenabled = true; //Only true if an RGB method is enabled
+ private int[] mCoord = new int[3]; //For drawing slider/palette markers
+ private int mFocusedControl = -1; //Which control receives trackball events.
private OnColorChangedListener mListener;
/**
* Ctor.
+ *
* @param c
* @param l
- * @param width Used to determine orientation and adjust layout accordingly
+ * @param width Used to determine orientation and adjust layout accordingly
* @param height Used to determine orientation and adjust layout accordingly
- * @param color The initial color
+ * @param color The initial color
* @throws Exception
*/
ColorPickerView(Context c, OnColorChangedListener l, int width, int height, int color)
- throws Exception {
+ throws Exception {
super(c);
//We need to make the dialog focusable to retrieve trackball events.
@@ -236,7 +237,7 @@ public class UberColorPickerDialog extends Dialog {
updateAllFromHSV();
//Setup the layout based on whether this is a portrait or landscape orientation.
- if (width <= height) { //Portrait layout
+ if (width <= height) { //Portrait layout
SWATCH_WIDTH = (PALETTE_DIM + SLIDER_THICKNESS) / 2;
PALETTE_POS_X = 0;
@@ -259,8 +260,7 @@ public class UberColorPickerDialog extends Dialog {
VIEW_DIM_X = PALETTE_DIM + SLIDER_THICKNESS;
VIEW_DIM_Y = SWATCH_HEIGHT + PALETTE_DIM + TEXT_SIZE * 4;
- }
- else { //Landscape layout
+ } else { //Landscape layout
SWATCH_WIDTH = 110;
PALETTE_POS_X = SWATCH_WIDTH;
@@ -275,9 +275,9 @@ public class UberColorPickerDialog extends Dialog {
TEXT_HSV_POS[0] = 3;
TEXT_HSV_POS[1] = 0;
TEXT_RGB_POS[0] = TEXT_HSV_POS[0];
- TEXT_RGB_POS[1] = (int)(TEXT_HSV_POS[1] + TEXT_SIZE * 3.5);
+ TEXT_RGB_POS[1] = (int) (TEXT_HSV_POS[1] + TEXT_SIZE * 3.5);
TEXT_YUV_POS[0] = TEXT_HSV_POS[0] + 50;
- TEXT_YUV_POS[1] = (int)(TEXT_HSV_POS[1] + TEXT_SIZE * 3.5);
+ TEXT_YUV_POS[1] = (int) (TEXT_HSV_POS[1] + TEXT_SIZE * 3.5);
TEXT_HEX_POS[0] = TEXT_HSV_POS[0] + 50;
TEXT_HEX_POS[1] = TEXT_HSV_POS[1];
@@ -286,9 +286,9 @@ public class UberColorPickerDialog extends Dialog {
}
//Rainbows make everybody happy!
- mSpectrumColorsRev = new int[] {
- 0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF,
- 0xFF00FF00, 0xFFFFFF00, 0xFFFF0000,
+ mSpectrumColorsRev = new int[]{
+ 0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF,
+ 0xFF00FF00, 0xFFFFFF00, 0xFFFF0000,
};
//Setup all the Paint and Shader objects. There are lots of them!
@@ -370,6 +370,7 @@ public class UberColorPickerDialog extends Dialog {
/**
* Draw the old and new swatches.
+ *
* @param canvas
*/
private void drawSwatches(Canvas canvas) {
@@ -399,13 +400,14 @@ public class UberColorPickerDialog extends Dialog {
/**
* Write the color parametes (HSV, RGB, YUV, Hex, etc.).
+ *
* @param canvas
*/
private void writeColorParams(Canvas canvas) {
if (mHSVenabled) {
- canvas.drawText("H: " + Integer.toString((int)(mHSV[0] / 360.0f * 255)), TEXT_HSV_POS[0], TEXT_HSV_POS[1] + TEXT_SIZE, mText);
- canvas.drawText("S: " + Integer.toString((int)(mHSV[1] * 255)), TEXT_HSV_POS[0], TEXT_HSV_POS[1] + TEXT_SIZE * 2, mText);
- canvas.drawText("V: " + Integer.toString((int)(mHSV[2] * 255)), TEXT_HSV_POS[0], TEXT_HSV_POS[1] + TEXT_SIZE * 3, mText);
+ canvas.drawText("H: " + Integer.toString((int) (mHSV[0] / 360.0f * 255)), TEXT_HSV_POS[0], TEXT_HSV_POS[1] + TEXT_SIZE, mText);
+ canvas.drawText("S: " + Integer.toString((int) (mHSV[1] * 255)), TEXT_HSV_POS[0], TEXT_HSV_POS[1] + TEXT_SIZE * 2, mText);
+ canvas.drawText("V: " + Integer.toString((int) (mHSV[2] * 255)), TEXT_HSV_POS[0], TEXT_HSV_POS[1] + TEXT_SIZE * 3, mText);
}
if (mRGBenabled) {
@@ -415,9 +417,9 @@ public class UberColorPickerDialog extends Dialog {
}
if (mYUVenabled) {
- canvas.drawText("Y: " + Integer.toString((int)(mYUV[0] * 255)), TEXT_YUV_POS[0], TEXT_YUV_POS[1] + TEXT_SIZE, mText);
- canvas.drawText("U: " + Integer.toString((int)((mYUV[1] + .5f) * 255)), TEXT_YUV_POS[0], TEXT_YUV_POS[1] + TEXT_SIZE * 2, mText);
- canvas.drawText("V: " + Integer.toString((int)((mYUV[2] + .5f) * 255)), TEXT_YUV_POS[0], TEXT_YUV_POS[1] + TEXT_SIZE * 3, mText);
+ canvas.drawText("Y: " + Integer.toString((int) (mYUV[0] * 255)), TEXT_YUV_POS[0], TEXT_YUV_POS[1] + TEXT_SIZE, mText);
+ canvas.drawText("U: " + Integer.toString((int) ((mYUV[1] + .5f) * 255)), TEXT_YUV_POS[0], TEXT_YUV_POS[1] + TEXT_SIZE * 2, mText);
+ canvas.drawText("V: " + Integer.toString((int) ((mYUV[2] + .5f) * 255)), TEXT_YUV_POS[0], TEXT_YUV_POS[1] + TEXT_SIZE * 3, mText);
}
if (mHexenabled)
@@ -426,6 +428,7 @@ public class UberColorPickerDialog extends Dialog {
/**
* Place a small circle on the 2D palette to indicate the current values.
+ *
* @param canvas
* @param markerPosX
* @param markerPosY
@@ -439,6 +442,7 @@ public class UberColorPickerDialog extends Dialog {
/**
* Draw a line across the slider to indicate its current value.
+ *
* @param canvas
* @param markerPos
*/
@@ -451,6 +455,7 @@ public class UberColorPickerDialog extends Dialog {
/**
* Frame the slider to indicate that it has trackball focus.
+ *
* @param canvas
*/
private void hilightFocusedVerSlider(Canvas canvas) {
@@ -462,6 +467,7 @@ public class UberColorPickerDialog extends Dialog {
/**
* Frame the 2D palette to indicate that it has trackball focus.
+ *
* @param canvas
*/
private void hilightFocusedOvalPalette(Canvas canvas) {
@@ -473,8 +479,10 @@ public class UberColorPickerDialog extends Dialog {
//NEW_METHOD_WORK_NEEDED_HERE
//To add a new method, replicate the basic draw functions here. Use the 2D palette or 1D sliders as templates for the new method.
+
/**
* Draw the UI for HSV with angular H and radial S combined in 2D and a 1D V slider.
+ *
* @param canvas
*/
private void drawHSV1Palette(Canvas canvas) {
@@ -513,6 +521,7 @@ public class UberColorPickerDialog extends Dialog {
//NEW_METHOD_WORK_NEEDED_HERE
//To add a new method, replicate and extend the last init function shown below
+
/**
* Initialize a color chooser.
*/
@@ -520,16 +529,17 @@ public class UberColorPickerDialog extends Dialog {
setOvalValDimmer();
setVerValSlider();
- float angle = 2*PI - mHSV[0] / (180 / 3.1415927f);
+ float angle = 2 * PI - mHSV[0] / (180 / 3.1415927f);
float radius = mHSV[1] * PALETTE_RADIUS;
- mCoord[0] = (int)(Math.cos(angle) * radius);
- mCoord[1] = (int)(Math.sin(angle) * radius);
+ mCoord[0] = (int) (Math.cos(angle) * radius);
+ mCoord[1] = (int) (Math.sin(angle) * radius);
- mCoord[2] = PALETTE_DIM - (int)(mHSV[2] * PALETTE_DIM);
+ mCoord[2] = PALETTE_DIM - (int) (mHSV[2] * PALETTE_DIM);
}
//NEW_METHOD_WORK_NEEDED_HERE
//To add a new method, replicate and extend the set functions below, one per UI controller in the new method
+
/**
* Adjust a Paint which, when painted, dims its underlying object to show the effects of varying value (brightness).
*/
@@ -572,15 +582,17 @@ public class UberColorPickerDialog extends Dialog {
/**
* Wrap Math.round(). I'm not a Java expert. Is this the only way to avoid writing "(int)Math.round" everywhere?
+ *
* @param x
* @return
*/
private int round(double x) {
- return (int)Math.round(x);
+ return (int) Math.round(x);
}
/**
* Limit a value to the range [0,1].
+ *
* @param n
* @return
*/
@@ -595,6 +607,7 @@ public class UberColorPickerDialog extends Dialog {
/**
* Limit a value to the range [0,max].
+ *
* @param n
* @param max
* @return
@@ -610,6 +623,7 @@ public class UberColorPickerDialog extends Dialog {
/**
* Limit a value to the range [min,max].
+ *
* @param n
* @param min
* @param max
@@ -627,6 +641,7 @@ public class UberColorPickerDialog extends Dialog {
/**
* No clue what this does (some sort of average/mean I presume). It came with the original UberColorPickerDialog
* in the API Demos and wasn't documented. I don't feel like spending any time figuring it out, I haven't looked at it at all.
+ *
* @param s
* @param d
* @param p
@@ -640,6 +655,7 @@ public class UberColorPickerDialog extends Dialog {
* Came with the original UberColorPickerDialog in the API Demos, wasn't documented. I believe it takes an array of
* colors and a value in the range [0,1] and interpolates a resulting color in a seemingly predictable manner.
* I haven't looked at it at all.
+ *
* @param colors
* @param unit
* @return
@@ -653,12 +669,12 @@ public class UberColorPickerDialog extends Dialog {
}
float p = unit * (colors.length - 1);
- int i = (int)p;
+ int i = (int) p;
p -= i;
// now p is just the fractional part [0...1) and i is the index
int c0 = colors[i];
- int c1 = colors[i+1];
+ int c1 = colors[i + 1];
int a = ave(Color.alpha(c0), Color.alpha(c1), p);
int r = ave(Color.red(c0), Color.red(c1), p);
int g = ave(Color.green(c0), Color.green(c1), p);
@@ -669,6 +685,7 @@ public class UberColorPickerDialog extends Dialog {
/**
* A standard point-in-rect routine.
+ *
* @param x
* @param y
* @param r
@@ -753,13 +770,13 @@ public class UberColorPickerDialog extends Dialog {
else if (mCoord[1] > PALETTE_RADIUS)
mCoord[1] = PALETTE_RADIUS;
- float radius = (float)java.lang.Math.sqrt(mCoord[0] * mCoord[0] + mCoord[1] * mCoord[1]);
+ float radius = (float) java.lang.Math.sqrt(mCoord[0] * mCoord[0] + mCoord[1] * mCoord[1]);
if (radius > PALETTE_RADIUS)
radius = PALETTE_RADIUS;
- float angle = (float)java.lang.Math.atan2(mCoord[1], mCoord[0]);
+ float angle = (float) java.lang.Math.atan2(mCoord[1], mCoord[0]);
// need to turn angle [-PI ... PI] into unit [0....1]
- float unit = angle/(2*PI);
+ float unit = angle / (2 * PI);
if (unit < 0) {
unit += 1;
}
@@ -797,7 +814,7 @@ public class UberColorPickerDialog extends Dialog {
mHSV[2] += (increase ? jump : -jump) / 256.0f;
mHSV[2] = pinToUnit(mHSV[2]);
updateAllFromHSV();
- mCoord[2] = PALETTE_DIM - (int)(mHSV[2] * PALETTE_DIM);
+ mCoord[2] = PALETTE_DIM - (int) (mHSV[2] * PALETTE_DIM);
mSwatchNew.setColor(Color.HSVToColor(mHSV));
@@ -872,7 +889,7 @@ public class UberColorPickerDialog extends Dialog {
float y = event.getY();
//Generate coordinates which are palette=local with the origin at the upper left of the main 2D palette
- int y2 = (int)(pin(round(y - PALETTE_POS_Y), PALETTE_DIM));
+ int y2 = (int) (pin(round(y - PALETTE_POS_Y), PALETTE_DIM));
//Generate coordinates which are palette-local with the origin at the center of the main 2D palette
float circlePinnedX = x - PALETTE_POS_X - PALETTE_CENTER_X;
@@ -883,7 +900,7 @@ public class UberColorPickerDialog extends Dialog {
boolean inSwatchNew = ptInRect(round(x), round(y), mNewSwatchRect);
//Get the event's distance from the center of the main 2D palette
- float radius = (float)java.lang.Math.sqrt(circlePinnedX * circlePinnedX + circlePinnedY * circlePinnedY);
+ float radius = (float) java.lang.Math.sqrt(circlePinnedX * circlePinnedX + circlePinnedY * circlePinnedY);
//Is the event in a circle-pinned 2D palette?
boolean inOvalPalette = radius <= PALETTE_RADIUS;
@@ -910,8 +927,7 @@ public class UberColorPickerDialog extends Dialog {
if (inOvalPalette) {
mTracking = TRACK_HS_PALETTE;
mFocusedControl = 0;
- }
- else if (inVerSlider) {
+ } else if (inVerSlider) {
mTracking = TRACK_VER_VALUE_SLIDER;
mFocusedControl = 1;
}
@@ -921,9 +937,9 @@ public class UberColorPickerDialog extends Dialog {
//To add a new method, replicate and extend the entries in this list,
//one per UI controller the new method requires.
if (mTracking == TRACK_HS_PALETTE) {
- float angle = (float)java.lang.Math.atan2(circlePinnedY, circlePinnedX);
+ float angle = (float) java.lang.Math.atan2(circlePinnedY, circlePinnedX);
// need to turn angle [-PI ... PI] into unit [0....1]
- float unit = angle/(2*PI);
+ float unit = angle / (2 * PI);
if (unit < 0) {
unit += 1;
}
@@ -942,11 +958,10 @@ public class UberColorPickerDialog extends Dialog {
setVerValSlider();
invalidate();
- }
- else if (mTracking == TRACK_VER_VALUE_SLIDER) {
+ } else if (mTracking == TRACK_VER_VALUE_SLIDER) {
if (mCoord[2] != y2) {
mCoord[2] = y2;
- float value = 1.0f - (float)y2 / (float)PALETTE_DIM;
+ float value = 1.0f - (float) y2 / (float) PALETTE_DIM;
mHSV[2] = value;
updateAllFromHSV();
@@ -966,13 +981,12 @@ public class UberColorPickerDialog extends Dialog {
mSwatchNew.setColor(mOriginalColor);
initUI();
invalidate();
- }
- else if (mTracking == TRACK_SWATCH_NEW && inSwatchNew) {
+ } else if (mTracking == TRACK_SWATCH_NEW && inSwatchNew) {
mListener.colorChanged(mSwatchNew.getColor());
invalidate();
}
- mTracking= TRACKED_NONE;
+ mTracking = TRACKED_NONE;
break;
}
diff --git a/app/src/main/java/org/connectbot/util/VolumePreference.java b/app/src/main/java/org/connectbot/util/VolumePreference.java
index 2e7f61c..09feb61 100644
--- a/app/src/main/java/org/connectbot/util/VolumePreference.java
+++ b/app/src/main/java/org/connectbot/util/VolumePreference.java
@@ -54,7 +54,7 @@ public class VolumePreference extends DialogPreference implements OnSeekBarChang
SeekBar sb = new SeekBar(getContext());
sb.setMax(100);
- sb.setProgress((int)(getPersistedFloat(
+ sb.setProgress((int) (getPersistedFloat(
PreferenceConstants.DEFAULT_BELL_VOLUME) * 100));
sb.setPadding(10, 10, 10, 10);
sb.setOnSeekBarChangeListener(this);
diff --git a/config/quality/checkstyle/checkstyle.xml b/config/quality/checkstyle/checkstyle.xml
index e4504f7..105f707 100644
--- a/config/quality/checkstyle/checkstyle.xml
+++ b/config/quality/checkstyle/checkstyle.xml
@@ -11,9 +11,20 @@
value="Line has leading space characters; indentation should be performed with tabs only."/>
<property name="ignoreComments" value="true"/>
</module>
+
<module name="AvoidStarImport" />
<module name="IllegalImport" />
<module name="RedundantImport" />
<module name="UnusedImports" />
+ <module name="NoWhitespaceAfter">
+ <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS" />
+ </module>
+ <module name="NoWhitespaceBefore" />
+ <module name="ParenPad" />
+ <module name="TypecastParenPad" />
+ <module name="WhitespaceAfter" />
+ <module name="WhitespaceAround">
+ <property name="allowEmptyMethods" value="true" />
+ </module>
</module>
</module>