Remove dependency of :net:discovery and :ui:echo on :core (#7036)

Moves the common icon files to :ui:common
This commit is contained in:
ByteHamster 2024-03-29 11:23:33 +01:00 committed by GitHub
parent 13a985ca1e
commit 5ede21d676
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
118 changed files with 91 additions and 90 deletions

View File

@ -309,7 +309,7 @@
<activity android:name=".activity.SelectSubscriptionActivity"
android:label="@string/shortcut_subscription_label"
android:icon="@drawable/ic_subscriptions_shortcut"
android:icon="@drawable/ic_shortcut_subscriptions"
android:theme="@style/Theme.AntennaPod.Dark.Translucent"
android:exported="true">
<intent-filter>

View File

@ -32,7 +32,7 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.FeedItemlistDescriptionAdapter;
import de.danoeh.antennapod.ui.common.ThemeSwitcher;
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
import de.danoeh.antennapod.core.feed.FeedUrlNotFoundException;
import de.danoeh.antennapod.net.discovery.FeedUrlNotFoundException;
import de.danoeh.antennapod.core.storage.FeedDatabaseWriter;
import de.danoeh.antennapod.core.service.playback.PlaybackServiceInterface;
import de.danoeh.antennapod.core.util.DownloadErrorLabel;

View File

@ -100,7 +100,7 @@ public class SelectSubscriptionActivity extends AppCompatActivity {
if (bitmap != null) {
icon = IconCompat.createWithAdaptiveBitmap(bitmap);
} else {
icon = IconCompat.createWithResource(this, R.drawable.ic_subscriptions_shortcut);
icon = IconCompat.createWithResource(this, R.drawable.ic_shortcut_subscriptions);
}
ShortcutInfoCompat shortcut = new ShortcutInfoCompat.Builder(this, id)

View File

@ -7,7 +7,7 @@
android:layout_height="@dimen/listitem_iconwithtext_height"
android:orientation="vertical"
android:layout_marginHorizontal="8dp"
android:background="@drawable/drawer_item_background">
android:background="@drawable/bg_drawer_item">
<ImageView
android:id="@+id/imgvCover"

View File

@ -2,7 +2,7 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_playlist_shortcut"
android:icon="@drawable/ic_shortcut_playlist"
android:shortcutId="queue"
android:shortcutShortLabel="@string/queue_label">
<intent
@ -17,7 +17,7 @@
<shortcut
android:enabled="true"
android:icon="@drawable/ic_feed_shortcut"
android:icon="@drawable/ic_shortcut_feed"
android:shortcutId="episodes"
android:shortcutShortLabel="@string/episodes_label">
<intent
@ -32,7 +32,7 @@
<shortcut
android:enabled="true"
android:icon="@drawable/ic_subscriptions_shortcut"
android:icon="@drawable/ic_shortcut_subscriptions"
android:shortcutId="subscriptions"
android:shortcutShortLabel="@string/subscriptions_label">
<intent
@ -47,7 +47,7 @@
<shortcut
android:enabled="true"
android:icon="@drawable/ic_refresh_shortcut"
android:icon="@drawable/ic_shortcut_refresh"
android:shortcutId="refresh"
android:shortcutShortLabel="@string/refresh_label">
<intent

View File

@ -3,6 +3,7 @@ package de.danoeh.antennapod.core;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import de.danoeh.antennapod.storage.preferences.SynchronizationCredentials;
import de.danoeh.antennapod.storage.preferences.PlaybackPreferences;
import de.danoeh.antennapod.storage.preferences.SleepTimerPreferences;
import de.danoeh.antennapod.storage.preferences.UsageStatistics;
@ -36,6 +37,7 @@ public class ClientConfigurator {
}
PodDBAdapter.init(context);
UserPreferences.init(context);
SynchronizationCredentials.init(context);
UsageStatistics.init(context);
PlaybackPreferences.init(context);
SslProviderInstaller.install(context);

View File

@ -28,6 +28,7 @@ import de.danoeh.antennapod.event.FeedUpdateRunningEvent;
import de.danoeh.antennapod.event.MessageEvent;
import de.danoeh.antennapod.model.feed.FeedItemFilter;
import de.danoeh.antennapod.model.feed.SortOrder;
import de.danoeh.antennapod.storage.preferences.SynchronizationCredentials;
import de.danoeh.antennapod.ui.notifications.NotificationUtils;
import org.apache.commons.lang3.StringUtils;
import org.greenrobot.eventbus.EventBus;
@ -371,7 +372,7 @@ public class SyncService extends Worker {
switch (selectedService) {
case GPODDER_NET:
return new GpodnetService(AntennapodHttpClient.getHttpClient(),
SynchronizationCredentials.getHosturl(), SynchronizationCredentials.getDeviceID(),
SynchronizationCredentials.getHosturl(), SynchronizationCredentials.getDeviceId(),
SynchronizationCredentials.getUsername(), SynchronizationCredentials.getPassword());
case NEXTCLOUD_GPODDER:
return new NextcloudSyncService(AntennapodHttpClient.getHttpClient(),

View File

@ -1,67 +0,0 @@
package de.danoeh.antennapod.core.sync;
import android.content.Context;
import android.content.SharedPreferences;
import de.danoeh.antennapod.core.ClientConfig;
import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.core.sync.queue.SynchronizationQueueSink;
/**
* Manages preferences for accessing gpodder.net service and other sync providers
*/
public class SynchronizationCredentials {
private SynchronizationCredentials() {
}
private static final String PREF_NAME = "gpodder.net";
private static final String PREF_USERNAME = "de.danoeh.antennapod.preferences.gpoddernet.username";
private static final String PREF_PASSWORD = "de.danoeh.antennapod.preferences.gpoddernet.password";
private static final String PREF_DEVICEID = "de.danoeh.antennapod.preferences.gpoddernet.deviceID";
private static final String PREF_HOSTNAME = "prefGpodnetHostname";
private static SharedPreferences getPreferences() {
return ClientConfig.applicationCallbacks.getApplicationInstance()
.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
}
public static String getUsername() {
return getPreferences().getString(PREF_USERNAME, null);
}
public static void setUsername(String username) {
getPreferences().edit().putString(PREF_USERNAME, username).apply();
}
public static String getPassword() {
return getPreferences().getString(PREF_PASSWORD, null);
}
public static void setPassword(String password) {
getPreferences().edit().putString(PREF_PASSWORD, password).apply();
}
public static String getDeviceID() {
return getPreferences().getString(PREF_DEVICEID, null);
}
public static void setDeviceID(String deviceID) {
getPreferences().edit().putString(PREF_DEVICEID, deviceID).apply();
}
public static String getHosturl() {
return getPreferences().getString(PREF_HOSTNAME, null);
}
public static void setHosturl(String value) {
getPreferences().edit().putString(PREF_HOSTNAME, value).apply();
}
public static synchronized void clear(Context context) {
setUsername(null);
setPassword(null);
setDeviceID(null);
SynchronizationQueueSink.clearQueue(context);
UserPreferences.setGpodnetNotificationsEnabled();
}
}

View File

@ -19,11 +19,12 @@ android {
}
dependencies {
implementation project(':core')
implementation project(':model')
implementation project(':net:common')
implementation project(':net:sync:gpoddernet')
implementation project(':net:sync:model')
implementation project(':storage:preferences')
implementation project(':ui:i18n')
annotationProcessor "androidx.annotation:annotation:$annotationVersion"

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.core.feed;
package de.danoeh.antennapod.net.discovery;
import java.io.IOException;

View File

@ -1,10 +1,10 @@
package de.danoeh.antennapod.net.discovery;
import de.danoeh.antennapod.core.sync.SynchronizationCredentials;
import de.danoeh.antennapod.net.common.AntennapodHttpClient;
import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetService;
import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetServiceException;
import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetPodcast;
import de.danoeh.antennapod.storage.preferences.SynchronizationCredentials;
import io.reactivex.Single;
import io.reactivex.SingleOnSubscribe;
import io.reactivex.android.schedulers.AndroidSchedulers;
@ -18,7 +18,7 @@ public class GpodnetPodcastSearcher implements PodcastSearcher {
return Single.create((SingleOnSubscribe<List<PodcastSearchResult>>) subscriber -> {
try {
GpodnetService service = new GpodnetService(AntennapodHttpClient.getHttpClient(),
SynchronizationCredentials.getHosturl(), SynchronizationCredentials.getDeviceID(),
SynchronizationCredentials.getHosturl(), SynchronizationCredentials.getDeviceId(),
SynchronizationCredentials.getUsername(), SynchronizationCredentials.getPassword());
List<GpodnetPodcast> gpodnetPodcasts = service.searchPodcasts(query, 0);
List<PodcastSearchResult> results = new ArrayList<>();

View File

@ -1,6 +1,5 @@
package de.danoeh.antennapod.net.discovery;
import de.danoeh.antennapod.core.feed.FeedUrlNotFoundException;
import de.danoeh.antennapod.net.common.AntennapodHttpClient;
import io.reactivex.Single;
import io.reactivex.SingleOnSubscribe;

View File

@ -0,0 +1,60 @@
package de.danoeh.antennapod.storage.preferences;
import android.content.Context;
import android.content.SharedPreferences;
/**
* Manages preferences for accessing gpodder.net service and other sync providers
*/
public abstract class SynchronizationCredentials {
private static final String PREF_NAME = "gpodder.net";
private static final String PREF_USERNAME = "de.danoeh.antennapod.preferences.gpoddernet.username";
private static final String PREF_PASSWORD = "de.danoeh.antennapod.preferences.gpoddernet.password";
private static final String PREF_DEVICEID = "de.danoeh.antennapod.preferences.gpoddernet.deviceID";
private static final String PREF_HOSTNAME = "prefGpodnetHostname";
private static SharedPreferences prefs;
public static void init(Context context) {
prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
}
public static String getUsername() {
return prefs.getString(PREF_USERNAME, null);
}
public static void setUsername(String username) {
prefs.edit().putString(PREF_USERNAME, username).apply();
}
public static String getPassword() {
return prefs.getString(PREF_PASSWORD, null);
}
public static void setPassword(String password) {
prefs.edit().putString(PREF_PASSWORD, password).apply();
}
public static String getDeviceId() {
return prefs.getString(PREF_DEVICEID, null);
}
public static void setDeviceId(String deviceId) {
prefs.edit().putString(PREF_DEVICEID, deviceId).apply();
}
public static String getHosturl() {
return prefs.getString(PREF_HOSTNAME, null);
}
public static void setHosturl(String value) {
prefs.edit().putString(PREF_HOSTNAME, value).apply();
}
public static synchronized void clear() {
setUsername(null);
setPassword(null);
setDeviceId(null);
UserPreferences.setGpodnetNotificationsEnabled();
}
}

Some files were not shown because too many files have changed in this diff Show More