[app] Fix the tabLayout style of the repository item fragment (#883)
The repository item fragment and modules fragment use the same layout file, the previous commit missed this. The changes in fragment_pager.xml are just formatting code.
This commit is contained in:
parent
7481f04947
commit
bf969cfc5f
|
|
@ -48,6 +48,7 @@ import androidx.viewpager2.widget.ViewPager2;
|
||||||
import com.google.android.material.button.MaterialButton;
|
import com.google.android.material.button.MaterialButton;
|
||||||
import com.google.android.material.progressindicator.CircularProgressIndicator;
|
import com.google.android.material.progressindicator.CircularProgressIndicator;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
import com.google.android.material.tabs.TabLayout;
|
||||||
import com.google.android.material.tabs.TabLayoutMediator;
|
import com.google.android.material.tabs.TabLayoutMediator;
|
||||||
|
|
||||||
import org.lsposed.manager.App;
|
import org.lsposed.manager.App;
|
||||||
|
|
@ -74,6 +75,7 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import rikka.recyclerview.RecyclerViewKt;
|
import rikka.recyclerview.RecyclerViewKt;
|
||||||
import rikka.widget.borderview.BorderNestedScrollView;
|
import rikka.widget.borderview.BorderNestedScrollView;
|
||||||
|
|
@ -125,6 +127,16 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
|
||||||
});
|
});
|
||||||
int[] titles = new int[]{R.string.module_readme, R.string.module_releases, R.string.module_information};
|
int[] titles = new int[]{R.string.module_readme, R.string.module_releases, R.string.module_information};
|
||||||
new TabLayoutMediator(binding.tabLayout, binding.viewPager, (tab, position) -> tab.setText(titles[position])).attach();
|
new TabLayoutMediator(binding.tabLayout, binding.viewPager, (tab, position) -> tab.setText(titles[position])).attach();
|
||||||
|
|
||||||
|
binding.tabLayout.addOnLayoutChangeListener((view, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
|
||||||
|
ViewGroup vg = (ViewGroup) binding.tabLayout.getChildAt(0);
|
||||||
|
int tabLayoutWidth = IntStream.range(0, binding.tabLayout.getTabCount()).map(i -> vg.getChildAt(i).getWidth()).sum();
|
||||||
|
if (tabLayoutWidth <= binding.getRoot().getWidth()) {
|
||||||
|
binding.tabLayout.setTabMode(TabLayout.MODE_FIXED);
|
||||||
|
binding.tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@
|
||||||
android:id="@+id/snackbar"
|
android:id="@+id/snackbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:animateLayoutChanges="true"
|
||||||
app:consumeSystemWindowsInsets="start|end"
|
app:consumeSystemWindowsInsets="start|end"
|
||||||
app:edgeToEdge="true"
|
app:edgeToEdge="true"
|
||||||
android:animateLayoutChanges="true"
|
|
||||||
app:fitsSystemWindowsInsets="start|end">
|
app:fitsSystemWindowsInsets="start|end">
|
||||||
|
|
||||||
<rikka.material.widget.AppBarLayout
|
<rikka.material.widget.AppBarLayout
|
||||||
|
|
@ -44,18 +44,18 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="?attr/actionBarSize"
|
android:minHeight="?attr/actionBarSize"
|
||||||
|
app:popupTheme="?actionBarPopupTheme"
|
||||||
app:subtitleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Subtitle"
|
app:subtitleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Subtitle"
|
||||||
app:titleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Title"
|
app:titleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Title" />
|
||||||
app:popupTheme="?actionBarPopupTheme" />
|
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
<com.google.android.material.tabs.TabLayout
|
||||||
android:id="@+id/tab_layout"
|
android:id="@+id/tab_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/tab_layout_height"
|
android:layout_height="@dimen/tab_layout_height"
|
||||||
app:tabMode="scrollable"
|
|
||||||
app:tabGravity="center"
|
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
app:tabIndicatorAnimationMode="elastic" />
|
app:tabGravity="center"
|
||||||
|
app:tabIndicatorAnimationMode="elastic"
|
||||||
|
app:tabMode="scrollable" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</rikka.material.widget.AppBarLayout>
|
</rikka.material.widget.AppBarLayout>
|
||||||
|
|
||||||
|
|
@ -69,11 +69,11 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end|bottom"
|
android:layout_gravity="end|bottom"
|
||||||
android:src="@drawable/ic_baseline_add_24"
|
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:visibility="invisible"
|
android:contentDescription="@string/add_module_to_user"
|
||||||
android:outlineAmbientShadowColor="?colorAccent"
|
android:outlineAmbientShadowColor="?colorAccent"
|
||||||
android:outlineSpotShadowColor="?colorAccent"
|
android:outlineSpotShadowColor="?colorAccent"
|
||||||
app:layout_fitsSystemWindowsInsets="bottom"
|
android:src="@drawable/ic_baseline_add_24"
|
||||||
android:contentDescription="@string/add_module_to_user" />
|
android:visibility="invisible"
|
||||||
|
app:layout_fitsSystemWindowsInsets="bottom" />
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,7 @@
|
||||||
<string name="dns_over_http_summary">解决某些地区的 DNS 污染问题</string>
|
<string name="dns_over_http_summary">解决某些地区的 DNS 污染问题</string>
|
||||||
<string name="theme_color">主题颜色</string>
|
<string name="theme_color">主题颜色</string>
|
||||||
<string name="theme_color_summary">应用中最常见的颜色</string>
|
<string name="theme_color_summary">应用中最常见的颜色</string>
|
||||||
|
<string name="theme_color_system_accent">系统强调色</string>
|
||||||
<string name="settings_show_hidden_icon_apps_enabled">强制应用在启动器中显示图标</string>
|
<string name="settings_show_hidden_icon_apps_enabled">强制应用在启动器中显示图标</string>
|
||||||
<string name="settings_show_hidden_icon_apps_enabled_summary">在 Android 10 之后,应用(特别是 Xposed 模块)不被允许隐藏启动器图标。关闭本选项以禁用此功能。</string>
|
<string name="settings_show_hidden_icon_apps_enabled_summary">在 Android 10 之后,应用(特别是 Xposed 模块)不被允许隐藏启动器图标。关闭本选项以禁用此功能。</string>
|
||||||
<string name="settings_group_system">系统</string>
|
<string name="settings_group_system">系统</string>
|
||||||
|
|
@ -189,4 +190,5 @@
|
||||||
<string name="translators"><![CDATA[<a href="https://github.com/LSPosed/LSPosed">LSPosed</a>]]></string>
|
<string name="translators"><![CDATA[<a href="https://github.com/LSPosed/LSPosed">LSPosed</a>]]></string>
|
||||||
<string name="copy_toast_msg">已复制</string>
|
<string name="copy_toast_msg">已复制</string>
|
||||||
<string name="list_empty">¯\\\\_(ツ)_\/¯\n空空如也</string>
|
<string name="list_empty">¯\\\\_(ツ)_\/¯\n空空如也</string>
|
||||||
|
<string name="add_module_to_user">安装模块到用户</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue