UI changes for smaller devices and GTV. Fix for defect 4616102.
Change-Id: I2fc37199eedfd779494cf9e5c87f53fb1081c1eb
This commit is contained in:
@@ -14,6 +14,7 @@ import android.widget.MediaController;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Button;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.content.Context;
|
||||
@@ -23,6 +24,7 @@ import android.media.MediaPlayer.OnErrorListener;
|
||||
import android.media.MediaPlayer.OnCompletionListener;
|
||||
|
||||
public class VideoPlayerView extends Activity {
|
||||
private final static float BUTTON_FONT_SIZE = 10;
|
||||
private final static String EXIT_FULLSCREEN = "Exit Full Screen";
|
||||
private final static String FULLSCREEN = "Enter Full Screen";
|
||||
private final static String PLAY = "Play";
|
||||
@@ -42,9 +44,13 @@ public class VideoPlayerView extends Activity {
|
||||
private LinearLayout main;
|
||||
private LinearLayout sidePanel;
|
||||
private boolean enteringFullScreen;
|
||||
private int width, height;
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Display display = getWindowManager().getDefaultDisplay();
|
||||
height = display.getHeight();
|
||||
width = display.getWidth();
|
||||
context = this;
|
||||
contentView = createView();
|
||||
setContentView(contentView);
|
||||
@@ -106,7 +112,7 @@ public class VideoPlayerView extends Activity {
|
||||
|
||||
sidePanel = new LinearLayout(this);
|
||||
sidePanel.setOrientation(LinearLayout.VERTICAL);
|
||||
sidePanel.addView(scrollView, new LinearLayout.LayoutParams(300, 450));
|
||||
sidePanel.addView(scrollView, new LinearLayout.LayoutParams((int)(width * 0.35), (int)(height * 0.5)));
|
||||
|
||||
LinearLayout.LayoutParams paramsSidePanel = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
@@ -165,7 +171,7 @@ public class VideoPlayerView extends Activity {
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT));
|
||||
|
||||
main = new LinearLayout(this);
|
||||
main.addView(playerFrame, new LinearLayout.LayoutParams(900,
|
||||
main.addView(playerFrame, new LinearLayout.LayoutParams((int)(width * 0.65),
|
||||
LinearLayout.LayoutParams.FILL_PARENT, 1));
|
||||
main.addView(sidePanel, new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
@@ -242,6 +248,7 @@ public class VideoPlayerView extends Activity {
|
||||
private View createButtons() {
|
||||
playButton = new Button(this);
|
||||
playButton.setText(R.string.play);
|
||||
playButton.setTextSize(BUTTON_FONT_SIZE);
|
||||
|
||||
playButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
@@ -256,6 +263,7 @@ public class VideoPlayerView extends Activity {
|
||||
|
||||
Button rightsButton = new Button(this);
|
||||
rightsButton.setText(R.string.acquire_rights);
|
||||
rightsButton.setTextSize(BUTTON_FONT_SIZE);
|
||||
|
||||
rightsButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
@@ -266,6 +274,7 @@ public class VideoPlayerView extends Activity {
|
||||
|
||||
Button removeButton = new Button(this);
|
||||
removeButton.setText(R.string.remove_rights);
|
||||
removeButton.setTextSize(BUTTON_FONT_SIZE);
|
||||
|
||||
removeButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
@@ -276,6 +285,7 @@ public class VideoPlayerView extends Activity {
|
||||
|
||||
Button checkButton = new Button(this);
|
||||
checkButton.setText(R.string.show_rights);
|
||||
checkButton.setTextSize(BUTTON_FONT_SIZE);
|
||||
|
||||
checkButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
@@ -286,6 +296,7 @@ public class VideoPlayerView extends Activity {
|
||||
|
||||
Button checkConstraints = new Button(this);
|
||||
checkConstraints.setText(R.string.constraints);
|
||||
checkConstraints.setTextSize(BUTTON_FONT_SIZE);
|
||||
|
||||
checkConstraints.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
@@ -297,7 +308,8 @@ public class VideoPlayerView extends Activity {
|
||||
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.FILL_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT, 1);
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT, 1);
|
||||
|
||||
params.setMargins(0, 0, 0, 5);
|
||||
LinearLayout buttonsLeft = new LinearLayout(this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user