From d9aaaa6760d21141e69e3fd4d0452d6dac6f4b44 Mon Sep 17 00:00:00 2001 From: tobexyz <40026159+tobexyz@users.noreply.github.com> Date: Thu, 12 Jan 2023 23:15:42 +0100 Subject: [PATCH 1/2] migrate to AppCompat and issue #45 chunk size now configurable in settings --- yaacc/build.gradle | 1 + .../de/yaacc/browser/BrowseItemAdapter.java | 4 +- .../player/AVTransportPlayerActivity.java | 5 +- .../player/MultiContentPlayerActivity.java | 5 +- .../de/yaacc/player/MusicPlayerActivity.java | 5 +- .../ThirdPartieMusicPlayerActivity.java | 5 +- .../de/yaacc/settings/SettingsActivity.java | 8 +- .../de/yaacc/settings/SettingsFragment.java | 33 +++- .../YaaccUpnpServerControlActivity.java | 5 +- .../java/de/yaacc/util/AboutActivity.java | 7 +- .../java/de/yaacc/util/YaaccLogActivity.java | 7 +- .../fourthline/cling/model/meta/Service.java | 20 +-- .../layout/activity_avtransport_player.xml | 138 ++++++++------- yaacc/src/main/res/layout/activity_browse.xml | 19 +-- .../main/res/layout/activity_image_viewer.xml | 20 +-- .../layout/activity_multi_content_player.xml | 159 +++++++++--------- .../main/res/layout/activity_music_player.xml | 124 +++++++------- .../activity_third_partie_music_player.xml | 159 +++++++++--------- yaacc/src/main/res/values-de/strings.xml | 6 +- yaacc/src/main/res/values/strings.xml | 3 + yaacc/src/main/res/values/styles.xml | 9 +- yaacc/src/main/res/xml/preference.xml | 151 +++++++++-------- 22 files changed, 462 insertions(+), 431 deletions(-) diff --git a/yaacc/build.gradle b/yaacc/build.gradle index a104fa24..b4a150db 100644 --- a/yaacc/build.gradle +++ b/yaacc/build.gradle @@ -22,6 +22,7 @@ dependencies { implementation 'org.apache.httpcomponents.core5:httpcore5:5.2' implementation 'org.slf4j:slf4j-simple:2.0.6' implementation 'androidx.appcompat:appcompat:1.5.1' + implementation 'androidx.preference:preference:1.1.0' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1' //https://developer.android.com/jetpack/androidx/migrate/artifact-mappings diff --git a/yaacc/src/main/java/de/yaacc/browser/BrowseItemAdapter.java b/yaacc/src/main/java/de/yaacc/browser/BrowseItemAdapter.java index 9f96a2cf..ff506ef8 100644 --- a/yaacc/src/main/java/de/yaacc/browser/BrowseItemAdapter.java +++ b/yaacc/src/main/java/de/yaacc/browser/BrowseItemAdapter.java @@ -58,7 +58,7 @@ */ public class BrowseItemAdapter extends BaseAdapter implements AbsListView.OnScrollListener { public static final Item LOAD_MORE_FAKE_ITEM = new Item("LoadMoreFakeItem", (String) null, "...", "", (DIDLObject.Class) null); - private static final long CHUNK_SIZE = 10; + private static final Item LOADING_FAKE_ITEM = new Item("LoadingFakeItem", (String) null, "Loading...", "", (DIDLObject.Class) null); private boolean loading = false; @@ -287,7 +287,7 @@ public void loadMore() { Log.d(getClass().getName(), "loadMore from: " + from); - BrowseItemLoadTask browseItemLoadTask = new BrowseItemLoadTask(this, CHUNK_SIZE); + BrowseItemLoadTask browseItemLoadTask = new BrowseItemLoadTask(this, Long.parseLong(PreferenceManager.getDefaultSharedPreferences(getContext()).getString(getContext().getString(R.string.settings_browse_chunk_size_key), "10"))); asyncTasks.add(browseItemLoadTask); browseItemLoadTask.executeOnExecutor(((Yaacc) getContext().getApplicationContext()).getContentLoadExecutor(), from); diff --git a/yaacc/src/main/java/de/yaacc/player/AVTransportPlayerActivity.java b/yaacc/src/main/java/de/yaacc/player/AVTransportPlayerActivity.java index 3db8c9e5..735985ab 100644 --- a/yaacc/src/main/java/de/yaacc/player/AVTransportPlayerActivity.java +++ b/yaacc/src/main/java/de/yaacc/player/AVTransportPlayerActivity.java @@ -17,7 +17,6 @@ */ package de.yaacc.player; -import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -36,6 +35,8 @@ import android.widget.Switch; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; + import org.fourthline.cling.model.meta.Device; import java.net.URI; @@ -59,7 +60,7 @@ * * @author Tobias Schoene (openbit) */ -public class AVTransportPlayerActivity extends Activity implements ServiceConnection { +public class AVTransportPlayerActivity extends AppCompatActivity implements ServiceConnection { protected boolean updateTime = false; protected SeekBar seekBar = null; diff --git a/yaacc/src/main/java/de/yaacc/player/MultiContentPlayerActivity.java b/yaacc/src/main/java/de/yaacc/player/MultiContentPlayerActivity.java index f382d064..1cec5027 100644 --- a/yaacc/src/main/java/de/yaacc/player/MultiContentPlayerActivity.java +++ b/yaacc/src/main/java/de/yaacc/player/MultiContentPlayerActivity.java @@ -17,7 +17,6 @@ */ package de.yaacc.player; -import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -29,6 +28,8 @@ import android.view.MenuItem; import android.widget.ImageButton; +import androidx.appcompat.app.AppCompatActivity; + import de.yaacc.R; import de.yaacc.settings.SettingsActivity; import de.yaacc.util.AboutActivity; @@ -39,7 +40,7 @@ * * @author Tobias Schoene (openbit) */ -public class MultiContentPlayerActivity extends Activity implements ServiceConnection { +public class MultiContentPlayerActivity extends AppCompatActivity implements ServiceConnection { private PlayerService playerService; diff --git a/yaacc/src/main/java/de/yaacc/player/MusicPlayerActivity.java b/yaacc/src/main/java/de/yaacc/player/MusicPlayerActivity.java index 202a74c3..8a1f10a9 100644 --- a/yaacc/src/main/java/de/yaacc/player/MusicPlayerActivity.java +++ b/yaacc/src/main/java/de/yaacc/player/MusicPlayerActivity.java @@ -17,7 +17,6 @@ */ package de.yaacc.player; -import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -33,6 +32,8 @@ import android.widget.SeekBar; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; + import java.net.URI; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -53,7 +54,7 @@ * * @author Tobias Schoene (openbit) */ -public class MusicPlayerActivity extends Activity implements ServiceConnection { +public class MusicPlayerActivity extends AppCompatActivity implements ServiceConnection { protected boolean updateTime = false; protected SeekBar seekBar = null; diff --git a/yaacc/src/main/java/de/yaacc/player/ThirdPartieMusicPlayerActivity.java b/yaacc/src/main/java/de/yaacc/player/ThirdPartieMusicPlayerActivity.java index 6cf3ec87..c763ab23 100644 --- a/yaacc/src/main/java/de/yaacc/player/ThirdPartieMusicPlayerActivity.java +++ b/yaacc/src/main/java/de/yaacc/player/ThirdPartieMusicPlayerActivity.java @@ -17,7 +17,6 @@ */ package de.yaacc.player; -import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -29,6 +28,8 @@ import android.view.MenuItem; import android.widget.ImageButton; +import androidx.appcompat.app.AppCompatActivity; + import de.yaacc.R; import de.yaacc.settings.SettingsActivity; import de.yaacc.util.AboutActivity; @@ -39,7 +40,7 @@ * * @author Tobias Schoene (openbit) */ -public class ThirdPartieMusicPlayerActivity extends Activity implements ServiceConnection { +public class ThirdPartieMusicPlayerActivity extends AppCompatActivity implements ServiceConnection { private PlayerService playerService; diff --git a/yaacc/src/main/java/de/yaacc/settings/SettingsActivity.java b/yaacc/src/main/java/de/yaacc/settings/SettingsActivity.java index a9b42e8e..b5970b28 100644 --- a/yaacc/src/main/java/de/yaacc/settings/SettingsActivity.java +++ b/yaacc/src/main/java/de/yaacc/settings/SettingsActivity.java @@ -17,23 +17,23 @@ */ package de.yaacc.settings; -import android.app.Activity; import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; + import de.yaacc.browser.TabBrowserActivity; /** * @author Christoph Hähnel (eyeless) */ -public class SettingsActivity extends Activity { +public class SettingsActivity extends AppCompatActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getFragmentManager().beginTransaction() + getSupportFragmentManager().beginTransaction() .replace(android.R.id.content, new SettingsFragment()).commit(); - } @Override diff --git a/yaacc/src/main/java/de/yaacc/settings/SettingsFragment.java b/yaacc/src/main/java/de/yaacc/settings/SettingsFragment.java index d847e735..7e35b152 100644 --- a/yaacc/src/main/java/de/yaacc/settings/SettingsFragment.java +++ b/yaacc/src/main/java/de/yaacc/settings/SettingsFragment.java @@ -18,9 +18,12 @@ package de.yaacc.settings; import android.os.Bundle; -import android.preference.ListPreference; -import android.preference.MultiSelectListPreference; -import android.preference.PreferenceFragment; +import android.text.InputType; + +import androidx.preference.EditTextPreference; +import androidx.preference.ListPreference; +import androidx.preference.MultiSelectListPreference; +import androidx.preference.PreferenceFragmentCompat; import org.fourthline.cling.model.meta.Device; @@ -35,13 +38,25 @@ /** * @author Christoph Hähnel (eyeless) */ -public class SettingsFragment extends PreferenceFragment implements UpnpClientListener { +public class SettingsFragment extends PreferenceFragmentCompat implements UpnpClientListener { @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.preference); - + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + setPreferencesFromResource(R.xml.preference, rootKey); + EditTextPreference numberPreference = findPreference(getString(R.string.settings_device_playback_offset_key)); + if (numberPreference != null) { + numberPreference.setOnBindEditTextListener( + editText -> editText.setInputType(InputType.TYPE_CLASS_NUMBER)); + } + numberPreference = findPreference(getString(R.string.settings_browse_load_threads_key)); + if (numberPreference != null) { + numberPreference.setOnBindEditTextListener( + editText -> editText.setInputType(InputType.TYPE_CLASS_NUMBER)); + } + numberPreference = findPreference(getString(R.string.settings_browse_chunk_size_key)); + if (numberPreference != null) { + numberPreference.setOnBindEditTextListener( + editText -> editText.setInputType(InputType.TYPE_CLASS_NUMBER)); + } populateDeviceLists(); ((Yaacc) getActivity().getApplicationContext()).getUpnpClient().addUpnpClientListener(this); diff --git a/yaacc/src/main/java/de/yaacc/upnp/server/YaaccUpnpServerControlActivity.java b/yaacc/src/main/java/de/yaacc/upnp/server/YaaccUpnpServerControlActivity.java index 74c7253c..760fc9ac 100644 --- a/yaacc/src/main/java/de/yaacc/upnp/server/YaaccUpnpServerControlActivity.java +++ b/yaacc/src/main/java/de/yaacc/upnp/server/YaaccUpnpServerControlActivity.java @@ -17,7 +17,6 @@ */ package de.yaacc.upnp.server; -import android.app.Activity; import android.app.NotificationManager; import android.content.Context; import android.content.Intent; @@ -30,6 +29,8 @@ import android.widget.Button; import android.widget.CheckBox; +import androidx.appcompat.app.AppCompatActivity; + import de.yaacc.R; import de.yaacc.settings.SettingsActivity; import de.yaacc.util.AboutActivity; @@ -40,7 +41,7 @@ * * @author Tobias Schoene (openbit) */ -public class YaaccUpnpServerControlActivity extends Activity { +public class YaaccUpnpServerControlActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/yaacc/src/main/java/de/yaacc/util/AboutActivity.java b/yaacc/src/main/java/de/yaacc/util/AboutActivity.java index 4cfe7641..69a5915f 100644 --- a/yaacc/src/main/java/de/yaacc/util/AboutActivity.java +++ b/yaacc/src/main/java/de/yaacc/util/AboutActivity.java @@ -18,13 +18,14 @@ */ package de.yaacc.util; -import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; import android.util.Log; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; + import de.yaacc.R; /** @@ -32,8 +33,8 @@ * * @author Tobias Schoene (openbit) */ -public class AboutActivity extends Activity { - public static void showAbout(Activity activity) { +public class AboutActivity extends AppCompatActivity { + public static void showAbout(AppCompatActivity activity) { activity.startActivity(new Intent(activity, AboutActivity.class)); } diff --git a/yaacc/src/main/java/de/yaacc/util/YaaccLogActivity.java b/yaacc/src/main/java/de/yaacc/util/YaaccLogActivity.java index 7e013811..c66be4a1 100644 --- a/yaacc/src/main/java/de/yaacc/util/YaaccLogActivity.java +++ b/yaacc/src/main/java/de/yaacc/util/YaaccLogActivity.java @@ -18,19 +18,20 @@ */ package de.yaacc.util; -import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import de.yaacc.R; -public class YaaccLogActivity extends Activity { - public static void showLog(Activity activity) { +public class YaaccLogActivity extends AppCompatActivity { + public static void showLog(AppCompatActivity activity) { activity.startActivity(new Intent(activity, YaaccLogActivity.class)); } diff --git a/yaacc/src/main/java/org/fourthline/cling/model/meta/Service.java b/yaacc/src/main/java/org/fourthline/cling/model/meta/Service.java index cc3aae84..e25f3717 100644 --- a/yaacc/src/main/java/org/fourthline/cling/model/meta/Service.java +++ b/yaacc/src/main/java/org/fourthline/cling/model/meta/Service.java @@ -15,12 +15,6 @@ package org.fourthline.cling.model.meta; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - import org.fourthline.cling.model.ServiceReference; import org.fourthline.cling.model.ValidationError; import org.fourthline.cling.model.ValidationException; @@ -28,6 +22,12 @@ import org.fourthline.cling.model.types.ServiceId; import org.fourthline.cling.model.types.ServiceType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + /** * The metadata of a service, with actions and state variables. * @@ -35,7 +35,7 @@ */ public abstract class Service { - final private static Logger log = Logger.getLogger(Service.class.getName()); + final private static Logger log = Logger.getLogger(Service.class.getName()); final private ServiceType serviceType; final private ServiceId serviceId; @@ -103,7 +103,7 @@ public D getDevice() { } void setDevice(D device) { - if (this.device != null) + if (this.device != null && !this.device.equals(device)) throw new IllegalStateException("Final value has been set already, model is immutable"); this.device = device; } @@ -186,13 +186,13 @@ public List validate() { // errors.addAll(action.validate()); List actionErrors = action.validate(); - if(actionErrors.size() > 0) { + if (actionErrors.size() > 0) { actions.remove(action.getName()); // Remove it log.warning("Discarding invalid action of service '" + getServiceId() + "': " + action.getName()); for (ValidationError actionError : actionErrors) { log.warning("Invalid action '" + action.getName() + "': " + actionError); } - } + } } } diff --git a/yaacc/src/main/res/layout/activity_avtransport_player.xml b/yaacc/src/main/res/layout/activity_avtransport_player.xml index 7a7dc0d8..d629d7bf 100644 --- a/yaacc/src/main/res/layout/activity_avtransport_player.xml +++ b/yaacc/src/main/res/layout/activity_avtransport_player.xml @@ -1,5 +1,4 @@ - - - + tools:context=".player.AVTransportPlayerActivity"> + + android:text="@string/activity_remote_player_volume" + android:textAppearance="?android:attr/textAppearanceMedium" /> + android:layout_toEndOf="@+id/avtransportPlayerActivityControlVolumeTextView" + android:layout_toRightOf="@+id/avtransportPlayerActivityControlVolumeTextView" /> + app:srcCompat="@drawable/device" /> + android:layout_height="wrap_content" + android:layout_alignBaseline="@+id/avtransportPlayerActivityCurrentItem" + android:layout_toEndOf="@+id/avtransportPlayerActivityCurrentItem" + android:layout_toRightOf="@+id/avtransportPlayerActivityCurrentItem" /> + android:text="@string/avtransportPlayerActivityNextLabel" /> + android:text="@string/playerNextItem" /> + android:layout_alignParentLeft="true" + android:text="@string/playerTimeElapsed" /> + android:layout_alignBaseline="@+id/avtransportPlayerActivityElapsedTime" + android:layout_toEndOf="@id/avtransportPlayerActivityElapsedTime" + android:layout_toRightOf="@id/avtransportPlayerActivityElapsedTime" + android:text="@string/playerTimeSeparator" /> + android:layout_alignBaseline="@+id/avtransportPlayerActivityElapsedTime" + android:layout_toEndOf="@id/avtransportPlayerActivitySeparator" + android:layout_toRightOf="@id/avtransportPlayerActivitySeparator" + android:text="@string/playerTimeDuration" /> + android:layout_alignBaseline="@+id/avtransportPlayerActivityElapsedTime" + android:layout_toEndOf="@id/avtransportPlayerActivityDuration" + android:layout_toRightOf="@id/avtransportPlayerActivityDuration" /> + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_toEndOf="@+id/avtransportPlayerActivitySeparator2" + android:layout_toRightOf="@+id/avtransportPlayerActivitySeparator2" + android:gravity="end" + android:text="@string/playerPosition" + android:textAlignment="textEnd" /> - + android:layout_alignParentLeft="true" + android:orientation="horizontal"> + + + + android:layout_alignParentBottom="true" + android:orientation="horizontal"> + app:srcCompat="@drawable/player_start" /> + app:srcCompat="@drawable/player_play" /> + app:srcCompat="@drawable/player_pause" /> + app:srcCompat="@drawable/player_stop" /> + app:srcCompat="@drawable/player_end" /> + + app:srcCompat="@drawable/button_cancel" /> \ No newline at end of file diff --git a/yaacc/src/main/res/layout/activity_browse.xml b/yaacc/src/main/res/layout/activity_browse.xml index 1b40dcd0..43eaf85b 100644 --- a/yaacc/src/main/res/layout/activity_browse.xml +++ b/yaacc/src/main/res/layout/activity_browse.xml @@ -1,5 +1,4 @@ - - + android:layout_height="fill_parent"> + android:orientation="horizontal"> + app:srcCompat="@drawable/device_48_48" /> + app:srcCompat="@drawable/player_play" /> + app:srcCompat="@drawable/player_stop" /> + app:srcCompat="@drawable/refresh" /> + app:srcCompat="@drawable/laptop_48_48" /> diff --git a/yaacc/src/main/res/layout/activity_image_viewer.xml b/yaacc/src/main/res/layout/activity_image_viewer.xml index afc62c6f..99c17a61 100644 --- a/yaacc/src/main/res/layout/activity_image_viewer.xml +++ b/yaacc/src/main/res/layout/activity_image_viewer.xml @@ -1,5 +1,4 @@ - - + android:layout_height="match_parent"> - + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_alignParentBottom="true" + android:contentDescription="@string/images" + app:srcCompat="@drawable/yaacc192_32" /> \ No newline at end of file diff --git a/yaacc/src/main/res/layout/activity_multi_content_player.xml b/yaacc/src/main/res/layout/activity_multi_content_player.xml index 332aa467..afdac149 100644 --- a/yaacc/src/main/res/layout/activity_multi_content_player.xml +++ b/yaacc/src/main/res/layout/activity_multi_content_player.xml @@ -1,5 +1,4 @@ - - + tools:context=".player.MultiContentPlayerActivity"> - + - + - + - + - + - - - + - + + + + \ No newline at end of file diff --git a/yaacc/src/main/res/layout/activity_music_player.xml b/yaacc/src/main/res/layout/activity_music_player.xml index 0d0b12d0..9e567dfd 100644 --- a/yaacc/src/main/res/layout/activity_music_player.xml +++ b/yaacc/src/main/res/layout/activity_music_player.xml @@ -1,5 +1,4 @@ - - + tools:context=".player.MusicPlayerActivity"> - - - + app:srcCompat="@drawable/cdtrack" /> + android:text="@string/playerCurrentItem" /> + android:layout_height="wrap_content" + android:layout_alignBaseline="@+id/musicActivityCurrentItem" + android:layout_toEndOf="@+id/musicActivityCurrentItem" + android:layout_toRightOf="@+id/musicActivityCurrentItem" /> + android:text="@string/musicActivityNextLabel" /> - - + android:text="@string/playerNextItem" /> + android:text="@string/playerTimeElapsed" /> + android:layout_alignBaseline="@+id/musicActivityElapsedTime" + android:layout_toEndOf="@id/musicActivityElapsedTime" + android:layout_toRightOf="@id/musicActivityElapsedTime" + android:text="@string/playerTimeSeparator" /> + android:layout_alignBaseline="@+id/musicActivityElapsedTime" + android:layout_toEndOf="@id/musicActivitySeparator" + android:layout_toRightOf="@id/musicActivitySeparator" + android:text="@string/playerTimeDuration" /> + + android:layout_alignBaseline="@+id/musicActivityElapsedTime" + android:layout_toEndOf="@id/musicActivityDuration" + android:layout_toRightOf="@id/musicActivityDuration" /> - + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_toEndOf="@+id/musicActivitySeparator2" + android:layout_toRightOf="@+id/musicActivitySeparator2" + android:gravity="end" + android:text="@string/playerPosition" + android:textAlignment="textEnd" /> - + android:layout_alignParentLeft="true" + android:orientation="horizontal"> + + + android:layout_alignParentBottom="true" + android:orientation="horizontal"> + app:srcCompat="@drawable/player_start" /> + app:srcCompat="@drawable/player_play" /> + app:srcCompat="@drawable/player_pause" /> + app:srcCompat="@drawable/player_stop" /> + app:srcCompat="@drawable/player_end" /> + + app:srcCompat="@drawable/button_cancel" /> diff --git a/yaacc/src/main/res/layout/activity_third_partie_music_player.xml b/yaacc/src/main/res/layout/activity_third_partie_music_player.xml index 25732176..79389130 100644 --- a/yaacc/src/main/res/layout/activity_third_partie_music_player.xml +++ b/yaacc/src/main/res/layout/activity_third_partie_music_player.xml @@ -1,5 +1,4 @@ - - + tools:context=".player.ThirdPartieMusicPlayerActivity"> - + - + - + - + - + - - - + - + + + + \ No newline at end of file diff --git a/yaacc/src/main/res/values-de/strings.xml b/yaacc/src/main/res/values-de/strings.xml index eee155ea..12abbc89 100644 --- a/yaacc/src/main/res/values-de/strings.xml +++ b/yaacc/src/main/res/values-de/strings.xml @@ -96,10 +96,14 @@ Icon not yet implemented Nächstes: - Control device + Gerät steuern Yaacc Yaacc notifications Images Music multi + Abfragegröße + browse_chunk_size_key + Anzahl der abzufragenden Einträge je Anfrage + diff --git a/yaacc/src/main/res/values/strings.xml b/yaacc/src/main/res/values/strings.xml index 8b11ca9a..be36c9ef 100644 --- a/yaacc/src/main/res/values/strings.xml +++ b/yaacc/src/main/res/values/strings.xml @@ -102,6 +102,9 @@ Images Music multi + chunk size when browsing + browse_chunk_size_key + amount of items fetched from server in one request \ No newline at end of file diff --git a/yaacc/src/main/res/values/styles.xml b/yaacc/src/main/res/values/styles.xml index 308823f9..2241bcb1 100644 --- a/yaacc/src/main/res/values/styles.xml +++ b/yaacc/src/main/res/values/styles.xml @@ -1,5 +1,4 @@ - - - diff --git a/yaacc/src/main/res/xml/preference.xml b/yaacc/src/main/res/xml/preference.xml index 7eb5c381..f4e0846e 100644 --- a/yaacc/src/main/res/xml/preference.xml +++ b/yaacc/src/main/res/xml/preference.xml @@ -1,5 +1,4 @@ - - - + - - - - - - - - + + + + + + android:key="@string/settings_thumbnails_chkbx" + android:summaryOff="@string/settings_browse_thumbnails_off" + android:summaryOn="@string/settings_browse_thumbnails_on" /> + android:dependency="@string/settings_thumbnails_chkbx" + android:key="@string/settings_browse_thumbnails_coverlookup_chkbx" + android:summaryOff="@string/settings_browse_thumbnails_coverlookup_off" + android:summaryOn="@string/settings_browse_thumbnails_coverlookup_on" /> - - + + + + android:entryValues="@array/duration_values_with_never" + android:key="@string/settings_default_duration_key" + android:title="@string/settings_default_duration" /> + android:entryValues="@array/duration_values" + android:key="@string/settings_silence_duration_key" + android:title="@string/settings_silence_duration" /> + android:summaryOn="@string/settings_replay_playlist_on" /> - - + android:summaryOn="@string/settings_music_player_shuffle_on" /> + + + android:summaryOn="@string/settings_local_server_started" /> + android:summaryOff="@string/settings_local_server_autostart_deactivated" + android:summaryOn="@string/settings_local_server_autostart_activated" /> + android:summaryOn="@string/settings_local_server_receiver_on" /> - + + android:summaryOn="@string/settings_local_server_testcontent" /> + android:summaryOn="@string/settings_local_server_serve_images_on" /> + android:summaryOn="@string/settings_local_server_serve_video_on" /> - + - - - + android:entryValues="@array/duration_values_with_never" + android:key="@string/settings_sending_upnp_alive_interval_key" + android:title="@string/settings_sending_upnp_alive_interval" /> + + + + android:entryValues="@array/duration_values" + android:key="@string/settings_default_playback_delay_key" + android:title="@string/settings_default_playback_delay" /> - + android:defaultValue="0" + android:dialogTitle="@string/settings_device_playback_offset" + android:inputType="number" + android:key="@string/settings_device_playback_offset_key" + android:summary="@string/settings_device_playback_offset_summ" + android:title="@string/settings_device_playback_offset" /> + + + android:entryValues="@array/duration_values_with_never" + android:key="@string/image_viewer_settings_duration_key" + android:title="@string/image_viewer_settings_duration" /> + \ No newline at end of file From ce32e5e3c5d9ce6c725bc03aee18bcf26a583bc6 Mon Sep 17 00:00:00 2001 From: tobexyz <40026159+tobexyz@users.noreply.github.com> Date: Sat, 14 Jan 2023 18:31:07 +0100 Subject: [PATCH 2/2] issue #45 set default chunk size to 50 --- yaacc/src/main/java/de/yaacc/browser/BrowseItemAdapter.java | 2 +- yaacc/src/main/res/xml/preference.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/yaacc/src/main/java/de/yaacc/browser/BrowseItemAdapter.java b/yaacc/src/main/java/de/yaacc/browser/BrowseItemAdapter.java index ff506ef8..8bfe25f3 100644 --- a/yaacc/src/main/java/de/yaacc/browser/BrowseItemAdapter.java +++ b/yaacc/src/main/java/de/yaacc/browser/BrowseItemAdapter.java @@ -287,7 +287,7 @@ public void loadMore() { Log.d(getClass().getName(), "loadMore from: " + from); - BrowseItemLoadTask browseItemLoadTask = new BrowseItemLoadTask(this, Long.parseLong(PreferenceManager.getDefaultSharedPreferences(getContext()).getString(getContext().getString(R.string.settings_browse_chunk_size_key), "10"))); + BrowseItemLoadTask browseItemLoadTask = new BrowseItemLoadTask(this, Long.parseLong(PreferenceManager.getDefaultSharedPreferences(getContext()).getString(getContext().getString(R.string.settings_browse_chunk_size_key), "50"))); asyncTasks.add(browseItemLoadTask); browseItemLoadTask.executeOnExecutor(((Yaacc) getContext().getApplicationContext()).getContentLoadExecutor(), from); diff --git a/yaacc/src/main/res/xml/preference.xml b/yaacc/src/main/res/xml/preference.xml index f4e0846e..bb104afc 100644 --- a/yaacc/src/main/res/xml/preference.xml +++ b/yaacc/src/main/res/xml/preference.xml @@ -46,7 +46,7 @@ android:summary="@string/settings_browse_load_threads_summ" android:title="@string/settings_browse_load_threads" />