summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/com/lonkaars/bingo3/OrientationActivity.java6
-rw-r--r--app/src/main/java/com/lonkaars/bingo3/PortraitFragment.java15
-rw-r--r--app/src/main/res/layout-land/portrait_fragment.xml (renamed from app/src/main/res/layout-land/orientation_demo.xml)2
-rw-r--r--app/src/main/res/layout/orientation_demo.xml17
-rw-r--r--app/src/main/res/layout/portrait_fragment.xml24
5 files changed, 51 insertions, 13 deletions
diff --git a/app/src/main/java/com/lonkaars/bingo3/OrientationActivity.java b/app/src/main/java/com/lonkaars/bingo3/OrientationActivity.java
index 960af18..114f66e 100644
--- a/app/src/main/java/com/lonkaars/bingo3/OrientationActivity.java
+++ b/app/src/main/java/com/lonkaars/bingo3/OrientationActivity.java
@@ -5,9 +5,15 @@ import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class OrientationActivity extends AppCompatActivity {
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.orientation_demo);
+
+ PortraitFragment f = new PortraitFragment();
+ getSupportFragmentManager().beginTransaction()
+ .replace(R.id.fragment_container, f)
+ .commit();
}
} \ No newline at end of file
diff --git a/app/src/main/java/com/lonkaars/bingo3/PortraitFragment.java b/app/src/main/java/com/lonkaars/bingo3/PortraitFragment.java
new file mode 100644
index 0000000..6420883
--- /dev/null
+++ b/app/src/main/java/com/lonkaars/bingo3/PortraitFragment.java
@@ -0,0 +1,15 @@
+package com.lonkaars.bingo3;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import androidx.fragment.app.Fragment;
+
+public class PortraitFragment extends Fragment {
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.portrait_fragment, container, false);
+ }
+}
+
diff --git a/app/src/main/res/layout-land/orientation_demo.xml b/app/src/main/res/layout-land/portrait_fragment.xml
index 65dec93..c4d0730 100644
--- a/app/src/main/res/layout-land/orientation_demo.xml
+++ b/app/src/main/res/layout-land/portrait_fragment.xml
@@ -20,4 +20,4 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
-</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/app/src/main/res/layout/orientation_demo.xml b/app/src/main/res/layout/orientation_demo.xml
index 2b178d3..c013ebf 100644
--- a/app/src/main/res/layout/orientation_demo.xml
+++ b/app/src/main/res/layout/orientation_demo.xml
@@ -5,20 +5,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
- <TextView
- android:id="@+id/textView"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:rotation="45"
- android:rotationX="54"
- android:rotationY="-2"
- android:scaleX="7"
- android:scaleY="6"
- android:text="portrait"
- android:translationX="-30dp"
- android:translationY="-50dp"
+ <androidx.fragment.app.FragmentContainerView
+ android:id="@+id/fragment_container"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
+
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/portrait_fragment.xml b/app/src/main/res/layout/portrait_fragment.xml
new file mode 100644
index 0000000..2b178d3
--- /dev/null
+++ b/app/src/main/res/layout/portrait_fragment.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ android:id="@+id/textView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:rotation="45"
+ android:rotationX="54"
+ android:rotationY="-2"
+ android:scaleX="7"
+ android:scaleY="6"
+ android:text="portrait"
+ android:translationX="-30dp"
+ android:translationY="-50dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file