Eliminate the useless layout for the message overlay
This commit is contained in:
parent
52377a86de
commit
8e30ad605f
@ -33,12 +33,10 @@ import android.view.Gravity;
|
|||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -54,7 +52,6 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
*/
|
*/
|
||||||
private Handler mUiHandler = new Handler(this);
|
private Handler mUiHandler = new Handler(this);
|
||||||
|
|
||||||
private RelativeLayout mMessageOverlay;
|
|
||||||
private TextView mOverlayText;
|
private TextView mOverlayText;
|
||||||
private View mControlsTop;
|
private View mControlsTop;
|
||||||
private View mControlsBottom;
|
private View mControlsBottom;
|
||||||
@ -167,8 +164,8 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
*/
|
*/
|
||||||
private void hideMessageOverlay()
|
private void hideMessageOverlay()
|
||||||
{
|
{
|
||||||
if (mMessageOverlay != null)
|
if (mOverlayText != null)
|
||||||
mMessageOverlay.setVisibility(View.GONE);
|
mOverlayText.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -178,35 +175,20 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
*/
|
*/
|
||||||
private void showOverlayMessage(int text)
|
private void showOverlayMessage(int text)
|
||||||
{
|
{
|
||||||
if (mMessageOverlay == null) {
|
if (mOverlayText == null) {
|
||||||
mMessageOverlay = new RelativeLayout(this) {
|
TextView view = new TextView(this);
|
||||||
@Override
|
view.setBackgroundColor(Color.BLACK);
|
||||||
public boolean onTouchEvent(MotionEvent ev)
|
view.setTextColor(Color.WHITE);
|
||||||
{
|
view.setGravity(Gravity.CENTER);
|
||||||
// Eat all touch events so they don't pass through to the
|
view.setPadding(25, 25, 25, 25);
|
||||||
// CoverView
|
// Make the view clickable so it eats touch events
|
||||||
return true;
|
view.setClickable(true);
|
||||||
}
|
addContentView(view,
|
||||||
};
|
|
||||||
|
|
||||||
mMessageOverlay.setBackgroundColor(Color.BLACK);
|
|
||||||
|
|
||||||
RelativeLayout.LayoutParams layoutParams =
|
|
||||||
new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
|
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
|
||||||
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
|
|
||||||
layoutParams.setMargins(20, 20, 20, 20);
|
|
||||||
|
|
||||||
mOverlayText = new TextView(this);
|
|
||||||
mOverlayText.setLayoutParams(layoutParams);
|
|
||||||
mOverlayText.setGravity(Gravity.CENTER);
|
|
||||||
mMessageOverlay.addView(mOverlayText);
|
|
||||||
|
|
||||||
addContentView(mMessageOverlay,
|
|
||||||
new ViewGroup.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
|
new ViewGroup.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
|
||||||
LinearLayout.LayoutParams.FILL_PARENT));
|
LinearLayout.LayoutParams.FILL_PARENT));
|
||||||
|
mOverlayText = view;
|
||||||
} else {
|
} else {
|
||||||
mMessageOverlay.setVisibility(View.VISIBLE);
|
mOverlayText.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
mOverlayText.setText(text);
|
mOverlayText.setText(text);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user