aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2009-01-13 17:44:53 +0000
committerKenny Root <kenny@the-b.org>2009-01-13 17:44:53 +0000
commit1322b4654fd09505b1bc4ef5aecc3bfd205a923d (patch)
tree49e12bcbb4aad085edbfe798798022e5bc306812
parent38132a59fdc4b7a5aee4161ce9b17e80fbf88d86 (diff)
downloadconnectbot-1322b4654fd09505b1bc4ef5aecc3bfd205a923d.tar.gz
connectbot-1322b4654fd09505b1bc4ef5aecc3bfd205a923d.tar.bz2
connectbot-1322b4654fd09505b1bc4ef5aecc3bfd205a923d.zip
A smaller fix to the ViewFlipper bug
-rw-r--r--res/layout/act_console.xml3
-rw-r--r--src/org/connectbot/ConsoleActivity.java13
-rw-r--r--src/org/connectbot/util/ViewFlipperFixed.java64
3 files changed, 11 insertions, 69 deletions
diff --git a/res/layout/act_console.xml b/res/layout/act_console.xml
index 29b60d8..da58b8c 100644
--- a/res/layout/act_console.xml
+++ b/res/layout/act_console.xml
@@ -31,8 +31,7 @@
android:gravity="center"
/>
- <!-- CHANGE BACK TO ViewFlipper WHEN FIX RELEASED! -->
- <org.connectbot.util.ViewFlipperFixed
+ <ViewFlipper
android:id="@+id/console_flip"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java
index 211ec45..da543ce 100644
--- a/src/org/connectbot/ConsoleActivity.java
+++ b/src/org/connectbot/ConsoleActivity.java
@@ -23,7 +23,6 @@ import org.connectbot.bean.PortForwardBean;
import org.connectbot.service.PromptHelper;
import org.connectbot.service.TerminalBridge;
import org.connectbot.service.TerminalManager;
-import org.connectbot.util.ViewFlipperFixed;
import android.app.Activity;
import android.app.AlertDialog;
@@ -63,6 +62,7 @@ import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
+import android.widget.ViewFlipper;
import de.mud.terminal.vt320;
public class ConsoleActivity extends Activity {
@@ -70,7 +70,7 @@ public class ConsoleActivity extends Activity {
protected static final int REQUEST_EDIT = 1;
- protected ViewFlipperFixed flip = null;
+ protected ViewFlipper flip = null;
protected TerminalManager bound = null;
protected LayoutInflater inflater = null;
@@ -222,6 +222,13 @@ public class ConsoleActivity extends Activity {
if(flip.getDisplayedChild() == i)
shiftLeft();
flip.removeViewAt(i);
+
+ /* TODO Remove this workaround when ViewFlipper is fixed to listen
+ * to view removals. Android Issue 1784
+ */
+ if (flip.getDisplayedChild() >= flip.getChildCount())
+ flip.setDisplayedChild(flip.getDisplayedChild());
+
updateEmptyVisible();
break;
}
@@ -310,7 +317,7 @@ public class ConsoleActivity extends Activity {
inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- flip = (ViewFlipperFixed)findViewById(R.id.console_flip);
+ flip = (ViewFlipper)findViewById(R.id.console_flip);
empty = (TextView)findViewById(android.R.id.empty);
stringPromptGroup = (RelativeLayout) findViewById(R.id.console_password_group);
diff --git a/src/org/connectbot/util/ViewFlipperFixed.java b/src/org/connectbot/util/ViewFlipperFixed.java
deleted file mode 100644
index 157864c..0000000
--- a/src/org/connectbot/util/ViewFlipperFixed.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- ConnectBot: simple, powerful, open-source SSH client for Android
- Copyright (C) 2007-2008 Kenny Root, Jeffrey Sharkey
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-package org.connectbot.util;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.widget.ViewFlipper;
-
-/**
- * @author Kenny Root
- *
- * This class simply overrides ViewFlipper until a fix can be released
- * for tracking removal of views from a ViewAnimator.
- *
- * REMOVE THIS CLASS WHEN ViewAnimator IN ANDROID IS FIXED TO TRACK
- * REMOVAL OF CHILD VIEWS! See also res/layout/act_console.xml
- */
-public class ViewFlipperFixed extends ViewFlipper {
-
- /**
- * @param context
- */
- public ViewFlipperFixed(Context context) {
- super(context);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param context
- * @param attrs
- */
- public ViewFlipperFixed(Context context, AttributeSet attrs) {
- super(context, attrs);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param index child index
- */
- @Override
- public void removeViewAt(int index) {
- // TODO Auto-generated method stub
- super.removeViewAt(index);
-
- // Since we can't override removeViewInternal, we might as well do this.
- if (getDisplayedChild() >= getChildCount())
- setDisplayedChild(index - 1);
- }
-}