Commit aafbf4f3 authored by fallenstardust's avatar fallenstardust

添加卡组分享者查询

parent 92b99ad2
package cn.garymb.ygomobile.deck_square; package cn.garymb.ygomobile.deck_square;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -34,11 +36,7 @@ public class DeckSquareFragment extends Fragment { ...@@ -34,11 +36,7 @@ public class DeckSquareFragment extends Fragment {
} }
@Override @Override
public View onCreateView( public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentDeckSquareBinding.inflate(inflater, container, false); binding = FragmentDeckSquareBinding.inflate(inflater, container, false);
deckSquareListAdapter = new DeckSquareListAdapter(R.layout.item_deck_info); deckSquareListAdapter = new DeckSquareListAdapter(R.layout.item_deck_info);
...@@ -47,6 +45,109 @@ public class DeckSquareFragment extends Fragment { ...@@ -47,6 +45,109 @@ public class DeckSquareFragment extends Fragment {
binding.listDeckInfo.setAdapter(deckSquareListAdapter); binding.listDeckInfo.setAdapter(deckSquareListAdapter);
deckSquareListAdapter.loadData(); deckSquareListAdapter.loadData();
binding.etGoToPage.setText("1"); binding.etGoToPage.setText("1");
binding.etDeckSquareInputDeckName.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
Editable contributerName = binding.etInputContributerName.getText();
if (contributerName != null) contributerName.clear();
keyWord = v.getText().toString();
binding.etGoToPage.setText("1");
binding.etGoToPage.setEnabled(false);
// 底部按钮不可用状态
binding.formerPageBtn.setEnabled(false);
binding.formerPageBtn.setColorFilter(R.color.navigator_dir_text_color);
binding.nextPageBtn.setEnabled(false);
binding.nextPageBtn.setColorFilter(R.color.navigator_dir_text_color);
binding.refreshData.setEnabled(false);
binding.refreshData.setColorFilter(R.color.navigator_dir_text_color);
deckSquareListAdapter.loadData(1, 1000, keyWord, true, false, "");
binding.listDeckInfo.scrollToPosition(0);
return true;
}
return false;
});
// 添加文本变化监听器
binding.etDeckSquareInputDeckName.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
binding.btnClearDeckName.setVisibility(View.VISIBLE);
}
@Override
public void afterTextChanged(Editable s) {
// 当输入框内容为空时
if (s.toString().isEmpty()) {
binding.btnClearDeckName.setVisibility(View.GONE);
// 恢复底部按钮可用状态
binding.formerPageBtn.setEnabled(true);
binding.formerPageBtn.setColorFilter(R.color.selector_text_color_white_gold);
binding.nextPageBtn.setEnabled(true);
binding.nextPageBtn.setColorFilter(R.color.selector_text_color_white_gold);
binding.refreshData.setEnabled(true);
binding.refreshData.setColorFilter(R.color.selector_text_color_white_gold);
// 重置页码为1
binding.etGoToPage.setText("1");
binding.etGoToPage.setEnabled(true);
deckSquareListAdapter.loadData();
binding.listDeckInfo.scrollToPosition(0);
}
}
});
binding.etInputContributerName.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
Editable deckName = binding.etDeckSquareInputDeckName.getText();
if (deckName != null) deckName.clear();
contributer = v.getText().toString();
binding.etGoToPage.setText("1");
binding.etGoToPage.setEnabled(false);
// 底部按钮不可用状态
binding.formerPageBtn.setEnabled(false);
binding.formerPageBtn.setColorFilter(R.color.navigator_dir_text_color);
binding.nextPageBtn.setEnabled(false);
binding.nextPageBtn.setColorFilter(R.color.navigator_dir_text_color);
binding.refreshData.setEnabled(false);
binding.refreshData.setColorFilter(R.color.navigator_dir_text_color);
deckSquareListAdapter.loadData(1, 1000, null, true, false, contributer);
binding.listDeckInfo.scrollToPosition(0);
return true;
}
return false;
});
// 添加文本变化监听器
binding.etInputContributerName.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
binding.btnClearContributerName.setVisibility(View.VISIBLE);
}
@Override
public void afterTextChanged(Editable s) {
// 当输入框内容为空时
if (s.toString().isEmpty()) {
binding.btnClearDeckName.setVisibility(View.GONE);
// 恢复底部按钮可用状态
binding.formerPageBtn.setEnabled(true);
binding.formerPageBtn.setColorFilter(R.color.selector_text_color_white_gold);
binding.nextPageBtn.setEnabled(true);
binding.nextPageBtn.setColorFilter(R.color.selector_text_color_white_gold);
binding.refreshData.setEnabled(true);
binding.refreshData.setColorFilter(R.color.selector_text_color_white_gold);
// 重置页码为1
binding.etGoToPage.setText("1");
binding.etGoToPage.setEnabled(true);
deckSquareListAdapter.loadData();
binding.listDeckInfo.scrollToPosition(0);
}
}
});
//设置清空按钮点击清除输入内容
binding.btnClearDeckName.setOnClickListener(view -> binding.etDeckSquareInputDeckName.getText().clear());
binding.btnClearContributerName.setOnClickListener(view -> binding.etInputContributerName.getText().clear());
// 设置页码跳转监听 // 设置页码跳转监听
binding.etGoToPage.setOnEditorActionListener((v, actionId, event) -> { binding.etGoToPage.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_DONE) { if (actionId == EditorInfo.IME_ACTION_DONE) {
......
...@@ -71,15 +71,6 @@ public class DeckSquareListAdapter extends BaseQuickAdapter<OnlineDeckDetail, Ba ...@@ -71,15 +71,6 @@ public class DeckSquareListAdapter extends BaseQuickAdapter<OnlineDeckDetail, Ba
} }
private static Boolean isMonster(List<String> list) {
for (String data : list) {
if (data.equals("怪兽")) {
return true;
}
}
return false;
}
@Override @Override
protected void convert(BaseViewHolder helper, OnlineDeckDetail item) { protected void convert(BaseViewHolder helper, OnlineDeckDetail item) {
helper.setText(R.id.deck_info_name, item.getDeckName()); helper.setText(R.id.deck_info_name, item.getDeckName());
......
...@@ -54,14 +54,16 @@ ...@@ -54,14 +54,16 @@
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_deck" android:id="@+id/tv_deck"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:background="@drawable/button_radius_black_transparents"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:shadowColor="@color/black" android:shadowColor="@color/black"
android:shadowDx="1" android:shadowDx="1"
android:shadowDy="1" android:shadowDy="1"
android:shadowRadius="2" android:shadowRadius="2"
android:gravity="center|left"
android:text="@string/select_deck" android:text="@string/select_deck"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="18sp" android:textSize="18sp"
...@@ -92,7 +94,6 @@ ...@@ -92,7 +94,6 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="bottom|center_horizontal" android:gravity="bottom|center_horizontal"
android:shadowColor="@color/black" android:shadowColor="@color/black"
android:shadowDx="1" android:shadowDx="1"
...@@ -120,7 +121,6 @@ ...@@ -120,7 +121,6 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="bottom|center_horizontal" android:gravity="bottom|center_horizontal"
android:shadowColor="@color/black" android:shadowColor="@color/black"
android:shadowDx="1" android:shadowDx="1"
...@@ -163,7 +163,6 @@ ...@@ -163,7 +163,6 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="bottom|center_horizontal" android:gravity="bottom|center_horizontal"
android:shadowColor="@color/black" android:shadowColor="@color/black"
android:shadowDx="1" android:shadowDx="1"
...@@ -175,8 +174,6 @@ ...@@ -175,8 +174,6 @@
android:textStyle="bold" /> android:textStyle="bold" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
<LinearLayout <LinearLayout
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
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">
<!-- 顶部输入框区域 -->
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:id="@+id/top_input_container"
android:layout_height="0dp" android:layout_width="0dp"
android:layout_weight="12.5" android:layout_height="wrap_content"
android:weightSum="10" android:layout_marginStart="5dp"
android:orientation="vertical"> android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText <!-- 第一个输入框及清空按钮 -->
android:id="@+id/et_deck_square_input_deck_name" <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_weight="1" android:background="@drawable/button_radius_black_transparents"
android:layout_marginLeft="5dp" android:layout_marginEnd="2.5dp"
android:layout_marginRight="5dp" android:layout_weight="1">
android:gravity="center"
android:hint="@string/intpu_name" <EditText
android:imeOptions="actionSearch" android:id="@+id/et_deck_square_input_deck_name"
android:inputType="textNoSuggestions" android:layout_width="0dp"
android:singleLine="true" android:layout_height="wrap_content"
android:textColor="@color/holo_blue_bright" android:gravity="center"
android:textColorHint="@color/gray" android:hint="@string/intpu_name"
android:textSize="15sp" /> android:imeOptions="actionSearch"
android:inputType="textNoSuggestions"
<com.tubb.smrv.SwipeMenuRecyclerView android:singleLine="true"
android:id="@+id/list_deck_info" android:textColor="@color/holo_blue_bright"
android:layout_width="match_parent" android:textColorHint="@color/gray"
android:layout_height="0dp" android:textSize="15sp"
android:layout_weight="9" app:layout_constraintEnd_toStartOf="@id/btn_clear_deck_name"
android:divider="@android:color/transparent" app:layout_constraintStart_toStartOf="parent"
android:dividerHeight="4dp" app:layout_constraintTop_toTopOf="parent" />
android:padding="5dp"
android:scrollbars="vertical" /> <ImageButton
android:id="@+id/btn_clear_deck_name"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="5dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_close_black_24dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- 第二个输入框及清空按钮 -->
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="2.5dp"
android:background="@drawable/button_radius_black_transparents"
android:layout_weight="1">
<EditText
android:id="@+id/et_input_contributer_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:hint="@string/input_contributor_name"
android:imeOptions="actionSearch"
android:inputType="textNoSuggestions"
android:singleLine="true"
android:textColor="@color/holo_blue_bright"
android:textColorHint="@color/gray"
android:textSize="15sp"
app:layout_constraintEnd_toStartOf="@id/btn_clear_contributer_name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/btn_clear_contributer_name"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="5dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_close_black_24dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <!-- 列表区域 - 设置底部边距为控制栏留出空间 -->
android:layout_width="match_parent" <com.tubb.smrv.SwipeMenuRecyclerView
android:id="@+id/list_deck_info"
android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="2" android:layout_marginBottom="80dp"
android:divider="@android:color/transparent"
android:dividerHeight="4dp"
android:padding="5dp"
android:scrollbars="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/top_input_container" />
<!-- 底部控制栏 - 固定在底部 -->
<LinearLayout
android:id="@+id/ll_page_ctrl"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:elevation="8dp"
android:orientation="vertical" android:orientation="vertical"
android:weightSum="2"> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<!-- 页码输入区域 -->
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_weight="0.5"
android:weightSum="3"> android:weightSum="3">
<View <View
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:background="@color/holo_blue_light" /> android:background="@color/holo_blue_light" />
...@@ -62,34 +135,35 @@ ...@@ -62,34 +135,35 @@
android:id="@+id/et_go_to_page" android:id="@+id/et_go_to_page"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/veil2"
android:gravity="center"
android:hint="@string/go_to" android:hint="@string/go_to"
android:inputType="number"
android:imeOptions="actionDone" android:imeOptions="actionDone"
android:background="@drawable/veil2" android:inputType="number"
android:singleLine="true" android:singleLine="true"
android:textSize="14sp" /> android:textSize="14sp" />
<View <View
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:background="@color/holo_blue_light" /> android:background="@color/holo_blue_light" />
</LinearLayout> </LinearLayout>
<!-- 按钮控制区域 -->
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="bottom"
android:layout_margin="5dp"> android:layout_margin="5dp">
<ImageButton <ImageButton
android:id="@+id/former_page_btn" android:id="@+id/former_page_btn"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1"
android:layout_margin="5dp" android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/ic_radius_bg" android:background="@drawable/ic_radius_bg"
android:src="@drawable/baseline_arrow_left_24" /> android:src="@drawable/baseline_arrow_left_24" />
...@@ -97,8 +171,8 @@ ...@@ -97,8 +171,8 @@
android:id="@+id/next_page_btn" android:id="@+id/next_page_btn"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1"
android:layout_margin="5dp" android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/ic_radius_bg" android:background="@drawable/ic_radius_bg"
android:src="@drawable/baseline_arrow_right_24" /> android:src="@drawable/baseline_arrow_right_24" />
...@@ -106,10 +180,10 @@ ...@@ -106,10 +180,10 @@
android:id="@+id/refresh_data" android:id="@+id/refresh_data"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1"
android:layout_margin="5dp" android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/ic_radius_bg" android:background="@drawable/ic_radius_bg"
android:src="@drawable/ic_refresh" /> android:src="@drawable/ic_refresh" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -381,5 +381,6 @@ ...@@ -381,5 +381,6 @@
<string name="input_pwd">Introduce la Contraseña</string> <string name="input_pwd">Introduce la Contraseña</string>
<string name="deck_square">Plaza de Decks</string> <string name="deck_square">Plaza de Decks</string>
<string name="my_deck_online">Copia en la Nube</string> <string name="my_deck_online">Copia en la Nube</string>
<string name="input_contributor_name">Introduce el Nombre del Compartidor</string>
</resources> </resources>
...@@ -375,4 +375,5 @@ ...@@ -375,4 +375,5 @@
<string name="input_pwd">パスワードを入力してください</string> <string name="input_pwd">パスワードを入力してください</string>
<string name="deck_square">デッキ広場</string> <string name="deck_square">デッキ広場</string>
<string name="my_deck_online">クラウド バックアップ</string> <string name="my_deck_online">クラウド バックアップ</string>
<string name="input_contributor_name">共有者の名前を入力してください</string>
</resources> </resources>
...@@ -376,4 +376,5 @@ ...@@ -376,4 +376,5 @@
<string name="input_pwd">비밀번호를 입력하세요</string> <string name="input_pwd">비밀번호를 입력하세요</string>
<string name="deck_square">덱 공유 광장</string> <string name="deck_square">덱 공유 광장</string>
<string name="my_deck_online">클라우드 백업</string> <string name="my_deck_online">클라우드 백업</string>
<string name="input_contributor_name">공유자의 이름을 입력하세요</string>
</resources> </resources>
...@@ -365,5 +365,6 @@ ...@@ -365,5 +365,6 @@
<string name="input_pwd">Insira a Senha</string> <string name="input_pwd">Insira a Senha</string>
<string name="deck_square">Praça de Decks</string> <string name="deck_square">Praça de Decks</string>
<string name="my_deck_online">Backup na Nuvem</string> <string name="my_deck_online">Backup na Nuvem</string>
<string name="input_contributor_name">Insira o Nome do Compartilhador</string>
</resources> </resources>
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
<string name="last_path">上一级目录</string> <string name="last_path">上一级目录</string>
<string name="create_folder">新建文件夹</string> <string name="create_folder">新建文件夹</string>
<string name="intpu_name">输入卡组名</string> <string name="intpu_name">输入卡组名</string>
<string name="the_name_is_folder">当前文件名是个文件夹</string> <string name="the_name_is_folder">当前文件名是个文件夹</string>
<string name="tab_search">搜索</string> <string name="tab_search">搜索</string>
<string name="tab_result">列表</string> <string name="tab_result">列表</string>
...@@ -380,4 +380,5 @@ ...@@ -380,4 +380,5 @@
<string name="sign_out">切换账号</string> <string name="sign_out">切换账号</string>
<string name="deck_square">卡组广场</string> <string name="deck_square">卡组广场</string>
<string name="my_deck_online">云备份</string> <string name="my_deck_online">云备份</string>
<string name="input_contributor_name">输入共享者名称</string>
</resources> </resources>
...@@ -445,4 +445,5 @@ ...@@ -445,4 +445,5 @@
<string name="input_pwd">Enter Password</string> <string name="input_pwd">Enter Password</string>
<string name="deck_square">Deck Plaza</string> <string name="deck_square">Deck Plaza</string>
<string name="my_deck_online">Cloud Backup</string> <string name="my_deck_online">Cloud Backup</string>
<string name="input_contributor_name">Enter the Sharer\'s Name</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