Merge pull request #5747 from ByteHamster/decouple-statistics
Move statistics screens to new module
This commit is contained in:
commit
8ff8ac2d5d
|
@ -121,6 +121,7 @@ dependencies {
|
|||
implementation project(':ui:app-start-intent')
|
||||
implementation project(':ui:common')
|
||||
implementation project(':ui:i18n')
|
||||
implementation project(':ui:statistics')
|
||||
|
||||
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
||||
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
||||
|
|
|
@ -35,6 +35,7 @@ import de.danoeh.antennapod.core.storage.DBReader;
|
|||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
||||
import de.danoeh.antennapod.core.util.download.AutoUpdateManager;
|
||||
import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
|
||||
import de.danoeh.antennapod.ui.common.PagedToolbarFragment;
|
||||
import de.danoeh.antennapod.view.EmptyViewHandler;
|
||||
import de.danoeh.antennapod.view.EpisodeItemListRecyclerView;
|
||||
import de.danoeh.antennapod.view.viewholder.EpisodeItemViewHolder;
|
||||
|
|
|
@ -25,6 +25,7 @@ import de.danoeh.antennapod.core.util.download.AutoUpdateManager;
|
|||
import de.danoeh.antennapod.dialog.DownloadLogDetailsDialog;
|
||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.ui.common.PagedToolbarFragment;
|
||||
import de.danoeh.antennapod.view.EmptyViewHandler;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.google.android.material.tabs.TabLayoutMediator;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.ui.common.PagedToolbarFragment;
|
||||
|
||||
/**
|
||||
* Shows the CompletedDownloadsFragment and the RunningDownloadsFragment.
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.google.android.material.tabs.TabLayoutMediator;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.ui.common.PagedToolbarFragment;
|
||||
|
||||
public class EpisodesFragment extends PagedToolbarFragment {
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import de.danoeh.antennapod.event.playback.PlaybackPositionEvent;
|
|||
import de.danoeh.antennapod.event.PlayerStatusEvent;
|
||||
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
||||
import de.danoeh.antennapod.core.menuhandler.MenuItemUtils;
|
||||
import de.danoeh.antennapod.ui.common.PagedToolbarFragment;
|
||||
import de.danoeh.antennapod.view.EpisodeItemListRecyclerView;
|
||||
import de.danoeh.antennapod.view.viewholder.EpisodeItemViewHolder;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
|
|
@ -42,10 +42,11 @@ import de.danoeh.antennapod.core.storage.DBReader;
|
|||
import de.danoeh.antennapod.core.storage.DBTasks;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
import de.danoeh.antennapod.core.util.syndication.HtmlToPlainText;
|
||||
import de.danoeh.antennapod.fragment.preferences.StatisticsFragment;
|
||||
import de.danoeh.antennapod.menuhandler.FeedMenuHandler;
|
||||
import de.danoeh.antennapod.model.feed.Feed;
|
||||
import de.danoeh.antennapod.model.feed.FeedFunding;
|
||||
import de.danoeh.antennapod.ui.statistics.StatisticsFragment;
|
||||
import de.danoeh.antennapod.ui.statistics.feed.FeedStatisticsFragment;
|
||||
import de.danoeh.antennapod.view.ToolbarIconTintManager;
|
||||
import io.reactivex.Completable;
|
||||
import io.reactivex.Maybe;
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.joanzapata.iconify.Iconify;
|
|||
import com.leinardi.android.speeddial.SpeedDialView;
|
||||
|
||||
import de.danoeh.antennapod.dialog.TagSettingsDialog;
|
||||
import de.danoeh.antennapod.ui.statistics.StatisticsFragment;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
@ -57,7 +58,6 @@ import de.danoeh.antennapod.dialog.RemoveFeedDialog;
|
|||
import de.danoeh.antennapod.dialog.RenameItemDialog;
|
||||
import de.danoeh.antennapod.dialog.SubscriptionsFilterDialog;
|
||||
import de.danoeh.antennapod.fragment.actions.FeedMultiSelectActionHandler;
|
||||
import de.danoeh.antennapod.fragment.preferences.StatisticsFragment;
|
||||
import de.danoeh.antennapod.model.feed.Feed;
|
||||
import de.danoeh.antennapod.view.EmptyViewHandler;
|
||||
import io.reactivex.Observable;
|
||||
|
|
|
@ -17,3 +17,4 @@ include ':ui:app-start-intent'
|
|||
include ':ui:common'
|
||||
include ':ui:i18n'
|
||||
include ':ui:png-icons'
|
||||
include ':ui:statistics'
|
||||
|
|
|
@ -6,4 +6,6 @@ apply from: "../../common.gradle"
|
|||
dependencies {
|
||||
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
||||
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
||||
implementation "androidx.viewpager2:viewpager2:$viewPager2Version"
|
||||
implementation "com.google.android.material:material:$googleMaterialVersion"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.fragment;
|
||||
package de.danoeh.antennapod.ui.common;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
@ -17,7 +17,7 @@ public abstract class PagedToolbarFragment extends Fragment {
|
|||
* Invalidate the toolbar menu if the current child fragment is visible.
|
||||
* @param child The fragment to invalidate
|
||||
*/
|
||||
void invalidateOptionsMenuIfActive(@NonNull Fragment child) {
|
||||
public void invalidateOptionsMenuIfActive(@NonNull Fragment child) {
|
||||
Fragment visibleChild = getChildFragmentManager().findFragmentByTag("f" + viewPager.getCurrentItem());
|
||||
if (visibleChild == child) {
|
||||
visibleChild.onPrepareOptionsMenu(toolbar.getMenu());
|
|
@ -0,0 +1,3 @@
|
|||
# :ui:statistics
|
||||
|
||||
This module provides the statistics screens.
|
|
@ -0,0 +1,31 @@
|
|||
plugins {
|
||||
id("com.android.library")
|
||||
}
|
||||
apply from: "../../common.gradle"
|
||||
apply from: "../../playFlavor.gradle"
|
||||
|
||||
android {
|
||||
lintOptions {
|
||||
disable "InvalidPeriodicWorkRequestInterval", "MissingPermission", "GradleCompatible",
|
||||
"QueryPermissionsNeeded", "Overdraw", "SetTextI18n", "RtlHardcoded"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":core")
|
||||
implementation project(":model")
|
||||
implementation project(":ui:common")
|
||||
|
||||
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
||||
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
||||
implementation "androidx.core:core:$coreVersion"
|
||||
implementation "androidx.fragment:fragment:$fragmentVersion"
|
||||
implementation "androidx.recyclerview:recyclerview:$recyclerViewVersion"
|
||||
implementation "androidx.viewpager2:viewpager2:$viewPager2Version"
|
||||
implementation "com.google.android.material:material:$googleMaterialVersion"
|
||||
|
||||
implementation "com.github.bumptech.glide:glide:$glideVersion"
|
||||
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
|
||||
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
|
||||
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<manifest package="de.danoeh.antennapod.ui.statistics" />
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.view;
|
||||
package de.danoeh.antennapod.ui.statistics;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.fragment.preferences;
|
||||
package de.danoeh.antennapod.ui.statistics;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -13,10 +13,10 @@ import androidx.viewpager2.widget.ViewPager2;
|
|||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||
import de.danoeh.antennapod.fragment.PagedToolbarFragment;
|
||||
import de.danoeh.antennapod.ui.common.PagedToolbarFragment;
|
||||
import de.danoeh.antennapod.ui.statistics.downloads.DownloadStatisticsFragment;
|
||||
import de.danoeh.antennapod.ui.statistics.subscriptions.SubscriptionStatisticsFragment;
|
||||
import de.danoeh.antennapod.ui.statistics.years.YearsStatisticsFragment;
|
||||
|
||||
/**
|
||||
* Displays the 'statistics' screen
|
||||
|
@ -68,14 +68,6 @@ public class StatisticsFragment extends PagedToolbarFragment {
|
|||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (getActivity().getClass() == PreferenceActivity.class) {
|
||||
((PreferenceActivity) getActivity()).getSupportActionBar().setTitle(R.string.statistics_label);
|
||||
}
|
||||
}
|
||||
|
||||
public static class StatisticsPagerAdapter extends FragmentStateAdapter {
|
||||
|
||||
StatisticsPagerAdapter(@NonNull Fragment fragment) {
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.adapter;
|
||||
package de.danoeh.antennapod.ui.statistics;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -12,10 +12,8 @@ import android.widget.TextView;
|
|||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.storage.StatisticsItem;
|
||||
import de.danoeh.antennapod.view.PieChartView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -25,11 +23,11 @@ import java.util.List;
|
|||
public abstract class StatisticsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private static final int TYPE_HEADER = 0;
|
||||
private static final int TYPE_FEED = 1;
|
||||
final Context context;
|
||||
protected final Context context;
|
||||
private List<StatisticsItem> statisticsData;
|
||||
PieChartView.PieChartData pieChartData;
|
||||
protected PieChartView.PieChartData pieChartData;
|
||||
|
||||
StatisticsListAdapter(Context context) {
|
||||
protected StatisticsListAdapter(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
@ -98,11 +96,11 @@ public abstract class StatisticsListAdapter extends RecyclerView.Adapter<Recycle
|
|||
}
|
||||
}
|
||||
|
||||
static class StatisticsHolder extends RecyclerView.ViewHolder {
|
||||
ImageView image;
|
||||
TextView title;
|
||||
TextView value;
|
||||
TextView chip;
|
||||
public static class StatisticsHolder extends RecyclerView.ViewHolder {
|
||||
public ImageView image;
|
||||
public TextView title;
|
||||
public TextView value;
|
||||
public TextView chip;
|
||||
|
||||
StatisticsHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
@ -113,11 +111,11 @@ public abstract class StatisticsListAdapter extends RecyclerView.Adapter<Recycle
|
|||
}
|
||||
}
|
||||
|
||||
abstract String getHeaderCaption();
|
||||
protected abstract String getHeaderCaption();
|
||||
|
||||
abstract String getHeaderValue();
|
||||
protected abstract String getHeaderValue();
|
||||
|
||||
abstract PieChartView.PieChartData generateChartData(List<StatisticsItem> statisticsData);
|
||||
protected abstract PieChartView.PieChartData generateChartData(List<StatisticsItem> statisticsData);
|
||||
|
||||
abstract void onBindFeedViewHolder(StatisticsHolder holder, StatisticsItem item);
|
||||
protected abstract void onBindFeedViewHolder(StatisticsHolder holder, StatisticsItem item);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.fragment.preferences;
|
||||
package de.danoeh.antennapod.ui.statistics.downloads;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
@ -14,9 +14,8 @@ import androidx.fragment.app.Fragment;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.DownloadStatisticsListAdapter;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.ui.statistics.R;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
@ -39,7 +38,7 @@ public class DownloadStatisticsFragment extends Fragment {
|
|||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View root = inflater.inflate(R.layout.statistics_activity, container, false);
|
||||
View root = inflater.inflate(R.layout.statistics_fragment, container, false);
|
||||
downloadStatisticsList = root.findViewById(R.id.statistics_list);
|
||||
progressBar = root.findViewById(R.id.progressBar);
|
||||
listAdapter = new DownloadStatisticsListAdapter(getContext());
|
|
@ -1,15 +1,15 @@
|
|||
package de.danoeh.antennapod.adapter;
|
||||
package de.danoeh.antennapod.ui.statistics.downloads;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.format.Formatter;
|
||||
import de.danoeh.antennapod.core.storage.StatisticsItem;
|
||||
import de.danoeh.antennapod.ui.statistics.PieChartView;
|
||||
import de.danoeh.antennapod.ui.statistics.R;
|
||||
import de.danoeh.antennapod.ui.statistics.StatisticsListAdapter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.storage.StatisticsItem;
|
||||
import de.danoeh.antennapod.view.PieChartView;
|
||||
|
||||
/**
|
||||
* Adapter for the download statistics list.
|
||||
*/
|
||||
|
@ -20,17 +20,17 @@ public class DownloadStatisticsListAdapter extends StatisticsListAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
String getHeaderCaption() {
|
||||
protected String getHeaderCaption() {
|
||||
return context.getString(R.string.total_size_downloaded_podcasts);
|
||||
}
|
||||
|
||||
@Override
|
||||
String getHeaderValue() {
|
||||
protected String getHeaderValue() {
|
||||
return Formatter.formatShortFileSize(context, (long) pieChartData.getSum());
|
||||
}
|
||||
|
||||
@Override
|
||||
PieChartView.PieChartData generateChartData(List<StatisticsItem> statisticsData) {
|
||||
protected PieChartView.PieChartData generateChartData(List<StatisticsItem> statisticsData) {
|
||||
float[] dataValues = new float[statisticsData.size()];
|
||||
for (int i = 0; i < statisticsData.size(); i++) {
|
||||
StatisticsItem item = statisticsData.get(i);
|
||||
|
@ -40,7 +40,7 @@ public class DownloadStatisticsListAdapter extends StatisticsListAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
void onBindFeedViewHolder(StatisticsHolder holder, StatisticsItem item) {
|
||||
protected void onBindFeedViewHolder(StatisticsHolder holder, StatisticsItem item) {
|
||||
holder.value.setText(Formatter.formatShortFileSize(context, item.totalDownloadSize)
|
||||
+ " • "
|
||||
+ String.format(Locale.getDefault(), "%d%s",
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.fragment;
|
||||
package de.danoeh.antennapod.ui.statistics.feed;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.ui.statistics.R;
|
||||
|
||||
public class FeedStatisticsDialogFragment extends DialogFragment {
|
||||
private static final String EXTRA_FEED_ID = "de.danoeh.antennapod.extra.feedId";
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.fragment;
|
||||
package de.danoeh.antennapod.ui.statistics.feed;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.format.Formatter;
|
||||
|
@ -11,7 +11,7 @@ import androidx.fragment.app.Fragment;
|
|||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.StatisticsItem;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.databinding.FeedStatisticsBinding;
|
||||
import de.danoeh.antennapod.ui.statistics.databinding.FeedStatisticsBinding;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
|
@ -1,11 +1,12 @@
|
|||
package de.danoeh.antennapod.adapter;
|
||||
package de.danoeh.antennapod.ui.statistics.subscriptions;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.storage.StatisticsItem;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.fragment.FeedStatisticsDialogFragment;
|
||||
import de.danoeh.antennapod.view.PieChartView;
|
||||
import de.danoeh.antennapod.ui.statistics.PieChartView;
|
||||
import de.danoeh.antennapod.ui.statistics.R;
|
||||
import de.danoeh.antennapod.ui.statistics.StatisticsListAdapter;
|
||||
import de.danoeh.antennapod.ui.statistics.feed.FeedStatisticsDialogFragment;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
@ -34,7 +35,7 @@ public class PlaybackStatisticsListAdapter extends StatisticsListAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
String getHeaderCaption() {
|
||||
protected String getHeaderCaption() {
|
||||
if (includeMarkedAsPlayed) {
|
||||
return context.getString(R.string.statistics_counting_total);
|
||||
}
|
||||
|
@ -45,12 +46,12 @@ public class PlaybackStatisticsListAdapter extends StatisticsListAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
String getHeaderValue() {
|
||||
protected String getHeaderValue() {
|
||||
return Converter.shortLocalizedDuration(context, (long) pieChartData.getSum());
|
||||
}
|
||||
|
||||
@Override
|
||||
PieChartView.PieChartData generateChartData(List<StatisticsItem> statisticsData) {
|
||||
protected PieChartView.PieChartData generateChartData(List<StatisticsItem> statisticsData) {
|
||||
float[] dataValues = new float[statisticsData.size()];
|
||||
for (int i = 0; i < statisticsData.size(); i++) {
|
||||
StatisticsItem item = statisticsData.get(i);
|
||||
|
@ -60,7 +61,7 @@ public class PlaybackStatisticsListAdapter extends StatisticsListAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
void onBindFeedViewHolder(StatisticsHolder holder, StatisticsItem statsItem) {
|
||||
protected void onBindFeedViewHolder(StatisticsHolder holder, StatisticsItem statsItem) {
|
||||
long time = statsItem.timePlayed;
|
||||
holder.value.setText(Converter.shortLocalizedDuration(context, time));
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.fragment.preferences;
|
||||
package de.danoeh.antennapod.ui.statistics.subscriptions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
|
@ -21,12 +21,11 @@ import androidx.fragment.app.Fragment;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.PlaybackStatisticsListAdapter;
|
||||
import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.databinding.StatisticsFilterDialogBinding;
|
||||
import de.danoeh.antennapod.ui.statistics.R;
|
||||
import de.danoeh.antennapod.ui.statistics.databinding.StatisticsFilterDialogBinding;
|
||||
import io.reactivex.Completable;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
|
@ -74,7 +73,7 @@ public class SubscriptionStatisticsFragment extends Fragment {
|
|||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View root = inflater.inflate(R.layout.statistics_activity, container, false);
|
||||
View root = inflater.inflate(R.layout.statistics_fragment, container, false);
|
||||
feedStatisticsList = root.findViewById(R.id.statistics_list);
|
||||
progressBar = root.findViewById(R.id.progressBar);
|
||||
listAdapter = new PlaybackStatisticsListAdapter(this);
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.view;
|
||||
package de.danoeh.antennapod.ui.statistics.years;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
|
@ -15,8 +15,8 @@ import android.graphics.drawable.Drawable;
|
|||
import android.util.AttributeSet;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.appcompat.widget.ThemeUtils;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||
import de.danoeh.antennapod.ui.statistics.R;
|
||||
import io.reactivex.annotations.Nullable;
|
||||
|
||||
public class LineChartView extends AppCompatImageView {
|
||||
|
@ -82,7 +82,7 @@ public class LineChartView extends AppCompatImageView {
|
|||
paintLine.setStyle(Paint.Style.STROKE);
|
||||
paintLine.setStrokeJoin(Paint.Join.ROUND);
|
||||
paintLine.setStrokeCap(Paint.Cap.ROUND);
|
||||
paintLine.setColor(ThemeUtils.getThemeAttrColor(getContext(), R.attr.colorAccent));
|
||||
paintLine.setColor(ThemeUtils.getColorFromAttr(getContext(), R.attr.colorAccent));
|
||||
paintBackground = new Paint();
|
||||
paintBackground.setStyle(Paint.Style.FILL);
|
||||
paintVerticalLines = new Paint();
|
||||
|
@ -117,7 +117,7 @@ public class LineChartView extends AppCompatImageView {
|
|||
path.lineTo(data.values.length * stepSize, height);
|
||||
path.lineTo(stepSize, height);
|
||||
paintBackground.setShader(new LinearGradient(0, 0, 0, height,
|
||||
(ThemeUtils.getThemeAttrColor(getContext(), R.attr.colorAccent) & 0xffffff) + 0x66000000,
|
||||
(ThemeUtils.getColorFromAttr(getContext(), R.attr.colorAccent) & 0xffffff) + 0x66000000,
|
||||
Color.TRANSPARENT, Shader.TileMode.CLAMP));
|
||||
canvas.drawPath(path, paintBackground);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.adapter;
|
||||
package de.danoeh.antennapod.ui.statistics.years;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -7,10 +7,9 @@ import android.view.ViewGroup;
|
|||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.util.LongList;
|
||||
import de.danoeh.antennapod.view.LineChartView;
|
||||
import de.danoeh.antennapod.ui.statistics.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.fragment.preferences;
|
||||
package de.danoeh.antennapod.ui.statistics.years;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
@ -12,9 +12,8 @@ import androidx.annotation.Nullable;
|
|||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.YearStatisticsListAdapter;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.ui.statistics.R;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
@ -35,7 +34,7 @@ public class YearsStatisticsFragment extends Fragment {
|
|||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View root = inflater.inflate(R.layout.statistics_activity, container, false);
|
||||
View root = inflater.inflate(R.layout.statistics_fragment, container, false);
|
||||
yearStatisticsList = root.findViewById(R.id.statistics_list);
|
||||
progressBar = root.findViewById(R.id.progressBar);
|
||||
listAdapter = new YearStatisticsListAdapter(getContext());
|
|
@ -6,7 +6,7 @@
|
|||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<de.danoeh.antennapod.view.LineChartView
|
||||
<de.danoeh.antennapod.ui.statistics.years.LineChartView
|
||||
android:id="@+id/lineChart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
|
@ -6,7 +6,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<de.danoeh.antennapod.view.PieChartView
|
||||
<de.danoeh.antennapod.ui.statistics.PieChartView
|
||||
android:id="@+id/pie_chart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
|
@ -11,7 +11,7 @@
|
|||
android:id="@+id/statistics_filter"
|
||||
android:icon="@drawable/ic_filter"
|
||||
android:title="@string/filter"
|
||||
custom:showAsAction="always">
|
||||
custom:showAsAction="ifRoom">
|
||||
</item>
|
||||
|
||||
</menu>
|
Loading…
Reference in New Issue