Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Samsung Dex #306

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Houseclub/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-configuration android:reqTouchScreen="finger" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />

<application
android:allowBackup="true"
Expand All @@ -18,8 +20,10 @@
android:name=".App"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:usesCleartextTraffic="true">
<activity android:name=".MainActivity" android:configChanges="screenSize|orientation" android:launchMode="singleTask">
android:usesCleartextTraffic="true"
android:resizeableActivity="true">
<activity android:name=".MainActivity" android:launchMode="singleTask" android:resizeableActivity="true"
android:configChanges="colorMode|orientation|screenLayout|screenSize|smallestScreenSize|keyboardHidden|keyboard">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
22 changes: 22 additions & 0 deletions Houseclub/src/main/java/me/grishka/houseclub/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions Houseclub/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="reference_width">320dp</dimen>
<dimen name="reference_height">480dp</dimen>
</resources>