diff --git a/application/res/layout/conversations.xml b/application/res/layout/conversations.xml index fea7b56..73bc732 100644 --- a/application/res/layout/conversations.xml +++ b/application/res/layout/conversations.xml @@ -26,6 +26,7 @@ along with Yaaic. If not, see . android:layout_height="fill_parent" android:background="#ff181818"> + */ + private boolean setStarvationMode(int height) + { + if (height == 0) { + return false; + } else if (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; + } + /** * onMeasure (ask the view how much space it wants) * This is called when the window size changes, so we can hook into it to * resize ourselves when the IME comes up * @author Steven Luo - * @author Reynaldo Cortorreal */ @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - - if(!fullscreen && !isLandscape){ - return; - } int height = getWindowHeight(); - if (curHeight != height) { - curHeight = height; - status = (ImageView) findViewById(R.id.status); - title = (TextView) findViewById(R.id.title); - final 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); - title.setVisibility(GONE); - } else if (status.getVisibility() == GONE || title.getVisibility() == GONE){ - status.setVisibility(VISIBLE); - title.setVisibility(VISIBLE); + if(!fullscreen) { + if (setStarvationMode(height)){ + curHeight = height; + redoLayout = true; + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + return; + } else { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + return; } + } + + //here to forth the code applies only to full screen + if (isLandscape && !setStarvationMode(height)) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + return; + } else if (curHeight != height && height != 0) { + curHeight = height; FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.FILL_PARENT, @@ -135,7 +161,10 @@ public class ConversationLayout extends LinearLayout params.gravity = Gravity.BOTTOM | Gravity.CLIP_VERTICAL; setLayoutParams(params); redoLayout = true; + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + return; } + super.onMeasure(widthMeasureSpec, heightMeasureSpec); } /** diff --git a/application/src/org/yaaic/view/MessageListView.java b/application/src/org/yaaic/view/MessageListView.java index ff1f6d4..40c395f 100644 --- a/application/src/org/yaaic/view/MessageListView.java +++ b/application/src/org/yaaic/view/MessageListView.java @@ -42,8 +42,8 @@ public class MessageListView extends ListView private final View parent; private int parentWidth; private int parentHeight; - private int padding; - private int paddingWide; + private final int padding; + private final int paddingWide; /** * Create a new MessageListView @@ -139,11 +139,11 @@ public class MessageListView extends ListView if (switched) { setLayoutParams(new Gallery.LayoutParams(Gallery.LayoutParams.FILL_PARENT, Gallery.LayoutParams.FILL_PARENT)); setTranscriptMode(TRANSCRIPT_MODE_NORMAL); - setPadding(paddingWide, padding, paddingWide, padding); + setPadding(paddingWide, padding, paddingWide, 0); } else { setLayoutParams(new Gallery.LayoutParams(parentWidth*85/100, parentHeight)); setTranscriptMode(TRANSCRIPT_MODE_ALWAYS_SCROLL); - setPadding(padding, padding, padding, padding); + setPadding(padding, padding, padding, 0); } } }