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:
parent
1fc7cc4b73
commit
ec3e6b04d1
@ -43,10 +43,6 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
android:textSize="12px"
|
android:textSize="12px"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<org.yaaic.view.ConversationSwitcher
|
|
||||||
android:id="@+id/dots"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
<ViewSwitcher
|
<ViewSwitcher
|
||||||
android:id="@+id/switcher"
|
android:id="@+id/switcher"
|
||||||
android:layout_width="fill_parent"
|
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:id="@+id/deck"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_margin="10px"
|
android:layout_margin="0px"
|
||||||
android:spacing="5px"
|
android:spacing="5px"
|
||||||
android:unselectedAlpha="100"/>
|
android:unselectedAlpha="100"/>
|
||||||
</ViewSwitcher>
|
</ViewSwitcher>
|
||||||
|
<org.yaaic.view.ConversationSwitcher
|
||||||
|
android:id="@+id/dots"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/input"
|
android:id="@+id/input"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -28,7 +28,6 @@ import org.yaaic.model.Server;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
@ -39,8 +38,6 @@ import android.view.View;
|
|||||||
*/
|
*/
|
||||||
public class ConversationSwitcher extends View
|
public class ConversationSwitcher extends View
|
||||||
{
|
{
|
||||||
private static final boolean DEBUG_MODE = false;
|
|
||||||
|
|
||||||
private Server server;
|
private Server server;
|
||||||
private Paint paint;
|
private Paint paint;
|
||||||
|
|
||||||
@ -54,6 +51,7 @@ public class ConversationSwitcher extends View
|
|||||||
super(context, attributes);
|
super(context, attributes);
|
||||||
|
|
||||||
paint = new Paint();
|
paint = new Paint();
|
||||||
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,8 +72,7 @@ public class ConversationSwitcher extends View
|
|||||||
*/
|
*/
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
||||||
{
|
{
|
||||||
int width = MeasureSpec.getSize(widthMeasureSpec);
|
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), 16);
|
||||||
setMeasuredDimension(width, 16);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,29 +82,17 @@ public class ConversationSwitcher extends View
|
|||||||
{
|
{
|
||||||
super.onDraw(canvas);
|
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) {
|
if (server == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int width = getWidth();
|
|
||||||
int height = getHeight();
|
|
||||||
|
|
||||||
Collection<Conversation> conversations = server.getConversations();
|
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 i = 0;
|
||||||
|
int width = getWidth();
|
||||||
|
int height = getHeight();
|
||||||
|
int circles = conversations.size();
|
||||||
|
int startX = (width / 2) - (((circles + 1) / 2) * 12);
|
||||||
|
|
||||||
for (Conversation conversation : conversations) {
|
for (Conversation conversation : conversations) {
|
||||||
switch (conversation.getStatus()) {
|
switch (conversation.getStatus()) {
|
||||||
@ -125,7 +110,7 @@ public class ConversationSwitcher extends View
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.drawCircle(startX + 14 * i, height / 2, 5, paint);
|
canvas.drawCircle(startX + 12 * i, height / 2, 4, paint);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user