aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2011-05-29 09:29:45 -0700
committerKenny Root <kenny@the-b.org>2011-05-29 09:29:45 -0700
commitecf8b0378c1b484e383bc6c4b7d6b727b64c8b1c (patch)
tree58d8c99c190d819918504093e4c5b0fec4a1b7d4
parent38129a97436444108d8e7eb9a2a210bf85c64989 (diff)
parentf328e7f8acccca78cd0e7559b6cbcd17d56844e6 (diff)
downloadconnectbot-ecf8b0378c1b484e383bc6c4b7d6b727b64c8b1c.tar.gz
connectbot-ecf8b0378c1b484e383bc6c4b7d6b727b64c8b1c.tar.bz2
connectbot-ecf8b0378c1b484e383bc6c4b7d6b727b64c8b1c.zip
Merge pull request #10 from AgentHH/master
Update ConnectBot to API 11 and to use holo UI
-rw-r--r--AndroidManifest.xml2
-rw-r--r--default.properties2
-rw-r--r--res/values-v11/styles.xml24
-rw-r--r--src/org/connectbot/HostEditorActivity.java9
-rw-r--r--src/org/connectbot/service/ConnectionNotifier.java37
5 files changed, 68 insertions, 6 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 205f0f6..88a1823 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -5,7 +5,7 @@
android:versionCode="347"
android:installLocation="auto">
- <uses-sdk android:targetSdkVersion="9" android:minSdkVersion="3" />
+ <uses-sdk android:targetSdkVersion="11" android:minSdkVersion="3" />
<application
android:icon="@drawable/icon"
diff --git a/default.properties b/default.properties
index 76c9984..af73ae7 100644
--- a/default.properties
+++ b/default.properties
@@ -11,4 +11,4 @@
split.density=false
# Project target.
-target=android-9
+target=android-11
diff --git a/res/values-v11/styles.xml b/res/values-v11/styles.xml
new file mode 100644
index 0000000..cf9636b
--- /dev/null
+++ b/res/values-v11/styles.xml
@@ -0,0 +1,24 @@
+<?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.Holo">
+ <item name="android:windowContentOverlay">@null</item>
+ </style>
+</resources>
diff --git a/src/org/connectbot/HostEditorActivity.java b/src/org/connectbot/HostEditorActivity.java
index a994b1b..4e8427f 100644
--- a/src/org/connectbot/HostEditorActivity.java
+++ b/src/org/connectbot/HostEditorActivity.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.Map.Entry;
import org.connectbot.bean.HostBean;
@@ -162,6 +163,10 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr
update.remove(key);
return this;
}
+
+ public android.content.SharedPreferences.Editor putStringSet(String key, Set<String> value) {
+ throw new UnsupportedOperationException("HostEditor Prefs do not support Set<String>");
+ }
}
@@ -197,6 +202,10 @@ public class HostEditorActivity extends PreferenceActivity implements OnSharedPr
return values.get(key);
}
+ public Set<String> getStringSet(String key, Set<String> defValue) {
+ throw new ClassCastException("HostEditor Prefs do not support Set<String>");
+ }
+
protected List<OnSharedPreferenceChangeListener> listeners = new LinkedList<OnSharedPreferenceChangeListener>();
public void registerOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener) {
diff --git a/src/org/connectbot/service/ConnectionNotifier.java b/src/org/connectbot/service/ConnectionNotifier.java
index a9c054d..d276761 100644
--- a/src/org/connectbot/service/ConnectionNotifier.java
+++ b/src/org/connectbot/service/ConnectionNotifier.java
@@ -17,6 +17,9 @@
package org.connectbot.service;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
import org.connectbot.ConsoleActivity;
import org.connectbot.R;
import org.connectbot.bean.HostBean;
@@ -128,20 +131,46 @@ public abstract class ConnectionNotifier {
public abstract void hideRunningNotification(Service context);
private static class PreEclair extends ConnectionNotifier {
+ private static final Class<?>[] setForegroundSignature = new Class[] {boolean.class};
+ private Method setForeground = null;
+
private static class Holder {
private static final PreEclair sInstance = new PreEclair();
}
+ public PreEclair() {
+ try {
+ setForeground = Service.class.getMethod("setForeground", setForegroundSignature);
+ } catch (Exception e) {
+ }
+ }
+
@Override
public void showRunningNotification(Service context) {
- context.setForeground(true);
- getNotificationManager(context).notify(ONLINE_NOTIFICATION, newRunningNotification(context));
+ if (setForeground != null) {
+ Object[] setForegroundArgs = new Object[1];
+ setForegroundArgs[0] = Boolean.TRUE;
+ try {
+ setForeground.invoke(context, setForegroundArgs);
+ } catch (InvocationTargetException e) {
+ } catch (IllegalAccessException e) {
+ }
+ getNotificationManager(context).notify(ONLINE_NOTIFICATION, newRunningNotification(context));
+ }
}
@Override
public void hideRunningNotification(Service context) {
- context.setForeground(false);
- getNotificationManager(context).cancel(ONLINE_NOTIFICATION);
+ if (setForeground != null) {
+ Object[] setForegroundArgs = new Object[1];
+ setForegroundArgs[0] = Boolean.FALSE;
+ try {
+ setForeground.invoke(context, setForegroundArgs);
+ } catch (InvocationTargetException e) {
+ } catch (IllegalAccessException e) {
+ }
+ getNotificationManager(context).cancel(ONLINE_NOTIFICATION);
+ }
}
}