1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-22 08:52:18 -05:00

Finalized fullscreen implementation, added heuristics to resizing, fixed ime extract bug introduced 2 commits ago.

Conflicts:

	application/src/org/yaaic/activity/ConversationActivity.java
This commit is contained in:
Rey Rey 2011-07-02 18:01:01 +02:00 committed by Sebastian Kaspari
parent 27d93ebaa7
commit 84ade9fae4
2 changed files with 26 additions and 9 deletions

View File

@ -259,7 +259,7 @@ public class ConversationActivity extends Activity implements ServiceConnection,
button in that case */ button in that case */
setInputTypeFlags |= InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE; setInputTypeFlags |= InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE;
} else { } else {
input.setImeOptions(input.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI); input.setImeOptions(input.getImeOptions());
} }
input.setInputType(input.getInputType() | setInputTypeFlags); input.setInputType(input.getInputType() | setInputTypeFlags);

View File

@ -20,6 +20,7 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.yaaic.view; package org.yaaic.view;
import org.yaaic.R;
import org.yaaic.model.Settings; import org.yaaic.model.Settings;
import android.app.Activity; import android.app.Activity;
@ -31,7 +32,9 @@ import android.util.AttributeSet;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView;
/** /**
* ConversationLayout: LinearLayout that resizes correctly when an IME * ConversationLayout: LinearLayout that resizes correctly when an IME
@ -41,7 +44,9 @@ import android.widget.LinearLayout;
*/ */
public class ConversationLayout extends LinearLayout public class ConversationLayout extends LinearLayout
{ {
Activity activity; private Activity activity;
private TextView title;
private ImageView status;
int curHeight = 0; int curHeight = 0;
boolean fullscreen = false, isLandscape = false; boolean fullscreen = false, isLandscape = false;
boolean redoLayout = false; boolean redoLayout = false;
@ -93,26 +98,38 @@ public class ConversationLayout extends LinearLayout
* onMeasure (ask the view how much space it wants) * onMeasure (ask the view how much space it wants)
* This is called when the window size changes, so we can hook into it to * This is called when the window size changes, so we can hook into it to
* resize ourselves when the IME comes up * resize ourselves when the IME comes up
* @author Steven Luo <stevenandroid@steven676.net>
* @author Reynaldo Cortorreal <reyncor@gmail.com>
*/ */
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{ {
super.onMeasure(widthMeasureSpec, 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(); int height = getWindowHeight();
if (curHeight != height) { if (curHeight != height) {
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 params = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT,
height height
); );
params.gravity = Gravity.BOTTOM | Gravity.CLIP_VERTICAL; params.gravity = Gravity.BOTTOM | Gravity.CLIP_VERTICAL;
setLayoutParams(params); setLayoutParams(params);
redoLayout = true; redoLayout = true;