diff --git a/application/res/layout/rounded.xml b/application/res/layout/border.xml similarity index 69% rename from application/res/layout/rounded.xml rename to application/res/layout/border.xml index 56a9a18..0a18b00 100644 --- a/application/res/layout/rounded.xml +++ b/application/res/layout/border.xml @@ -23,18 +23,13 @@ along with Yaaic. If not, see . xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> + android:width="1dp" + android:color="#3f5d9b" /> + android:left="3dp" + android:top="3dp" + android:right="3dp" + android:bottom="3dp" /> - + android:color="#ff181818" /> \ No newline at end of file diff --git a/application/res/layout/conversations.xml b/application/res/layout/conversations.xml index 5324d05..0c1a88c 100644 --- a/application/res/layout/conversations.xml +++ b/application/res/layout/conversations.xml @@ -24,28 +24,11 @@ along with Yaaic. If not, see . android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:background="#ff181818"> - + - - - + android:layout_height="wrap_content" /> . android:layout_weight="1" android:layout_margin="0px" android:unselectedAlpha="100" - android:spacing="5dp" android:padding="0dp" /> - mConversations = server.getConversations(); @@ -298,8 +285,6 @@ public class ConversationActivity extends Activity implements ServiceConnection, } } - ((ImageView) findViewById(R.id.status)).setImageResource(server.getStatusIcon()); - // Start service Intent intent = new Intent(this, IRCService.class); intent.setAction(IRCService.ACTION_FOREGROUND); @@ -539,10 +524,6 @@ public class ConversationActivity extends Activity implements ServiceConnection, conversation.setStatus(status); } } - - if (dots != null) { - dots.invalidate(); - } } /** @@ -586,17 +567,7 @@ public class ConversationActivity extends Activity implements ServiceConnection, @Override public void onTopicChanged(String target) { - String selected = server.getSelectedConversation(); - if (selected.equals(target)) { - // onTopicChanged is only called for channels - Channel channel = (Channel) server.getConversation(selected); - StringBuilder sb = new StringBuilder(); - sb.append(server.getTitle() + " - " + channel.getName()); - if (!(channel.getTopic()).equals("")) { - sb.append(" - " + channel.getTopic()); - } - ((TextView) findViewById(R.id.title)).setText(sb.toString()); - } + // No implementation } /** @@ -605,8 +576,6 @@ public class ConversationActivity extends Activity implements ServiceConnection, @Override public void onStatusUpdate() { - ((ImageView) findViewById(R.id.status)).setImageResource(server.getStatusIcon()); - EditText input = (EditText) findViewById(R.id.input); if (server.isConnected()) { @@ -845,7 +814,7 @@ public class ConversationActivity extends Activity implements ServiceConnection, word = text.substring(cursor, sel_end); } else { // use the word at the curent cursor position - while(true) { + while (true) { cursor -= 1; if (cursor <= 0 || text.charAt(cursor) == ' ') { break; @@ -938,6 +907,7 @@ public class ConversationActivity extends Activity implements ServiceConnection, openSoftKeyboard(input); } }); + input.requestFocus(); } diff --git a/application/src/org/yaaic/adapter/ConversationPagerAdapter.java b/application/src/org/yaaic/adapter/ConversationPagerAdapter.java index e6f7c5c..b5e7bdf 100644 --- a/application/src/org/yaaic/adapter/ConversationPagerAdapter.java +++ b/application/src/org/yaaic/adapter/ConversationPagerAdapter.java @@ -25,19 +25,24 @@ import java.util.LinkedList; import org.yaaic.listener.MessageClickListener; import org.yaaic.model.Conversation; +import org.yaaic.model.Server; import org.yaaic.view.MessageListView; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; +import com.viewpagerindicator.TitlePageIndicator; +import com.viewpagerindicator.TitleProvider; + /** * Adapter for displaying a pager of conversations. * * @author Sebastian Kaspari */ -public class ConversationPagerAdapter extends PagerAdapter +public class ConversationPagerAdapter extends PagerAdapter implements TitleProvider { + private final Server server; private LinkedList conversations; private final HashMap views; @@ -59,7 +64,9 @@ public class ConversationPagerAdapter extends PagerAdapter /** * Create a new {@link ConversationPagerAdapter} instance. */ - public ConversationPagerAdapter() { + public ConversationPagerAdapter(Server server) { + this.server = server; + conversations = new LinkedList(); views = new HashMap(); } @@ -254,4 +261,19 @@ public class ConversationPagerAdapter extends PagerAdapter ((ViewPager) collection).removeView((View) view); views.remove(position); } + + /** + * Get the title for the given position. Used by the {@link TitlePageIndicator}. + */ + @Override + public String getTitle(int position) + { + Conversation conversation = getItem(position); + + if (conversation.getType() == Conversation.TYPE_SERVER) { + return server.getTitle(); + } else { + return conversation.getName(); + } + } } diff --git a/application/src/org/yaaic/view/ConversationLayout.java b/application/src/org/yaaic/view/ConversationLayout.java index d79072d..bbca4a8 100644 --- a/application/src/org/yaaic/view/ConversationLayout.java +++ b/application/src/org/yaaic/view/ConversationLayout.java @@ -20,7 +20,6 @@ along with Yaaic. If not, see . */ package org.yaaic.view; -import org.yaaic.R; import org.yaaic.model.Settings; import android.app.Activity; @@ -36,7 +35,7 @@ import android.widget.LinearLayout; /** * ConversationLayout: LinearLayout that resizes correctly when an IME * comes up in fullscreen mode - * + * * @author Steven Luo */ public class ConversationLayout extends LinearLayout @@ -50,7 +49,7 @@ public class ConversationLayout extends LinearLayout /** * Create a new conversation linear layout - * + * * @param context */ public ConversationLayout(Context context) @@ -61,7 +60,7 @@ public class ConversationLayout extends LinearLayout /** * Create a new conversation linear layout - * + * * @param context * @param attrs */ @@ -91,35 +90,6 @@ public class ConversationLayout extends LinearLayout return visible.height(); } - /** - * Check if starving the gui is necessary, and starves - * Starves when less then a vertical inch is available to us - * - * @return true if we are able to check, false if not. - * @author Reynaldo Cortorreal - */ - private boolean setStarvationMode(int height) - { - if (height == 0 || height == curHeight) { - return false; - } - - LinearLayout status = (LinearLayout) findViewById(R.id.status_layout); - ConversationSwitcher dots = (ConversationSwitcher) findViewById(R.id.dots); - - float scale = getResources().getDisplayMetrics().density; - - //Give us at least an inch, or we'll have to make sacrifices. - if (height < 160*scale) { - status.setVisibility(GONE); - dots.setVisibility(GONE); - } else { - status.setVisibility(VISIBLE); - dots.setVisibility(VISIBLE); - } - return true; - } - /** * Adjust the height of the view to avoid scrolling and hide UI components * if necessary to save space @@ -132,17 +102,11 @@ public class ConversationLayout extends LinearLayout int height = getWindowHeight(); if (!fullscreen) { - if (setStarvationMode(height)) { - curHeight = height; - redoLayout = true; - } return; } //here to forth the code applies only to full screen - if (isLandscape && !setStarvationMode(height)) { - return; - } else if (curHeight != height && height != 0) { + if (curHeight != height && height != 0) { curHeight = height; FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( diff --git a/application/src/org/yaaic/view/MessageListView.java b/application/src/org/yaaic/view/MessageListView.java index 2564d5e..744d480 100644 --- a/application/src/org/yaaic/view/MessageListView.java +++ b/application/src/org/yaaic/view/MessageListView.java @@ -47,8 +47,8 @@ public class MessageListView extends ListView setDivider(null); - setBackgroundResource(R.layout.rounded); - setCacheColorHint(0xee000000); + setBackgroundResource(R.layout.border); + setCacheColorHint(0xFF181818); setVerticalFadingEdgeEnabled(false); setScrollBarStyle(SCROLLBARS_OUTSIDE_INSET); setTranscriptMode(TRANSCRIPT_MODE_ALWAYS_SCROLL);