Move basic views to new module
This commit is contained in:
parent
87b149b764
commit
010ed376cd
|
@ -165,6 +165,7 @@ dependencies {
|
|||
System.out.println("app: free build hack, skipping some dependencies")
|
||||
}
|
||||
implementation project(':ui:app-start-intent')
|
||||
implementation project(':ui:common')
|
||||
|
||||
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
||||
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
||||
|
|
|
@ -41,7 +41,7 @@ import de.danoeh.antennapod.core.preferences.UserPreferences;
|
|||
import de.danoeh.antennapod.core.receiver.MediaButtonReceiver;
|
||||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||
import de.danoeh.antennapod.core.util.StorageUtils;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
import de.danoeh.antennapod.core.util.download.AutoUpdateManager;
|
||||
import de.danoeh.antennapod.dialog.RatingDialog;
|
||||
import de.danoeh.antennapod.fragment.AddFeedFragment;
|
||||
|
|
|
@ -20,9 +20,9 @@ import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
|||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.EmbeddedChapterImage;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
import de.danoeh.antennapod.view.CircularProgressBar;
|
||||
import de.danoeh.antennapod.ui.common.CircularProgressBar;
|
||||
|
||||
public class ChaptersListAdapter extends RecyclerView.Adapter<ChaptersListAdapter.ChapterHolder> {
|
||||
private Playable media;
|
||||
|
|
|
@ -20,7 +20,7 @@ import de.danoeh.antennapod.core.storage.DBReader;
|
|||
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||
import de.danoeh.antennapod.core.storage.DownloadRequestException;
|
||||
import de.danoeh.antennapod.core.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
import de.danoeh.antennapod.view.viewholder.DownloadItemViewHolder;
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,8 +15,8 @@ import de.danoeh.antennapod.core.feed.FeedMedia;
|
|||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
||||
import de.danoeh.antennapod.core.service.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.core.service.download.Downloader;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.view.CircularProgressBar;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
import de.danoeh.antennapod.ui.common.CircularProgressBar;
|
||||
|
||||
public class DownloadlistAdapter extends BaseAdapter {
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import de.danoeh.antennapod.R;
|
|||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.fragment.FeedItemlistFragment;
|
||||
import de.danoeh.antennapod.view.SquareImageView;
|
||||
import de.danoeh.antennapod.ui.common.SquareImageView;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -28,7 +28,7 @@ import de.danoeh.antennapod.core.storage.DownloadRequester;
|
|||
import de.danoeh.antennapod.core.util.FeedItemPermutors;
|
||||
import de.danoeh.antennapod.core.util.LongList;
|
||||
import de.danoeh.antennapod.core.util.SortOrder;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.Set;
|
|||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.feed.FeedItemFilter;
|
||||
import de.danoeh.antennapod.core.feed.FeedItemFilterGroup;
|
||||
import de.danoeh.antennapod.view.RecursiveRadioGroup;
|
||||
import de.danoeh.antennapod.ui.common.RecursiveRadioGroup;
|
||||
|
||||
public abstract class FilterDialog {
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
|
|||
import de.danoeh.antennapod.core.feed.SubscriptionsFilter;
|
||||
import de.danoeh.antennapod.core.feed.SubscriptionsFilterGroup;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.view.RecursiveRadioGroup;
|
||||
import de.danoeh.antennapod.ui.common.RecursiveRadioGroup;
|
||||
|
||||
public class SubscriptionsFilterDialog {
|
||||
public static void showDialog(Context context) {
|
||||
|
|
|
@ -47,7 +47,7 @@ import de.danoeh.antennapod.dialog.SkipPreferenceDialog;
|
|||
import de.danoeh.antennapod.dialog.SleepTimerDialog;
|
||||
import de.danoeh.antennapod.dialog.VariableSpeedDialog;
|
||||
import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
|
||||
import de.danoeh.antennapod.view.PlaybackSpeedIndicatorView;
|
||||
import de.danoeh.antennapod.ui.common.PlaybackSpeedIndicatorView;
|
||||
import io.reactivex.Maybe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
|
|
@ -45,7 +45,7 @@ import de.danoeh.antennapod.core.storage.DownloadRequestException;
|
|||
import de.danoeh.antennapod.core.storage.StatisticsItem;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
import de.danoeh.antennapod.core.util.syndication.HtmlToPlainText;
|
||||
import de.danoeh.antennapod.fragment.preferences.StatisticsFragment;
|
||||
import de.danoeh.antennapod.menuhandler.FeedMenuHandler;
|
||||
|
|
|
@ -58,7 +58,7 @@ import de.danoeh.antennapod.core.storage.DownloadRequester;
|
|||
import de.danoeh.antennapod.core.util.FeedItemPermutors;
|
||||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
||||
import de.danoeh.antennapod.core.util.Optional;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
import de.danoeh.antennapod.core.util.gui.MoreContentListFooterUtil;
|
||||
import de.danoeh.antennapod.dialog.EpisodesApplyActionFragment;
|
||||
import de.danoeh.antennapod.dialog.FilterDialog;
|
||||
|
|
|
@ -57,7 +57,7 @@ import de.danoeh.antennapod.core.storage.DBReader;
|
|||
import de.danoeh.antennapod.core.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.DateUtils;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||
import de.danoeh.antennapod.core.util.playback.Timeline;
|
||||
import de.danoeh.antennapod.view.ShownotesWebView;
|
||||
|
|
|
@ -9,7 +9,7 @@ import androidx.appcompat.widget.SearchView;
|
|||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
import de.danoeh.antennapod.fragment.SearchFragment;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
|
@ -30,8 +30,8 @@ import de.danoeh.antennapod.core.storage.DownloadRequester;
|
|||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.DateUtils;
|
||||
import de.danoeh.antennapod.core.util.NetworkUtils;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.view.CircularProgressBar;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
import de.danoeh.antennapod.ui.common.CircularProgressBar;
|
||||
|
||||
/**
|
||||
* Holds the view which shows FeedItems.
|
||||
|
|
|
@ -156,7 +156,7 @@
|
|||
android:scaleType="fitCenter"
|
||||
tools:srcCompat="@drawable/ic_av_play_white_24dp"/>
|
||||
|
||||
<de.danoeh.antennapod.view.CircularProgressBar
|
||||
<de.danoeh.antennapod.ui.common.CircularProgressBar
|
||||
android:layout_width="@dimen/audioplayer_playercontrols_length_big"
|
||||
android:layout_height="@dimen/audioplayer_playercontrols_length_big"
|
||||
android:layout_marginLeft="16dp"
|
||||
|
@ -164,7 +164,8 @@
|
|||
android:layout_marginRight="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"/>
|
||||
android:layout_centerVertical="true"
|
||||
app:foregroundColor="?attr/action_icon_color"/>
|
||||
|
||||
<ProgressBar
|
||||
style="?android:attr/progressBarStyle"
|
||||
|
@ -205,7 +206,7 @@
|
|||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:clickable="false"/>
|
||||
|
||||
<de.danoeh.antennapod.view.PlaybackSpeedIndicatorView
|
||||
<de.danoeh.antennapod.ui.common.PlaybackSpeedIndicatorView
|
||||
android:id="@+id/butPlaybackSpeed"
|
||||
android:layout_width="@dimen/audioplayer_playercontrols_length"
|
||||
android:layout_height="@dimen/audioplayer_playercontrols_length"
|
||||
|
@ -214,7 +215,8 @@
|
|||
android:layout_centerVertical="true"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/playback_speed"
|
||||
tools:srcCompat="@drawable/ic_playback_speed_white"/>
|
||||
tools:srcCompat="@drawable/ic_playback_speed_white"
|
||||
app:foregroundColor="?attr/action_icon_color"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvPlaybackSpeed"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
android:padding="8dp"
|
||||
android:gravity="center">
|
||||
|
||||
<de.danoeh.antennapod.view.SquareImageView
|
||||
<de.danoeh.antennapod.ui.common.SquareImageView
|
||||
android:id="@+id/imgvCover"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="200dp"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<de.danoeh.antennapod.view.RecursiveRadioGroup
|
||||
<de.danoeh.antennapod.ui.common.RecursiveRadioGroup
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -58,4 +58,4 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:checked="true" />
|
||||
|
||||
</de.danoeh.antennapod.view.RecursiveRadioGroup>
|
||||
</de.danoeh.antennapod.ui.common.RecursiveRadioGroup>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<de.danoeh.antennapod.view.WrappingGridView
|
||||
<de.danoeh.antennapod.ui.common.WrappingGridView
|
||||
android:id="@+id/discover_grid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
android:padding="4dp"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<de.danoeh.antennapod.view.SquareImageView
|
||||
<de.danoeh.antennapod.ui.common.SquareImageView
|
||||
android:id="@+id/discovery_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
android:padding="4dp"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<de.danoeh.antennapod.view.SquareImageView
|
||||
<de.danoeh.antennapod.ui.common.SquareImageView
|
||||
android:id="@+id/discovery_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="96dp"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginRight="12dp"
|
||||
|
@ -19,9 +20,10 @@
|
|||
tools:ignore="ContentDescription"
|
||||
tools:src="@sample/secondaryaction"/>
|
||||
|
||||
<de.danoeh.antennapod.view.CircularProgressBar
|
||||
<de.danoeh.antennapod.ui.common.CircularProgressBar
|
||||
android:id="@+id/secondaryActionProgress"
|
||||
android:layout_width="40dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_height="40dp"/>
|
||||
android:layout_height="40dp"
|
||||
app:foregroundColor="?attr/action_icon_color"/>
|
||||
</FrameLayout>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:foreground="?attr/selectableItemBackground">
|
||||
|
||||
<de.danoeh.antennapod.view.SquareImageView
|
||||
<de.danoeh.antennapod.ui.common.SquareImageView
|
||||
android:id="@+id/imgvCover"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
|
|
|
@ -72,6 +72,7 @@ android {
|
|||
|
||||
dependencies {
|
||||
implementation project(':ui:app-start-intent')
|
||||
implementation project(':ui:common')
|
||||
|
||||
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
||||
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
||||
|
|
|
@ -32,8 +32,8 @@ import de.danoeh.antennapod.core.service.playback.PlaybackServiceMediaPlayer;
|
|||
import de.danoeh.antennapod.core.service.playback.PlayerStatus;
|
||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||
import de.danoeh.antennapod.core.util.Optional;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable.PlayableUtils;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
import io.reactivex.Maybe;
|
||||
import io.reactivex.MaybeOnSubscribe;
|
||||
import io.reactivex.Observable;
|
||||
|
|
|
@ -64,12 +64,4 @@
|
|||
<attr name="ic_notifications" format="reference"/>
|
||||
<attr name="seek_background" format="color" />
|
||||
<attr name="ic_share" format="reference"/>
|
||||
|
||||
<declare-styleable name="SquareImageView">
|
||||
<attr name="direction" format="enum">
|
||||
<enum name="width" value="0"/>
|
||||
<enum name="height" value="1"/>
|
||||
<enum name="minimum" value="2"/>
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
include ':app'
|
||||
include ':core'
|
||||
include ':ui:app-start-intent'
|
||||
include ':ui:common'
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# :ui:common
|
||||
|
||||
This module provides basic UI functionality that is needed in multiple modules. UI elements that are only used in a single module should not be defined here.
|
|
@ -0,0 +1,50 @@
|
|||
apply plugin: "com.android.library"
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
|
||||
multiDexEnabled false
|
||||
|
||||
testApplicationId "de.danoeh.antennapod.core.tests"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile("proguard-android.txt")
|
||||
}
|
||||
debug {
|
||||
// debug build has method count over 64k single-dex threshold.
|
||||
// For building debug build to use on Android < 21 (pre-Android 5) devices,
|
||||
// you need to manually change class
|
||||
// de.danoeh.antennapod.PodcastApp to extend MultiDexApplication .
|
||||
// See Issue #2813
|
||||
multiDexEnabled true
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests {
|
||||
includeAndroidResources = true
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
warningsAsErrors true
|
||||
abortOnError true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
||||
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<manifest package="de.danoeh.antennapod.ui.common" />
|
|
@ -1,14 +1,14 @@
|
|||
package de.danoeh.antennapod.view;
|
||||
package de.danoeh.antennapod.ui.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
|
||||
public class CircularProgressBar extends View {
|
||||
public static final float MINIMUM_PERCENTAGE = 0.005f;
|
||||
|
@ -23,20 +23,20 @@ public class CircularProgressBar extends View {
|
|||
|
||||
public CircularProgressBar(Context context) {
|
||||
super(context);
|
||||
setup();
|
||||
setup(null);
|
||||
}
|
||||
|
||||
public CircularProgressBar(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setup();
|
||||
setup(attrs);
|
||||
}
|
||||
|
||||
public CircularProgressBar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setup();
|
||||
setup(attrs);
|
||||
}
|
||||
|
||||
private void setup() {
|
||||
private void setup(@Nullable AttributeSet attrs) {
|
||||
paintBackground.setAntiAlias(true);
|
||||
paintBackground.setStyle(Paint.Style.STROKE);
|
||||
|
||||
|
@ -44,7 +44,9 @@ public class CircularProgressBar extends View {
|
|||
paintProgress.setStyle(Paint.Style.STROKE);
|
||||
paintProgress.setStrokeCap(Paint.Cap.ROUND);
|
||||
|
||||
int color = ThemeUtils.getColorFromAttr(getContext(), R.attr.action_icon_color);
|
||||
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.CircularProgressBar);
|
||||
int color = typedArray.getColor(R.styleable.CircularProgressBar_foregroundColor, Color.GREEN);
|
||||
typedArray.recycle();
|
||||
paintProgress.setColor(color);
|
||||
paintBackground.setColor(color);
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
package de.danoeh.antennapod.view;
|
||||
package de.danoeh.antennapod.ui.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
public class PlaybackSpeedIndicatorView extends View {
|
||||
private static final float DEG_2_RAD = (float) (Math.PI / 180);
|
||||
|
@ -19,37 +19,37 @@ public class PlaybackSpeedIndicatorView extends View {
|
|||
private final Paint arcPaint = new Paint();
|
||||
private final Paint indicatorPaint = new Paint();
|
||||
private final Path trianglePath = new Path();
|
||||
private final RectF arcBounds = new RectF();
|
||||
private float angle = VALUE_UNSET;
|
||||
private float targetAngle = VALUE_UNSET;
|
||||
private float degreePerFrame = 2;
|
||||
private float paddingArc = 20;
|
||||
private float paddingIndicator = 10;
|
||||
private RectF arcBounds = new RectF();
|
||||
|
||||
public PlaybackSpeedIndicatorView(Context context) {
|
||||
super(context);
|
||||
setup();
|
||||
setup(null);
|
||||
}
|
||||
|
||||
public PlaybackSpeedIndicatorView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setup();
|
||||
setup(attrs);
|
||||
}
|
||||
|
||||
public PlaybackSpeedIndicatorView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setup();
|
||||
setup(attrs);
|
||||
}
|
||||
|
||||
private void setup() {
|
||||
private void setup(@Nullable AttributeSet attrs) {
|
||||
setSpeed(1.0f); // Set default angle to 1.0
|
||||
targetAngle = VALUE_UNSET; // Do not move to first value that is set externally
|
||||
|
||||
int[] colorAttrs = new int[] {R.attr.action_icon_color };
|
||||
TypedArray a = getContext().obtainStyledAttributes(colorAttrs);
|
||||
arcPaint.setColor(a.getColor(0, 0xffffffff));
|
||||
indicatorPaint.setColor(a.getColor(0, 0xffffffff));
|
||||
a.recycle();
|
||||
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.PlaybackSpeedIndicatorView);
|
||||
int color = typedArray.getColor(R.styleable.PlaybackSpeedIndicatorView_foregroundColor, Color.GREEN);
|
||||
typedArray.recycle();
|
||||
arcPaint.setColor(color);
|
||||
indicatorPaint.setColor(color);
|
||||
|
||||
arcPaint.setAntiAlias(true);
|
||||
arcPaint.setStyle(Paint.Style.STROKE);
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.view;
|
||||
package de.danoeh.antennapod.ui.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
|
@ -1,10 +1,9 @@
|
|||
package de.danoeh.antennapod.view;
|
||||
package de.danoeh.antennapod.ui.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import android.util.AttributeSet;
|
||||
import de.danoeh.antennapod.core.R;
|
||||
|
||||
/**
|
||||
* From http://stackoverflow.com/a/19449488/6839
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.core.util;
|
||||
package de.danoeh.antennapod.ui.common;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.AttrRes;
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.view;
|
||||
package de.danoeh.antennapod.ui.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="SquareImageView">
|
||||
<attr name="direction" format="enum">
|
||||
<enum name="width" value="0"/>
|
||||
<enum name="height" value="1"/>
|
||||
<enum name="minimum" value="2"/>
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="CircularProgressBar">
|
||||
<attr name="foregroundColor" format="color" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="PlaybackSpeedIndicatorView">
|
||||
<attr name="foregroundColor" /> <!-- format omitted to avoid double definition -->
|
||||
</declare-styleable>
|
||||
</resources>
|
Loading…
Reference in New Issue