Merge remote-tracking branch 'upstream/master'
Remove hide ActionBar preference Conflicts: AndroidManifest.xml build.xml project.properties res/values/notrans.xml src/org/connectbot/service/TerminalKeyListener.java src/sk/vx/connectbot/util/PreferenceConstants.javamaster
commit
dedc1ee7fe
|
@ -21,7 +21,7 @@
|
|||
android:versionCode="21"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-sdk android:targetSdkVersion="13" android:minSdkVersion="8" />
|
||||
<uses-sdk android:targetSdkVersion="15" android:minSdkVersion="8" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
|
125
build.xml
125
build.xml
|
@ -1,4 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- vim: set ts=4 sw=4 et: -->
|
||||
<project name="VX ConnectBot" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
|
@ -34,6 +35,49 @@
|
|||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
|
||||
<!-- extension targets. Uncomment the ones where you want to do custom work
|
||||
in between standard targets -->
|
||||
<!--
|
||||
<target name="-pre-build">
|
||||
</target>
|
||||
<target name="-pre-compile">
|
||||
</target>
|
||||
|
||||
/* This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir} */
|
||||
<target name="-post-compile">
|
||||
</target>
|
||||
-->
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: custom -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
<!-- Begin custom ConnectBot stuff -->
|
||||
|
||||
<!-- Output directory for .po files. -->
|
||||
|
@ -82,9 +126,9 @@
|
|||
<xpath input="AndroidManifest.xml" expression="/manifest/@android:versionName"
|
||||
output="manifest.version.name" />
|
||||
|
||||
<!-- checkout notrans.xml so we can ignore it in our index -->
|
||||
<!-- tell git to ignore changes to the version xml -->
|
||||
<exec executable="git">
|
||||
<arg line="checkout res/values/notrans.xml"/>
|
||||
<arg line="update-index --assume-unchanged res/values/version.xml"/>
|
||||
</exec>
|
||||
|
||||
<!-- find out the description of the current Git commit -->
|
||||
|
@ -92,16 +136,14 @@
|
|||
<arg line="describe --match 'v[0-9]*' --dirty"/>
|
||||
</exec>
|
||||
|
||||
<replaceregexp file="${resource.absolute.dir}/values/notrans.xml" encoding="utf8" match='(\x3Cstring name="msg_version">)[^\x3C]*(\x3C/string>)'
|
||||
replace='\1${ant.project.name} ${manifest.version.name} (${git.revision} ${build.date})\2' />
|
||||
<echo>Updated "msg_version" to: ${ant.project.name} ${manifest.version.name} (${git.revision} ${build.date})</echo>
|
||||
</target>
|
||||
<!-- write out to res/values/version.xml -->
|
||||
<echo file="${resource.absolute.dir}/values/version.xml" encoding="utf8"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="msg_version" translatable="false">${ant.project.name} ${manifest.version.name} (${git.revision} ${build.date})</string>
|
||||
</resources>
|
||||
]]></echo>
|
||||
|
||||
<target name="clean"
|
||||
description="Clean up the result of the build process">
|
||||
<delete dir="${out.absolute.dir}"/>
|
||||
<delete dir="${gen.absolute.dir}"/>
|
||||
<ant dir="tests" target="clean" />
|
||||
<echo>Updated "msg_version" to: ${ant.project.name} ${manifest.version.name} (${git.revision} ${build.date})</echo>
|
||||
</target>
|
||||
|
||||
<!-- Translations come from launchpad.net and are placed in the
|
||||
|
@ -144,49 +186,24 @@
|
|||
</exec>
|
||||
</target>
|
||||
|
||||
<property name="lint" location="${android.tools.dir}/lint${bat}" />
|
||||
|
||||
<target name="lint-xml">
|
||||
<exec executable="${lint}">
|
||||
<arg value="--xml" />
|
||||
<arg value="lint-results.xml" />
|
||||
<arg path="${basedir}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="lint-html">
|
||||
<exec executable="${lint}">
|
||||
<arg value="--html" />
|
||||
<arg value="lint-results.html" />
|
||||
<arg path="${basedir}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<!-- End custom ConnectBot stuff -->
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
|
||||
<!-- extension targets. Uncomment the ones where you want to do custom work
|
||||
in between standard targets -->
|
||||
<!--
|
||||
<target name="-pre-build">
|
||||
</target>
|
||||
<target name="-pre-compile">
|
||||
</target>
|
||||
|
||||
/* This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir} */
|
||||
<target name="-post-compile">
|
||||
</target>
|
||||
-->
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: custom -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<lint>
|
||||
<issue id="MissingTranslation" severity="warning" />
|
||||
<issue id="NewApi" severity="warning" />
|
||||
</lint>
|
|
@ -11,4 +11,4 @@
|
|||
split.density=false
|
||||
proguard.config=proguard.cfg
|
||||
# Project target.
|
||||
target=android-13
|
||||
target=android-15
|
||||
|
|
|
@ -82,8 +82,6 @@
|
|||
<string name="pref_rotation_summary">Wie soll die Rotation beim Ein-/Ausklappen der Tastatur verändert werden</string>
|
||||
<string name="pref_fullscreen_title">Vollbild</string>
|
||||
<string name="pref_fullscreen_summary">Konsole im Vollbildmodus ausführen</string>
|
||||
<string name="pref_hide_actionbar_title">Aktionsleiste verstecken</string>
|
||||
<string name="pref_hide_actionbar_summary">Die Aktionsleiste in der Konsole nicht anzeigen</string>
|
||||
<string name="pref_memkeys_title">Schlüssel im Speicher behalten</string>
|
||||
<string name="pref_memkeys_summary">Entsperrte Schlüssel im Speicher halten, bis der Hintergrunddienst beendet wurde</string>
|
||||
<string name="pref_update_title">Aktualisierungen suchen</string>
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
<string name="pref_rotation_summary">Hogyan forduljon a kijelző a billentyűzet ki/becsukása során</string>
|
||||
<string name="pref_fullscreen_title">Teljes képernyő</string>
|
||||
<string name="pref_fullscreen_summary">Rejtett állapotsor a konzol használata során</string>
|
||||
<string name="pref_hide_actionbar_title">Műveleti mező elrejtése</string>
|
||||
<string name="pref_hide_actionbar_summary">Nem jeleníti meg a műveleti mezőt a terminál ablakban.</string>
|
||||
<string name="pref_memkeys_title">Kulcsok megőrzése a memóriában</string>
|
||||
<string name="pref_memkeys_summary">Tartsa nyitva a memóriában lévő kulcsokat amíg a háttérszolgáltatás meg nem szűnik</string>
|
||||
<string name="pref_update_title">Frissítés ellenőrzése</string>
|
||||
|
|
|
@ -82,8 +82,6 @@
|
|||
<string name="pref_rotation_summary">Ako zmeniť rotáciu, keď sa zobrazí / skryje klávesnica</string>
|
||||
<string name="pref_fullscreen_title">Celá obrazovka</string>
|
||||
<string name="pref_fullscreen_summary">Spúšťať konzolu v režime celej obrazovky</string>
|
||||
<string name="pref_hide_actionbar_title">Skryť lištu s akciami</string>
|
||||
<string name="pref_hide_actionbar_summary">Nezobrazovať v konzole lištu s akciami</string>
|
||||
<string name="pref_memkeys_title">Zapamätať kľúče v pamäti</string>
|
||||
<string name="pref_memkeys_summary">Ponechať odomknuté kľúče v pamäti pokiaľ nie je ukončená služba na pozadí.</string>
|
||||
<string name="pref_update_title">Kontrolovať aktualizácie</string>
|
||||
|
|
|
@ -20,5 +20,11 @@
|
|||
<resources>
|
||||
<style name="NoTitle" parent="android:Theme.Holo">
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
<item name="android:actionBarStyle">@style/SolidActionBar</item>
|
||||
</style>
|
||||
|
||||
<style name="SolidActionBar" parent="android:Widget.Holo.ActionBar">
|
||||
<item name="android:background">#222222</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
* ConnectBot: simple, powerful, open-source SSH client for Android
|
||||
* Copyright 2007 Kenny Root, Jeffrey Sharkey
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<style name="NoTitle" parent="android:Theme.DeviceDefault">
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
<item name="android:actionBarStyle">@style/SolidActionBar</item>
|
||||
</style>
|
||||
|
||||
<style name="SolidActionBar" parent="android:Widget.Holo.ActionBar">
|
||||
<item name="android:background">#222222</item>
|
||||
</style>
|
||||
</resources>
|
|
@ -165,11 +165,6 @@
|
|||
<!-- Summary for the full screen preference -->
|
||||
<string name="pref_fullscreen_summary">"Start terminal in full screen mode"</string>
|
||||
|
||||
<!-- Name for the Action Bar preference -->
|
||||
<string name="pref_hide_actionbar_title">"Hide Action Bar"</string>
|
||||
<!-- Summary for the Action Bar preference -->
|
||||
<string name="pref_hide_actionbar_summary">"Do not display the Action Bar in terminal window"</string>
|
||||
|
||||
<!-- Name for the memorize keys preference -->
|
||||
<string name="pref_memkeys_title">"Remember keys in memory"</string>
|
||||
<!-- Summary for the memorize keys preference -->
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="msg_version" translatable="false">ConnectBot (working copy)</string>
|
||||
</resources>
|
|
@ -85,13 +85,6 @@
|
|||
android:defaultValue="false"
|
||||
/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="hide_actionbar"
|
||||
android:title="@string/pref_hide_actionbar_title"
|
||||
android:summary="@string/pref_hide_actionbar_summary"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
|
||||
<ListPreference
|
||||
android:key="keymode"
|
||||
android:title="@string/pref_keymode_title"
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* ConnectBot: simple, powerful, open-source SSH client for Android
|
||||
* Copyright 2007 Kenny Root, Jeffrey Sharkey
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package sk.vx.connectbot;
|
||||
|
||||
import sk.vx.connectbot.util.PreferenceConstants;
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
|
||||
public abstract class ActionBarWrapper {
|
||||
public interface OnMenuVisibilityListener {
|
||||
public void onMenuVisibilityChanged(boolean isVisible);
|
||||
}
|
||||
|
||||
public static ActionBarWrapper getActionBar(Activity activity) {
|
||||
if (PreferenceConstants.PRE_HONEYCOMB)
|
||||
return new DummyActionBar();
|
||||
else
|
||||
return new RealActionBar(activity);
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
}
|
||||
|
||||
public void show() {
|
||||
}
|
||||
|
||||
public void addOnMenuVisibilityListener(OnMenuVisibilityListener listener) {
|
||||
}
|
||||
|
||||
public void setDisplayHomeAsUpEnabled(boolean showHomeAsUp) {
|
||||
}
|
||||
|
||||
private static class DummyActionBar extends ActionBarWrapper {
|
||||
}
|
||||
|
||||
private static class RealActionBar extends ActionBarWrapper {
|
||||
private final ActionBar actionBar;
|
||||
|
||||
public RealActionBar(Activity activity) {
|
||||
actionBar = activity.getActionBar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
actionBar.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
actionBar.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOnMenuVisibilityListener(final OnMenuVisibilityListener listener) {
|
||||
actionBar.addOnMenuVisibilityListener(new ActionBar.OnMenuVisibilityListener() {
|
||||
public void onMenuVisibilityChanged(boolean isVisible) {
|
||||
listener.onMenuVisibilityChanged(isVisible);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayHomeAsUpEnabled(boolean showHomeAsUp) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(showHomeAsUp);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,7 +31,6 @@ import sk.vx.connectbot.util.FileChooser;
|
|||
import sk.vx.connectbot.util.FileChooserCallback;
|
||||
import sk.vx.connectbot.util.PreferenceConstants;
|
||||
import sk.vx.connectbot.util.TransferThread;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ComponentName;
|
||||
|
@ -141,6 +140,9 @@ public class ConsoleActivity extends Activity implements FileChooserCallback {
|
|||
|
||||
private ImageView mKeyboardButton;
|
||||
|
||||
private ActionBarWrapper actionBar;
|
||||
private boolean inActionBarMenu = false;
|
||||
|
||||
private ServiceConnection connection = new ServiceConnection() {
|
||||
public void onServiceConnected(ComponentName className, IBinder service) {
|
||||
bound = ((TerminalManager.TerminalBinder) service).getService();
|
||||
|
@ -313,10 +315,6 @@ public class ConsoleActivity extends Activity implements FileChooserCallback {
|
|||
clipboard = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE);
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
// hide action bar if requested by user
|
||||
if (!PreferenceConstants.PRE_HONEYCOMB && prefs.getBoolean(PreferenceConstants.HIDE_ACTIONBAR, false))
|
||||
this.hideActionBar();
|
||||
|
||||
// TODO find proper way to disable volume key beep if it exists.
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
|
@ -400,6 +398,7 @@ public class ConsoleActivity extends Activity implements FileChooserCallback {
|
|||
|
||||
inputManager.showSoftInput(flip, InputMethodManager.SHOW_FORCED);
|
||||
keyboardGroup.setVisibility(View.GONE);
|
||||
actionBar.hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -458,6 +457,7 @@ public class ConsoleActivity extends Activity implements FileChooserCallback {
|
|||
handler.metaPress(TerminalKeyListener.META_CTRL_ON);
|
||||
|
||||
keyboardGroup.setVisibility(View.GONE);
|
||||
actionBar.hide();
|
||||
}
|
||||
});
|
||||
ctrlButton.setOnLongClickListener(new OnLongClickListener() {
|
||||
|
@ -481,6 +481,20 @@ public class ConsoleActivity extends Activity implements FileChooserCallback {
|
|||
handler.sendEscape();
|
||||
|
||||
keyboardGroup.setVisibility(View.GONE);
|
||||
actionBar.hide();
|
||||
}
|
||||
});
|
||||
|
||||
actionBar = ActionBarWrapper.getActionBar(this);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.hide();
|
||||
actionBar.addOnMenuVisibilityListener(new ActionBarWrapper.OnMenuVisibilityListener() {
|
||||
public void onMenuVisibilityChanged(boolean isVisible) {
|
||||
inActionBarMenu = isVisible;
|
||||
if (isVisible == false) {
|
||||
keyboardGroup.setVisibility(View.GONE);
|
||||
actionBar.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
escButton.setOnLongClickListener(new OnLongClickListener() {
|
||||
|
@ -732,14 +746,16 @@ public class ConsoleActivity extends Activity implements FileChooserCallback {
|
|||
&& Math.abs(event.getY() - lastY) < MAX_CLICK_DISTANCE) {
|
||||
keyboardGroup.startAnimation(keyboard_fade_in);
|
||||
keyboardGroup.setVisibility(View.VISIBLE);
|
||||
actionBar.show();
|
||||
|
||||
handler.postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
if (keyboardGroup.getVisibility() == View.GONE)
|
||||
if (keyboardGroup.getVisibility() == View.GONE || inActionBarMenu)
|
||||
return;
|
||||
|
||||
keyboardGroup.startAnimation(keyboard_fade_out);
|
||||
keyboardGroup.setVisibility(View.GONE);
|
||||
actionBar.hide();
|
||||
}
|
||||
}, KEYBOARD_DISPLAY_TIME);
|
||||
}
|
||||
|
@ -1120,6 +1136,19 @@ public class ConsoleActivity extends Activity implements FileChooserCallback {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
Intent intent = new Intent(this, HostListActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOptionsMenuClosed(Menu menu) {
|
||||
super.onOptionsMenuClosed(menu);
|
||||
|
@ -1432,39 +1461,12 @@ public class ConsoleActivity extends Activity implements FileChooserCallback {
|
|||
if (fullScreen == FULLSCREEN_ON) {
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
if (!PreferenceConstants.PRE_HONEYCOMB) {
|
||||
this.hideActionBar();
|
||||
}
|
||||
} else {
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
if (!PreferenceConstants.PRE_HONEYCOMB) {
|
||||
if (!prefs.getBoolean(PreferenceConstants.HIDE_ACTIONBAR, false))
|
||||
this.showActionBar();
|
||||
}
|
||||
}
|
||||
this.fullScreen = fullScreen;
|
||||
if (bound != null)
|
||||
bound.setFullScreen(this.fullScreen);
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(11)
|
||||
private void showActionBar() {
|
||||
try {
|
||||
if (this.getActionBar() != null)
|
||||
this.getActionBar().show();
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error showing ActionBar", e);
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(11)
|
||||
private void hideActionBar() {
|
||||
try {
|
||||
if (this.getActionBar() != null)
|
||||
this.getActionBar().hide();
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error hiding ActionBar", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import android.net.Uri;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.text.ClipboardManager;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyCharacterMap;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
|
@ -44,7 +45,6 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.view.Gravity;
|
||||
import de.mud.terminal.VDUBuffer;
|
||||
import de.mud.terminal.vt320;
|
||||
|
||||
|
@ -225,32 +225,28 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
|
|||
curMetaState |= KeyEvent.META_ALT_ON;
|
||||
}
|
||||
|
||||
int key = event.getUnicodeChar(curMetaState);
|
||||
int uchar = event.getUnicodeChar(curMetaState);
|
||||
// no hard keyboard? ALT-k should pass through to below
|
||||
|
||||
if ((orgMetaState & KeyEvent.META_ALT_ON) != 0 &&
|
||||
(!hardKeyboard || hardKeyboardHidden)) {
|
||||
key = 0;
|
||||
uchar = 0;
|
||||
}
|
||||
|
||||
if ((key & KeyCharacterMap.COMBINING_ACCENT) != 0) {
|
||||
mDeadKey = key & KeyCharacterMap.COMBINING_ACCENT_MASK;
|
||||
if ((uchar & KeyCharacterMap.COMBINING_ACCENT) != 0) {
|
||||
mDeadKey = uchar & KeyCharacterMap.COMBINING_ACCENT_MASK;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mDeadKey != 0) {
|
||||
key = KeyCharacterMap.getDeadChar(mDeadKey, keyCode);
|
||||
uchar = KeyCharacterMap.getDeadChar(mDeadKey, keyCode);
|
||||
mDeadKey = 0;
|
||||
}
|
||||
|
||||
final boolean printing = (key != 0 && keyCode != KeyEvent.KEYCODE_ENTER);
|
||||
|
||||
|
||||
|
||||
if (v != null) {
|
||||
//Show up the CharacterPickerDialog when the SYM key is pressed
|
||||
if( (keyCode == KeyEvent.KEYCODE_SYM || keyCode == KeyEvent.KEYCODE_PICTSYMBOLS ||
|
||||
key == KeyCharacterMap.PICKER_DIALOG_INPUT)) {
|
||||
uchar == KeyCharacterMap.PICKER_DIALOG_INPUT)) {
|
||||
bridge.showCharPickerDialog();
|
||||
if(metaState == 4) { // reset fn-key state
|
||||
metaState = 0;
|
||||
|
@ -270,7 +266,7 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
|
|||
|
||||
// otherwise pass through to existing session
|
||||
// print normal keys
|
||||
if (printing) {
|
||||
if (uchar >= 0x20) {
|
||||
metaState &= ~(META_SLASH | META_TAB);
|
||||
|
||||
// Remove shift and alt modifiers
|
||||
|
@ -290,7 +286,7 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
|
|||
&& sendFunctionKey(keyCode))
|
||||
return true;
|
||||
|
||||
key = keyAsControl(key);
|
||||
uchar = keyAsControl(uchar);
|
||||
}
|
||||
|
||||
// handle pressing f-keys
|
||||
|
@ -300,11 +296,11 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
|
|||
&& sendFunctionKey(keyCode))
|
||||
return true;
|
||||
|
||||
if (key < 0x80)
|
||||
bridge.transport.write(key);
|
||||
if (uchar < 0x80)
|
||||
bridge.transport.write(uchar);
|
||||
else
|
||||
// TODO write encoding routine that doesn't allocate each time
|
||||
bridge.transport.write(new String(Character.toChars(key))
|
||||
bridge.transport.write(new String(Character.toChars(uchar))
|
||||
.getBytes(encoding));
|
||||
|
||||
return true;
|
||||
|
|
|
@ -19,6 +19,7 @@ package sk.vx.connectbot.util;
|
|||
|
||||
import android.os.Build;
|
||||
|
||||
|
||||
/**
|
||||
* @author Kenny Root
|
||||
*
|
||||
|
|
100
tests/build.xml
100
tests/build.xml
|
@ -1,4 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- vim: set ts=4 sw=4 et: -->
|
||||
<project name="tests" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
|
@ -61,51 +62,6 @@
|
|||
</target>
|
||||
-->
|
||||
|
||||
<target name="coverage-xml" depends="-test-project-check">
|
||||
|
||||
<property name="tested.project.absolute.dir" location="${tested.project.dir}" />
|
||||
|
||||
<property name="test.runner" value="android.test.InstrumentationTestRunner" />
|
||||
|
||||
<!-- Application package of the tested project extracted from its manifest file -->
|
||||
<xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
|
||||
expression="/manifest/@package" output="tested.manifest.package" />
|
||||
|
||||
<property name="emma.dump.file"
|
||||
value="/data/data/${tested.manifest.package}/coverage.ec" />
|
||||
|
||||
<run-tests-helper emma.enabled="true">
|
||||
<extra-instrument-args>
|
||||
<arg value="-e" />
|
||||
<arg value="coverageFile" />
|
||||
<arg value="${emma.dump.file}" />
|
||||
</extra-instrument-args>
|
||||
</run-tests-helper>
|
||||
<echo>Downloading coverage file into project directory...</echo>
|
||||
<exec executable="${adb}" failonerror="true">
|
||||
<arg line="${adb.device.arg}" />
|
||||
<arg value="pull" />
|
||||
<arg value="${emma.dump.file}" />
|
||||
<arg value="coverage.ec" />
|
||||
</exec>
|
||||
<echo>Extracting XML coverage report...</echo>
|
||||
<emma>
|
||||
<report sourcepath="${tested.project.absolute.dir}/${source.dir}"
|
||||
verbosity="${verbosity}">
|
||||
<infileset dir=".">
|
||||
<include name="coverage.ec" />
|
||||
<include name="coverage.em" />
|
||||
</infileset>
|
||||
<xml outfile="coverage/coverage.xml" />
|
||||
</report>
|
||||
</emma>
|
||||
<echo>Cleaning up temporary files...</echo>
|
||||
<delete dir="${instrumentation.absolute.dir}" />
|
||||
<delete file="coverage.ec" />
|
||||
<delete file="coverage.em" />
|
||||
<echo>Saving the report file in ${basedir}/coverage/coverage.xml</echo>
|
||||
</target>
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
|
@ -124,7 +80,59 @@
|
|||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<!-- version-tag: custom -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
<target name="coverage-xml" depends="-test-project-check">
|
||||
|
||||
<property name="tested.project.absolute.dir" location="${tested.project.dir}" />
|
||||
|
||||
<property name="test.runner" value="android.test.InstrumentationTestRunner" />
|
||||
|
||||
<!-- Application package of the tested project extracted from its manifest file -->
|
||||
<xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
|
||||
expression="/manifest/@package" output="tested.manifest.package" />
|
||||
|
||||
<getprojectpaths projectPath="${tested.project.absolute.dir}"
|
||||
binOut="tested.project.out.absolute.dir"
|
||||
srcOut="tested.project.source.absolute.dir" />
|
||||
|
||||
<getlibpath projectPath="${tested.project.absolute.dir}"
|
||||
libraryFolderPathOut="tested.project.lib.source.path"
|
||||
leaf="@{source.dir}" />
|
||||
|
||||
<property name="emma.dump.file"
|
||||
value="/data/data/${tested.manifest.package}/coverage.ec" />
|
||||
|
||||
<run-tests-helper emma.enabled="true">
|
||||
<extra-instrument-args>
|
||||
<arg value="-e" />
|
||||
<arg value="coverageFile" />
|
||||
<arg value="${emma.dump.file}" />
|
||||
</extra-instrument-args>
|
||||
</run-tests-helper>
|
||||
<echo>Downloading coverage file into project directory...</echo>
|
||||
<exec executable="${adb}" failonerror="true">
|
||||
<arg line="${adb.device.arg}" />
|
||||
<arg value="pull" />
|
||||
<arg value="${emma.dump.file}" />
|
||||
<arg value="${out.absolute.dir}/coverage.ec" />
|
||||
</exec>
|
||||
<echo>Extracting XML coverage report...</echo>
|
||||
<emma>
|
||||
<report sourcepath="${tested.project.source.absolute.dir}:${tested.project.lib.source.path.value}"
|
||||
verbosity="${verbosity}">
|
||||
<!-- TODO: report.dir or something like should be introduced if necessary -->
|
||||
<infileset file="${out.absolute.dir}/coverage.ec" />
|
||||
<infileset file="${tested.project.out.absolute.dir}/coverage.em" />
|
||||
<!-- TODO: reports in other, indicated by user formats -->
|
||||
<xml outfile="${out.absolute.dir}/coverage.xml" />
|
||||
</report>
|
||||
</emma>
|
||||
<echo level="info">Cleaning up temporary files...</echo>
|
||||
<delete file="${out.absolute.dir}/coverage.ec" />
|
||||
<delete file="${out.absolute.dir}/coverage.em" />
|
||||
<echo level="info">Saving the report file in ${out.absolute.dir}/coverage.xml</echo>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
Loading…
Reference in New Issue