Files
ClashMetaForAndroid/design/src/main/res/layout/design_main.xml
2022-06-16 14:27:24 +07:00

153 lines
7.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="self"
type="com.github.kr328.clash.design.MainDesign" />
<variable
name="clashRunning"
type="boolean" />
<variable
name="forwarded"
type="String" />
<variable
name="mode"
type="String" />
<variable
name="profileName"
type="String" />
<variable
name="colorClashStarted"
type="int" />
<variable
name="colorClashStopped"
type="int" />
<variable
name="hasProviders"
type="boolean" />
<import type="android.view.View" />
<import type="com.github.kr328.clash.design.MainDesign.Request" />
</data>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="@{self.surface.insets.start}"
android:paddingEnd="@{self.surface.insets.end}">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingHorizontal="@dimen/main_padding_horizontal"
android:paddingTop="@{self.surface.insets.top}"
android:paddingBottom="@{self.surface.insets.bottom}">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="@dimen/main_top_banner_height"
android:orientation="horizontal">
<FrameLayout
android:layout_width="@dimen/large_item_header_layout_size"
android:layout_height="@dimen/large_item_header_layout_size">
<View
android:layout_width="@dimen/main_logo_size"
android:layout_height="@dimen/main_logo_size"
android:layout_gravity="center"
android:background="@drawable/ic_clash" />
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/launch_name"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6" />
</LinearLayout>
<com.github.kr328.clash.design.view.LargeActionCard
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/main_card_margin_vertical"
android:onClick="@{() -> self.request(Request.ToggleStatus)}"
android:theme="@style/AppThemeDark"
app:cardBackgroundColor="@{clashRunning ? colorClashStarted : colorClashStopped}"
app:icon="@{clashRunning ? @drawable/ic_outline_check_circle : @drawable/ic_outline_not_interested}"
app:subtext="@{clashRunning ? @string/format_traffic_forwarded(forwarded) : @string/tap_to_start}"
app:text="@{clashRunning ? @string/running : @string/stopped}" />
<com.github.kr328.clash.design.view.LargeActionCard
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/main_card_margin_vertical"
android:onClick="@{() -> self.request(Request.OpenProxy)}"
android:visibility="@{clashRunning ? View.VISIBLE : View.GONE}"
app:icon="@drawable/ic_baseline_apps"
app:subtext="@{mode}"
app:text="@string/proxy" />
<com.github.kr328.clash.design.view.LargeActionCard
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/main_card_margin_vertical"
android:onClick="@{() -> self.request(Request.OpenProfiles)}"
app:icon="@drawable/ic_baseline_view_list"
app:subtext="@{profileName != null ? @string/format_profile_activated(profileName) : @string/not_selected}"
app:text="@string/profile" />
<com.github.kr328.clash.design.view.LargeActionLabel
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginVertical="@dimen/main_label_margin_vertical"
android:onClick="@{() -> self.request(Request.OpenProviders)}"
android:visibility="@{clashRunning &amp;&amp; hasProviders ? View.VISIBLE : View.GONE}"
app:icon="@drawable/ic_baseline_swap_vertical_circle"
app:text="@string/providers" />
<com.github.kr328.clash.design.view.LargeActionLabel
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/main_label_margin_vertical"
android:onClick="@{() -> self.request(Request.OpenLogs)}"
app:icon="@drawable/ic_baseline_assignment"
app:text="@string/logs" />
<com.github.kr328.clash.design.view.LargeActionLabel
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/main_label_margin_vertical"
android:onClick="@{() -> self.request(Request.OpenSettings)}"
app:icon="@drawable/ic_baseline_settings"
app:text="@string/settings" />
<com.github.kr328.clash.design.view.LargeActionLabel
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/main_label_margin_vertical"
android:onClick="@{() -> self.request(Request.OpenHelp)}"
app:icon="@drawable/ic_baseline_help_center"
app:text="@string/help" />
<com.github.kr328.clash.design.view.LargeActionLabel
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/main_label_margin_vertical"
android:onClick="@{() -> self.request(Request.OpenAbout)}"
app:icon="@drawable/ic_baseline_info"
app:text="@string/about" />
</LinearLayout>
</ScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>