From 42a2bc8a9a8aa5e6368d31e123271c53c234535e Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Fri, 16 Feb 2018 11:31:25 +0100 Subject: [PATCH 1/3] clean DetailFragment code --- .../fragments/detail/VideoDetailFragment.java | 220 ++++++++++++------ 1 file changed, 151 insertions(+), 69 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 206f6edd8..a4c1bacbf 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -95,7 +95,12 @@ import io.reactivex.schedulers.Schedulers; import static org.schabi.newpipe.util.AnimationUtils.animateView; -public class VideoDetailFragment extends BaseStateFragment implements BackPressable, SharedPreferences.OnSharedPreferenceChangeListener, View.OnClickListener, View.OnLongClickListener { +public class VideoDetailFragment + extends BaseStateFragment + implements BackPressable, + SharedPreferences.OnSharedPreferenceChangeListener, + View.OnClickListener, + View.OnLongClickListener { public static final String AUTO_PLAY = "auto_play"; // Amount of videos to show on start @@ -186,8 +191,10 @@ public class VideoDetailFragment extends BaseStateFragment implement super.onCreate(savedInstanceState); setHasOptionsMenu(true); - showRelatedStreams = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(getString(R.string.show_next_video_key), true); - PreferenceManager.getDefaultSharedPreferences(activity).registerOnSharedPreferenceChangeListener(this); + showRelatedStreams = PreferenceManager.getDefaultSharedPreferences(activity) + .getBoolean(getString(R.string.show_next_video_key), true); + PreferenceManager.getDefaultSharedPreferences(activity) + .registerOnSharedPreferenceChangeListener(this); } @Override @@ -211,7 +218,10 @@ public class VideoDetailFragment extends BaseStateFragment implement if ((updateFlags & RESOLUTIONS_MENU_UPDATE_FLAG) != 0) setupActionBarHandler(currentInfo); } - if ((updateFlags & TOOLBAR_ITEMS_UPDATE_FLAG) != 0 && actionBarHandler != null) actionBarHandler.updateItemsVisibility(); + if ((updateFlags & TOOLBAR_ITEMS_UPDATE_FLAG) != 0 + && actionBarHandler != null) { + actionBarHandler.updateItemsVisibility(); + } updateFlags = 0; } @@ -224,7 +234,8 @@ public class VideoDetailFragment extends BaseStateFragment implement @Override public void onDestroy() { super.onDestroy(); - PreferenceManager.getDefaultSharedPreferences(activity).unregisterOnSharedPreferenceChangeListener(this); + PreferenceManager.getDefaultSharedPreferences(activity) + .unregisterOnSharedPreferenceChangeListener(this); if (currentWorker != null) currentWorker.dispose(); if (disposables != null) disposables.clear(); @@ -285,7 +296,8 @@ public class VideoDetailFragment extends BaseStateFragment implement // Check if the next video label and video is visible, // if it is, include the two elements in the next check int nextCount = currentInfo != null && currentInfo.getNextVideo() != null ? 2 : 0; - if (relatedStreamsView != null && relatedStreamsView.getChildCount() > INITIAL_RELATED_VIDEOS + nextCount) { + if (relatedStreamsView != null + && relatedStreamsView.getChildCount() > INITIAL_RELATED_VIDEOS + nextCount) { outState.putSerializable(WAS_RELATED_EXPANDED_KEY, true); } @@ -417,8 +429,10 @@ public class VideoDetailFragment extends BaseStateFragment implement int initialCount = INITIAL_RELATED_VIDEOS + nextCount; if (relatedStreamsView.getChildCount() > initialCount) { - relatedStreamsView.removeViews(initialCount, relatedStreamsView.getChildCount() - (initialCount)); - relatedStreamExpandButton.setImageDrawable(ContextCompat.getDrawable(activity, ThemeHelper.resolveResourceIdFromAttr(activity, R.attr.expand))); + relatedStreamsView.removeViews(initialCount, + relatedStreamsView.getChildCount() - (initialCount)); + relatedStreamExpandButton.setImageDrawable(ContextCompat.getDrawable( + activity, ThemeHelper.resolveResourceIdFromAttr(activity, R.attr.expand))); return; } @@ -428,7 +442,9 @@ public class VideoDetailFragment extends BaseStateFragment implement //Log.d(TAG, "i = " + i); relatedStreamsView.addView(infoItemBuilder.buildView(relatedStreamsView, item)); } - relatedStreamExpandButton.setImageDrawable(ContextCompat.getDrawable(activity, ThemeHelper.resolveResourceIdFromAttr(activity, R.attr.collapse))); + relatedStreamExpandButton.setImageDrawable( + ContextCompat.getDrawable(activity, + ThemeHelper.resolveResourceIdFromAttr(activity, R.attr.collapse))); } /*////////////////////////////////////////////////////////////////////////// @@ -547,7 +563,10 @@ public class VideoDetailFragment extends BaseStateFragment implement private View.OnTouchListener getOnControlsTouchListener() { return (View view, MotionEvent motionEvent) -> { - if (!PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(getString(R.string.show_hold_to_append_key), true)) return false; + if (!PreferenceManager.getDefaultSharedPreferences(activity) + .getBoolean(getString(R.string.show_hold_to_append_key), true)) { + return false; + } if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { animateView(appendControlsDetail, true, 250, 0, () -> @@ -560,14 +579,25 @@ public class VideoDetailFragment extends BaseStateFragment implement private void initThumbnailViews(StreamInfo info) { thumbnailImageView.setImageResource(R.drawable.dummy_thumbnail_dark); if (!TextUtils.isEmpty(info.getThumbnailUrl())) { - imageLoader.displayImage(info.getThumbnailUrl(), thumbnailImageView, DISPLAY_THUMBNAIL_OPTIONS, new SimpleImageLoadingListener() { + imageLoader.displayImage( + info.getThumbnailUrl(), + thumbnailImageView, + DISPLAY_THUMBNAIL_OPTIONS, new SimpleImageLoadingListener() { @Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { - ErrorActivity.reportError(activity, failReason.getCause(), null, activity.findViewById(android.R.id.content), ErrorActivity.ErrorInfo.make(UserAction.LOAD_IMAGE, NewPipe.getNameOfService(currentInfo.getServiceId()), imageUri, R.string.could_not_load_thumbnails)); + ErrorActivity.reportError( + activity, + failReason.getCause(), + null, + activity.findViewById(android.R.id.content), + ErrorActivity.ErrorInfo.make(UserAction.LOAD_IMAGE, + NewPipe.getNameOfService(currentInfo.getServiceId()), + imageUri, + R.string.could_not_load_thumbnails)); } }); } - + if (!TextUtils.isEmpty(info.getUploaderAvatarUrl())) { imageLoader.displayImage(info.getUploaderAvatarUrl(), uploaderThumb, DISPLAY_AVATAR_OPTIONS); } @@ -578,14 +608,17 @@ public class VideoDetailFragment extends BaseStateFragment implement if (info.getNextVideo() != null && showRelatedStreams) { nextStreamTitle.setVisibility(View.VISIBLE); - relatedStreamsView.addView(infoItemBuilder.buildView(relatedStreamsView, info.getNextVideo())); + relatedStreamsView.addView( + infoItemBuilder.buildView(relatedStreamsView, info.getNextVideo())); relatedStreamsView.addView(getSeparatorView()); relatedStreamRootLayout.setVisibility(View.VISIBLE); } else nextStreamTitle.setVisibility(View.GONE); if (info.related_streams != null && !info.related_streams.isEmpty() && showRelatedStreams) { //long first = System.nanoTime(), each; - int to = info.getRelatedStreams().size() >= INITIAL_RELATED_VIDEOS ? INITIAL_RELATED_VIDEOS : info.getRelatedStreams().size(); + int to = info.getRelatedStreams().size() >= INITIAL_RELATED_VIDEOS + ? INITIAL_RELATED_VIDEOS + : info.getRelatedStreams().size(); for (int i = 0; i < to; i++) { InfoItem item = info.getRelatedStreams().get(i); //each = System.nanoTime(); @@ -597,7 +630,8 @@ public class VideoDetailFragment extends BaseStateFragment implement relatedStreamRootLayout.setVisibility(View.VISIBLE); relatedStreamExpandButton.setVisibility(View.VISIBLE); - relatedStreamExpandButton.setImageDrawable(ContextCompat.getDrawable(activity, ThemeHelper.resolveResourceIdFromAttr(activity, R.attr.expand))); + relatedStreamExpandButton.setImageDrawable(ContextCompat.getDrawable( + activity, ThemeHelper.resolveResourceIdFromAttr(activity, R.attr.expand))); } else { if (info.getNextVideo() == null) relatedStreamRootLayout.setVisibility(View.GONE); relatedStreamExpandButton.setVisibility(View.GONE); @@ -620,7 +654,8 @@ public class VideoDetailFragment extends BaseStateFragment implement @Override public boolean onOptionsItemSelected(MenuItem item) { - return (!isLoading.get() && actionBarHandler.onItemSelected(item)) || super.onOptionsItemSelected(item); + return (!isLoading.get() && actionBarHandler.onItemSelected(item)) + || super.onOptionsItemSelected(item); } private static void showInstallKoreDialog(final Context context) { @@ -634,7 +669,8 @@ public class VideoDetailFragment extends BaseStateFragment implement private void setupActionBarHandler(final StreamInfo info) { if (DEBUG) Log.d(TAG, "setupActionBarHandler() called with: info = [" + info + "]"); - sortedStreamVideosList = new ArrayList<>(ListHelper.getSortedStreamVideosList(activity, info.getVideoStreams(), info.getVideoOnlyStreams(), false)); + sortedStreamVideosList = new ArrayList<>(ListHelper.getSortedStreamVideosList( + activity, info.getVideoStreams(), info.getVideoOnlyStreams(), false)); actionBarHandler.setupStreamList(sortedStreamVideosList, spinnerToolbar); actionBarHandler.setOnShareListener(selectedStreamId -> shareUrl(info.name, info.url)); @@ -685,7 +721,10 @@ public class VideoDetailFragment extends BaseStateFragment implement public void setTitleToUrl(int serviceId, String videoUrl, String name) { if (name != null && !name.isEmpty()) { for (StackItem stackItem : stack) { - if (stack.peek().getServiceId() == serviceId && stackItem.getUrl().equals(videoUrl)) stackItem.setTitle(name); + if (stack.peek().getServiceId() == serviceId + && stackItem.getUrl().equals(videoUrl)) { + stackItem.setTitle(name); + } } } } @@ -727,18 +766,18 @@ public class VideoDetailFragment extends BaseStateFragment implement pushToStack(serviceId, url, name); showLoading(); - Log.d(TAG, "prepareAndHandleInfo() called parallaxScrollRootView.getScrollY(): " + parallaxScrollRootView.getScrollY()); + Log.d(TAG, "prepareAndHandleInfo() called parallaxScrollRootView.getScrollY(): " + + parallaxScrollRootView.getScrollY()); final boolean greaterThanThreshold = parallaxScrollRootView.getScrollY() > (int) (getResources().getDisplayMetrics().heightPixels * .1f); if (scrollToTop) parallaxScrollRootView.smoothScrollTo(0, 0); - animateView(contentRootLayoutHiding, false, greaterThanThreshold ? 250 : 0, 0, new Runnable() { - @Override - public void run() { - handleResult(info); - showContentWithAnimation(120, 0, .01f); - } - }); + animateView(contentRootLayoutHiding, + false, + greaterThanThreshold ? 250 : 0, 0, () -> { + handleResult(info); + showContentWithAnimation(120, 0, .01f); + }); } protected void prepareAndLoadInfo() { @@ -773,7 +812,8 @@ public class VideoDetailFragment extends BaseStateFragment implement //////////////////////////////////////////////////////////////////////////*/ private void openBackgroundPlayer(final boolean append) { - AudioStream audioStream = currentInfo.getAudioStreams().get(ListHelper.getDefaultAudioFormat(activity, currentInfo.getAudioStreams())); + AudioStream audioStream = currentInfo.getAudioStreams() + .get(ListHelper.getDefaultAudioFormat(activity, currentInfo.getAudioStreams())); boolean useExternalAudioPlayer = PreferenceManager.getDefaultSharedPreferences(activity) .getBoolean(activity.getString(R.string.use_external_audio_player_key), false); @@ -781,7 +821,10 @@ public class VideoDetailFragment extends BaseStateFragment implement if (!useExternalAudioPlayer && android.os.Build.VERSION.SDK_INT >= 16) { openNormalBackgroundPlayer(append); } else { - NavigationHelper.playOnExternalPlayer(activity, currentInfo.getName(), currentInfo.getUploaderName(), audioStream); + NavigationHelper.playOnExternalPlayer(activity, + currentInfo.getName(), + currentInfo.getUploaderName(), + audioStream); } } @@ -806,8 +849,12 @@ public class VideoDetailFragment extends BaseStateFragment implement private void openVideoPlayer() { VideoStream selectedVideoStream = getSelectedVideoStream(); - if (PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(this.getString(R.string.use_external_video_player_key), false)) { - NavigationHelper.playOnExternalPlayer(activity, currentInfo.getName(), currentInfo.getUploaderName(), selectedVideoStream); + if (PreferenceManager.getDefaultSharedPreferences(activity) + .getBoolean(this.getString(R.string.use_external_video_player_key), false)) { + NavigationHelper.playOnExternalPlayer(activity, + currentInfo.getName(), + currentInfo.getUploaderName(), + selectedVideoStream); } else { openNormalPlayer(selectedVideoStream); } @@ -828,7 +875,10 @@ public class VideoDetailFragment extends BaseStateFragment implement if (!useOldPlayer) { // ExoPlayer final PlayQueue playQueue = new SinglePlayQueue(currentInfo); - mIntent = NavigationHelper.getPlayerIntent(activity, MainVideoPlayer.class, playQueue, getSelectedVideoStream().getResolution()); + mIntent = NavigationHelper.getPlayerIntent(activity, + MainVideoPlayer.class, + playQueue, + getSelectedVideoStream().getResolution()); } else { // Internal Player mIntent = new Intent(activity, PlayVideoActivity.class) @@ -859,28 +909,31 @@ public class VideoDetailFragment extends BaseStateFragment implement disposables.add(Single.just(descriptionHtml) .map((@io.reactivex.annotations.NonNull String description) -> { - Spanned parsedDescription; - if (Build.VERSION.SDK_INT >= 24) { - parsedDescription = Html.fromHtml(description, 0); - } else { - //noinspection deprecation - parsedDescription = Html.fromHtml(description); - } - return parsedDescription; + Spanned parsedDescription; + if (Build.VERSION.SDK_INT >= 24) { + parsedDescription = Html.fromHtml(description, 0); + } else { + //noinspection deprecation + parsedDescription = Html.fromHtml(description); + } + return parsedDescription; }) .subscribeOn(Schedulers.computation()) .observeOn(AndroidSchedulers.mainThread()) .subscribe((@io.reactivex.annotations.NonNull Spanned spanned) -> { - videoDescriptionView.setText(spanned); - videoDescriptionView.setVisibility(View.VISIBLE); + videoDescriptionView.setText(spanned); + videoDescriptionView.setVisibility(View.VISIBLE); })); } private View getSeparatorView() { View separator = new View(activity); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1); - int m8 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); - int m5 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics()); + LinearLayout.LayoutParams params = + new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1); + int m8 = (int) TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); + int m5 = (int) TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics()); params.setMargins(m8, m5, m8, m5); separator.setLayoutParams(params); @@ -894,13 +947,20 @@ public class VideoDetailFragment extends BaseStateFragment implement private void setHeightThumbnail() { final DisplayMetrics metrics = getResources().getDisplayMetrics(); boolean isPortrait = metrics.heightPixels > metrics.widthPixels; - int height = isPortrait ? (int) (metrics.widthPixels / (16.0f / 9.0f)) : (int) (metrics.heightPixels / 2f); - thumbnailImageView.setScaleType(isPortrait ? ImageView.ScaleType.CENTER_CROP : ImageView.ScaleType.FIT_CENTER); - thumbnailImageView.setLayoutParams(new FrameLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, height)); + int height = isPortrait + ? (int) (metrics.widthPixels / (16.0f / 9.0f)) + : (int) (metrics.heightPixels / 2f); + thumbnailImageView.setScaleType(isPortrait + ? ImageView.ScaleType.CENTER_CROP + : ImageView.ScaleType.FIT_CENTER); + thumbnailImageView.setLayoutParams( + new FrameLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, height)); thumbnailImageView.setMinimumHeight(height); } - private void showContentWithAnimation(long duration, long delay, @FloatRange(from = 0.0f, to = 1.0f) float translationPercent) { + private void showContentWithAnimation(long duration, + long delay, + @FloatRange(from = 0.0f, to = 1.0f) float translationPercent) { int translationY = (int) (getResources().getDisplayMetrics().heightPixels * (translationPercent > 0.0f ? translationPercent : .06f)); @@ -908,23 +968,38 @@ public class VideoDetailFragment extends BaseStateFragment implement contentRootLayoutHiding.setAlpha(0f); contentRootLayoutHiding.setTranslationY(translationY); contentRootLayoutHiding.setVisibility(View.VISIBLE); - contentRootLayoutHiding.animate().alpha(1f).translationY(0) - .setStartDelay(delay).setDuration(duration).setInterpolator(new FastOutSlowInInterpolator()).start(); + contentRootLayoutHiding.animate() + .alpha(1f) + .translationY(0) + .setStartDelay(delay) + .setDuration(duration) + .setInterpolator(new FastOutSlowInInterpolator()) + .start(); uploaderRootLayout.animate().setListener(null).cancel(); uploaderRootLayout.setAlpha(0f); uploaderRootLayout.setTranslationY(translationY); uploaderRootLayout.setVisibility(View.VISIBLE); - uploaderRootLayout.animate().alpha(1f).translationY(0) - .setStartDelay((long) (duration * .5f) + delay).setDuration(duration).setInterpolator(new FastOutSlowInInterpolator()).start(); + uploaderRootLayout.animate() + .alpha(1f) + .translationY(0) + .setStartDelay((long) (duration * .5f) + delay) + .setDuration(duration) + .setInterpolator(new FastOutSlowInInterpolator()) + .start(); if (showRelatedStreams) { relatedStreamRootLayout.animate().setListener(null).cancel(); relatedStreamRootLayout.setAlpha(0f); relatedStreamRootLayout.setTranslationY(translationY); relatedStreamRootLayout.setVisibility(View.VISIBLE); - relatedStreamRootLayout.animate().alpha(1f).translationY(0) - .setStartDelay((long) (duration * .8f) + delay).setDuration(duration).setInterpolator(new FastOutSlowInInterpolator()).start(); + relatedStreamRootLayout.animate() + .alpha(1f) + .translationY(0) + .setStartDelay((long) (duration * .8f) + delay) + .setDuration(duration) + .setInterpolator(new FastOutSlowInInterpolator()) + .start(); } } @@ -938,12 +1013,8 @@ public class VideoDetailFragment extends BaseStateFragment implement if (thumbnailImageView == null || activity == null) return; thumbnailImageView.setImageDrawable(ContextCompat.getDrawable(activity, imageResource)); - animateView(thumbnailImageView, false, 0, 0, new Runnable() { - @Override - public void run() { - animateView(thumbnailImageView, true, 500); - } - }); + animateView(thumbnailImageView, false, 0, 0, + () -> animateView(thumbnailImageView, true, 500)); } @Override @@ -1058,7 +1129,11 @@ public class VideoDetailFragment extends BaseStateFragment implement setTitleToUrl(info.getServiceId(), info.getUrl(), info.getName()); if (!info.getErrors().isEmpty()) { - showSnackBarError(info.getErrors(), UserAction.REQUESTED_STREAM, NewPipe.getNameOfService(info.getServiceId()), info.getUrl(), 0); + showSnackBarError(info.getErrors(), + UserAction.REQUESTED_STREAM, + NewPipe.getNameOfService(info.getServiceId()), + info.getUrl(), + 0); } if (info.video_streams.isEmpty() && info.video_only_streams.isEmpty()) { @@ -1090,9 +1165,16 @@ public class VideoDetailFragment extends BaseStateFragment implement } else if (exception instanceof ContentNotAvailableException) { showError(getString(R.string.content_not_available), false); } else { - int errorId = exception instanceof YoutubeStreamExtractor.DecryptException ? R.string.youtube_signature_decryption_error : - exception instanceof ParsingException ? R.string.parsing_error : R.string.general_error; - onUnrecoverableError(exception, UserAction.REQUESTED_STREAM, NewPipe.getNameOfService(serviceId), url, errorId); + int errorId = exception instanceof YoutubeStreamExtractor.DecryptException + ? R.string.youtube_signature_decryption_error + : exception instanceof ParsingException + ? R.string.parsing_error + : R.string.general_error; + onUnrecoverableError(exception, + UserAction.REQUESTED_STREAM, + NewPipe.getNameOfService(serviceId), + url, + errorId); } return true; @@ -1100,10 +1182,10 @@ public class VideoDetailFragment extends BaseStateFragment implement public void onBlockedByGemaError() { thumbnailBackgroundButton.setOnClickListener((View v) -> { - Intent intent = new Intent(); - intent.setAction(Intent.ACTION_VIEW); - intent.setData(Uri.parse(getString(R.string.c3s_url))); - startActivity(intent); + Intent intent = new Intent(); + intent.setAction(Intent.ACTION_VIEW); + intent.setData(Uri.parse(getString(R.string.c3s_url))); + startActivity(intent); }); showError(getString(R.string.blocked_by_gema), false, R.drawable.gruese_die_gema); From b12f0490f38c692f3872c8f5f88334e40046de90 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Fri, 16 Feb 2018 12:18:15 +0100 Subject: [PATCH 2/3] remove ActionBarHandler --- .../fragments/detail/ActionBarHandler.java | 150 ------------------ .../fragments/detail/VideoDetailFragment.java | 102 +++++++++--- 2 files changed, 79 insertions(+), 173 deletions(-) delete mode 100644 app/src/main/java/org/schabi/newpipe/fragments/detail/ActionBarHandler.java diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/ActionBarHandler.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/ActionBarHandler.java deleted file mode 100644 index d928166ab..000000000 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/ActionBarHandler.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.schabi.newpipe.fragments.detail; - -import android.content.SharedPreferences; -import android.preference.PreferenceManager; -import android.support.v7.app.AppCompatActivity; -import android.util.Log; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; -import android.widget.AdapterView; -import android.widget.Spinner; - -import org.schabi.newpipe.R; -import org.schabi.newpipe.extractor.stream.VideoStream; -import org.schabi.newpipe.util.ListHelper; - -import java.util.List; - -/* - * Created by Christian Schabesberger on 18.08.15. - *

- * Copyright (C) Christian Schabesberger 2015 - * DetailsMenuHandler.java is part of NewPipe. - *

- * NewPipe is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * NewPipe is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with NewPipe. If not, see . - */ - - -@SuppressWarnings("WeakerAccess") -class ActionBarHandler { - private static final String TAG = "ActionBarHandler"; - - private AppCompatActivity activity; - private int selectedVideoStream = -1; - - private SharedPreferences defaultPreferences; - - private Menu menu; - - // Only callbacks are listed here, there are more actions which don't need a callback. - // those are edited directly. Typically VideoDetailFragment will implement those callbacks. - private OnActionListener onShareListener; - private OnActionListener onOpenInBrowserListener; - private OnActionListener onPlayWithKodiListener; - - // Triggered when a stream related action is triggered. - public interface OnActionListener { - void onActionSelected(int selectedStreamId); - } - - public ActionBarHandler(AppCompatActivity activity) { - this.activity = activity; - } - - public void setupStreamList(final List videoStreams, Spinner toolbarSpinner) { - if (activity == null) return; - - selectedVideoStream = ListHelper.getDefaultResolutionIndex(activity, videoStreams); - - boolean isExternalPlayerEnabled = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(activity.getString(R.string.use_external_video_player_key), false); - toolbarSpinner.setAdapter(new SpinnerToolbarAdapter(activity, videoStreams, isExternalPlayerEnabled)); - toolbarSpinner.setSelection(selectedVideoStream); - toolbarSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView parent, View view, int position, long id) { - selectedVideoStream = position; - } - - @Override - public void onNothingSelected(AdapterView parent) { - } - }); - - } - - public void setupMenu(Menu menu, MenuInflater inflater) { - this.menu = menu; - - // CAUTION set item properties programmatically otherwise it would not be accepted by - // appcompat itemsinflater.inflate(R.menu.videoitem_detail, menu); - - defaultPreferences = PreferenceManager.getDefaultSharedPreferences(activity); - inflater.inflate(R.menu.video_detail_menu, menu); - - updateItemsVisibility(); - } - - public void updateItemsVisibility(){ - showPlayWithKodiAction(defaultPreferences.getBoolean(activity.getString(R.string.show_play_with_kodi_key), false)); - } - - public boolean onItemSelected(MenuItem item) { - int id = item.getItemId(); - switch (id) { - case R.id.menu_item_share: { - if (onShareListener != null) { - onShareListener.onActionSelected(selectedVideoStream); - } - return true; - } - case R.id.menu_item_openInBrowser: { - if (onOpenInBrowserListener != null) { - onOpenInBrowserListener.onActionSelected(selectedVideoStream); - } - return true; - } - case R.id.action_play_with_kodi: - if (onPlayWithKodiListener != null) { - onPlayWithKodiListener.onActionSelected(selectedVideoStream); - } - return true; - default: - Log.e(TAG, "Menu Item not known"); - } - return false; - } - - public int getSelectedVideoStream() { - return selectedVideoStream; - } - - public void setOnShareListener(OnActionListener listener) { - onShareListener = listener; - } - - public void setOnOpenInBrowserListener(OnActionListener listener) { - onOpenInBrowserListener = listener; - } - - public void setOnPlayWithKodiListener(OnActionListener listener) { - onPlayWithKodiListener = listener; - } - - public void showPlayWithKodiAction(boolean visible) { - menu.findItem(R.id.action_play_with_kodi).setVisible(visible); - } - -} diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index a4c1bacbf..94a2f8ec0 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -31,6 +31,7 @@ import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.widget.AdapterView; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; @@ -106,7 +107,6 @@ public class VideoDetailFragment // Amount of videos to show on start private static final int INITIAL_RELATED_VIDEOS = 8; - private ActionBarHandler actionBarHandler; private ArrayList sortedStreamVideosList; private InfoItemBuilder infoItemBuilder = null; @@ -131,9 +131,12 @@ public class VideoDetailFragment private Disposable currentWorker; private CompositeDisposable disposables = new CompositeDisposable(); + private int selectedVideoStream = -1; + /*////////////////////////////////////////////////////////////////////////// // Views //////////////////////////////////////////////////////////////////////////*/ + private Menu menu; private Spinner spinnerToolbar; @@ -174,6 +177,7 @@ public class VideoDetailFragment private LinearLayout relatedStreamsView; private ImageButton relatedStreamExpandButton; + /*////////////////////////////////////////////////////////////////////////*/ public static VideoDetailFragment getInstance(int serviceId, String videoUrl, String name) { @@ -215,12 +219,12 @@ public class VideoDetailFragment if (updateFlags != 0) { if (!isLoading.get() && currentInfo != null) { if ((updateFlags & RELATED_STREAMS_UPDATE_FLAG) != 0) initRelatedVideos(currentInfo); - if ((updateFlags & RESOLUTIONS_MENU_UPDATE_FLAG) != 0) setupActionBarHandler(currentInfo); + if ((updateFlags & RESOLUTIONS_MENU_UPDATE_FLAG) != 0) setupActionBar(currentInfo); } if ((updateFlags & TOOLBAR_ITEMS_UPDATE_FLAG) != 0 - && actionBarHandler != null) { - actionBarHandler.updateItemsVisibility(); + && menu != null) { + updateMenuItemVisibility(); } updateFlags = 0; } @@ -357,7 +361,7 @@ public class VideoDetailFragment DownloadDialog downloadDialog = DownloadDialog.newInstance(currentInfo, sortedStreamVideosList, - actionBarHandler.getSelectedVideoStream()); + selectedVideoStream); downloadDialog.show(activity.getSupportFragmentManager(), "downloadDialog"); } catch (Exception e) { Toast.makeText(activity, @@ -499,7 +503,6 @@ public class VideoDetailFragment relatedStreamExpandButton = rootView.findViewById(R.id.detail_related_streams_expand); - actionBarHandler = new ActionBarHandler(activity); infoItemBuilder = new InfoItemBuilder(activity); setHeightThumbnail(); } @@ -644,7 +647,15 @@ public class VideoDetailFragment @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - actionBarHandler.setupMenu(menu, inflater); + this.menu = menu; + + // CAUTION set item properties programmatically otherwise it would not be accepted by + // appcompat itemsinflater.inflate(R.menu.videoitem_detail, menu); + + inflater.inflate(R.menu.video_detail_menu, menu); + + updateMenuItemVisibility(); + ActionBar supportActionBar = activity.getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setDisplayHomeAsUpEnabled(true); @@ -652,10 +663,47 @@ public class VideoDetailFragment } } + private void updateMenuItemVisibility() { + + // show kodi if set in settings + menu.findItem(R.id.action_play_with_kodi).setVisible( + PreferenceManager.getDefaultSharedPreferences(activity).getBoolean( + activity.getString(R.string.show_play_with_kodi_key), false)); + } + @Override public boolean onOptionsItemSelected(MenuItem item) { - return (!isLoading.get() && actionBarHandler.onItemSelected(item)) - || super.onOptionsItemSelected(item); + if(isLoading.get()) { + // if is still loading block menu + return true; + } + + int id = item.getItemId(); + switch (id) { + case R.id.menu_item_share: { + if(currentInfo != null) { + shareUrl(currentInfo.name, url); + } else { + shareUrl(url, url); + } + return true; + } + case R.id.menu_item_openInBrowser: { + openUrlInBrowser(url); + return true; + } + case R.id.action_play_with_kodi: + try { + NavigationHelper.playWithKore(activity, Uri.parse( + url.replace("https", "http"))); + } catch (Exception e) { + if(DEBUG) Log.i(TAG, "Failed to start kore", e); + showInstallKoreDialog(activity); + } + return true; + default: + return super.onOptionsItemSelected(item); + } } private static void showInstallKoreDialog(final Context context) { @@ -667,23 +715,31 @@ public class VideoDetailFragment builder.create().show(); } - private void setupActionBarHandler(final StreamInfo info) { + private void setupActionBarOnError(final String url) { + if (DEBUG) Log.d(TAG, "setupActionBarHandlerOnError() called with: url = [" + url + "]"); + Log.e("-----", "missing code"); + } + + private void setupActionBar(final StreamInfo info) { if (DEBUG) Log.d(TAG, "setupActionBarHandler() called with: info = [" + info + "]"); sortedStreamVideosList = new ArrayList<>(ListHelper.getSortedStreamVideosList( activity, info.getVideoStreams(), info.getVideoOnlyStreams(), false)); - actionBarHandler.setupStreamList(sortedStreamVideosList, spinnerToolbar); - actionBarHandler.setOnShareListener(selectedStreamId -> shareUrl(info.name, info.url)); - actionBarHandler.setOnOpenInBrowserListener((int selectedStreamId)-> - openUrlInBrowser(info.getUrl())); + selectedVideoStream = ListHelper.getDefaultResolutionIndex(activity, sortedStreamVideosList); - actionBarHandler.setOnPlayWithKodiListener((int selectedStreamId) -> { - try { - NavigationHelper.playWithKore(activity, Uri.parse( - info.getUrl().replace("https", "http"))); - } catch (Exception e) { - if(DEBUG) Log.i(TAG, "Failed to start kore", e); - showInstallKoreDialog(activity); + boolean isExternalPlayerEnabled = PreferenceManager.getDefaultSharedPreferences(activity) + .getBoolean(activity.getString(R.string.use_external_video_player_key), false); + spinnerToolbar.setAdapter(new SpinnerToolbarAdapter(activity, sortedStreamVideosList, + isExternalPlayerEnabled)); + spinnerToolbar.setSelection(selectedVideoStream); + spinnerToolbar.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + selectedVideoStream = position; + } + + @Override + public void onNothingSelected(AdapterView parent) { } }); @@ -899,7 +955,7 @@ public class VideoDetailFragment } private VideoStream getSelectedVideoStream() { - return sortedStreamVideosList.get(actionBarHandler.getSelectedVideoStream()); + return sortedStreamVideosList.get(selectedVideoStream); } private void prepareDescription(final String descriptionHtml) { @@ -1119,7 +1175,7 @@ public class VideoDetailFragment prepareDescription(info.getDescription()); animateView(spinnerToolbar, true, 500); - setupActionBarHandler(info); + setupActionBar(info); initThumbnailViews(info); initRelatedVideos(info); if (wasRelatedStreamsExpanded) { From 86f041b803792b23be664ae50aa5c97675acaa44 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Fri, 16 Feb 2018 14:45:52 +0100 Subject: [PATCH 3/3] add header/footer to drawer --- .../java/org/schabi/newpipe/MainActivity.java | 13 ++++ .../settings/MainSettingsFragment.java | 1 + .../drawable-hdpi/ic_settings_black_24dp.png | Bin 0 -> 453 bytes .../drawable-hdpi/ic_settings_white_24dp.png | Bin 0 -> 460 bytes .../drawable-mdpi/ic_settings_black_24dp.png | Bin 0 -> 322 bytes .../drawable-mdpi/ic_settings_white_24dp.png | Bin 0 -> 326 bytes .../drawable-xhdpi/ic_settings_black_24dp.png | Bin 0 -> 557 bytes .../drawable-xhdpi/ic_settings_white_24dp.png | Bin 0 -> 562 bytes .../ic_settings_black_24dp.png | Bin 0 -> 827 bytes .../ic_settings_white_24dp.png | Bin 0 -> 843 bytes .../ic_settings_black_24dp.png | Bin 0 -> 1073 bytes .../ic_settings_white_24dp.png | Bin 0 -> 1074 bytes app/src/main/res/layout/activity_main.xml | 9 +-- app/src/main/res/layout/drawer_laoyut.xml | 65 ++++++++++++++++++ .../main/res/layout/fragment_video_detail.xml | 8 +-- app/src/main/res/values/attrs.xml | 3 + app/src/main/res/values/styles.xml | 5 ++ 17 files changed, 93 insertions(+), 11 deletions(-) create mode 100644 app/src/main/res/drawable-hdpi/ic_settings_black_24dp.png create mode 100644 app/src/main/res/drawable-hdpi/ic_settings_white_24dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_settings_black_24dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_settings_white_24dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_settings_black_24dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_settings_white_24dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_settings_black_24dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_settings_white_24dp.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_settings_black_24dp.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_settings_white_24dp.png create mode 100644 app/src/main/res/layout/drawer_laoyut.xml diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java index ea6715f16..cbd2bacaa 100644 --- a/app/src/main/java/org/schabi/newpipe/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java @@ -41,6 +41,8 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; +import android.widget.Button; +import android.widget.ImageButton; import android.widget.Toast; import org.schabi.newpipe.extractor.StreamingService; @@ -79,6 +81,7 @@ public class MainActivity extends AppCompatActivity { setSupportActionBar(findViewById(R.id.toolbar)); setupDrawer(); + setupDrawerFooter(); } private void setupDrawer() { @@ -123,6 +126,16 @@ public class MainActivity extends AppCompatActivity { } } + private void setupDrawerFooter() { + ImageButton settings = findViewById(R.id.drawer_settings); + ImageButton downloads = findViewById(R.id.drawer_downloads); + ImageButton history = findViewById(R.id.drawer_history); + + settings.setOnClickListener(view -> NavigationHelper.openSettings(this) ); + downloads.setOnClickListener(view -> NavigationHelper.openDownloads(this)); + history.setOnClickListener(view -> NavigationHelper.openHistory(this)); + } + @Override protected void onDestroy() { super.onDestroy(); diff --git a/app/src/main/java/org/schabi/newpipe/settings/MainSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/MainSettingsFragment.java index 230f3b5ee..728da0ae5 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/MainSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/MainSettingsFragment.java @@ -1,6 +1,7 @@ package org.schabi.newpipe.settings; import android.os.Bundle; +import android.support.v7.preference.Preference; import org.schabi.newpipe.R; diff --git a/app/src/main/res/drawable-hdpi/ic_settings_black_24dp.png b/app/src/main/res/drawable-hdpi/ic_settings_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..acf1ddf85b3388b4fb02a683664d7599d96ebfe3 GIT binary patch literal 453 zcmV;$0XqJPP)bdAc8oEppaIOE(LXPbaD_uiXgfuI0y=Ui?$Rg z3N9|rijvq&CiQlchlhJevpDqnjrr%mb8?c{t6qzumxlIL6n!zIh8Gl(U}e3LlM0Ef;V2BeJSjZb=;SQ|z+u z4yaibL-bf>PG6*TZCbM}(t2i;JWOXDi<+RJrJZgbD4Fy&xy-!MTym*5Ce+-mj<=}R zs*bfH=Sq2RG}Riq#p042E*7&*ne}3EUJe(E*_zBou{bA(tHo?vL#bs|A+IvyeHm7t#M^wEtHOK?m*3tk?OFDx*kh6Lst!v$eu1NdssLB&DM32-Q z^h4~jZ>A+~7n2>4r=NU@Dq}tg9ji`Suql$(%vHn+eg}v!7dsOm%)+nCb00000NkvXXu0mjfkE75f literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_settings_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_settings_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..97ded33b5558a0efbd7812296a52325b4170076e GIT binary patch literal 460 zcmV;-0W=4>kIV21T<&3Kg>clSSXlU}7 zNsTbZb7CDT8exhj%*e(#KY#)6xy}u?uzckjH(4PAzEPEh1-w0q?BPAtVVvU+$MuUd zim^-?Z*&k19JY)eT?W{4>I$)hC8bSG`$%Zf$FisplYAzY(o}#3ePW-OP>dHiLTyE8 z5z6Vv#(lhunj$1*cz0EVJ9s@A*ucB3BFy1+WndHUmWuEIZ$P35H8Q+=vQXg_LqaV@ zm?z|TsTk9IA=am%09Qzftuv(%OIZ4}NVJa{^Q2f76=H@QTgC>PWY~7OsDpS*8Lt)N zEWbIfpG@m8p5YBC;_%wCP~|(2vdmRx>0#;8WR`dQ1-2NIjXDoGtr048h%M+pCV0dp z9SxU>omUy0Vn}G0s>)%9(6-8A4Tr6%Lb0000J%}fHzV<>iUk{yCv=|P(yFM9CIKrv6;vdj!^e)OQ=oM~3L z3Hov zYMc*TMS6^4Y*s#v8YK}AT(ig&XB4{J=afm7xZ$2C{CQWp)PoCx)G7YcXPY7T1DnU) UWG_v5V*mgE07*qoM6N<$f<$+V!T>O6 zS70QgNAU8v+(?*#6#o9*V@~mgC;x#Rf^DRK!rxsIH1Y+{1W$v50*~CV#54`Q2vW|N zVwqbWh7Wvdgwql&RGT?0V4Y7)9ZgCcW4f$baDbN(6Vt-m zvtW!jvUC`+K-kE98fAa!hNkla9V}f0{{|82kXi@9MRd@?$weK4A^ju7 zLRBcZi6~YV4Y?x0YCBk^ee93}@A5qN9`;=V`Fy9md5-r894+Q7Vwa zKGHbsTJ3CbB>k$}G!3du63TIxO+;yvI}8$@RV#hZwGsJa1 zG(UeLOQIW*%YP$A_S8JsifkZzY=a`Er-+B1U^vMR;-MW*pvdqV@zg66vq)lJDKSEJ zw`0sxb4<_B;v8FuS(#q`)kg&}+hPL6xOrb?GQ?%fExvFHL!Kq|$LU4WPhFXQ&M?@z zxR1mtVOeOIy~lo>;tz)rETgf>fK;}TNLegBvB^KiQ=u3Ot|-Y( z2Uu+mzU3;1m}L#YE?|a1uJMlWb*&qR^Q=+kG@*msHr|$gaEk##XL&}z6#u1a9Hidf vu2=2VHre2#z3N8+Q5wRd6(rV6I@-ivWBUX&LwAlh00000NkvXXu0mjfs0IG% literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_settings_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_settings_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..5caedc8e57497ba9d32c3a1798f7394bd8ca7cff GIT binary patch literal 562 zcmV-20?qx2P)lpy;7r2s24Mgk2IZK^^iBh`hXFsLp$Hi^-XdC|o$nN|w}JYolv9aiaA3)AHJ#jL^+Vnw!iASI;~WiKXmD0RMEHO!?-j&6;kHOKLX;?@ zWGE7DPJUcs54$WqYC|tM?Dm*a5EB$J%My_f5ptOQ;JnO8utv}pJu;w=5<;?v>&>8 zhF?Y&EaUf-F4>V}ouDGUG9XTwpfwUQW0DePIU@2QLIJZP6AEI68g@DQ)P^_(>}pKO zkE?_$vBVfLVvMs)nQ&JW#5%6Ll?i8P;6j~onehS_p38;=e>tq*49Si(?RM$JF6|Z- zhLe1y=@Yj&%{<$LDKkeuxA{!dCfy3hWwyzZQVXYeKoyfe+#{|QF7lc(Gdc+Jm}KP& zE12AuD=c7gL#~j*pF literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_settings_black_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_settings_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..3023ff8daa925ac79e863caf679d03c56c3afc93 GIT binary patch literal 827 zcmV-B1H}A^P)>`06 zl!7Kix5q+Fq6=w?Bq2zRX%{Q=l9q~JFAfaD-fMk(ql{OMJp*hZ8Le@FKzb36b`fRvPbJZ#ihbmi`-huQ`v`H+dnnz5 zIO;AGB7BE9YM!%LJ&ic*2`mcPKpgfvmoR!03D^-c43Z$hAhR4H0ecmL8#qMtu}v3c zWQvny2hqm?F??uNd0r4z>Rub{-SwiV_KcJlc$@G(Y7OnY{oYXaZ@4M{dXjJ$v z`$eh=sKvO?Cei3I?)A;6Md`CXq2t(8SWgZw6G7n$pCQ&JiDGgU(}=YRim_lq5{{Tt>$z%L(Sw8>(002ovPDHLk FV1g%Ge~AD9 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_settings_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_settings_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..eabb0a2ba41bbe0e109263ee9b0d6ada40a6e792 GIT binary patch literal 843 zcmV-R1GM~!P)RPWZAHfP!)RVB2S(!`lt|Um(uYf2_cGfFjG~?QJ_SKM>Hu7Qz_%` zC^KY0j^p?%F-hrI#t?oEkx>e=^x$WZC9-20$8bAJMiyi_f!j|s$&C!#uq!e{4&*3d z*U4D<;$4cQ>yQUJNq3uf6oz@6$E?Ckd0-Y5%+4`a;aG`TuRL)UvsTrDjhJ=G6Wy3? zP%Zcjv%EY}z-*IhK|5x7d7^;XCe?zCn03h$-I#4qEm(P<#_c#+Sul>1xE*7f>{!k} z_~{|56pZ6*{0y;7>1g5}{!WmS0WF-w-(4mv4bw>oQKFMsszM7}DHGx$QauHt_cw57G zmNrf?VwFPCz(EGt%|eYrmJb-fVG|Z VF?y~eTbBR;002ovPDHLkV1i=jh>-vQ literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_settings_black_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_settings_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..476d5c9780b6904004c7da0d86c1f02e4c37f892 GIT binary patch literal 1073 zcmV-11kU@3P)?ENDOXxEq##k{R3pG`V_=<^3NWfR4)j)KkE?kf% zU}CHb1trze6>4h;sTD;rtpyq(711_6TOXmFPeL**CLQm0&Kbrt$^HG8P44Zq_ne-d zIYT6GB9TZWvWW>Kq@TD8Z%rbKCJFFT3Q=|)UTQ^@t;I_ZBg!7bOS=$dFXN?m5M}%E z(wB&`ukq3!h_Yz{ypu!>x)$#=AqKVLoh^t#k5E8sIL>$MVhOq3&gY0hM`8YgceIr|YY&iqQ@`QK~6 zQos?!gFYj`%4WoqwqT*0?-5V>feMW6L_F#x3@zbr#H0S91|$0r&w3vNHzOXl4y8E9 z5Dz;}9F@lr$I={PD~(h#??P2Hv5k*OBaS_R%D0F^Gwfz5bE%<=S;V1HRE7}izM+=? zvXWuMx}&JnaTc-a1LhN^j9$d5v#dlZNx#*%UxG%$>Lq+a5(6c?YW(obN2{C>#Hd#& z!B{)f219oRCRP~?=PB;R(sE89s&->)k9y|05eEzCQO)~HF|~}eY5{Q-jsl(y{dFJ0 zLg+*>%Tom8#bC&-wqj#@$W=cjZ_b3=su3H_Ay*wEUqWZ2%FD7H{2O^AAiF$gQgUe1!CaxCt9AAy+*GP?%|S8#ZFe%*GOO> z#bLy_Ugb>^^dZI#kVL7TbBI;FloO_cKI?z#>rnXuv2KJ_AwQf^#JVG>3?mNBvWI0k zCeFQ%8(UwY@+jh1ntry^Op?+IC23&?1EdS}PEAbz5c&FESu5gU4Th($JgXZci}?%j zAcuGCUqC#n17l^3BOc^%YUO^!lkUMvz+uFL`muJC2Zudosl~w?NY31kB51DEg_A{d zo(4V7yWC2^CMFTbCfGp0ZS3d#oLeiEIC_%o8Q~cgkx|9lh(m9&kc<=^oYC)hXq9s6 z($m<(9mL4iY&qBmXe3*lJNfX^nst-}xU1(FC+XyRa$C!w;mW?1+!pg9Cm5oZ0(uZJ z=)Phh(s literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_settings_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_settings_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..507c5edd44bfb5efe41327d5cef511a108d35f13 GIT binary patch literal 1074 zcmV-21kL-2P)+t)}?IPi4`?n-BcG{I5ur- z(S>O`4876<#~6}k=`>Up4hWM~CUltm-)|Ri1Ni>m=Xw7B>2vXZK2lazR#sM4OxVB` zGWm@sMM^ z-;l({UGfbz*r=0l*o=*rbn~#1)BM5?7AY+r;d^YHV6D>PUbfT6IjR&Lx6#YE6o*+) zuBKoO-MHxHK}|s}>p4WgxIShmD&AzWe%_@-6DZ+pqS#BZCQ!mV^fOt5qM?`(rW@k` zYsq0Fe-hOnJV_2~IlvgxjZ&g0_?+}E6PL@R*DQCeAjPd$B{wAK#0SSo$OW75#b()K zHUs$LSLVnT+wsWmw*M;;$z=L|Dth}oRO&PU|Q78@DG)EG-;f#n348sTZV zVF~9kvs0GXg_$1ilRM_pLS`uz%MxXz$ZS8iD;g5KO+dIKazGp50^T5@IM7A7EpotC z!W~mwxJ0;WIiQwsy^0H?ge#H*l7zdexR6PK98gHOKye|H0y&_NaDn2&2;t_-0ZGDL zRb044xEeWN72z%_E_4yDUJlqsxMPX~IW&?Y+)+88op1pSBoqyIaEQ!Ol*$riq{ys= zxpK!+dNI=^OYFwX1(wJSoA?`3V^qijl?0d?Wut77&!^Zq%PbjU4n5fUgnXH!m=5f< zk}m_~a~ON=BxQz5hH%r$Y-PY44&!E!3Yp*}?#{7XA*iGWcbzi9S)vHoMVW4ZGIkRX z#g8(<%S4r;jjhy@q>w_AtYRDOq=;&>OpwD#d~}?I%ut7qs$`Bm_@-GlSja#4WRw!w z;XQoPAY06$A7At_L-u$UUpyrjB^DU#RVFRX2UE@R5j!x|C?D|xrk<0JScR#T@)5nxBvhE literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 7eafc6c69..b894c23aa 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,7 +1,6 @@ - + + \ No newline at end of file diff --git a/app/src/main/res/layout/drawer_laoyut.xml b/app/src/main/res/layout/drawer_laoyut.xml new file mode 100644 index 000000000..dcf29c42f --- /dev/null +++ b/app/src/main/res/layout/drawer_laoyut.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_video_detail.xml b/app/src/main/res/layout/fragment_video_detail.xml index 330fb34da..fb9ee2890 100644 --- a/app/src/main/res/layout/fragment_video_detail.xml +++ b/app/src/main/res/layout/fragment_video_detail.xml @@ -310,7 +310,7 @@ android:layout_height="55dp" android:layout_gravity="center_vertical" android:layout_weight="1" - android:background="?attr/selectableItemBackground" + android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true" android:focusable="true" android:contentDescription="@string/append_playlist" @@ -327,7 +327,7 @@ android:layout_height="55dp" android:layout_gravity="center_vertical" android:layout_weight="1" - android:background="?attr/selectableItemBackground" + android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true" android:focusable="true" android:contentDescription="@string/play_audio" @@ -344,7 +344,7 @@ android:layout_height="55dp" android:layout_gravity="center_vertical" android:layout_weight="1" - android:background="?attr/selectableItemBackground" + android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true" android:focusable="true" android:contentDescription="@string/open_in_popup_mode" @@ -361,7 +361,7 @@ android:layout_height="55dp" android:layout_gravity="center_vertical" android:layout_weight="1" - android:background="?attr/selectableItemBackground" + android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true" android:focusable="true" android:contentDescription="@string/controls_download_desc" diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 31eda4fbc..c8e0907be 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -25,6 +25,7 @@ + @@ -39,4 +40,6 @@ + + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index dcf8f9268..ad767835b 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -15,6 +15,7 @@ @color/light_youtube_dark_color @color/light_youtube_accent_color @color/light_background_color + @color/light_background_color @drawable/ic_thumb_up_black_24dp @drawable/ic_thumb_down_black_24dp @@ -40,6 +41,7 @@ @drawable/ic_arrow_top_left_black_24dp @drawable/ic_more_vert_black_24dp @drawable/ic_play_arrow_black_24dp + @drawable/ic_settings_black_24dp @drawable/ic_whatshot_black_24dp @drawable/ic_channel_black_24dp @drawable/ic_bookmark_black_24dp @@ -66,6 +68,7 @@ @color/dark_youtube_dark_color @color/dark_youtube_accent_color @color/dark_background_color + @color/dark_background_color @drawable/ic_thumb_up_white_24dp @drawable/ic_thumb_down_white_24dp @@ -91,6 +94,7 @@ @drawable/ic_arrow_top_left_white_24dp @drawable/ic_more_vert_white_24dp @drawable/ic_play_arrow_white_24dp + @drawable/ic_settings_white_24dp @drawable/ic_whatshot_white_24dp @drawable/ic_channel_white_24dp @drawable/ic_bookmark_white_24dp @@ -114,6 +118,7 @@