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