Commit 35021f68 authored by fallenstardust's avatar fallenstardust

优化翻页操作

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