Commit 1e1f6808 authored by wangfugui's avatar wangfugui

开发登录、用户协议功能,优化用户在线卡组页面

parent d151ae09
...@@ -11,6 +11,7 @@ import java.util.Map; ...@@ -11,6 +11,7 @@ import java.util.Map;
import cn.garymb.ygomobile.deck_square.api_response.BasicResponse; import cn.garymb.ygomobile.deck_square.api_response.BasicResponse;
import cn.garymb.ygomobile.deck_square.api_response.DeckIdResponse; import cn.garymb.ygomobile.deck_square.api_response.DeckIdResponse;
import cn.garymb.ygomobile.deck_square.api_response.DownloadDeckResponse; import cn.garymb.ygomobile.deck_square.api_response.DownloadDeckResponse;
import cn.garymb.ygomobile.deck_square.api_response.GetSquareDeckCondition;
import cn.garymb.ygomobile.deck_square.api_response.LoginRequest; import cn.garymb.ygomobile.deck_square.api_response.LoginRequest;
import cn.garymb.ygomobile.deck_square.api_response.LoginResponse; import cn.garymb.ygomobile.deck_square.api_response.LoginResponse;
import cn.garymb.ygomobile.deck_square.api_response.LoginToken; import cn.garymb.ygomobile.deck_square.api_response.LoginToken;
...@@ -33,9 +34,19 @@ public class DeckSquareApiUtil { ...@@ -33,9 +34,19 @@ public class DeckSquareApiUtil {
private static final String TAG = DeckSquareListAdapter.class.getSimpleName(); private static final String TAG = DeckSquareListAdapter.class.getSimpleName();
public static boolean needLogin() {
String serverToken = SharedPreferenceUtil.getServerToken();
Integer serverUserId = SharedPreferenceUtil.getServerUserId();
if (serverToken == null || serverUserId == -1) {
return true;
}
return false;
}
/** /**
*
* 如果未登录(不存在token),显示toast提示用户。如果已登录,返回token * 如果未登录(不存在token),显示toast提示用户。如果已登录,返回token
*
* @return * @return
*/ */
public static LoginToken getLoginData() { public static LoginToken getLoginData() {
...@@ -51,18 +62,22 @@ public class DeckSquareApiUtil { ...@@ -51,18 +62,22 @@ public class DeckSquareApiUtil {
} }
public static SquareDeckResponse getSquareDecks() throws IOException { public static SquareDeckResponse getSquareDecks(GetSquareDeckCondition condition) throws IOException {
SquareDeckResponse result = null; SquareDeckResponse result = null;
String url = "http://rarnu.xyz:38383/api/mdpro3/deck/list"; String url = "http://rarnu.xyz:38383/api/mdpro3/deck/list";
Map<String, String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
headers.put("ReqSource", "MDPro3"); headers.put("ReqSource", "MDPro3");
Response response = OkhttpUtil.synchronousGet(url, null, headers);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("page", condition.getPage());
paramMap.put("size", condition.getSize());
Response response = OkhttpUtil.synchronousGet(url, paramMap, headers);
String responseBodyString = response.body().string(); String responseBodyString = response.body().string();
// Type listType = new TypeToken<List<DeckInfo>>() {
// }.getType();
Gson gson = new Gson(); Gson gson = new Gson();
// Convert JSON to Java object using Gson
result = gson.fromJson(responseBodyString, SquareDeckResponse.class); result = gson.fromJson(responseBodyString, SquareDeckResponse.class);
return result; return result;
} }
...@@ -213,7 +228,6 @@ public class DeckSquareApiUtil { ...@@ -213,7 +228,6 @@ public class DeckSquareApiUtil {
Response response = OkhttpUtil.postJson(url, json, headers, 1000); Response response = OkhttpUtil.postJson(url, json, headers, 1000);
String responseBodyString = response.body().string(); String responseBodyString = response.body().string();
// Convert JSON to Java object using Gson
result = gson.fromJson(responseBodyString, PushDeckResponse.class); result = gson.fromJson(responseBodyString, PushDeckResponse.class);
LogUtil.i(TAG, "push deck response:" + responseBodyString); LogUtil.i(TAG, "push deck response:" + responseBodyString);
...@@ -245,16 +259,15 @@ public class DeckSquareApiUtil { ...@@ -245,16 +259,15 @@ public class DeckSquareApiUtil {
} }
public static LoginResponse login(Integer userId, String password) throws IOException { public static LoginResponse login(String username, String password) throws IOException {
LoginResponse result = null; LoginResponse result = null;
String url = "https://sapi.moecube.com:444/accounts/signin"; String url = "https://sapi.moecube.com:444/accounts/signin";
String baseUrl = "https://sapi.moecube.com:444/accounts/signin";
// Create request body using Gson // Create request body using Gson
Gson gson = new Gson(); Gson gson = new Gson();
userId = 107630627; // userId = 107630627;
password = "Qbz95qbz96"; // password = "Qbz95qbz96";
LoginRequest loginRequest = new LoginRequest(userId, password); LoginRequest loginRequest = new LoginRequest(username, password);
String json = gson.toJson(loginRequest);//"{\"id\":1,\"name\":\"John\"}"; String json = gson.toJson(loginRequest);//"{\"id\":1,\"name\":\"John\"}";
......
...@@ -4,6 +4,7 @@ import android.os.Bundle; ...@@ -4,6 +4,7 @@ import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
...@@ -41,11 +42,68 @@ public class DeckSquareFragment extends Fragment { ...@@ -41,11 +42,68 @@ 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.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_DONE) {
int targetPage = 0;
try {
targetPage = Integer.parseInt(v.getText().toString());
} catch (NumberFormatException e) {
}
binding.tvPageInfo.setText(Integer.toString(targetPage));
deckSquareListAdapter.loadData(targetPage, 30);
return true;
}
return false;
});
binding.nextPageBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int targetPage = 0;
try {
targetPage = Integer.parseInt(binding.tvPageInfo.getText().toString());
} catch (NumberFormatException e) {
}
int newPage = targetPage + 1;
deckSquareListAdapter.loadData(newPage, 30);
binding.tvPageInfo.setText(Integer.toString(newPage));
}
});
binding.formerPageBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int targetPage = 0;
try {
targetPage = Integer.parseInt(binding.tvPageInfo.getText().toString());
} catch (NumberFormatException e) {
}
int newPage = targetPage - 1;
if (newPage < 1) {
newPage = 1;
}
deckSquareListAdapter.loadData(newPage, 30);
binding.tvPageInfo.setText(Integer.toString(newPage));
}
});
binding.refreshData.setOnClickListener(new View.OnClickListener() { binding.refreshData.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
deckSquareListAdapter.loadData(); int targetPage = 1;
try {
targetPage = Integer.parseInt(binding.tvPageInfo.getText().toString());
} catch (NumberFormatException e) {
}
deckSquareListAdapter.loadData(targetPage, 30);
} }
}); });
deckSquareListAdapter.setOnItemLongClickListener((adapter, view, position) -> { deckSquareListAdapter.setOnItemLongClickListener((adapter, view, position) -> {
......
...@@ -9,6 +9,7 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder; ...@@ -9,6 +9,7 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import java.util.List; import java.util.List;
import cn.garymb.ygomobile.deck_square.api_response.GetSquareDeckCondition;
import cn.garymb.ygomobile.deck_square.api_response.OnlineDeckDetail; import cn.garymb.ygomobile.deck_square.api_response.OnlineDeckDetail;
import cn.garymb.ygomobile.deck_square.api_response.SquareDeckResponse; import cn.garymb.ygomobile.deck_square.api_response.SquareDeckResponse;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
...@@ -29,9 +30,13 @@ public class DeckSquareListAdapter extends BaseQuickAdapter<OnlineDeckDetail, Ba ...@@ -29,9 +30,13 @@ public class DeckSquareListAdapter extends BaseQuickAdapter<OnlineDeckDetail, Ba
} }
public void loadData() { public void loadData() {
loadData(1, 30);
}
public void loadData(int page, int size) {
final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_online_deck)); final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_online_deck));
VUiKit.defer().when(() -> { VUiKit.defer().when(() -> {
SquareDeckResponse result = DeckSquareApiUtil.getSquareDecks(); SquareDeckResponse result = DeckSquareApiUtil.getSquareDecks(new GetSquareDeckCondition(page, size));
if (result == null) { if (result == null) {
return null; return null;
} else { } else {
...@@ -85,6 +90,9 @@ public class DeckSquareListAdapter extends BaseQuickAdapter<OnlineDeckDetail, Ba ...@@ -85,6 +90,9 @@ public class DeckSquareListAdapter extends BaseQuickAdapter<OnlineDeckDetail, Ba
LogUtil.i(TAG, code + " " + item.getDeckName()); LogUtil.i(TAG, code + " " + item.getDeckName());
if (code != 0) { if (code != 0) {
imageLoader.bindImage(cardImage, code, null, ImageLoader.Type.small); 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); // ImageView imageview = helper.getView(R.id.ex_card_image);
//the function cn.garymb.ygomobile.loader.ImageLoader.bindT(...) //the function cn.garymb.ygomobile.loader.ImageLoader.bindT(...)
......
...@@ -12,7 +12,6 @@ import android.widget.ProgressBar; ...@@ -12,7 +12,6 @@ import android.widget.ProgressBar;
import android.widget.Toast; import android.widget.Toast;
import cn.garymb.ygomobile.deck_square.api_response.LoginResponse; import cn.garymb.ygomobile.deck_square.api_response.LoginResponse;
import cn.garymb.ygomobile.deck_square.api_response.LoginToken;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.plus.VUiKit; import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.LogUtil; import cn.garymb.ygomobile.utils.LogUtil;
...@@ -70,7 +69,8 @@ public class LoginDialog extends Dialog { ...@@ -70,7 +69,8 @@ public class LoginDialog extends Dialog {
VUiKit.defer().when(() -> { VUiKit.defer().when(() -> {
LogUtil.d(TAG, "start fetch"); LogUtil.d(TAG, "start fetch");
LoginResponse result = DeckSquareApiUtil.login(1, "");
LoginResponse result = DeckSquareApiUtil.login(username, password);
SharedPreferenceUtil.setServerToken(result.token); SharedPreferenceUtil.setServerToken(result.token);
SharedPreferenceUtil.setServerUserId(result.user.id); SharedPreferenceUtil.setServerUserId(result.user.id);
return result; return result;
......
...@@ -13,13 +13,16 @@ import cn.garymb.ygomobile.deck_square.api_response.LoginResponse; ...@@ -13,13 +13,16 @@ import cn.garymb.ygomobile.deck_square.api_response.LoginResponse;
import cn.garymb.ygomobile.lite.databinding.FragmentMcOnlineManageBinding; import cn.garymb.ygomobile.lite.databinding.FragmentMcOnlineManageBinding;
import cn.garymb.ygomobile.utils.LogUtil; import cn.garymb.ygomobile.utils.LogUtil;
import cn.garymb.ygomobile.utils.SharedPreferenceUtil; import cn.garymb.ygomobile.utils.SharedPreferenceUtil;
import cn.garymb.ygomobile.utils.YGOUtil;
//管理用户的登录状态、缓存状态 //管理用户的登录状态、缓存状态
public class MCOnlineManageFragment extends Fragment { public class MCOnlineManageFragment extends Fragment implements PrivacyDialogFragment.PrivacyAgreementListener {
private FragmentMcOnlineManageBinding binding; private FragmentMcOnlineManageBinding binding;
private static final String TAG = DeckSquareListAdapter.class.getSimpleName(); private static final String TAG = DeckSquareListAdapter.class.getSimpleName();
boolean privacAgree = false;
LoginDialog loginDialog = null;
@Override @Override
public View onCreateView( public View onCreateView(
...@@ -31,7 +34,13 @@ public class MCOnlineManageFragment extends Fragment { ...@@ -31,7 +34,13 @@ public class MCOnlineManageFragment extends Fragment {
binding.mcLoginBtn.setOnClickListener(new View.OnClickListener() { binding.mcLoginBtn.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
LoginDialog loginDialog = new LoginDialog(getContext(), new LoginDialog.LoginListener() {
if (!DeckSquareApiUtil.needLogin()) {
return;
}
if (privacAgree) {//如果不同意隐私协议,log提示用户,
loginDialog = new LoginDialog(getContext(), new LoginDialog.LoginListener() {
@Override @Override
public void notifyResult(boolean success, LoginResponse response) { public void notifyResult(boolean success, LoginResponse response) {
// Handle login logic // Handle login logic
...@@ -40,12 +49,22 @@ public class MCOnlineManageFragment extends Fragment { ...@@ -40,12 +49,22 @@ public class MCOnlineManageFragment extends Fragment {
LogUtil.i(TAG, "login success" + SharedPreferenceUtil.getServerToken()); LogUtil.i(TAG, "login success" + SharedPreferenceUtil.getServerToken());
refreshBtn(); refreshBtn();
//response.token; //response.token;
}else{
YGOUtil.showTextToast("登录失败:");
} }
} }
}); });
loginDialog.show(); loginDialog.show();
} else {
YGOUtil.showTextToast("登录内容需要用户同意协议");
showPrivacyDialog();
}
} }
}); });
//其实仅仅是清除掉本机的token //其实仅仅是清除掉本机的token
...@@ -76,11 +95,27 @@ public class MCOnlineManageFragment extends Fragment { ...@@ -76,11 +95,27 @@ public class MCOnlineManageFragment extends Fragment {
} }
public void refreshBtn() { public void refreshBtn() {
if (SharedPreferenceUtil.getServerToken() != null) { if (DeckSquareApiUtil.getLoginData() != null) {
binding.mcLoginBtn.setText("已登录"); binding.mcLoginBtn.setText("已登录");
} else { } else {
binding.mcLoginBtn.setText("登录"); binding.mcLoginBtn.setText("登录");
} }
} }
private void showPrivacyDialog() {
PrivacyDialogFragment dialog = new PrivacyDialogFragment();
dialog.setPrivacyAgreementListener(this);
dialog.show(getChildFragmentManager(), "PrivacyDialog");
}
@Override
public void onAgree() {
privacAgree = true;
}
@Override
public void onDisagree() {
privacAgree = false;
}
} }
\ No newline at end of file
...@@ -34,13 +34,12 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold ...@@ -34,13 +34,12 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
List<MyDeckItem> myOnlieDecks = new ArrayList<>(); List<MyDeckItem> myOnlieDecks = new ArrayList<>();
final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_online_deck));
LoginToken loginToken = DeckSquareApiUtil.getLoginData(); LoginToken loginToken = DeckSquareApiUtil.getLoginData();
if (loginToken == null) { if (loginToken == null) {
return; return;
} }
final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_online_deck));
VUiKit.defer().when(() -> { VUiKit.defer().when(() -> {
MyDeckResponse result = DeckSquareApiUtil.getUserDecks(loginToken); MyDeckResponse result = DeckSquareApiUtil.getUserDecks(loginToken);
...@@ -103,17 +102,22 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold ...@@ -103,17 +102,22 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
protected void convert(BaseViewHolder helper, MyDeckItem item) { protected void convert(BaseViewHolder helper, MyDeckItem item) {
helper.setText(R.id.my_deck_name, item.getDeckName()); helper.setText(R.id.my_deck_name, item.getDeckName());
//helper.setText(R.id.deck_upload_date, item.getDeckUploadDate()); //helper.setText(R.id.deck_upload_date, item.getDeckUploadDate());
ImageView imageView = helper.getView(R.id.deck_upload_state_img); //ImageView imageView = helper.getView(R.id.deck_upload_state_img);
if (item.getDeckSouce() == 0) {//本地
helper.setText(R.id.my_deck_id, "本地卡组");
imageView.setImageResource(R.drawable.ic_server_push);
helper.setVisible(R.id.deck_update_date, false);
helper.setVisible(R.id.deck_upload_date, false);
} else if (item.getDeckSouce() == 1) {
helper.setText(R.id.my_deck_id, item.getDeckId());
imageView.setImageResource(R.drawable.ic_server_download);
helper.setText(R.id.deck_update_date, item.getUpdateDate()); helper.setText(R.id.deck_update_date, item.getUpdateDate());
ImageView cardImage = helper.getView(R.id.deck_info_image);
long code = item.getDeckCoverCard1();
LogUtil.i(TAG, code + " " + item.getDeckName());
if (code != 0) {
imageLoader.bindImage(cardImage, code, null, ImageLoader.Type.small);
} else {
imageLoader.bindImage(cardImage, -1, null, ImageLoader.Type.small);
} }
// else if (item.getDeckSouce() == 1) {
// helper.setText(R.id.my_deck_id, item.getDeckId());
// imageView.setImageResource(R.drawable.ic_server_download);
// }
// long code = item.getDeckCoverCard1(); // long code = item.getDeckCoverCard1();
......
package cn.garymb.ygomobile.deck_square;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import cn.garymb.ygomobile.lite.R;
public class PrivacyDialogFragment extends DialogFragment {
private PrivacyAgreementListener listener;
public interface PrivacyAgreementListener {
void onAgree();
void onDisagree();
}
public void setPrivacyAgreementListener(PrivacyAgreementListener listener) {
this.listener = listener;
}
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
LayoutInflater inflater = requireActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dialog_privacy, null);
builder.setView(view);
// 禁止点击外部关闭
setCancelable(false);
Button btnAgree = view.findViewById(R.id.btn_agree);
Button btnDisagree = view.findViewById(R.id.btn_disagree);
btnAgree.setOnClickListener(v -> {
if (listener != null) listener.onAgree();
dismiss();
});
btnDisagree.setOnClickListener(v -> {
if (listener != null) listener.onDisagree();
dismiss();
});
return builder.create();
}
@Override
public void onStart() {
super.onStart();
// 设置对话框宽度占屏幕 90%
if (getDialog() != null && getDialog().getWindow() != null) {
DisplayMetrics metrics = new DisplayMetrics();
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
int width = (int) (metrics.widthPixels * 0.9);
getDialog().getWindow().setLayout(width, ViewGroup.LayoutParams.WRAP_CONTENT);
}
}
}
\ No newline at end of file
package cn.garymb.ygomobile.deck_square.api_response;
public class GetSquareDeckCondition {
Integer page;
Integer size;
String keyWord;
Boolean sortLike;
Boolean sortRank;
String contributer;
public GetSquareDeckCondition() {
}
public GetSquareDeckCondition(Integer page, Integer size) {
this.page = page;
this.size = size;
}
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public Integer getSize() {
return size;
}
public void setSize(Integer size) {
this.size = size;
}
public String getKeyWord() {
return keyWord;
}
public void setKeyWord(String keyWord) {
this.keyWord = keyWord;
}
public Boolean getSortLike() {
return sortLike;
}
public void setSortLike(Boolean sortLike) {
this.sortLike = sortLike;
}
public Boolean getSortRank() {
return sortRank;
}
public void setSortRank(Boolean sortRank) {
this.sortRank = sortRank;
}
public String getContributer() {
return contributer;
}
public void setContributer(String contributer) {
this.contributer = contributer;
}
}
package cn.garymb.ygomobile.deck_square.api_response; package cn.garymb.ygomobile.deck_square.api_response;
public class LoginRequest { public class LoginRequest {
public Integer account; public String account;
public String password; public String password;
public LoginRequest(Integer account, String password) { public LoginRequest(String account, String password) {
this.account = account; this.account = account;
this.password = password; this.password = password;
} }
......
...@@ -114,12 +114,12 @@ public class OkhttpUtil { ...@@ -114,12 +114,12 @@ public class OkhttpUtil {
client.newCall(request.build()).enqueue(callback); client.newCall(request.build()).enqueue(callback);
} }
public static Response synchronousGet(String address, Map<String, Object> map, Map<String, String> headers) throws IOException { public static Response synchronousGet(String address, Map<String, Object> paramMap, Map<String, String> headers) throws IOException {
OkHttpClient client = new OkHttpClient(); OkHttpClient client = new OkHttpClient();
HttpUrl.Builder httpBuilder = HttpUrl.parse(address).newBuilder(); HttpUrl.Builder httpBuilder = HttpUrl.parse(address).newBuilder();
if (map != null) { if (paramMap != null) {
for (Map.Entry<String, Object> param : map.entrySet()) { for (Map.Entry<String, Object> param : paramMap.entrySet()) {
httpBuilder.addQueryParameter(param.getKey(), param.getValue().toString()); httpBuilder.addQueryParameter(param.getKey(), param.getValue().toString());
} }
} }
...@@ -202,6 +202,7 @@ public class OkhttpUtil { ...@@ -202,6 +202,7 @@ public class OkhttpUtil {
/** /**
* 阻塞方法,POST推送json * 阻塞方法,POST推送json
*
* @param url * @param url
* @param json 可以传入null或空字符串,均代表不需要发送json * @param json 可以传入null或空字符串,均代表不需要发送json
* @param headers 可以传入null * @param headers 可以传入null
......
...@@ -22,5 +22,5 @@ ...@@ -22,5 +22,5 @@
<androidx.viewpager2.widget.ViewPager2 <androidx.viewpager2.widget.ViewPager2
android:id="@+id/deck_view_pager" android:id="@+id/deck_view_pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="match_parent" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<!-- 标题 -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="隐私政策协议"
android:textSize="20sp"
android:textStyle="bold"/>
<!-- 协议内容(可滚动) -->
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginVertical="16dp">
<TextView
android:id="@+id/tv_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/privacy_policy_content"/>
</ScrollView>
<!-- 操作按钮 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="end"
android:layout_marginTop="8dp">
<Button
android:id="@+id/btn_disagree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="不同意"
android:background="?selectableItemBackgroundBorderless"/>
<Button
android:id="@+id/btn_agree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="同意并继续"
android:layout_marginStart="16dp"
android:background="?selectableItemBackgroundBorderless"/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -32,6 +32,18 @@ ...@@ -32,6 +32,18 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="下一页"></Button> android:text="下一页"></Button>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="页"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_page_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:textSize="14sp" />
<Button <Button
android:id="@+id/former_page_btn" android:id="@+id/former_page_btn"
...@@ -40,6 +52,21 @@ ...@@ -40,6 +52,21 @@
android:layout_weight="1" android:layout_weight="1"
android:text="上一页"></Button> android:text="上一页"></Button>
<!-- <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"
/>
<Button <Button
android:id="@+id/refresh_data" android:id="@+id/refresh_data"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -14,41 +14,6 @@ ...@@ -14,41 +14,6 @@
android:paddingTop="2dp" android:paddingTop="2dp"
android:paddingRight="5dp"> android:paddingRight="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="4dp"
android:orientation="horizontal"
android:paddingLeft="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/label_limitlist"
android:textColor="@color/holo_blue_light" />
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/sp_limit_list"
android:layout_width="wrap_content"
android:layout_height="@dimen/item_height"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="fill_horizontal" />
<TextView
android:id="@+id/result_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:background="@drawable/radius"
android:gravity="center_horizontal"
android:text="0"
android:textColor="@color/gold"
android:textStyle="bold" />
</LinearLayout>
<Button <Button
android:id="@+id/mc_login_btn" android:id="@+id/mc_login_btn"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<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="wrap_content"
android:background="@color/holo_blue_bright"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
...@@ -44,26 +43,5 @@ ...@@ -44,26 +43,5 @@
android:layout_weight="1" /> android:layout_weight="1" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/text_download_precard"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ic_like"
android:clickable="false"
android:gravity="center"
android:textAlignment="center"
android:textColor="@color/gold"
android:textSize="10sp" />
<TextView
android:id="@+id/deck_like"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -2,24 +2,18 @@ ...@@ -2,24 +2,18 @@
<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="wrap_content" android:layout_height="wrap_content"
android:background="@color/holo_blue_bright"
android:orientation="vertical"> android:orientation="vertical">
<!-- <ImageView <ImageView
android:id="@+id/deck_info_image" android:id="@+id/deck_info_image"
android:layout_width="@dimen/card_width_middle" android:layout_width="@dimen/card_width_middle"
android:layout_height="@dimen/card_height_middle" />--> android:layout_height="@dimen/card_height_middle" />
<TextView <TextView
android:id="@+id/my_deck_id" android:id="@+id/my_deck_id"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView
android:id="@+id/deck_type_text"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView <TextView
android:id="@+id/my_deck_name" android:id="@+id/my_deck_name"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -32,23 +26,25 @@ ...@@ -32,23 +26,25 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="更新时间" />
<TextView <TextView
android:id="@+id/deck_update_date" android:id="@+id/deck_update_date"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" /> android:layout_weight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:text="更新" />
</LinearLayout> </LinearLayout>
<LinearLayout <!-- <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
...@@ -63,8 +59,8 @@ ...@@ -63,8 +59,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" /> android:layout_weight="1" />
</LinearLayout> </LinearLayout>-->
<!--
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -80,28 +76,7 @@ ...@@ -80,28 +76,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" /> android:layout_weight="1" />
</LinearLayout> </LinearLayout>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!-- <TextView-->
<!-- android:id="@+id/text_download_precard"-->
<!-- android:layout_width="30dp"-->
<!-- android:layout_height="30dp"-->
<!-- android:clickable="false"-->
<!-- android:gravity="center"-->
<!-- android:textAlignment="center"-->
<!-- android:textColor="@color/gold"-->
<!-- android:text="点赞数"-->
<!-- android:textSize="10sp" />-->
<TextView
android:id="@+id/deck_like"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="StringFormatInvalid"> <resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="StringFormatInvalid">
<string name="privacy_policy_content">privacy content</string>
<!--string name="app_name">YGOMobile</string--> <!--string name="app_name">YGOMobile</string-->
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="action_game">Single Game</string> <string name="action_game">Single Game</string>
......
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