forked from pocmo/Yaaic
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finalized fullscreen implementation, added heuristics to resizing, fi…
…xed ime extract bug introduced 2 commits ago. Conflicts: application/src/org/yaaic/activity/ConversationActivity.java
- Loading branch information
Showing
2 changed files
with
26 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
*/ | ||
package org.yaaic.view; | ||
|
||
import org.yaaic.R; | ||
import org.yaaic.model.Settings; | ||
|
||
import android.app.Activity; | ||
|
@@ -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 | ||
|
@@ -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; | ||
|
@@ -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; | ||
|