From 948db2a9c267dd6b08cbd1377cc334a6865cff0a Mon Sep 17 00:00:00 2001 From: Roy Yosef Date: Sat, 25 Apr 2020 23:42:28 +0300 Subject: [PATCH 1/6] feat(add-rtl-layout-support): drawer, tabs, list items & about * supportsRtl="true" * replace Left/ Right properties with Start/ End * tabs: * layoutDirection="ltr" for * reverse items for RTL in PagerAdapter * properties for force right in RTL: * textAlignment="viewStart" * textDirection="anyRtl" --- app/src/debug/AndroidManifest.xml | 3 +- app/src/main/AndroidManifest.xml | 1 + .../schabi/newpipe/about/AboutActivity.java | 52 +++++--- .../newpipe/fragments/MainFragment.java | 28 ++++- .../newpipe/fragments/detail/TabAdaptor.java | 30 +++-- .../fragments/detail/VideoDetailFragment.java | 7 +- .../fragments/list/search/SearchFragment.java | 2 +- .../local/playlist/LocalPlaylistFragment.java | 2 +- .../newpipe/player/PopupVideoPlayer.java | 4 +- .../playqueue/PlayQueueItemTouchCallback.java | 2 +- .../util/CommentTextOnTouchListener.java | 2 +- .../activity_player_queue_control.xml | 50 ++++---- .../activity_main_player.xml | 116 ++++++++---------- .../fragment_video_detail.xml | 84 +++++++------ app/src/main/res/layout/activity_about.xml | 1 + app/src/main/res/layout/activity_error.xml | 6 +- .../main/res/layout/activity_main_player.xml | 115 ++++++++--------- .../layout/activity_player_queue_control.xml | 52 ++++---- app/src/main/res/layout/channel_header.xml | 22 ++-- .../res/layout/dialog_feed_group_create.xml | 12 +- .../res/layout/dialog_playback_parameter.xml | 30 +---- .../main/res/layout/dialog_playlist_name.xml | 8 +- app/src/main/res/layout/dialog_playlists.xml | 14 +-- app/src/main/res/layout/dialog_title.xml | 9 +- app/src/main/res/layout/download_dialog.xml | 26 ++-- app/src/main/res/layout/drawer_header.xml | 12 +- .../res/layout/feed_group_reorder_item.xml | 20 +-- .../res/layout/feed_import_export_group.xml | 15 ++- app/src/main/res/layout/fragment_about.xml | 30 ++++- .../main/res/layout/fragment_choose_tabs.xml | 2 - app/src/main/res/layout/fragment_feed.xml | 4 +- .../res/layout/fragment_instance_list.xml | 2 - app/src/main/res/layout/fragment_licenses.xml | 22 ++-- app/src/main/res/layout/fragment_main.xml | 1 + .../main/res/layout/fragment_video_detail.xml | 94 +++++++------- app/src/main/res/layout/header_item.xml | 4 +- .../main/res/layout/header_with_menu_item.xml | 4 +- .../main/res/layout/header_with_text_item.xml | 8 +- app/src/main/res/layout/item_instance.xml | 28 ++--- .../main/res/layout/item_search_history.xml | 4 +- .../res/layout/item_search_suggestion.xml | 11 +- .../res/layout/item_software_component.xml | 4 +- app/src/main/res/layout/list_channel_item.xml | 10 +- .../res/layout/list_channel_mini_item.xml | 10 +- app/src/main/res/layout/list_choose_tabs.xml | 20 +-- .../res/layout/list_choose_tabs_dialog.xml | 10 +- .../main/res/layout/list_comments_item.xml | 25 ++-- .../res/layout/list_comments_mini_item.xml | 22 ++-- .../res/layout/list_playlist_grid_item.xml | 16 ++- .../main/res/layout/list_playlist_item.xml | 13 +- .../res/layout/list_playlist_mini_item.xml | 13 +- .../main/res/layout/list_radio_icon_item.xml | 8 +- .../main/res/layout/list_stream_grid_item.xml | 15 ++- app/src/main/res/layout/list_stream_item.xml | 41 ++++--- .../main/res/layout/list_stream_mini_item.xml | 17 +-- .../layout/list_stream_playlist_grid_item.xml | 18 ++- .../res/layout/list_stream_playlist_item.xml | 19 ++- .../main/res/layout/local_playlist_header.xml | 13 +- app/src/main/res/layout/mission_item.xml | 8 +- .../main/res/layout/mission_item_linear.xml | 18 +-- app/src/main/res/layout/missions_header.xml | 2 - app/src/main/res/layout/play_queue_item.xml | 22 ++-- .../main/res/layout/player_notification.xml | 6 +- .../layout/player_notification_expanded.xml | 34 +++-- app/src/main/res/layout/player_popup.xml | 34 ++--- .../res/layout/player_popup_notification.xml | 4 +- app/src/main/res/layout/playlist_control.xml | 2 - app/src/main/res/layout/playlist_header.xml | 25 ++-- .../layout/preferred_player_dialog_view.xml | 2 +- .../res/layout/related_streams_header.xml | 4 +- .../res/layout/select_channel_fragment.xml | 2 - .../main/res/layout/select_channel_item.xml | 6 +- .../main/res/layout/select_kiosk_fragment.xml | 2 - app/src/main/res/layout/select_kiosk_item.xml | 6 +- .../layout/settings_category_header_title.xml | 4 +- .../res/layout/statistic_playlist_control.xml | 10 +- .../main/res/layout/stream_quality_item.xml | 28 ++--- .../subscription_import_export_item.xml | 10 +- app/src/main/res/layout/toolbar_layout.xml | 2 +- .../main/res/layout/toolbar_search_layout.xml | 4 +- 80 files changed, 744 insertions(+), 704 deletions(-) diff --git a/app/src/debug/AndroidManifest.xml b/app/src/debug/AndroidManifest.xml index 5cc2fa66a54..3ec89484ace 100644 --- a/app/src/debug/AndroidManifest.xml +++ b/app/src/debug/AndroidManifest.xml @@ -6,5 +6,6 @@ + tools:replace="android:name" + android:supportsRtl="true" /> \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 28215e013cc..ca6952cbc95 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -21,6 +21,7 @@ android:label="@string/app_name" android:logo="@mipmap/ic_launcher" android:theme="@style/OpeningTheme" + android:supportsRtl="true" tools:ignore="AllowBackup"> internalTabsList; + private boolean isRTL; private SelectedTabsPagerAdapter(final Context context, final FragmentManager fragmentManager, - final List tabsList) { + final List tabsList, + final boolean isRTL) { super(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT); this.context = context; this.internalTabsList = new ArrayList<>(tabsList); + this.isRTL = isRTL; } @NonNull @Override public Fragment getItem(final int position) { - final Tab tab = internalTabsList.get(position); + final Tab tab = this.isRTL + ? internalTabsList.get(internalTabsList.size() - 1 - position) + : internalTabsList.get(position); Throwable throwable = null; Fragment fragment = null; diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/TabAdaptor.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/TabAdaptor.java index 38f013200b6..7b9feb53a4d 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/TabAdaptor.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/TabAdaptor.java @@ -14,15 +14,19 @@ public class TabAdaptor extends FragmentPagerAdapter { private final List mFragmentList = new ArrayList<>(); private final List mFragmentTitleList = new ArrayList<>(); private final FragmentManager fragmentManager; + private boolean isRTL; - public TabAdaptor(final FragmentManager fm) { + public TabAdaptor(final FragmentManager fm, final boolean isRTL) { super(fm); this.fragmentManager = fm; + this.isRTL = isRTL; } @Override public Fragment getItem(final int position) { - return mFragmentList.get(position); + int gg = getLayoutPosition(position); + + return mFragmentList.get(gg); } @Override @@ -41,16 +45,18 @@ public void clearAllItems() { } public void removeItem(final int position) { - mFragmentList.remove(position == 0 ? 0 : position - 1); - mFragmentTitleList.remove(position == 0 ? 0 : position - 1); + int newPosition = getLayoutPosition(position); + + mFragmentList.remove(newPosition == 0 ? 0 : newPosition - 1); + mFragmentTitleList.remove(newPosition == 0 ? 0 : newPosition - 1); } public void updateItem(final int position, final Fragment fragment) { - mFragmentList.set(position, fragment); + mFragmentList.set(getLayoutPosition(position), fragment); } public void updateItem(final String title, final Fragment fragment) { - int index = mFragmentTitleList.indexOf(title); + int index = getLayoutPosition(mFragmentTitleList.indexOf(title)); if (index != -1) { updateItem(index, fragment); } @@ -59,14 +65,14 @@ public void updateItem(final String title, final Fragment fragment) { @Override public int getItemPosition(final Object object) { if (mFragmentList.contains(object)) { - return mFragmentList.indexOf(object); + return getLayoutPosition(mFragmentList.indexOf(object)); } else { return POSITION_NONE; } } public int getItemPositionByTitle(final String title) { - return mFragmentTitleList.indexOf(title); + return getLayoutPosition(mFragmentTitleList.indexOf(title)); } @Nullable @@ -74,7 +80,8 @@ public String getItemTitle(final int position) { if (position < 0 || position >= mFragmentTitleList.size()) { return null; } - return mFragmentTitleList.get(position); + + return mFragmentTitleList.get(getLayoutPosition(position)); } public void notifyDataSetUpdate() { @@ -86,4 +93,9 @@ public void destroyItem(final ViewGroup container, final int position, final Obj fragmentManager.beginTransaction().remove((Fragment) object).commitNowAllowingStateLoss(); } + private int getLayoutPosition(final int position) { + return this.isRTL + ? mFragmentList.size() - 1 - position + : position; + } } 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 eba77847bf2..aaeca9d51ce 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 @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -528,7 +529,11 @@ protected void initViews(final View rootView, final Bundle savedInstanceState) { appBarLayout = rootView.findViewById(R.id.appbarlayout); viewPager = rootView.findViewById(R.id.viewpager); - pageAdapter = new TabAdaptor(getChildFragmentManager()); + + Configuration config = getResources().getConfiguration(); + boolean isRTL = config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; + + pageAdapter = new TabAdaptor(getChildFragmentManager(), isRTL); viewPager.setAdapter(pageAdapter); tabLayout = rootView.findViewById(R.id.tablayout); tabLayout.setupWithViewPager(viewPager); diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java index 71a530b3935..142a623a075 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java @@ -1022,7 +1022,7 @@ public int getSuggestionMovementFlags(@NonNull final RecyclerView recyclerView, final int position = viewHolder.getAdapterPosition(); final SuggestionItem item = suggestionListAdapter.getItem(position); return item.fromHistory ? makeMovementFlags(0, - ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) : 0; + ItemTouchHelper.START | ItemTouchHelper.END) : 0; } public void onSuggestionItemSwiped(@NonNull final RecyclerView.ViewHolder viewHolder, diff --git a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java index 485d3f39143..92e8af4e1b8 100644 --- a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java @@ -691,7 +691,7 @@ private void saveImmediate() { private ItemTouchHelper.SimpleCallback getItemTouchCallback() { int directions = ItemTouchHelper.UP | ItemTouchHelper.DOWN; if (isGridLayout()) { - directions |= ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; + directions |= ItemTouchHelper.START | ItemTouchHelper.END; } return new ItemTouchHelper.SimpleCallback(directions, ItemTouchHelper.ACTION_STATE_IDLE) { diff --git a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java index de9e9b74669..1a182d34da9 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java @@ -239,7 +239,7 @@ private void initPopup() { layoutParamType, IDLE_WINDOW_FLAGS, PixelFormat.TRANSLUCENT); - popupLayoutParams.gravity = Gravity.LEFT | Gravity.TOP; + popupLayoutParams.gravity = Gravity.START | Gravity.TOP; popupLayoutParams.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; int centerX = (int) (screenWidth / 2f - popupWidth / 2f); @@ -280,7 +280,7 @@ private void initPopupCloseOverlay() { layoutParamType, flags, PixelFormat.TRANSLUCENT); - closeOverlayLayoutParams.gravity = Gravity.LEFT | Gravity.TOP; + closeOverlayLayoutParams.gravity = Gravity.START | Gravity.TOP; closeOverlayLayoutParams.softInputMode = WindowManager .LayoutParams.SOFT_INPUT_ADJUST_RESIZE; diff --git a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueItemTouchCallback.java b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueItemTouchCallback.java index 5fee436596e..d3618615ae9 100644 --- a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueItemTouchCallback.java +++ b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueItemTouchCallback.java @@ -8,7 +8,7 @@ public abstract class PlayQueueItemTouchCallback extends ItemTouchHelper.SimpleC private static final int MAXIMUM_INITIAL_DRAG_VELOCITY = 25; public PlayQueueItemTouchCallback() { - super(ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.RIGHT); + super(ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.END); } public abstract void onMove(int sourceIndex, int targetIndex); diff --git a/app/src/main/java/org/schabi/newpipe/util/CommentTextOnTouchListener.java b/app/src/main/java/org/schabi/newpipe/util/CommentTextOnTouchListener.java index 770592537c1..aa633e581cc 100644 --- a/app/src/main/java/org/schabi/newpipe/util/CommentTextOnTouchListener.java +++ b/app/src/main/java/org/schabi/newpipe/util/CommentTextOnTouchListener.java @@ -49,7 +49,7 @@ public boolean onTouch(final View v, final MotionEvent event) { int x = (int) event.getX(); int y = (int) event.getY(); - x -= widget.getTotalPaddingLeft(); + x -= widget.getTotalPaddingStart(); y -= widget.getTotalPaddingTop(); x += widget.getScrollX(); diff --git a/app/src/main/res/layout-land/activity_player_queue_control.xml b/app/src/main/res/layout-land/activity_player_queue_control.xml index 6468c6784bd..dca5bf64eeb 100644 --- a/app/src/main/res/layout-land/activity_player_queue_control.xml +++ b/app/src/main/res/layout-land/activity_player_queue_control.xml @@ -32,7 +32,6 @@ android:layout_height="match_parent" android:layout_below="@+id/appbar" android:layout_above="@id/progress_bar" - android:layout_toLeftOf="@+id/control_pane" android:layout_toStartOf="@+id/control_pane" android:scrollbars="vertical" app:layoutManager="LinearLayoutManager" @@ -42,7 +41,6 @@ android:id="@+id/control_pane" android:layout_width="200dp" android:layout_height="match_parent" - android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:layout_above="@id/progress_bar" android:layout_below="@id/appbar"> @@ -89,8 +87,8 @@ android:layout_centerInParent="true" android:background="#c0000000" android:paddingBottom="5dp" - android:paddingLeft="30dp" - android:paddingRight="30dp" + android:paddingStart="30dp" + android:paddingEnd="30dp" android:paddingTop="5dp" android:layout_above="@+id/playback_controls_top" android:textColor="@android:color/white" @@ -115,8 +113,8 @@ android:layout_width="40dp" android:layout_height="40dp" android:layout_centerVertical="true" - android:layout_marginLeft="5dp" - android:layout_toLeftOf="@+id/control_play_pause" + android:layout_marginStart="5dp" + android:layout_toStartOf="@+id/control_play_pause" android:clickable="true" android:focusable="true" android:scaleType="fitCenter" @@ -132,8 +130,8 @@ android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_centerInParent="true" - android:layout_marginLeft="5dp" - android:layout_marginRight="5dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true" android:focusable="true" @@ -150,8 +148,8 @@ android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_centerInParent="true" - android:layout_marginLeft="5dp" - android:layout_marginRight="5dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" android:background="#00000000" android:tint="?attr/colorAccent" android:padding="2dp" @@ -165,8 +163,8 @@ android:layout_width="40dp" android:layout_height="40dp" android:layout_centerVertical="true" - android:layout_marginRight="5dp" - android:layout_toRightOf="@+id/control_play_pause" + android:layout_marginEnd="5dp" + android:layout_toEndOf="@+id/control_play_pause" android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true" android:focusable="true" @@ -189,10 +187,10 @@ android:id="@+id/control_playback_speed" android:layout_width="wrap_content" android:layout_height="35dp" - android:layout_marginLeft="5dp" - android:layout_marginRight="5dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/control_repeat" + android:layout_toStartOf="@+id/control_repeat" android:gravity="center" android:minWidth="50dp" android:text="1x" @@ -205,9 +203,9 @@ android:id="@+id/control_repeat" android:layout_width="30dp" android:layout_height="30dp" - android:layout_toLeftOf="@+id/anchor" + android:layout_toStartOf="@+id/anchor" android:layout_centerVertical="true" - android:layout_marginLeft="5dp" + android:layout_marginStart="5dp" android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true" android:focusable="true" @@ -225,9 +223,9 @@ android:id="@+id/control_shuffle" android:layout_width="30dp" android:layout_height="30dp" - android:layout_toRightOf="@+id/anchor" + android:layout_toEndOf="@+id/anchor" android:layout_centerVertical="true" - android:layout_marginRight="5dp" + android:layout_marginEnd="5dp" android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true" android:focusable="true" @@ -240,10 +238,10 @@ android:id="@+id/control_playback_pitch" android:layout_width="wrap_content" android:layout_height="35dp" - android:layout_marginLeft="5dp" - android:layout_marginRight="5dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" android:layout_centerVertical="true" - android:layout_toRightOf="@+id/control_shuffle" + android:layout_toEndOf="@+id/control_shuffle" android:gravity="center" android:minWidth="50dp" android:text="100%" @@ -261,9 +259,9 @@ android:layout_alignParentBottom="true" android:gravity="center" android:orientation="horizontal" - android:paddingLeft="16dp" + android:paddingStart="16dp" android:background="@drawable/player_controls_bg" - android:paddingRight="16dp"> + android:paddingEnd="16dp"> @@ -66,9 +65,7 @@ android:layout_width="50dp" android:layout_height="50dp" android:layout_centerVertical="true" - android:layout_alignParentRight="true" android:layout_alignParentEnd="true" - android:layout_marginRight="40dp" android:layout_marginEnd="40dp" android:padding="10dp" android:clickable="true" @@ -84,9 +81,7 @@ android:layout_width="50dp" android:layout_height="50dp" android:layout_centerVertical="true" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" - android:layout_marginLeft="40dp" android:layout_marginStart="40dp" android:padding="10dp" android:clickable="true" @@ -102,7 +97,7 @@ android:layout_width="50dp" android:layout_height="50dp" android:layout_centerVertical="true" - android:layout_toRightOf="@id/repeatButton" + android:layout_toEndOf="@id/repeatButton" android:padding="10dp" android:clickable="true" android:focusable="true" @@ -148,21 +143,21 @@ android:gravity="top" android:paddingTop="10dp" android:paddingBottom="10dp" - android:paddingLeft="5dp" - android:paddingRight="5dp" + android:paddingStart="5dp" + android:paddingEnd="5dp" tools:ignore="RtlHardcoded"> @@ -277,9 +272,9 @@ style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="wrap_content" android:layout_height="35dp" - android:layout_marginLeft="8dp" - android:layout_marginRight="8dp" - android:layout_alignParentLeft="true" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + android:layout_alignParentStart="true" android:gravity="center" android:minWidth="50dp" android:textColor="@android:color/white" @@ -294,15 +289,15 @@ android:id="@+id/captionTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="8dp" - android:layout_marginRight="8dp" - android:layout_toLeftOf="@id/switchMute" - android:layout_toRightOf="@id/resizeTextView" - android:gravity="center|left" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + android:layout_toStartOf="@id/switchMute" + android:layout_toEndOf="@id/resizeTextView" + android:gravity="center|start" android:minHeight="35dp" android:minWidth="40dp" - android:paddingLeft="2dp" - android:paddingRight="2dp" + android:paddingStart="2dp" + android:paddingEnd="2dp" android:textColor="@android:color/white" android:textStyle="bold" android:textAllCaps="false" @@ -314,9 +309,9 @@ android:id="@+id/kodi" android:layout_width="30dp" android:layout_height="30dp" - android:layout_marginLeft="4dp" - android:layout_marginRight="2dp" - android:layout_alignParentRight="true" + android:layout_marginStart="4dp" + android:layout_marginEnd="2dp" + android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:clickable="true" android:focusable="true" @@ -332,9 +327,9 @@ android:id="@+id/share" android:layout_width="30dp" android:layout_height="30dp" - android:layout_marginLeft="4dp" - android:layout_marginRight="2dp" - android:layout_toLeftOf="@id/kodi" + android:layout_marginStart="4dp" + android:layout_marginEnd="2dp" + android:layout_toStartOf="@id/kodi" android:layout_alignWithParentIfMissing="true" android:layout_centerVertical="true" android:clickable="true" @@ -350,9 +345,9 @@ android:id="@+id/toggleOrientation" android:layout_width="30dp" android:layout_height="30dp" - android:layout_marginLeft="4dp" - android:layout_marginRight="4dp" - android:layout_toLeftOf="@id/share" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" + android:layout_toStartOf="@id/share" android:layout_centerVertical="true" android:clickable="true" android:focusable="true" @@ -367,9 +362,9 @@ android:id="@+id/switchPopup" android:layout_width="30dp" android:layout_height="30dp" - android:layout_marginLeft="4dp" - android:layout_marginRight="4dp" - android:layout_toLeftOf="@id/toggleOrientation" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" + android:layout_toStartOf="@id/toggleOrientation" android:layout_centerVertical="true" android:clickable="true" android:focusable="true" @@ -383,9 +378,9 @@ android:id="@+id/switchBackground" android:layout_width="30dp" android:layout_height="30dp" - android:layout_marginLeft="4dp" - android:layout_marginRight="4dp" - android:layout_toLeftOf="@id/switchPopup" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" + android:layout_toStartOf="@id/switchPopup" android:layout_centerVertical="true" android:clickable="true" android:focusable="true" @@ -400,9 +395,9 @@ android:id="@+id/switchMute" android:layout_width="30dp" android:layout_height="30dp" - android:layout_marginLeft="4dp" - android:layout_marginRight="4dp" - android:layout_toLeftOf="@id/switchBackground" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" + android:layout_toStartOf="@id/switchBackground" android:layout_centerVertical="true" android:clickable="true" android:focusable="true" @@ -422,8 +417,8 @@ android:background="@drawable/player_controls_bg" android:gravity="center" android:orientation="horizontal" - android:paddingLeft="16dp" - android:paddingRight="16dp"> + android:paddingStart="16dp" + android:paddingEnd="16dp"> + android:paddingStart="12dp" + android:paddingEnd="12dp"> @@ -232,9 +232,9 @@ android:id="@+id/detail_root" android:layout_width="match_parent" android:layout_height="55dp" - android:layout_marginLeft="12dp" + android:layout_marginStart="12dp" android:layout_marginTop="6dp" - android:layout_marginRight="12dp" + android:layout_marginEnd="12dp" android:baselineAligned="false" android:orientation="horizontal"> @@ -244,7 +244,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_toStartOf="@id/details_panel" - android:layout_toLeftOf="@id/details_panel" android:background="?attr/selectableItemBackground" android:gravity="center_vertical" android:orientation="horizontal" @@ -262,7 +261,7 @@ android:id="@+id/detail_uploader_text_view" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginLeft="15dp" + android:layout_marginStart="15dp" android:ellipsize="marquee" android:fadingEdge="horizontal" android:marqueeRepeatLimit="marquee_forever" @@ -278,12 +277,12 @@ android:id="@+id/detail_uploader_subscribe" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center_vertical|right" - android:layout_marginRight="12dp" + android:layout_gravity="center_vertical|end" + android:layout_marginEnd="12dp" android:text="@string/rss_button_title" android:textSize="12sp" android:theme="@style/RedButton" - android:drawableLeft="@drawable/ic_rss_feed_white_24dp" + android:drawableStart="@drawable/ic_rss_feed_white_24dp" tools:ignore="RtlHardcoded" android:visibility="gone"/>--> @@ -294,9 +293,8 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" - android:paddingLeft="6dp" - android:paddingRight="6dp"> + android:paddingStart="6dp" + android:paddingEnd="6dp"> @@ -349,8 +347,8 @@ android:layout_width="wrap_content" android:layout_height="@dimen/video_item_detail_like_image_height" android:layout_below="@id/detail_view_count_view" - android:layout_marginLeft="@dimen/video_item_detail_like_margin" - android:layout_toRightOf="@id/detail_thumbs_down_img_view" + android:layout_marginStart="@dimen/video_item_detail_like_margin" + android:layout_toEndOf="@id/detail_thumbs_down_img_view" android:gravity="center_vertical" android:lines="1" android:textAppearance="?android:attr/textAppearanceMedium" @@ -363,8 +361,8 @@ android:layout_width="wrap_content" android:layout_height="@dimen/video_item_detail_like_image_height" android:layout_below="@id/detail_view_count_view" - android:layout_marginLeft="12dp" - android:layout_toRightOf="@id/detail_thumbs_down_img_view" + android:layout_marginStart="12dp" + android:layout_toEndOf="@id/detail_thumbs_down_img_view" android:gravity="center_vertical" android:text="@string/disabled" android:textAppearance="?android:attr/textAppearanceLarge" @@ -459,8 +457,8 @@ @@ -479,8 +477,8 @@ android:id="@+id/detail_upload_date_view" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="12dp" - android:layout_marginRight="12dp" + android:layout_marginStart="12dp" + android:layout_marginEnd="12dp" android:textAppearance="?android:attr/textAppearanceMedium" android:textSize="@dimen/video_item_detail_upload_date_text_size" android:textStyle="bold" @@ -491,9 +489,9 @@ android:nextFocusUp="@+id/detail_control_panel" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginLeft="12dp" + android:layout_marginStart="12dp" android:layout_marginTop="3dp" - android:layout_marginRight="12dp" + android:layout_marginEnd="12dp" android:layout_marginBottom="8dp" android:textAppearance="?android:attr/textAppearanceMedium" android:textIsSelectable="true" @@ -504,8 +502,8 @@ diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index fb11677f843..513b456ebf9 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -27,6 +27,7 @@ diff --git a/app/src/main/res/layout/activity_error.xml b/app/src/main/res/layout/activity_error.xml index c47077c73de..b68d1971319 100644 --- a/app/src/main/res/layout/activity_error.xml +++ b/app/src/main/res/layout/activity_error.xml @@ -18,8 +18,8 @@ android:layout_height="wrap_content" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingStart="@dimen/activity_horizontal_margin" + android:paddingEnd="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:focusable="true" android:focusableInTouchMode="true"> @@ -70,7 +70,7 @@ android:text="@string/info_labels"/> diff --git a/app/src/main/res/layout/activity_main_player.xml b/app/src/main/res/layout/activity_main_player.xml index 2b643ec76e0..e7ebf3ffa4d 100644 --- a/app/src/main/res/layout/activity_main_player.xml +++ b/app/src/main/res/layout/activity_main_player.xml @@ -64,9 +64,7 @@ android:layout_width="50dp" android:layout_height="50dp" android:layout_centerVertical="true" - android:layout_alignParentRight="true" android:layout_alignParentEnd="true" - android:layout_marginRight="40dp" android:layout_marginEnd="40dp" android:padding="10dp" android:clickable="true" @@ -82,9 +80,7 @@ android:layout_width="50dp" android:layout_height="50dp" android:layout_centerVertical="true" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" - android:layout_marginLeft="40dp" android:layout_marginStart="40dp" android:padding="10dp" android:clickable="true" @@ -100,7 +96,7 @@ android:layout_width="50dp" android:layout_height="50dp" android:layout_centerVertical="true" - android:layout_toRightOf="@id/repeatButton" + android:layout_toEndOf="@id/repeatButton" android:padding="10dp" android:clickable="true" android:focusable="true" @@ -146,21 +142,21 @@ android:gravity="top" android:paddingTop="10dp" android:paddingBottom="10dp" - android:paddingLeft="5dp" - android:paddingRight="5dp" + android:paddingStart="5dp" + android:paddingEnd="5dp" tools:ignore="RtlHardcoded"> @@ -272,9 +268,9 @@ android:id="@+id/resizeTextView" android:layout_width="wrap_content" android:layout_height="35dp" - android:layout_marginLeft="8dp" - android:layout_marginRight="8dp" - android:layout_alignParentLeft="true" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + android:layout_alignParentStart="true" android:gravity="center" android:minWidth="50dp" android:textColor="@android:color/white" @@ -287,15 +283,15 @@ android:id="@+id/captionTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="8dp" - android:layout_marginRight="8dp" - android:layout_toLeftOf="@id/switchMute" - android:layout_toRightOf="@id/resizeTextView" - android:gravity="center|left" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + android:layout_toStartOf="@id/switchMute" + android:layout_toEndOf="@id/resizeTextView" + android:gravity="center|start" android:minHeight="35dp" android:minWidth="40dp" - android:paddingLeft="2dp" - android:paddingRight="2dp" + android:paddingStart="2dp" + android:paddingEnd="2dp" android:textColor="@android:color/white" android:textStyle="bold" android:background="?attr/selectableItemBackground" @@ -306,9 +302,9 @@ android:id="@+id/kodi" android:layout_width="30dp" android:layout_height="30dp" - android:layout_marginLeft="4dp" - android:layout_marginRight="2dp" - android:layout_alignParentRight="true" + android:layout_marginStart="4dp" + android:layout_marginEnd="2dp" + android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:clickable="true" android:focusable="true" @@ -324,9 +320,9 @@ android:id="@+id/share" android:layout_width="30dp" android:layout_height="30dp" - android:layout_marginLeft="4dp" - android:layout_marginRight="2dp" - android:layout_toLeftOf="@id/kodi" + android:layout_marginStart="4dp" + android:layout_marginEnd="2dp" + android:layout_toStartOf="@id/kodi" android:layout_alignWithParentIfMissing="true" android:layout_centerVertical="true" android:clickable="true" @@ -342,9 +338,9 @@ android:id="@+id/toggleOrientation" android:layout_width="30dp" android:layout_height="30dp" - android:layout_marginLeft="4dp" - android:layout_marginRight="4dp" - android:layout_toLeftOf="@id/share" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" + android:layout_toStartOf="@id/share" android:layout_centerVertical="true" android:clickable="true" android:focusable="true" @@ -359,9 +355,9 @@ android:id="@+id/switchPopup" android:layout_width="30dp" android:layout_height="30dp" - android:layout_marginLeft="4dp" - android:layout_marginRight="4dp" - android:layout_toLeftOf="@id/toggleOrientation" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" + android:layout_toStartOf="@id/toggleOrientation" android:layout_centerVertical="true" android:clickable="true" android:focusable="true" @@ -375,9 +371,9 @@ android:id="@+id/switchBackground" android:layout_width="30dp" android:layout_height="30dp" - android:layout_marginLeft="4dp" - android:layout_marginRight="4dp" - android:layout_toLeftOf="@id/switchPopup" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" + android:layout_toStartOf="@id/switchPopup" android:layout_centerVertical="true" android:clickable="true" android:focusable="true" @@ -392,9 +388,9 @@ android:id="@+id/switchMute" android:layout_width="30dp" android:layout_height="30dp" - android:layout_marginLeft="4dp" - android:layout_marginRight="4dp" - android:layout_toLeftOf="@id/switchBackground" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" + android:layout_toStartOf="@id/switchBackground" android:layout_centerVertical="true" android:clickable="true" android:focusable="true" @@ -415,8 +411,8 @@ android:background="@drawable/player_controls_bg" android:gravity="center" android:orientation="horizontal" - android:paddingLeft="16dp" - android:paddingRight="16dp"> + android:paddingStart="16dp" + android:paddingEnd="16dp"> @@ -168,9 +168,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" - android:paddingLeft="12dp" + android:paddingStart="12dp" android:paddingTop="4dp" - android:paddingRight="12dp" + android:paddingEnd="12dp" android:paddingBottom="4dp"> @@ -56,11 +55,9 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" - android:layout_marginLeft="4dp" - android:layout_marginRight="4dp" - android:layout_toRightOf="@id/tempoStepDown" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" android:layout_toEndOf="@id/tempoStepDown" - android:layout_toLeftOf="@id/tempoStepUp" android:layout_toStartOf="@id/tempoStepUp"> @@ -96,9 +91,7 @@ android:gravity="center" android:text="---%" android:textColor="?attr/colorAccent" - android:layout_alignParentRight="true" android:layout_alignParentEnd="true" - android:layout_marginRight="4dp" android:layout_marginEnd="4dp" tools:ignore="HardcodedText" tools:text="300%"/> @@ -125,9 +118,7 @@ android:textColor="?attr/colorAccent" android:background="?attr/selectableItemBackground" android:layout_centerVertical="true" - android:layout_alignParentRight="true" android:layout_alignParentEnd="true" - android:layout_marginRight="4dp" android:layout_marginEnd="4dp" tools:ignore="HardcodedText" tools:text="+5%"/> @@ -172,7 +163,6 @@ android:textStyle="bold" android:textColor="?attr/colorAccent" android:background="?attr/selectableItemBackground" - android:layout_alignParentLeft="true" android:layout_alignParentStart="true" tools:ignore="HardcodedText" tools:text="-5%"/> @@ -182,11 +172,9 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" - android:layout_marginLeft="4dp" - android:layout_marginRight="4dp" - android:layout_toRightOf="@+id/pitchStepDown" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" android:layout_toEndOf="@+id/pitchStepDown" - android:layout_toLeftOf="@+id/pitchStepUp" android:layout_toStartOf="@+id/pitchStepUp"> @@ -222,9 +208,7 @@ android:gravity="center" android:text="---%" android:textColor="?attr/colorAccent" - android:layout_alignParentRight="true" android:layout_alignParentEnd="true" - android:layout_marginRight="4dp" android:layout_marginEnd="4dp" tools:ignore="HardcodedText" tools:text="300%"/> @@ -251,9 +235,7 @@ android:textColor="?attr/colorAccent" android:background="?attr/selectableItemBackground" android:layout_centerVertical="true" - android:layout_alignParentRight="true" android:layout_alignParentEnd="true" - android:layout_marginRight="4dp" android:layout_marginEnd="4dp" tools:ignore="HardcodedText" tools:text="+5%"/> diff --git a/app/src/main/res/layout/dialog_playlist_name.xml b/app/src/main/res/layout/dialog_playlist_name.xml index 2dfab228bb5..6b49faa8b29 100644 --- a/app/src/main/res/layout/dialog_playlist_name.xml +++ b/app/src/main/res/layout/dialog_playlist_name.xml @@ -3,8 +3,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:clickable="false" - android:paddingLeft="@dimen/video_item_search_padding" - android:paddingRight="@dimen/video_item_search_padding" + android:paddingStart="@dimen/video_item_search_padding" + android:paddingEnd="@dimen/video_item_search_padding" android:paddingTop="@dimen/video_item_search_padding"> @@ -26,8 +26,8 @@ android:id="@+id/newPlaylistText" android:layout_width="match_parent" android:layout_height="50dp" - android:layout_toRightOf="@+id/newPlaylistIcon" - android:gravity="left|center" + android:layout_toEndOf="@+id/newPlaylistIcon" + android:gravity="start|center" android:text="@string/create_playlist" android:textAppearance="?android:attr/textAppearanceLarge" android:textSize="15sp" @@ -40,8 +40,8 @@ android:layout_width="match_parent" android:layout_height="1dp" android:layout_below="@+id/newPlaylist" - android:layout_marginLeft="@dimen/video_item_search_padding" - android:layout_marginRight="@dimen/video_item_search_padding" + android:layout_marginStart="@dimen/video_item_search_padding" + android:layout_marginEnd="@dimen/video_item_search_padding" android:background="?attr/separator_color"/> @@ -25,8 +25,8 @@ android:layout_height="wrap_content" android:layout_below="@+id/file_name_text_view" android:layout_marginBottom="6dp" - android:layout_marginLeft="20dp" - android:layout_marginRight="20dp" + android:layout_marginStart="20dp" + android:layout_marginEnd="20dp" android:inputType="text" android:maxLines="1"/> @@ -36,8 +36,8 @@ android:layout_height="wrap_content" android:layout_below="@+id/file_name" android:layout_marginBottom="6dp" - android:layout_marginLeft="20dp" - android:gravity="left" + android:layout_marginStart="20dp" + android:gravity="start" android:orientation="horizontal" tools:ignore="RtlHardcoded"> @@ -67,8 +67,8 @@ android:layout_height="wrap_content" android:layout_below="@+id/video_audio_group" android:layout_marginBottom="12dp" - android:layout_marginLeft="20dp" - android:layout_marginRight="20dp" + android:layout_marginStart="20dp" + android:layout_marginEnd="20dp" android:minWidth="150dp" tools:listitem="@layout/stream_quality_item"/> @@ -78,8 +78,8 @@ android:layout_height="wrap_content" android:layout_below="@+id/quality_spinner" android:layout_marginBottom="6dp" - android:layout_marginLeft="24dp" - android:layout_marginRight="24dp" + android:layout_marginStart="24dp" + android:layout_marginEnd="24dp" android:text="@string/msg_threads"/> @@ -97,7 +97,7 @@ android:layout_width="25dp" android:layout_height="match_parent" android:gravity="center_vertical" - android:paddingLeft="2dp" + android:paddingStart="2dp" tools:ignore="RtlHardcoded,RtlSymmetry" tools:text="3"/> diff --git a/app/src/main/res/layout/drawer_header.xml b/app/src/main/res/layout/drawer_header.xml index 3cd3b233391..d939f2160c2 100644 --- a/app/src/main/res/layout/drawer_header.xml +++ b/app/src/main/res/layout/drawer_header.xml @@ -30,8 +30,8 @@ @@ -70,8 +70,8 @@ android:background="@drawable/drawer_header_bottom_background" android:gravity="center" android:orientation="horizontal" - android:paddingLeft="6dp" - android:paddingRight="6dp"> + android:paddingStart="6dp" + android:paddingEnd="6dp"> @@ -35,11 +35,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" - android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" android:layout_marginTop="6dp" android:layout_marginBottom="6dp" - android:layout_toLeftOf="@+id/handle" - android:layout_toRightOf="@+id/group_icon" + android:layout_toStartOf="@+id/handle" + android:layout_toEndOf="@+id/group_icon" android:ellipsize="end" android:maxLines="2" android:textAppearance="?textAppearanceListItem" @@ -50,11 +50,11 @@ android:id="@+id/handle" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_centerVertical="true" - android:paddingLeft="16dp" + android:paddingStart="16dp" android:paddingTop="12dp" - android:paddingRight="16dp" + android:paddingEnd="16dp" android:paddingBottom="12dp" android:src="?attr/drag_handle" tools:ignore="ContentDescription,RtlHardcoded" /> diff --git a/app/src/main/res/layout/feed_import_export_group.xml b/app/src/main/res/layout/feed_import_export_group.xml index 2049db65e4d..20f32f3fd91 100644 --- a/app/src/main/res/layout/feed_import_export_group.xml +++ b/app/src/main/res/layout/feed_import_export_group.xml @@ -40,8 +40,8 @@ android:layout_height="wrap_content" android:layout_weight="1" android:paddingBottom="8dp" - android:paddingLeft="16dp" - android:paddingRight="16dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" android:paddingTop="8dp" android:text="@string/tab_subscriptions" android:textColor="?android:attr/textColorPrimary" @@ -53,7 +53,7 @@ android:id="@+id/import_export_expand_icon" android:layout_width="24dp" android:layout_height="24dp" - android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" app:srcCompat="?attr/expand" tools:ignore="ContentDescription,RtlHardcoded"/> @@ -71,9 +71,9 @@ android:id="@+id/import_from_title" android:layout_width="match_parent" android:layout_height="@dimen/subscription_import_export_title_height" - android:gravity="left|center" + android:gravity="start|center" android:maxLines="1" - android:paddingLeft="36dp" + android:paddingStart="36dp" android:text="@string/import_from" android:textAppearance="?android:attr/textAppearanceLarge" android:textSize="13sp" @@ -83,7 +83,6 @@ android:id="@+id/import_from_options" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginLeft="36dp" android:layout_marginStart="36dp" android:orientation="vertical"/> @@ -92,9 +91,9 @@ android:layout_width="match_parent" android:layout_height="@dimen/subscription_import_export_title_height" android:background="?attr/selectableItemBackground" - android:gravity="left|center" + android:gravity="start|center" android:maxLines="1" - android:paddingLeft="36dp" + android:paddingStart="36dp" android:text="@string/export_to" android:textAppearance="?android:attr/textAppearanceLarge" android:textSize="13sp" diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml index d510bf26d37..328328b5d5a 100644 --- a/app/src/main/res/layout/fragment_about.xml +++ b/app/src/main/res/layout/fragment_about.xml @@ -11,8 +11,8 @@ android:layout_height="wrap_content" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingStart="@dimen/activity_horizontal_margin" + android:paddingEnd="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin"> @@ -55,11 +57,15 @@ android:layout_height="wrap_content" android:paddingTop="10dp" android:text="@string/contribution_title" + android:textAlignment="viewStart" + android:textDirection="anyRtl" android:textAppearance="@android:style/TextAppearance.Medium" />