Skip to content

Commit

Permalink
Finalized fullscreen implementation, added heuristics to resizing, fi…
Browse files Browse the repository at this point in the history
…xed ime extract bug introduced 2 commits ago.

Conflicts:

	application/src/org/yaaic/activity/ConversationActivity.java
  • Loading branch information
Rey Rey authored and pocmo committed Jul 2, 2011
1 parent 27d93eb commit 84ade9f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ protected void onCreate(Bundle savedInstanceState)
button in that case */
setInputTypeFlags |= InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE;
} else {
input.setImeOptions(input.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
input.setImeOptions(input.getImeOptions());
}
input.setInputType(input.getInputType() | setInputTypeFlags);

Expand Down
33 changes: 25 additions & 8 deletions application/src/org/yaaic/view/ConversationLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
package org.yaaic.view;

import org.yaaic.R;
import org.yaaic.model.Settings;

import android.app.Activity;
Expand All @@ -31,7 +32,9 @@
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
* ConversationLayout: LinearLayout that resizes correctly when an IME
Expand All @@ -41,7 +44,9 @@
*/
public class ConversationLayout extends LinearLayout
{
Activity activity;
private Activity activity;
private TextView title;
private ImageView status;
int curHeight = 0;
boolean fullscreen = false, isLandscape = false;
boolean redoLayout = false;
Expand Down Expand Up @@ -93,26 +98,38 @@ private int getWindowHeight()
* 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 <[email protected]>
* @author Reynaldo Cortorreal <[email protected]>
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);

/* XXX: We should probably use some heuristic of how many pixels are
available for deciding whether to scroll instead of resize, instead
of refusing to resize in landscape */
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;
android.util.Log.d("CONVO height",String.valueOf(height)+", Scale: "+String.valueOf(height*scale));


//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);
}

FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.FILL_PARENT,
height
);

params.gravity = Gravity.BOTTOM | Gravity.CLIP_VERTICAL;
setLayoutParams(params);
redoLayout = true;
Expand Down

0 comments on commit 84ade9f

Please sign in to comment.