mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	despaget certain parts of the new design
This commit is contained in:
		| @@ -12,7 +12,10 @@ import android.view.View; | |||||||
| import com.nostra13.universalimageloader.core.ImageLoader; | import com.nostra13.universalimageloader.core.ImageLoader; | ||||||
| import com.squareup.leakcanary.RefWatcher; | import com.squareup.leakcanary.RefWatcher; | ||||||
|  |  | ||||||
|  | import org.schabi.newpipe.report.UserAction; | ||||||
|  |  | ||||||
| import icepick.Icepick; | import icepick.Icepick; | ||||||
|  | import icepick.State; | ||||||
|  |  | ||||||
| public abstract class BaseFragment extends Fragment { | public abstract class BaseFragment extends Fragment { | ||||||
|     protected final String TAG = getClass().getSimpleName() + "@" + Integer.toHexString(hashCode()); |     protected final String TAG = getClass().getSimpleName() + "@" + Integer.toHexString(hashCode()); | ||||||
| @@ -21,6 +24,15 @@ public abstract class BaseFragment extends Fragment { | |||||||
|     protected AppCompatActivity activity; |     protected AppCompatActivity activity; | ||||||
|     public static final ImageLoader imageLoader = ImageLoader.getInstance(); |     public static final ImageLoader imageLoader = ImageLoader.getInstance(); | ||||||
|  |  | ||||||
|  |     //These values are used for controlling framgents when they are part of the frontpage | ||||||
|  |     @State | ||||||
|  |     protected boolean useAsFrontPage = false; | ||||||
|  |     protected boolean mIsVisibleToUser = false; | ||||||
|  |  | ||||||
|  |     public void useAsFrontPage(boolean value) { | ||||||
|  |         useAsFrontPage = value; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /*////////////////////////////////////////////////////////////////////////// |     /*////////////////////////////////////////////////////////////////////////// | ||||||
|     // Fragment's Lifecycle |     // Fragment's Lifecycle | ||||||
|     //////////////////////////////////////////////////////////////////////////*/ |     //////////////////////////////////////////////////////////////////////////*/ | ||||||
| @@ -73,6 +85,12 @@ public abstract class BaseFragment extends Fragment { | |||||||
|         if (refWatcher != null) refWatcher.watch(this); |         if (refWatcher != null) refWatcher.watch(this); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public void setUserVisibleHint(boolean isVisibleToUser) { | ||||||
|  |         super.setUserVisibleHint(isVisibleToUser); | ||||||
|  |         mIsVisibleToUser = isVisibleToUser; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /*////////////////////////////////////////////////////////////////////////// |     /*////////////////////////////////////////////////////////////////////////// | ||||||
|     // Init |     // Init | ||||||
|     //////////////////////////////////////////////////////////////////////////*/ |     //////////////////////////////////////////////////////////////////////////*/ | ||||||
| @@ -89,7 +107,8 @@ public abstract class BaseFragment extends Fragment { | |||||||
|  |  | ||||||
|     public void setTitle(String title) { |     public void setTitle(String title) { | ||||||
|         if (DEBUG) Log.d(TAG, "setTitle() called with: title = [" + title + "]"); |         if (DEBUG) Log.d(TAG, "setTitle() called with: title = [" + title + "]"); | ||||||
|         if (activity != null && activity.getSupportActionBar() != null) { |         if((!useAsFrontPage || mIsVisibleToUser) | ||||||
|  |             && (activity != null && activity.getSupportActionBar() != null)) { | ||||||
|             activity.getSupportActionBar().setTitle(title); |             activity.getSupportActionBar().setTitle(title); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -23,19 +23,15 @@ package org.schabi.newpipe; | |||||||
| import android.content.Intent; | import android.content.Intent; | ||||||
| import android.content.SharedPreferences; | import android.content.SharedPreferences; | ||||||
| import android.content.pm.PackageManager; | import android.content.pm.PackageManager; | ||||||
| import android.content.res.Resources; |  | ||||||
| import android.graphics.Color; |  | ||||||
| import android.net.Uri; | import android.net.Uri; | ||||||
| import android.os.Build; | import android.os.Build; | ||||||
| import android.os.Bundle; | import android.os.Bundle; | ||||||
| import android.os.Handler; | import android.os.Handler; | ||||||
| import android.os.Looper; | import android.os.Looper; | ||||||
| import android.preference.PreferenceManager; | import android.preference.PreferenceManager; | ||||||
| import android.support.annotation.ColorInt; |  | ||||||
| import android.support.annotation.NonNull; | import android.support.annotation.NonNull; | ||||||
| import android.support.design.widget.NavigationView; | import android.support.design.widget.NavigationView; | ||||||
| import android.support.v4.app.Fragment; | import android.support.v4.app.Fragment; | ||||||
| import android.support.v4.content.ContextCompat; |  | ||||||
| import android.support.v4.view.GravityCompat; | import android.support.v4.view.GravityCompat; | ||||||
| import android.support.v4.widget.DrawerLayout; | import android.support.v4.widget.DrawerLayout; | ||||||
| import android.support.v7.app.ActionBar; | import android.support.v7.app.ActionBar; | ||||||
| @@ -43,7 +39,6 @@ import android.support.v7.app.ActionBarDrawerToggle; | |||||||
| 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.util.Log; | ||||||
| import android.util.TypedValue; |  | ||||||
| import android.view.Gravity; | import android.view.Gravity; | ||||||
| import android.view.Menu; | import android.view.Menu; | ||||||
| import android.view.MenuInflater; | import android.view.MenuInflater; | ||||||
| @@ -52,7 +47,6 @@ import android.view.View; | |||||||
| import android.view.Window; | import android.view.Window; | ||||||
| import android.view.WindowManager; | import android.view.WindowManager; | ||||||
| import android.widget.Button; | import android.widget.Button; | ||||||
| import android.widget.ImageButton; |  | ||||||
| import android.widget.ImageView; | import android.widget.ImageView; | ||||||
| import android.widget.TextView; | import android.widget.TextView; | ||||||
|  |  | ||||||
| @@ -64,7 +58,6 @@ import org.schabi.newpipe.fragments.MainFragment; | |||||||
| import org.schabi.newpipe.fragments.detail.VideoDetailFragment; | import org.schabi.newpipe.fragments.detail.VideoDetailFragment; | ||||||
| import org.schabi.newpipe.fragments.list.search.SearchFragment; | import org.schabi.newpipe.fragments.list.search.SearchFragment; | ||||||
| import org.schabi.newpipe.report.ErrorActivity; | import org.schabi.newpipe.report.ErrorActivity; | ||||||
| import org.schabi.newpipe.report.UserAction; |  | ||||||
| import org.schabi.newpipe.util.Constants; | import org.schabi.newpipe.util.Constants; | ||||||
| import org.schabi.newpipe.util.KioskTranslator; | import org.schabi.newpipe.util.KioskTranslator; | ||||||
| import org.schabi.newpipe.util.NavigationHelper; | import org.schabi.newpipe.util.NavigationHelper; | ||||||
|   | |||||||
| @@ -51,9 +51,6 @@ public abstract class BaseStateFragment<I> extends BaseFragment implements ViewC | |||||||
|     protected Button errorButtonRetry; |     protected Button errorButtonRetry; | ||||||
|     protected TextView errorTextView; |     protected TextView errorTextView; | ||||||
|  |  | ||||||
|     @State |  | ||||||
|     protected boolean useAsFrontPage = false; |  | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void onViewCreated(View rootView, Bundle savedInstanceState) { |     public void onViewCreated(View rootView, Bundle savedInstanceState) { | ||||||
|         super.onViewCreated(rootView, savedInstanceState); |         super.onViewCreated(rootView, savedInstanceState); | ||||||
| @@ -66,9 +63,6 @@ public abstract class BaseStateFragment<I> extends BaseFragment implements ViewC | |||||||
|         wasLoading.set(isLoading.get()); |         wasLoading.set(isLoading.get()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void useAsFrontPage(boolean value) { |  | ||||||
|         useAsFrontPage = value; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /*////////////////////////////////////////////////////////////////////////// |     /*////////////////////////////////////////////////////////////////////////// | ||||||
|     // Init |     // Init | ||||||
|   | |||||||
| @@ -14,24 +14,16 @@ public class BlankFragment extends BaseFragment { | |||||||
|     @Nullable |     @Nullable | ||||||
|     @Override |     @Override | ||||||
|     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { |     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { | ||||||
|         if(activity != null && activity.getSupportActionBar() != null) { |         setTitle("NewPipe"); | ||||||
|             activity.getSupportActionBar() |  | ||||||
|                     .setTitle("NewPipe"); |  | ||||||
|         } |  | ||||||
|         return inflater.inflate(R.layout.fragment_blank, container, false); |         return inflater.inflate(R.layout.fragment_blank, container, false); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void setUserVisibleHint(boolean isVisibleToUser) { |     public void setUserVisibleHint(boolean isVisibleToUser) { | ||||||
|         super.setUserVisibleHint(isVisibleToUser); |         super.setUserVisibleHint(isVisibleToUser); | ||||||
|         if(isVisibleToUser) { |         setTitle("NewPipe"); | ||||||
|             if(activity != null && activity.getSupportActionBar() != null) { |  | ||||||
|                 activity.getSupportActionBar() |  | ||||||
|                         .setTitle("NewPipe"); |  | ||||||
|             } |  | ||||||
|         // leave this inline. Will make it harder for copy cats. |         // leave this inline. Will make it harder for copy cats. | ||||||
|         // If you are a Copy cat FUCK YOU. |         // If you are a Copy cat FUCK YOU. | ||||||
|         // I WILL FIND YOU, AND I WILL ... |         // I WILL FIND YOU, AND I WILL ... | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -519,13 +519,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void setTitle(String title) { |     public void setTitle(String title) { | ||||||
|         if(!useAsFrontPage) { |  | ||||||
|             super.setTitle(title); |  | ||||||
|             headerTitleView.setText(title); |  | ||||||
|         } else { |  | ||||||
|             if(mIsVisibleToUser) { |  | ||||||
|         super.setTitle(title); |         super.setTitle(title); | ||||||
|             } |         if (!useAsFrontPage) headerTitleView.setText(title); | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -57,7 +57,6 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> { | |||||||
|     protected String kioskId = ""; |     protected String kioskId = ""; | ||||||
|     protected String kioskTranslatedName; |     protected String kioskTranslatedName; | ||||||
|  |  | ||||||
|     private boolean mIsVisibleToUser = false; |  | ||||||
|  |  | ||||||
|     /*////////////////////////////////////////////////////////////////////////// |     /*////////////////////////////////////////////////////////////////////////// | ||||||
|     // Views |     // Views | ||||||
| @@ -97,7 +96,6 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> { | |||||||
|     @Override |     @Override | ||||||
|     public void setUserVisibleHint(boolean isVisibleToUser) { |     public void setUserVisibleHint(boolean isVisibleToUser) { | ||||||
|         super.setUserVisibleHint(isVisibleToUser); |         super.setUserVisibleHint(isVisibleToUser); | ||||||
|         mIsVisibleToUser = isVisibleToUser; |  | ||||||
|         if(useAsFrontPage && isVisibleToUser && activity != null) { |         if(useAsFrontPage && isVisibleToUser && activity != null) { | ||||||
|             try { |             try { | ||||||
|                 setTitle(kioskTranslatedName); |                 setTitle(kioskTranslatedName); | ||||||
| @@ -191,19 +189,4 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> { | |||||||
|                     , "Get next page of: " + url, 0); |                     , "Get next page of: " + url, 0); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|         /*////////////////////////////////////////////////////////////////////////// |  | ||||||
|     // Utils |  | ||||||
|     //////////////////////////////////////////////////////////////////////////*/ |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public void setTitle(String title) { |  | ||||||
|         if(!useAsFrontPage) { |  | ||||||
|             super.setTitle(title); |  | ||||||
|         } else { |  | ||||||
|             if(mIsVisibleToUser) { |  | ||||||
|                 super.setTitle(title); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -6,7 +6,6 @@ import android.os.Parcelable; | |||||||
| import android.support.annotation.NonNull; | import android.support.annotation.NonNull; | ||||||
| import android.support.annotation.Nullable; | import android.support.annotation.Nullable; | ||||||
| import android.support.v4.app.FragmentManager; | import android.support.v4.app.FragmentManager; | ||||||
| import android.support.v7.app.AppCompatActivity; |  | ||||||
| import android.view.LayoutInflater; | import android.view.LayoutInflater; | ||||||
| import android.view.View; | import android.view.View; | ||||||
| import android.view.ViewGroup; | import android.view.ViewGroup; | ||||||
| @@ -20,11 +19,9 @@ import org.schabi.newpipe.database.LocalItem; | |||||||
| import org.schabi.newpipe.database.playlist.PlaylistLocalItem; | import org.schabi.newpipe.database.playlist.PlaylistLocalItem; | ||||||
| import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry; | import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry; | ||||||
| import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity; | import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity; | ||||||
| import org.schabi.newpipe.extractor.NewPipe; |  | ||||||
| import org.schabi.newpipe.local.BaseLocalListFragment; | import org.schabi.newpipe.local.BaseLocalListFragment; | ||||||
| import org.schabi.newpipe.local.playlist.LocalPlaylistManager; | import org.schabi.newpipe.local.playlist.LocalPlaylistManager; | ||||||
| import org.schabi.newpipe.local.playlist.RemotePlaylistManager; | import org.schabi.newpipe.local.playlist.RemotePlaylistManager; | ||||||
| import org.schabi.newpipe.report.ErrorActivity; |  | ||||||
| import org.schabi.newpipe.report.UserAction; | import org.schabi.newpipe.report.UserAction; | ||||||
| import org.schabi.newpipe.util.NavigationHelper; | import org.schabi.newpipe.util.NavigationHelper; | ||||||
| import org.schabi.newpipe.util.OnClickGesture; | import org.schabi.newpipe.util.OnClickGesture; | ||||||
|   | |||||||
| @@ -179,19 +179,9 @@ public class FeedFragment extends BaseListFragment<List<SubscriptionEntity>, Voi | |||||||
|         showLoading(); |         showLoading(); | ||||||
|         showListFooter(true); |         showListFooter(true); | ||||||
|         subscriptionObserver = subscriptionService.getSubscription() |         subscriptionObserver = subscriptionService.getSubscription() | ||||||
|                 .onErrorReturnItem(Collections.<SubscriptionEntity>emptyList()) |                 .onErrorReturnItem(Collections.emptyList()) | ||||||
|                 .observeOn(AndroidSchedulers.mainThread()) |                 .observeOn(AndroidSchedulers.mainThread()) | ||||||
|                 .subscribe(new Consumer<List<SubscriptionEntity>>() { |                 .subscribe(this::handleResult, this::onError); | ||||||
|                     @Override |  | ||||||
|                     public void accept(List<SubscriptionEntity> subscriptionEntities) throws Exception { |  | ||||||
|                         handleResult(subscriptionEntities); |  | ||||||
|                     } |  | ||||||
|                 }, new Consumer<Throwable>() { |  | ||||||
|                     @Override |  | ||||||
|                     public void accept(Throwable throwable) throws Exception { |  | ||||||
|                         onError(throwable); |  | ||||||
|                     } |  | ||||||
|                 }); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
| @@ -242,13 +232,12 @@ public class FeedFragment extends BaseListFragment<List<SubscriptionEntity>, Voi | |||||||
|                 if (!itemsLoaded.contains(subscriptionEntity.getServiceId() + subscriptionEntity.getUrl())) { |                 if (!itemsLoaded.contains(subscriptionEntity.getServiceId() + subscriptionEntity.getUrl())) { | ||||||
|                     subscriptionService.getChannelInfo(subscriptionEntity) |                     subscriptionService.getChannelInfo(subscriptionEntity) | ||||||
|                             .observeOn(AndroidSchedulers.mainThread()) |                             .observeOn(AndroidSchedulers.mainThread()) | ||||||
|                             .onErrorComplete(new Predicate<Throwable>() { |                             .onErrorComplete( | ||||||
|                                 @Override |                                     (@io.reactivex.annotations.NonNull Throwable throwable) -> | ||||||
|                                 public boolean test(@io.reactivex.annotations.NonNull Throwable throwable) throws Exception { |                                             FeedFragment.super.onError(throwable)) | ||||||
|                                     return FeedFragment.super.onError(throwable); |                             .subscribe( | ||||||
|                                 } |                                     getChannelInfoObserver(subscriptionEntity.getServiceId(), | ||||||
|                             }) |                                             subscriptionEntity.getUrl())); | ||||||
|                             .subscribe(getChannelInfoObserver(subscriptionEntity.getServiceId(), subscriptionEntity.getUrl())); |  | ||||||
|                 } else { |                 } else { | ||||||
|                     requestFeed(1); |                     requestFeed(1); | ||||||
|                 } |                 } | ||||||
| @@ -319,7 +308,10 @@ public class FeedFragment extends BaseListFragment<List<SubscriptionEntity>, Voi | |||||||
|  |  | ||||||
|             @Override |             @Override | ||||||
|             public void onError(Throwable exception) { |             public void onError(Throwable exception) { | ||||||
|                 showSnackBarError(exception, UserAction.SUBSCRIPTION, NewPipe.getNameOfService(serviceId), url, 0); |                 showSnackBarError(exception, | ||||||
|  |                         UserAction.SUBSCRIPTION, | ||||||
|  |                         NewPipe.getNameOfService(serviceId), | ||||||
|  |                         url, 0); | ||||||
|                 requestFeed(1); |                 requestFeed(1); | ||||||
|                 onDone(); |                 onDone(); | ||||||
|             } |             } | ||||||
| @@ -364,12 +356,7 @@ public class FeedFragment extends BaseListFragment<List<SubscriptionEntity>, Voi | |||||||
|         delayHandler.removeCallbacksAndMessages(null); |         delayHandler.removeCallbacksAndMessages(null); | ||||||
|         // Add a little of a delay when requesting more items because the cache is so fast, |         // Add a little of a delay when requesting more items because the cache is so fast, | ||||||
|         // that the view seems stuck to the user when he scroll to the bottom |         // that the view seems stuck to the user when he scroll to the bottom | ||||||
|         delayHandler.postDelayed(new Runnable() { |         delayHandler.postDelayed(() -> requestFeed(FEED_LOAD_COUNT), 300); | ||||||
|             @Override |  | ||||||
|             public void run() { |  | ||||||
|                 requestFeed(FEED_LOAD_COUNT); |  | ||||||
|             } |  | ||||||
|         }, 300); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
| @@ -426,7 +413,9 @@ public class FeedFragment extends BaseListFragment<List<SubscriptionEntity>, Voi | |||||||
|         int heightPixels = getResources().getDisplayMetrics().heightPixels; |         int heightPixels = getResources().getDisplayMetrics().heightPixels; | ||||||
|         int itemHeightPixels = activity.getResources().getDimensionPixelSize(R.dimen.video_item_search_height); |         int itemHeightPixels = activity.getResources().getDimensionPixelSize(R.dimen.video_item_search_height); | ||||||
|  |  | ||||||
|         int items = itemHeightPixels > 0 ? heightPixels / itemHeightPixels + OFF_SCREEN_ITEMS_COUNT : MIN_ITEMS_INITIAL_LOAD; |         int items = itemHeightPixels > 0 | ||||||
|  |                 ? heightPixels / itemHeightPixels + OFF_SCREEN_ITEMS_COUNT | ||||||
|  |                 : MIN_ITEMS_INITIAL_LOAD; | ||||||
|         return Math.max(MIN_ITEMS_INITIAL_LOAD, items); |         return Math.max(MIN_ITEMS_INITIAL_LOAD, items); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -444,8 +433,14 @@ public class FeedFragment extends BaseListFragment<List<SubscriptionEntity>, Voi | |||||||
|     protected boolean onError(Throwable exception) { |     protected boolean onError(Throwable exception) { | ||||||
|         if (super.onError(exception)) return true; |         if (super.onError(exception)) return true; | ||||||
|  |  | ||||||
|         int errorId = exception instanceof ExtractionException ? R.string.parsing_error : R.string.general_error; |         int errorId = exception instanceof ExtractionException | ||||||
|         onUnrecoverableError(exception, UserAction.SOMETHING_ELSE, "none", "Requesting feed", errorId); |                 ? R.string.parsing_error | ||||||
|  |                 : R.string.general_error; | ||||||
|  |         onUnrecoverableError(exception, | ||||||
|  |                 UserAction.SOMETHING_ELSE, | ||||||
|  |                 "none", | ||||||
|  |                 "Requesting feed", | ||||||
|  |                 errorId); | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -74,7 +74,7 @@ public class StatisticsPlaylistFragment | |||||||
|                 return results; |                 return results; | ||||||
|             case MOST_PLAYED: |             case MOST_PLAYED: | ||||||
|                 Collections.sort(results, (left, right) -> |                 Collections.sort(results, (left, right) -> | ||||||
|                         ((Long) right.watchCount).compareTo(left.watchCount)); |                         Long.compare(right.watchCount, left.watchCount)); | ||||||
|                 return results; |                 return results; | ||||||
|             default: return null; |             default: return null; | ||||||
|         } |         } | ||||||
| @@ -356,7 +356,7 @@ public class StatisticsPlaylistFragment | |||||||
|             final Disposable onDelete = recordManager.deleteStreamHistory(entry.streamId) |             final Disposable onDelete = recordManager.deleteStreamHistory(entry.streamId) | ||||||
|                     .observeOn(AndroidSchedulers.mainThread()) |                     .observeOn(AndroidSchedulers.mainThread()) | ||||||
|                     .subscribe( |                     .subscribe( | ||||||
|                             howManyDelted -> { |                             howManyDeleted -> { | ||||||
|                                 if(getView() != null) { |                                 if(getView() != null) { | ||||||
|                                     Snackbar.make(getView(), R.string.one_item_deleted, |                                     Snackbar.make(getView(), R.string.one_item_deleted, | ||||||
|                                             Snackbar.LENGTH_SHORT).show(); |                                             Snackbar.LENGTH_SHORT).show(); | ||||||
|   | |||||||
| @@ -210,7 +210,8 @@ public class SubscriptionFragment extends BaseStateFragment<List<SubscriptionEnt | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void setupImportFromItems(final ViewGroup listHolder) { |     private void setupImportFromItems(final ViewGroup listHolder) { | ||||||
|         final View previousBackupItem = addItemView(getString(R.string.previous_export), ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.ic_backup), listHolder); |         final View previousBackupItem = addItemView(getString(R.string.previous_export), | ||||||
|  |                 ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.ic_backup), listHolder); | ||||||
|         previousBackupItem.setOnClickListener(item -> onImportPreviousSelected()); |         previousBackupItem.setOnClickListener(item -> onImportPreviousSelected()); | ||||||
|  |  | ||||||
|         final int iconColor = ThemeHelper.isLightThemeSelected(getContext()) ? Color.BLACK : Color.WHITE; |         final int iconColor = ThemeHelper.isLightThemeSelected(getContext()) ? Color.BLACK : Color.WHITE; | ||||||
| @@ -323,7 +324,9 @@ public class SubscriptionFragment extends BaseStateFragment<List<SubscriptionEnt | |||||||
|             public void selected(ChannelInfoItem selectedItem) { |             public void selected(ChannelInfoItem selectedItem) { | ||||||
|                 FragmentManager fragmentManager = getFM(); |                 FragmentManager fragmentManager = getFM(); | ||||||
|                 NavigationHelper.openChannelFragment(fragmentManager, |                 NavigationHelper.openChannelFragment(fragmentManager, | ||||||
|                         selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName()); |                         selectedItem.getServiceId(), | ||||||
|  |                         selectedItem.getUrl(), | ||||||
|  |                         selectedItem.getName()); | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
| @@ -402,10 +405,13 @@ public class SubscriptionFragment extends BaseStateFragment<List<SubscriptionEnt | |||||||
|  |  | ||||||
|     private List<InfoItem> getSubscriptionItems(List<SubscriptionEntity> subscriptions) { |     private List<InfoItem> getSubscriptionItems(List<SubscriptionEntity> subscriptions) { | ||||||
|         List<InfoItem> items = new ArrayList<>(); |         List<InfoItem> items = new ArrayList<>(); | ||||||
|         for (final SubscriptionEntity subscription : subscriptions) items.add(subscription.toChannelInfoItem()); |         for (final SubscriptionEntity subscription : subscriptions) { | ||||||
|  |             items.add(subscription.toChannelInfoItem()); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         Collections.sort(items, |         Collections.sort(items, | ||||||
|                 (InfoItem o1, InfoItem o2) -> o1.getName().compareToIgnoreCase(o2.getName())); |                 (InfoItem o1, InfoItem o2) -> | ||||||
|  |                         o1.getName().compareToIgnoreCase(o2.getName())); | ||||||
|         return items; |         return items; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -434,7 +440,11 @@ public class SubscriptionFragment extends BaseStateFragment<List<SubscriptionEnt | |||||||
|         resetFragment(); |         resetFragment(); | ||||||
|         if (super.onError(exception)) return true; |         if (super.onError(exception)) return true; | ||||||
|  |  | ||||||
|         onUnrecoverableError(exception, UserAction.SOMETHING_ELSE, "none", "Subscriptions", R.string.general_error); |         onUnrecoverableError(exception, | ||||||
|  |                 UserAction.SOMETHING_ELSE, | ||||||
|  |                 "none", | ||||||
|  |                 "Subscriptions", | ||||||
|  |                 R.string.general_error); | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -10,7 +10,6 @@ import org.schabi.newpipe.extractor.NewPipe; | |||||||
| import org.schabi.newpipe.extractor.ServiceList; | import org.schabi.newpipe.extractor.ServiceList; | ||||||
| import org.schabi.newpipe.extractor.StreamingService; | import org.schabi.newpipe.extractor.StreamingService; | ||||||
| import org.schabi.newpipe.extractor.exceptions.ExtractionException; | import org.schabi.newpipe.extractor.exceptions.ExtractionException; | ||||||
| import org.schabi.newpipe.fragments.MainFragment; |  | ||||||
|  |  | ||||||
| import java.util.concurrent.TimeUnit; | import java.util.concurrent.TimeUnit; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Christian Schabesberger
					Christian Schabesberger