From 95d994f997e8fd6be24e3c536912f6bddc35cc55 Mon Sep 17 00:00:00 2001 From: tobexyz <40026159+tobexyz@users.noreply.github.com> Date: Thu, 21 Sep 2023 22:02:30 +0200 Subject: [PATCH 1/3] issue #82 populate content list on ui thread --- .../de/yaacc/browser/ContentListFragment.java | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/yaacc/src/main/java/de/yaacc/browser/ContentListFragment.java b/yaacc/src/main/java/de/yaacc/browser/ContentListFragment.java index 9cec3162..4d49c0ad 100644 --- a/yaacc/src/main/java/de/yaacc/browser/ContentListFragment.java +++ b/yaacc/src/main/java/de/yaacc/browser/ContentListFragment.java @@ -98,29 +98,30 @@ private void init(Bundle savedInstanceState, View contentlistView) { contentList = contentlistView.findViewById(R.id.contentList); contentList.setLayoutManager(new LinearLayoutManager(getActivity())); upnpClient.addUpnpClientListener(this); - Thread thread = new Thread(() -> { - if (upnpClient.getReceiverDevices() != null) { - currentReceivers.setText(upnpClient.getReceiverDevices().stream().map(it -> it.getDetails().getFriendlyName()).collect(Collectors.joining("; "))); - } - if (upnpClient.getProviderDevice() != null) { - currentProvider.setText(upnpClient.getProviderDevice().getDetails().getFriendlyName()); - if (savedInstanceState == null || savedInstanceState.getSerializable(CONTENT_LIST_NAVIGATOR) == null) { - showMainFolder(); - } else { - navigator = (Navigator) savedInstanceState.getSerializable(CONTENT_LIST_NAVIGATOR); - if (navigator.getCurrentPosition() != null && upnpClient.getProviderDevice() != null && upnpClient.getProviderDevice().getIdentity().getUdn().getIdentifierString().equals(navigator.getCurrentPosition().getDeviceId())) { - populateItemList(true); - } else { + if (getActivity() != null) { + getActivity().runOnUiThread(() -> { + + if (upnpClient.getReceiverDevices() != null) { + currentReceivers.setText(upnpClient.getReceiverDevices().stream().map(it -> it.getDetails().getFriendlyName()).collect(Collectors.joining("; "))); + } + if (upnpClient.getProviderDevice() != null) { + currentProvider.setText(upnpClient.getProviderDevice().getDetails().getFriendlyName()); + if (savedInstanceState == null || savedInstanceState.getSerializable(CONTENT_LIST_NAVIGATOR) == null) { showMainFolder(); + } else { + navigator = (Navigator) savedInstanceState.getSerializable(CONTENT_LIST_NAVIGATOR); + if (navigator.getCurrentPosition() != null && upnpClient.getProviderDevice() != null && upnpClient.getProviderDevice().getIdentity().getUdn().getIdentifierString().equals(navigator.getCurrentPosition().getDeviceId())) { + populateItemList(true); + } else { + showMainFolder(); + } } - + } else { + clearItemList(); } - } else { - - clearItemList(); - } - }); - thread.start(); + }); + } + ; } From aca8e1fff0d54ab7798c291662c6318869d07198 Mon Sep 17 00:00:00 2001 From: tobexyz <40026159+tobexyz@users.noreply.github.com> Date: Sun, 8 Oct 2023 21:31:36 +0200 Subject: [PATCH 2/3] updated gradle --- gradle.properties | 3 +++ gradle/wrapper/gradle-wrapper.properties | 2 +- yaacc/build.gradle | 3 ++- yaacc/src/main/AndroidManifest.xml | 1 - 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 7c5436e3..b5ba2bd6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,3 +14,6 @@ org.gradle.jvmargs=-Xmx2048M android.enableJetifier=true android.useAndroidX=true +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1c4ba47d..73df0514 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip diff --git a/yaacc/build.gradle b/yaacc/build.gradle index 7ade2d07..20d28722 100644 --- a/yaacc/build.gradle +++ b/yaacc/build.gradle @@ -1,7 +1,7 @@ buildscript { dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' + classpath 'com.android.tools.build:gradle:8.1.2' } } @@ -72,5 +72,6 @@ android { testOptions { unitTests.returnDefaultValues = true } + namespace 'de.yaacc' } diff --git a/yaacc/src/main/AndroidManifest.xml b/yaacc/src/main/AndroidManifest.xml index e340f844..88e8acfa 100644 --- a/yaacc/src/main/AndroidManifest.xml +++ b/yaacc/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ From 8d3924fceae9a0cfdff438bc9fea616c7936d5f3 Mon Sep 17 00:00:00 2001 From: tobexyz <40026159+tobexyz@users.noreply.github.com> Date: Sun, 8 Oct 2023 21:32:58 +0200 Subject: [PATCH 3/3] issue #82 open player tab on share --- yaacc/src/main/java/de/yaacc/browser/TabBrowserActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/yaacc/src/main/java/de/yaacc/browser/TabBrowserActivity.java b/yaacc/src/main/java/de/yaacc/browser/TabBrowserActivity.java index 8c786294..3e0c6b4c 100644 --- a/yaacc/src/main/java/de/yaacc/browser/TabBrowserActivity.java +++ b/yaacc/src/main/java/de/yaacc/browser/TabBrowserActivity.java @@ -225,6 +225,7 @@ private void checkIfReceivedShareIntent(Intent receivedIntent) { player.play(); } } + setCurrentTab(BrowserTabs.PLAYER); } }