-Renamed "watch history" fragment under bookmark to "last played".

-Renamed "watched history" fragment under history to "watch history".
This commit is contained in:
John Zhen Mo 2018-02-07 14:37:05 -08:00
parent 7ab41e0c3a
commit 6020dc2b2d
7 changed files with 30 additions and 33 deletions

View file

@ -39,8 +39,8 @@ import io.reactivex.disposables.CompositeDisposable;
public final class BookmarkFragment public final class BookmarkFragment
extends BaseLocalListFragment<List<PlaylistLocalItem>, Void> { extends BaseLocalListFragment<List<PlaylistLocalItem>, Void> {
private View watchHistoryButton; private View lastPlayedButton;
private View mostWatchedButton; private View mostPlayedButton;
@State @State
protected Parcelable itemsListState; protected Parcelable itemsListState;
@ -96,8 +96,8 @@ public final class BookmarkFragment
protected View getListHeader() { protected View getListHeader() {
final View headerRootLayout = activity.getLayoutInflater() final View headerRootLayout = activity.getLayoutInflater()
.inflate(R.layout.bookmark_header, itemsList, false); .inflate(R.layout.bookmark_header, itemsList, false);
watchHistoryButton = headerRootLayout.findViewById(R.id.watchHistory); lastPlayedButton = headerRootLayout.findViewById(R.id.lastPlayed);
mostWatchedButton = headerRootLayout.findViewById(R.id.mostWatched); mostPlayedButton = headerRootLayout.findViewById(R.id.mostPlayed);
return headerRootLayout; return headerRootLayout;
} }
@ -135,13 +135,13 @@ public final class BookmarkFragment
} }
}); });
watchHistoryButton.setOnClickListener(view -> { lastPlayedButton.setOnClickListener(view -> {
if (getParentFragment() != null) { if (getParentFragment() != null) {
NavigationHelper.openWatchHistoryFragment(getParentFragment().getFragmentManager()); NavigationHelper.openLastPlayedFragment(getParentFragment().getFragmentManager());
} }
}); });
mostWatchedButton.setOnClickListener(view -> { mostPlayedButton.setOnClickListener(view -> {
if (getParentFragment() != null) { if (getParentFragment() != null) {
NavigationHelper.openMostPlayedFragment(getParentFragment().getFragmentManager()); NavigationHelper.openMostPlayedFragment(getParentFragment().getFragmentManager());
} }
@ -178,8 +178,8 @@ public final class BookmarkFragment
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
if (mostWatchedButton != null) mostWatchedButton.setOnClickListener(null); if (mostPlayedButton != null) mostPlayedButton.setOnClickListener(null);
if (watchHistoryButton != null) watchHistoryButton.setOnClickListener(null); if (lastPlayedButton != null) lastPlayedButton.setOnClickListener(null);
if (disposables != null) disposables.clear(); if (disposables != null) disposables.clear();
if (databaseSubscription != null) databaseSubscription.cancel(); if (databaseSubscription != null) databaseSubscription.cancel();

View file

@ -6,10 +6,10 @@ import org.schabi.newpipe.database.stream.StreamStatisticsEntry;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
public final class WatchHistoryFragment extends StatisticsPlaylistFragment { public final class LastPlayedFragment extends StatisticsPlaylistFragment {
@Override @Override
protected String getName() { protected String getName() {
return getString(R.string.title_watch_history); return getString(R.string.title_last_played);
} }
@Override @Override

View file

@ -9,10 +9,8 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -23,7 +21,6 @@ import org.schabi.newpipe.settings.SettingsActivity;
import org.schabi.newpipe.util.ThemeHelper; import org.schabi.newpipe.util.ThemeHelper;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
public class HistoryActivity extends AppCompatActivity { public class HistoryActivity extends AppCompatActivity {
@ -116,7 +113,7 @@ public class HistoryActivity extends AppCompatActivity {
fragment = SearchHistoryFragment.newInstance(); fragment = SearchHistoryFragment.newInstance();
break; break;
case 1: case 1:
fragment = WatchedHistoryFragment.newInstance(); fragment = WatchHistoryFragment.newInstance();
break; break;
default: default:
throw new IllegalArgumentException("position: " + position); throw new IllegalArgumentException("position: " + position);

View file

@ -33,11 +33,11 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
public class WatchedHistoryFragment extends HistoryFragment<StreamHistoryEntry> { public class WatchHistoryFragment extends HistoryFragment<StreamHistoryEntry> {
@NonNull @NonNull
public static WatchedHistoryFragment newInstance() { public static WatchHistoryFragment newInstance() {
return new WatchedHistoryFragment(); return new WatchHistoryFragment();
} }
@Override @Override

View file

@ -36,7 +36,7 @@ import org.schabi.newpipe.fragments.list.playlist.PlaylistFragment;
import org.schabi.newpipe.fragments.list.search.SearchFragment; import org.schabi.newpipe.fragments.list.search.SearchFragment;
import org.schabi.newpipe.fragments.local.LocalPlaylistFragment; import org.schabi.newpipe.fragments.local.LocalPlaylistFragment;
import org.schabi.newpipe.fragments.local.bookmark.MostPlayedFragment; import org.schabi.newpipe.fragments.local.bookmark.MostPlayedFragment;
import org.schabi.newpipe.fragments.local.bookmark.WatchHistoryFragment; import org.schabi.newpipe.fragments.local.bookmark.LastPlayedFragment;
import org.schabi.newpipe.history.HistoryActivity; import org.schabi.newpipe.history.HistoryActivity;
import org.schabi.newpipe.player.BackgroundPlayer; import org.schabi.newpipe.player.BackgroundPlayer;
import org.schabi.newpipe.player.BackgroundPlayerActivity; import org.schabi.newpipe.player.BackgroundPlayerActivity;
@ -335,10 +335,10 @@ public class NavigationHelper {
.commit(); .commit();
} }
public static void openWatchHistoryFragment(FragmentManager fragmentManager) { public static void openLastPlayedFragment(FragmentManager fragmentManager) {
fragmentManager.beginTransaction() fragmentManager.beginTransaction()
.setCustomAnimations(R.animator.custom_fade_in, R.animator.custom_fade_out, R.animator.custom_fade_in, R.animator.custom_fade_out) .setCustomAnimations(R.animator.custom_fade_in, R.animator.custom_fade_out, R.animator.custom_fade_in, R.animator.custom_fade_out)
.replace(R.id.fragment_holder, new WatchHistoryFragment()) .replace(R.id.fragment_holder, new LastPlayedFragment())
.addToBackStack(null) .addToBackStack(null)
.commit(); .commit();
} }

View file

@ -8,14 +8,14 @@
android:background="?attr/selectableItemBackground"> android:background="?attr/selectableItemBackground">
<RelativeLayout <RelativeLayout
android:id="@+id/watchHistory" android:id="@+id/lastPlayed"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:clickable="true" android:clickable="true"
android:focusable="true"> android:focusable="true">
<ImageView <ImageView
android:id="@+id/watchHistoryIcon" android:id="@+id/lastPlayedIcon"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="28dp" android:layout_height="28dp"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
@ -26,12 +26,12 @@
tools:ignore="ContentDescription,RtlHardcoded"/> tools:ignore="ContentDescription,RtlHardcoded"/>
<TextView <TextView
android:id="@+id/watchHistoryText" android:id="@+id/lastPlayedText"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:layout_toRightOf="@+id/watchHistoryIcon" android:layout_toRightOf="@+id/lastPlayedIcon"
android:gravity="left|center" android:gravity="left|center"
android:text="@string/title_watch_history" android:text="@string/title_last_played"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" android:textStyle="bold"
@ -39,15 +39,15 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/mostWatched" android:id="@+id/mostPlayed"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/watchHistory" android:layout_below="@id/lastPlayed"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:clickable="true" android:clickable="true"
android:focusable="true"> android:focusable="true">
<ImageView <ImageView
android:id="@+id/mostWatchedIcon" android:id="@+id/mostPlayedIcon"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="28dp" android:layout_height="28dp"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
@ -58,10 +58,10 @@
tools:ignore="ContentDescription,RtlHardcoded"/> tools:ignore="ContentDescription,RtlHardcoded"/>
<TextView <TextView
android:id="@+id/mostWatchedText" android:id="@+id/mostPlayedText"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:layout_toRightOf="@+id/mostWatchedIcon" android:layout_toRightOf="@+id/mostPlayedIcon"
android:gravity="left|center" android:gravity="left|center"
android:text="@string/title_most_played" android:text="@string/title_most_played"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
@ -73,7 +73,7 @@
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_below="@+id/mostWatched" android:layout_below="@+id/mostPlayed"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:background="?attr/separator_color"/> android:background="?attr/separator_color"/>

View file

@ -313,7 +313,7 @@
<string name="delete_item_search_history">Do you want to delete this item from search history?</string> <string name="delete_item_search_history">Do you want to delete this item from search history?</string>
<string name="delete_stream_history_prompt">Do you want to delete this item from watch history?</string> <string name="delete_stream_history_prompt">Do you want to delete this item from watch history?</string>
<string name="delete_all_history_prompt">Are you sure you want to delete all items from history?</string> <string name="delete_all_history_prompt">Are you sure you want to delete all items from history?</string>
<string name="title_watch_history">Watch History</string> <string name="title_last_played">Last Played</string>
<string name="title_most_played">Most Played</string> <string name="title_most_played">Most Played</string>
<!-- Content --> <!-- Content -->