I am trying to get an video to play as background. But I can only get it to take half of the screen. So, I need the video to stretch to 16:9 and turn it 90 degrees to make it fullscreen.
Im working within an test project right now.
MainActivity
public class MainActivity extends AppCompatActivity implements GestureOverlayView.OnGesturePerformedListener{
GestureLibrary gestureLib;
VideoView vvRick;
private Button btnTest;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gestureLib = GestureLibraries.fromRawResource(this, R.raw.gestures);
if (!gestureLib.load()) {
finish();
}
GestureOverlayView gOverlay =
(GestureOverlayView) findViewById(R.id.gOverlay);
gOverlay.addOnGesturePerformedListener(this);
vvRick = (VideoView)findViewById(R.id.vvRick);
btnTest = (Button)findViewById(R.id.btnTest);
btnTest.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "Workss!!",
Toast.LENGTH_LONG).show();
}
});
}
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
ArrayList<Prediction> predictions = gestureLib.recognize(gesture);
if (predictions.size() > 0 && predictions.get(0).score > 3.0) {
String result = predictions.get(0).name;
if ("turn".equalsIgnoreCase(result)) {
Toast.makeText(this, "Reverse", Toast.LENGTH_LONG).show();
} else if ("easteregg".equalsIgnoreCase(result)) {
Toast.makeText(this, "EasterEgg", Toast.LENGTH_LONG).show();
vvRick.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.rickroll));
vvRick.start();
} else{
Toast.makeText(this, "FOUT", Toast.LENGTH_LONG).show();
}
}
}
}
Layout File
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/rlMain">
<VideoView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/vvRick"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:background="@android:color/transparent" />
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button Test"
android:id="@+id/btnTest"
android:layout_gravity="center" />
</FrameLayout>
<android.gesture.GestureOverlayView
android:layout_width="fill_parent"
android:layout_height="200dp"
android:id="@+id/gOverlay"
android:minHeight="200dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="@android:color/transparent"></android.gesture.GestureOverlayView>