1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-29 20:32:22 -05:00

ConversationSwitcher: Changed layout and moved switcher to bottom

This commit is contained in:
Sebastian Kaspari 2010-08-27 17:26:53 +02:00
parent 1fc7cc4b73
commit ec3e6b04d1
2 changed files with 13 additions and 28 deletions

View File

@ -43,10 +43,6 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
android:textSize="12px"
android:layout_weight="1" />
</LinearLayout>
<org.yaaic.view.ConversationSwitcher
android:id="@+id/dots"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<ViewSwitcher
android:id="@+id/switcher"
android:layout_width="fill_parent"
@ -56,10 +52,14 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
android:id="@+id/deck"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="10px"
android:layout_margin="0px"
android:spacing="5px"
android:unselectedAlpha="100"/>
</ViewSwitcher>
<org.yaaic.view.ConversationSwitcher
android:id="@+id/dots"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/input"
android:layout_width="fill_parent"

View File

@ -28,7 +28,6 @@ import org.yaaic.model.Server;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
@ -39,8 +38,6 @@ import android.view.View;
*/
public class ConversationSwitcher extends View
{
private static final boolean DEBUG_MODE = false;
private Server server;
private Paint paint;
@ -54,6 +51,7 @@ public class ConversationSwitcher extends View
super(context, attributes);
paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
}
/**
@ -74,8 +72,7 @@ public class ConversationSwitcher extends View
*/
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
int width = MeasureSpec.getSize(widthMeasureSpec);
setMeasuredDimension(width, 16);
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), 16);
}
/**
@ -85,29 +82,17 @@ public class ConversationSwitcher extends View
{
super.onDraw(canvas);
if (DEBUG_MODE) {
// Draw debug lines
paint.setColor(0xFFFF0000);
paint.setStyle(Paint.Style.STROKE);
canvas.drawRect(new Rect(0, 0, getWidth() - 1, getHeight() - 1), paint);
}
if (server == null) {
return;
}
int width = getWidth();
int height = getHeight();
Collection<Conversation> conversations = server.getConversations();
int circles = conversations.size();
int startX = (width / 2) - (((circles + 1) / 2) * 14);
paint.setColor(0xFFDDDDDD);
paint.setStyle(Paint.Style.FILL);
int i = 0;
int width = getWidth();
int height = getHeight();
int circles = conversations.size();
int startX = (width / 2) - (((circles + 1) / 2) * 12);
for (Conversation conversation : conversations) {
switch (conversation.getStatus()) {
@ -125,7 +110,7 @@ public class ConversationSwitcher extends View
break;
}
canvas.drawCircle(startX + 14 * i, height / 2, 5, paint);
canvas.drawCircle(startX + 12 * i, height / 2, 4, paint);
i++;
}