Commit 35021f68 authored by fallenstardust's avatar fallenstardust

优化翻页操作

parent c2173c63
......@@ -72,7 +72,7 @@ public class DeckManageDialog extends DialogFragment implements YGODeckDialogUti
tab.setText("卡组广场");
break;
case 2:
tab.setText("我的在线卡组");
tab.setText("云备份卡组");
break;
case 3:
tab.setText("登录");
......
......@@ -42,7 +42,8 @@ public class DeckSquareFragment extends Fragment {
binding.listDeckInfo.setLayoutManager(linearLayoutManager);
binding.listDeckInfo.setAdapter(deckSquareListAdapter);
deckSquareListAdapter.loadData();
// 设置页码跳转监听
binding.etGoToPage.setText("1");
// 设置页码跳转监听
binding.etGoToPage.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_DONE) {
int targetPage = 0;
......@@ -53,7 +54,7 @@ public class DeckSquareFragment extends Fragment {
}
binding.tvPageInfo.setText(Integer.toString(targetPage));
binding.etGoToPage.setText(Integer.toString(targetPage));
deckSquareListAdapter.loadData(targetPage, 30);
return true;
}
......@@ -64,14 +65,14 @@ public class DeckSquareFragment extends Fragment {
public void onClick(View v) {
int targetPage = 0;
try {
targetPage = Integer.parseInt(binding.tvPageInfo.getText().toString());
targetPage = Integer.parseInt(binding.etGoToPage.getText().toString());
} catch (NumberFormatException e) {
}
int newPage = targetPage + 1;
deckSquareListAdapter.loadData(newPage, 30);
binding.tvPageInfo.setText(Integer.toString(newPage));
binding.etGoToPage.setText(Integer.toString(newPage));
}
});
......@@ -80,7 +81,7 @@ public class DeckSquareFragment extends Fragment {
public void onClick(View v) {
int targetPage = 0;
try {
targetPage = Integer.parseInt(binding.tvPageInfo.getText().toString());
targetPage = Integer.parseInt(binding.etGoToPage.getText().toString());
} catch (NumberFormatException e) {
}
......@@ -89,7 +90,7 @@ public class DeckSquareFragment extends Fragment {
newPage = 1;
}
deckSquareListAdapter.loadData(newPage, 30);
binding.tvPageInfo.setText(Integer.toString(newPage));
binding.etGoToPage.setText(Integer.toString(newPage));
}
......@@ -99,7 +100,7 @@ public class DeckSquareFragment extends Fragment {
public void onClick(View v) {
int targetPage = 1;
try {
targetPage = Integer.parseInt(binding.tvPageInfo.getText().toString());
targetPage = Integer.parseInt(binding.etGoToPage.getText().toString());
} catch (NumberFormatException e) {
}
......
......@@ -91,7 +91,6 @@ public class DeckSquareListAdapter extends BaseQuickAdapter<OnlineDeckDetail, Ba
if (code != 0) {
imageLoader.bindImage(cardImage, code, null, ImageLoader.Type.small);
} else {
imageLoader.bindImage(cardImage, -1, null, ImageLoader.Type.small);
}
// ImageView imageview = helper.getView(R.id.ex_card_image);
......
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:alpha="0.8" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M14,7l-5,5 5,5V7z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:alpha="0.8" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M10,17l5,-5 -5,-5v10z"/>
</vector>
......@@ -2,32 +2,35 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="14"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.8">
android:layout_height="0dp"
android:layout_weight="12.5"
android:weightSum="10"
android:orientation="vertical">
<EditText
android:id="@+id/et_deck_square_input_deck_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:hint="@string/intpu_name"
android:imeOptions="actionSearch"
android:inputType="textNoSuggestions"
android:singleLine="true"
android:textSize="15sp"
android:textColor="@color/holo_blue_bright"
android:textColorHint="@color/gray" />
android:textColorHint="@color/gray"
android:textSize="15sp" />
<com.tubb.smrv.SwipeMenuRecyclerView
android:id="@+id/list_deck_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_weight="9"
android:divider="@android:color/transparent"
android:dividerHeight="4dp"
android:padding="5dp"
......@@ -36,59 +39,75 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:orientation="horizontal">
android:layout_height="0dp"
android:layout_weight="2"
android:orientation="vertical"
android:weightSum="2">
<Button
android:id="@+id/former_page_btn"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/button_bg"
android:text="◀"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="页"
android:textSize="14sp" />
android:layout_height="0dp"
android:layout_weight="0.5"
android:weightSum="3">
<TextView
android:id="@+id/tv_page_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:textSize="14sp" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1"
android:background="@color/holo_blue_light" />
<Button
android:id="@+id/next_page_btn"
<EditText
android:id="@+id/et_go_to_page"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1"
android:hint="@string/go_to"
android:inputType="number"
android:imeOptions="actionSearch"
android:background="@drawable/veil2"
android:singleLine="true"
android:textSize="14sp" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1"
android:background="@color/holo_blue_light" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/button_bg"
android:text="▶"/>
android:layout_gravity="bottom"
android:layout_margin="5dp">
<!-- <Spinner-->
<!-- android:id="@+id/spinner_items_per_page"-->
<!-- android:layout_width="80dp"-->
<!-- android:layout_height="32dp" />-->
<EditText
android:id="@+id/et_go_to_page"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Go to"
android:inputType="number"
android:maxLines="1"
android:textSize="14sp"
<ImageButton
android:id="@+id/former_page_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="5dp"
android:background="@drawable/ic_radius_bg"
android:src="@drawable/baseline_arrow_left_24" />
/>
<ImageButton
android:id="@+id/next_page_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="5dp"
android:background="@drawable/ic_radius_bg"
android:src="@drawable/baseline_arrow_right_24" />
<Button
android:id="@+id/refresh_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/button_bg"
android:text="↑↓"></Button>
<ImageButton
android:id="@+id/refresh_data"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="5dp"
android:background="@drawable/ic_radius_bg"
android:src="@drawable/ic_refresh" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
......@@ -3,14 +3,14 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="10"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="0.8">
android:layout_height="0dp"
android:layout_weight="9.5"
android:orientation="vertical">
<EditText
android:id="@+id/et_my_deck_input_deck_name"
......@@ -21,9 +21,9 @@
android:imeOptions="actionSearch"
android:inputType="textNoSuggestions"
android:singleLine="true"
android:textSize="15sp"
android:textColor="@color/holo_blue_bright"
android:textColorHint="@color/gray" />
android:textColorHint="@color/gray"
android:textSize="15sp" />
<com.tubb.smrv.SwipeMenuRecyclerView
android:id="@+id/list_my_deck_info"
......@@ -37,32 +37,12 @@
tools:layout_editor_absoluteY="16dp" />
</LinearLayout>
<!-- <Button
android:id="@+id/upload_deck"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|bottom"
android:text="上传卡组"></Button>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:orientation="horizontal">
<Button
android:id="@+id/refresh_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|bottom"
android:background="@drawable/button_bg"
android:text="@string/refresh"/>
</LinearLayout>
<!--<com.google.android.material.floatingactionbutton.FloatingActionButton
<ImageButton
android:id="@+id/refresh_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginBottom="16dp"
android:tooltipText="刷新" />-->
android:layout_height="0dp"
android:layout_weight="0.5"
android:layout_gravity="center"
android:background="@drawable/ic_radius_bg"
android:src="@drawable/ic_refresh" />
</LinearLayout>
......@@ -371,5 +371,6 @@
<string name="about_user_privacy_policy">Explicación de los permisos utilizados por YGOMobile</string>
<string name="open">Abrir el Deck</string>
<string name="web_warn_save_deck">Abrir el Deck cerrará la página web que estás viendo actualmente. ¿Deseas cerrar la página web y abrir el Deck?</string>
<string name="go_to">pasar a</string>
</resources>
......@@ -365,4 +365,5 @@
<string name="about_user_privacy_policy">このアプリが使用する権限についての説明</string>
<string name="open">デッキを開く</string>
<string name="web_warn_save_deck">デッキを開くと、現在閲覧しているウェブページが閉じられます。ウェブページを閉じてデッキを開きますか?</string>
<string name="go_to">移る</string>
</resources>
......@@ -366,4 +366,5 @@
<string name="about_user_privacy_policy">이 앱에서 사용하는 권한에 대한 설명</string>
<string name="open">덱을 열기</string>
<string name="web_warn_save_deck">덱을 열면 현재 보고 있는 웹 페이지가 닫힙니다. 웹 페이지를 닫고 덱을 열까요?</string>
<string name="go_to">이동하다 로</string>
</resources>
......@@ -355,5 +355,6 @@
<string name="tip_download_ex">Há novas cartas, venha jogar!</string>
<string name="user_privacy_policy">Política de Privacidade do Usuário</string>
<string name="about_user_privacy_policy">Explicação das permissões utilizadas pelo YGOMobile</string>
<string name="go_to">pasar a</string>
</resources>
......@@ -367,6 +367,7 @@
<string name="user_privacy_policy">用户隐私政策</string>
<string name="about_user_privacy_policy">关于本应用使用的权限进行说明</string>
<string name="open">打开</string>
<string name="go_to">转到</string>
<string name="web_warn_save_deck">打开卡组将关闭正在浏览的网页,是否关闭网页并打开卡组</string>
......
......@@ -435,4 +435,5 @@
<string name="down_complete">download complete</string>
<string name="upload">upload</string>
<string name="go_to">go to</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment