From 7c80b7f0aa562aa672323d08180c8ca4cfa91b00 Mon Sep 17 00:00:00 2001 From: q8hk Date: Sun, 28 Mar 2021 21:08:43 +0300 Subject: [PATCH] Added Samsung Dex support. --- .idea/codeStyles/Project.xml | 116 ++++++++++++++++++ .idea/gradle.xml | 1 - .idea/misc.xml | 2 +- Houseclub/src/main/AndroidManifest.xml | 8 +- .../me/grishka/houseclub/MainActivity.java | 22 ++++ Houseclub/src/main/res/values/dimens.xml | 5 + 6 files changed, 150 insertions(+), 4 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 Houseclub/src/main/res/values/dimens.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..681f41ae --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index aaaa621c..f008200e 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -15,7 +15,6 @@ diff --git a/.idea/misc.xml b/.idea/misc.xml index c4e42dc4..794aa67e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/Houseclub/src/main/AndroidManifest.xml b/Houseclub/src/main/AndroidManifest.xml index 890f7467..3b4283a2 100644 --- a/Houseclub/src/main/AndroidManifest.xml +++ b/Houseclub/src/main/AndroidManifest.xml @@ -10,6 +10,8 @@ + + - + android:usesCleartextTraffic="true" + android:resizeableActivity="true"> + diff --git a/Houseclub/src/main/java/me/grishka/houseclub/MainActivity.java b/Houseclub/src/main/java/me/grishka/houseclub/MainActivity.java index f54d8c1c..5a8c8a1a 100644 --- a/Houseclub/src/main/java/me/grishka/houseclub/MainActivity.java +++ b/Houseclub/src/main/java/me/grishka/houseclub/MainActivity.java @@ -7,9 +7,12 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.content.res.Configuration; +import android.content.res.Resources; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.view.WindowManager; import android.widget.Toast; import java.util.Date; @@ -38,6 +41,25 @@ public class MainActivity extends FragmentStackActivity{ private Channel channelToJoin; private static final int PERMISSION_RESULT=270; + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + updateWindowSize(); + } + + public void updateWindowSize() { + Resources resources = getResources(); + // set the window to a known size so that we don't have issues with different + // screen sizes + int referenceWidthDp = resources.getDimensionPixelSize(R.dimen.reference_width); + int referenceHeightDp = resources.getDimensionPixelSize(R.dimen.reference_height); + WindowManager.LayoutParams attrs = getWindow().getAttributes(); + // set layout when the orientation has changed + if (attrs.width != referenceWidthDp || attrs.height != referenceHeightDp) { + getWindow().setLayout(referenceWidthDp, referenceHeightDp); + } + } + @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); diff --git a/Houseclub/src/main/res/values/dimens.xml b/Houseclub/src/main/res/values/dimens.xml new file mode 100644 index 00000000..639ca36c --- /dev/null +++ b/Houseclub/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 320dp + 480dp + \ No newline at end of file