Commit 673071f4 authored by wangfugui's avatar wangfugui

初步实习功能(界面未优化)

parent 83693aa0
......@@ -19,8 +19,8 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
productFlavors {
cn {
......@@ -68,6 +68,9 @@ android {
noCompress 'dll', 'config'
}
namespace 'cn.garymb.ygomobile.lite'
buildFeatures {
viewBinding true
}
// buildToolsVersion '28.0.3'
}
......@@ -89,6 +92,7 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'androidx.navigation:navigation-fragment:2.8.1'
implementation 'androidx.navigation:navigation-ui:2.8.1'
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation('com.github.chrisbanes.photoview:library:1.2.4') {
implementation 'com.github.chrisbanes.photoview:library:1.2.4'
......
......@@ -21,10 +21,7 @@
android:name="cn.garymb.ygomobile.ui.activities.LogoActivity"
android:excludeFromRecents="false"
android:theme="@style/TranslucentTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!--meta-data
android:name="android.app.shortcuts"
......@@ -158,14 +155,22 @@
<!-- android:screenOrientation="landscape"-->
<activity
android:name="cn.garymb.ygomobile.ex_card.ExCardActivity"
android:theme="@style/AppTheme.Mycard"
android:launchMode="singleTop"
/>
android:theme="@style/AppTheme.Mycard" />
<activity
android:name="cn.garymb.ygomobile.deck_square.DeckSquareActivity"
android:launchMode="singleTop"
android:theme="@style/AppTheme.Mycard">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="com.tencent.smtt.export.external.DexClassLoaderProviderService"
android:label="dexopt"
android:process=":dexopt" >
</service>
android:process=":dexopt"></service>
<!-- 如果已经安装过原版YGOMobile,请注释掉或修改成其他,否则会导致无法安装 -->
<provider
android:name="cn.garymb.ygomobile.ui.settings.YGOPreferencesProvider"
......
package cn.garymb.ygomobile.deck_square;
import android.os.Parcel;
import android.os.Parcelable;
public class DeckInfo implements Parcelable {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
protected DeckInfo(Parcel in) {
name = in.readString();
}
public static final Creator<DeckInfo> CREATOR = new Creator<DeckInfo>() {
@Override
public DeckInfo createFromParcel(Parcel in) {
return new DeckInfo(in);
}
@Override
public DeckInfo[] newArray(int size) {
return new DeckInfo[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.name);
}
}
package cn.garymb.ygomobile.deck_square;
import java.util.List;
public class DeckResponseJson {
int code;
String message;
String name;
List<DeckInfo> hobbies;
}
\ No newline at end of file
package cn.garymb.ygomobile.deck_square;
import android.os.Bundle;
import android.view.View;
import androidx.navigation.ui.AppBarConfiguration;
import cn.garymb.ygomobile.deck_square.api_response.LoginResponse;
import cn.garymb.ygomobile.lite.databinding.ActivityDeckSquareBinding;
import cn.garymb.ygomobile.ui.activities.BaseActivity;
import cn.garymb.ygomobile.utils.LogUtil;
import cn.garymb.ygomobile.utils.SharedPreferenceUtil;
public class DeckSquareActivity extends BaseActivity {
private AppBarConfiguration appBarConfiguration;
private ActivityDeckSquareBinding binding;
private static final String TAG = DeckSquareListAdapter.class.getSimpleName();
private DeckSquareTabAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityDeckSquareBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
binding.loginBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// In your Activity or Fragment
LoginDialog loginDialog = new LoginDialog(getContext(), new LoginDialog.LoginListener() {
@Override
public void notifyResult(boolean success, LoginResponse response) {
// Handle login logic
if (success) {
LogUtil.i(TAG, "login success" + SharedPreferenceUtil.getServerToken());
//response.token;
}
}
});
loginDialog.show();
// Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
// .setAnchorView(R.id.login_btn)
// .setAction("Action", null).show();
}
});
createTabFragment();
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
@Override
protected void onDestroy() {
super.onDestroy();
LogUtil.i(TAG, "deck square activity destroy");
}
private void createTabFragment() {
adapter = new DeckSquareTabAdapter(getSupportFragmentManager(), binding.packagetablayout, getContext());
binding.viewPager.setAdapter(adapter);
/* setupWithViewPager() is used to link the TabLayout to the ViewPager */
binding.packagetablayout.setupWithViewPager(binding.viewPager);
}
}
\ No newline at end of file
package cn.garymb.ygomobile.deck_square;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import cn.garymb.ygomobile.deck_square.api_response.ApiDeckRecord;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.lite.databinding.FragmentDeckSquareBinding;
public class DeckSquareFragment extends Fragment {
private FragmentDeckSquareBinding binding;
private DeckSquareListAdapter deckSquareListAdapter;
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentDeckSquareBinding.inflate(inflater, container, false);
deckSquareListAdapter = new DeckSquareListAdapter(R.layout.item_deck_info);
GridLayoutManager linearLayoutManager = new GridLayoutManager(getContext(), 2);
binding.listDeckInfo.setLayoutManager(linearLayoutManager);
binding.listDeckInfo.setAdapter(deckSquareListAdapter);
deckSquareListAdapter.loadData();
// Set click listener in your adapter
deckSquareListAdapter.setOnItemClickListener((adapter, view, position) -> {
// Handle item click
ApiDeckRecord item = (ApiDeckRecord) adapter.getItem(position);
// Show the dialog
SquareDeckDetailDialog dialog = new SquareDeckDetailDialog(getContext(), item);
dialog.show();
});
return binding.getRoot();
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}
\ No newline at end of file
package cn.garymb.ygomobile.deck_square;
import android.util.Log;
import android.widget.ImageView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.google.gson.Gson;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.garymb.ygomobile.deck_square.api_response.ApiDeckRecord;
import cn.garymb.ygomobile.deck_square.api_response.ApiResponse;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.loader.ImageLoader;
import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.LogUtil;
import cn.garymb.ygomobile.utils.OkhttpUtil;
import okhttp3.Response;
//提供recyclerview的数据
public class DeckSquareListAdapter extends BaseQuickAdapter<ApiDeckRecord, BaseViewHolder> {
private static final String TAG = DeckSquareListAdapter.class.getSimpleName();
private ImageLoader imageLoader;
public DeckSquareListAdapter(int layoutResId) {
super(layoutResId);
imageLoader = new ImageLoader();
}
public void loadData() {
final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_ex_card));
VUiKit.defer().when(() -> {
LogUtil.d(TAG, "start fetch");
ApiResponse result = null;
try {
String url = "http://rarnu.xyz:38383/api/mdpro3/deck/list";
Map<String, String> headers = new HashMap<>();
headers.put("ReqSource", "MDPro3");
Response response = OkhttpUtil.synchronousGet(url, null, headers);
String responseBodyString = response.body().string();
// Type listType = new TypeToken<List<DeckInfo>>() {
// }.getType();
Gson gson = new Gson();
// Convert JSON to Java object using Gson
result = gson.fromJson(responseBodyString, ApiResponse.class);
LogUtil.i(TAG, responseBodyString);
int a = 0;
} catch (IOException e) {
Log.e(TAG, "Error occured when fetching data from pre-card server");
return null;
}
if (result == null) {
return null;
} else {
return result.getData().getRecords();
}
}).fail((e) -> {
Log.e(TAG, e + "");
if (dialog_read_ex.isShowing()) {//关闭异常
try {
dialog_read_ex.dismiss();
} catch (Exception ex) {
}
}
LogUtil.i(TAG, "webCrawler fail");
}).done((exCardDataList) -> {
if (exCardDataList != null) {
LogUtil.i(TAG, "webCrawler done");
getData().clear();
addData(exCardDataList);
notifyDataSetChanged();
}
if (dialog_read_ex.isShowing()) {
try {
dialog_read_ex.dismiss();
} catch (Exception ex) {
}
}
});
}
private static Boolean isMonster(List<String> list) {
for (String data : list) {
if (data.equals("怪兽")) {
return true;
}
}
return false;
}
@Override
protected void convert(BaseViewHolder helper, ApiDeckRecord item) {
helper.setText(R.id.deck_info_name, item.getDeckName());
helper.setText(R.id.deck_contributor, item.getDeckContributor());
helper.setText(R.id.deck_last_date, item.getLastDate());
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);
}
// ImageView imageview = helper.getView(R.id.ex_card_image);
//the function cn.garymb.ygomobile.loader.ImageLoader.bindT(...)
//cn.garymb.ygomobile.loader.ImageLoader.setDefaults(...)
//is a private function,so I copied the content of it to here
/* 如果查不到版本号,则不显示图片 */
/* 如果能查到版本号,则显示图片,利用glide的signature,将版本号和url作为signature,由glide判断是否使用缓存 */
}
}
\ No newline at end of file
package cn.garymb.ygomobile.deck_square;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.lite.databinding.FragmentUserOnlineDeckBinding;
public class DeckSquareMyDeckFragment extends Fragment {
private FragmentUserOnlineDeckBinding binding;
private MyDeckListAdapter deckListAdapter;
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentUserOnlineDeckBinding.inflate(inflater, container, false);
deckListAdapter = new MyDeckListAdapter(R.layout.item_deck_info);
GridLayoutManager linearLayoutManager = new GridLayoutManager(getContext(), 2);
binding.listMyDeckInfo.setLayoutManager(linearLayoutManager);
binding.listMyDeckInfo.setAdapter(deckListAdapter);
deckListAdapter.loadData();
binding.refreshData.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
deckListAdapter.loadData();
}
});
return binding.getRoot();
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}
package cn.garymb.ygomobile.deck_square;
import android.content.Context;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import com.google.android.material.tabs.TabLayout;
import cn.garymb.ygomobile.lite.R;
//管理tab
public class DeckSquareTabAdapter extends FragmentStatePagerAdapter {
TabLayout tabLayout;
/* 仅用于获取strings.xml中的字符串。It's used just for getting strings from strings.xml */
Context context;
public DeckSquareTabAdapter(FragmentManager fm, TabLayout _tabLayout, Context context) {
super(fm);
this.tabLayout = _tabLayout;
this.context = context;
}
@Override
public Fragment getItem(int position) {
Fragment fragment = null;
if (position == 0) {
fragment = new DeckSquareFragment();
} else if (position == 1) {
fragment = new DeckSquareMyDeckFragment();
} else if (position == 2) {
fragment = new MCOnlineManageFragment();
}
return fragment;
}
@Override
public int getCount() {
return 3;
}
@Override
public CharSequence getPageTitle(int position) {
String title = null;
if (position == 0) {
title = context.getString(R.string.ex_card_list_title);
} else if (position == 1) {
title = "我的卡组";
}else if (position == 2) {
title = "我的登录";
}
return title;
}
}
package cn.garymb.ygomobile.deck_square;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.google.gson.Gson;
import java.io.IOException;
import cn.garymb.ygomobile.deck_square.api_response.LoginRequest;
import cn.garymb.ygomobile.deck_square.api_response.LoginResponse;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.LogUtil;
import cn.garymb.ygomobile.utils.SharedPreferenceUtil;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class LoginDialog extends Dialog {
private static final String TAG = DeckSquareListAdapter.class.getSimpleName();
public interface LoginListener {
void notifyResult(boolean success, LoginResponse response);
}
private ProgressBar progressBar;
private LoginListener listener;
private EditText etUsername, etPassword;
private Button btnLogin, btnCancel;
public LoginDialog(Context context, LoginListener listener) {
super(context);
this.listener = listener;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.dialog_login);
etUsername = findViewById(R.id.et_username);
etPassword = findViewById(R.id.et_password);
btnLogin = findViewById(R.id.btn_login);
btnCancel = findViewById(R.id.btn_cancel);
btnLogin.setOnClickListener(v -> attemptLogin());
btnCancel.setOnClickListener(v -> dismiss());
progressBar = findViewById(R.id.progressBar);
}
private void attemptLogin() {
String username = etUsername.getText().toString().trim();
String password = etPassword.getText().toString().trim();
if (username.isEmpty() || password.isEmpty()) {
Toast.makeText(getContext(), "Please enter both username and password", Toast.LENGTH_SHORT).show();
return;
}
progressBar.setVisibility(View.VISIBLE);
btnLogin.setEnabled(false);
btnCancel.setEnabled(false);
// Simulate network call
// new Handler().postDelayed(() -> {
// if (listener != null) {
// listener.onLogin(username, password);
// }
// dismiss();
// }, 1500);
VUiKit.defer().when(() -> {
LogUtil.d(TAG, "start fetch");
LoginResponse result = null;
try {
String url = "https://sapi.moecube.com:444/accounts/signin";
String baseUrl = "https://sapi.moecube.com:444/accounts/signin";
// Create request body using Gson
Gson gson = new Gson();
LoginRequest loginRequest = new LoginRequest("1076306278@qq.com", "Qbz95qbz96");
String json = gson.toJson(loginRequest);//"{\"id\":1,\"name\":\"John\"}";
RequestBody body = RequestBody.create(
MediaType.parse("application/json"), json);
Request request = new Request.Builder()
.url(url)
.post(body)
.build();
OkHttpClient okHttpClient = new OkHttpClient();
Response response = okHttpClient.newCall(request).execute();
// Read the response body
String responseBody = response.body().string();
LogUtil.i(TAG, "Response body: " + responseBody);
// Process the response
if (response.isSuccessful()) {
// Successful response (code 200-299)
// Parse the JSON response if needed
result = gson.fromJson(responseBody, LoginResponse.class);
LogUtil.i(TAG, "Login response: " + result);
} else {
// Error response
LogUtil.e(TAG, "Request failed: " + responseBody);
}
} catch (IOException e) {
Log.e(TAG, "Error occured when fetching data from pre-card server");
return null;
}
SharedPreferenceUtil.setServerToken(result.token);
SharedPreferenceUtil.setServerUserId(result.user.id);
return result;
}).fail((e) -> {
Log.e(TAG, e + "");
listener.notifyResult(false, null);
LogUtil.i(TAG, "login fail");
dismiss();
}).done((result) -> {
if (result != null) {
LogUtil.i(TAG, "login done");
listener.notifyResult(true, result);
// getData().clear();
// addData(exCardDataList);
// notifyDataSetChanged();
} else {
listener.notifyResult(false, null);
}
dismiss();
});
}
}
\ No newline at end of file
package cn.garymb.ygomobile.deck_square;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import cn.garymb.ygomobile.deck_square.api_response.LoginResponse;
import cn.garymb.ygomobile.lite.databinding.FragmentMcOnlineManageBinding;
import cn.garymb.ygomobile.utils.LogUtil;
import cn.garymb.ygomobile.utils.SharedPreferenceUtil;
//管理用户的登录状态、缓存状态
public class MCOnlineManageFragment extends Fragment {
private FragmentMcOnlineManageBinding binding;
private static final String TAG = DeckSquareListAdapter.class.getSimpleName();
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentMcOnlineManageBinding.inflate(inflater, container, false);
binding.mcLoginBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LoginDialog loginDialog = new LoginDialog(getContext(), new LoginDialog.LoginListener() {
@Override
public void notifyResult(boolean success, LoginResponse response) {
// Handle login logic
if (success) {
LogUtil.i(TAG, "login success" + SharedPreferenceUtil.getServerToken());
//response.token;
}
}
});
loginDialog.show();
}
});
//其实仅仅是清除掉本机的token
binding.mcLogoutBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferenceUtil.deleteServerToken();
}
});
return binding.getRoot();
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}
\ No newline at end of file
package cn.garymb.ygomobile.deck_square;
import android.util.Log;
import android.widget.ImageView;
import android.widget.Toast;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.google.gson.Gson;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.garymb.ygomobile.deck_square.api_response.MyDeckResponse;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.loader.ImageLoader;
import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.LogUtil;
import cn.garymb.ygomobile.utils.OkhttpUtil;
import cn.garymb.ygomobile.utils.SharedPreferenceUtil;
import cn.garymb.ygomobile.utils.YGOUtil;
import okhttp3.Response;
//提供“我的”卡组数据,打开后先从sharePreference查询,没有则从服务器查询,然后缓存到sharePreference
public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckResponse.MyDeckData, BaseViewHolder> {
private static final String TAG = DeckSquareListAdapter.class.getSimpleName();
private ImageLoader imageLoader;
public MyDeckListAdapter(int layoutResId) {
super(layoutResId);
imageLoader = new ImageLoader();
}
public void loadData() {
// final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_ex_card));
String serverToken = SharedPreferenceUtil.getServerToken();
Integer serverUserId = SharedPreferenceUtil.getServerUserId();
if (serverToken == null) {
YGOUtil.showTextToast("Login first", Toast.LENGTH_LONG);
return;
}
VUiKit.defer().when(() -> {
LogUtil.d(TAG, "start fetch" + serverToken + " " + serverUserId);
MyDeckResponse result = null;
try {
String url = "http://rarnu.xyz:38383/api/mdpro3/sync/" + serverUserId + "/nodel";
Map<String, String> headers = new HashMap<>();
headers.put("ReqSource", "MDPro3");
headers.put("token", serverToken);
Response response = OkhttpUtil.synchronousGet(url, null, headers);
String responseBodyString = response.body().string();
// Type listType = new TypeToken<List<DeckInfo>>() {
// }.getType();
Gson gson = new Gson();
// Convert JSON to Java object using Gson
result = gson.fromJson(responseBodyString, MyDeckResponse.class);
LogUtil.i(TAG, responseBodyString);
int a = 0;
} catch (IOException e) {
Log.e(TAG, "Error occured when fetching data from pre-card server");
return null;
}
if (result == null) {
return null;
} else {
return result.getData();
}
}).fail((e) -> {
Log.e(TAG, e + "");
// if (dialog_read_ex.isShowing()) {//关闭异常
// try {
// dialog_read_ex.dismiss();
// } catch (Exception ex) {
//
// }
// }
LogUtil.i(TAG, "webCrawler fail");
}).done((exCardDataList) -> {
if (exCardDataList != null) {
LogUtil.i(TAG, "webCrawler done");
getData().clear();
addData(exCardDataList);
notifyDataSetChanged();
}
// if (dialog_read_ex.isShowing()) {
// try {
// dialog_read_ex.dismiss();
// } catch (Exception ex) {
// }
// }
});
}
private static Boolean isMonster(List<String> list) {
for (String data : list) {
if (data.equals("怪兽")) {
return true;
}
}
return false;
}
@Override
protected void convert(BaseViewHolder helper, MyDeckResponse.MyDeckData item) {
helper.setText(R.id.deck_info_name, item.getDeckName());
helper.setText(R.id.deck_contributor, item.getDeckContributor());
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);
}
// ImageView imageview = helper.getView(R.id.ex_card_image);
//the function cn.garymb.ygomobile.loader.ImageLoader.bindT(...)
//cn.garymb.ygomobile.loader.ImageLoader.setDefaults(...)
//is a private function,so I copied the content of it to here
/* 如果查不到版本号,则不显示图片 */
/* 如果能查到版本号,则显示图片,利用glide的signature,将版本号和url作为signature,由glide判断是否使用缓存 */
}
}
\ No newline at end of file
package cn.garymb.ygomobile.deck_square;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.Toast;
import cn.garymb.ygomobile.deck_square.api_response.ApiDeckRecord;
import cn.garymb.ygomobile.lite.R;
public class SquareDeckDetailDialog extends Dialog {
public interface ActionListener {
void onDownloadClicked();
void onLikeClicked();
}
private ActionListener listener;
public SquareDeckDetailDialog(Context context, ApiDeckRecord item) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.dialog_square_deck_detail);
Button btnDownload = findViewById(R.id.btnDownload);
Button btnLike = findViewById(R.id.btnLike);
btnDownload.setOnClickListener(v -> {
dismiss();
});
btnLike.setOnClickListener(v -> {
dismiss();
});
}
}
\ No newline at end of file
package cn.garymb.ygomobile.deck_square;
import java.util.List;
public class UserDeckIds {
public List<String> deckId;
}
package cn.garymb.ygomobile.deck_square.api_response;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
public class ApiDeckRecord implements Parcelable {
private String deckId;
private String deckContributor;
private String deckName;
private int deckLike;
private int deckCoverCard1;
private int deckCoverCard2;
private int deckCoverCard3;
private int deckCase;
private int deckProtector;
private String lastDate;
private int userId;
protected ApiDeckRecord(Parcel in) {
deckId = in.readString();
deckContributor = in.readString();
deckName = in.readString();
deckLike = in.readInt();
deckCoverCard1 = in.readInt();
deckCoverCard2 = in.readInt();
deckCoverCard3 = in.readInt();
deckCase = in.readInt();
deckProtector = in.readInt();
lastDate = in.readString();
userId = in.readInt();
}
public static final Creator<ApiDeckRecord> CREATOR = new Creator<ApiDeckRecord>() {
@Override
public ApiDeckRecord createFromParcel(Parcel in) {
return new ApiDeckRecord(in);
}
@Override
public ApiDeckRecord[] newArray(int size) {
return new ApiDeckRecord[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeString(deckId);
dest.writeString(deckContributor);
dest.writeString(deckName);
dest.writeInt(deckLike);
dest.writeInt(deckCoverCard1);
dest.writeInt(deckCoverCard2);
dest.writeInt(deckCoverCard3);
dest.writeInt(deckCase);
dest.writeInt(deckProtector);
dest.writeString(lastDate);
dest.writeInt(userId);
}
public String getDeckId() {
return deckId;
}
public void setDeckId(String deckId) {
this.deckId = deckId;
}
public String getDeckContributor() {
return deckContributor;
}
public void setDeckContributor(String deckContributor) {
this.deckContributor = deckContributor;
}
public String getDeckName() {
return deckName;
}
public void setDeckName(String deckName) {
this.deckName = deckName;
}
public int getDeckLike() {
return deckLike;
}
public void setDeckLike(int deckLike) {
this.deckLike = deckLike;
}
public int getDeckCoverCard1() {
return deckCoverCard1;
}
public void setDeckCoverCard1(int deckCoverCard1) {
this.deckCoverCard1 = deckCoverCard1;
}
public int getDeckCoverCard2() {
return deckCoverCard2;
}
public void setDeckCoverCard2(int deckCoverCard2) {
this.deckCoverCard2 = deckCoverCard2;
}
public int getDeckCoverCard3() {
return deckCoverCard3;
}
public void setDeckCoverCard3(int deckCoverCard3) {
this.deckCoverCard3 = deckCoverCard3;
}
public int getDeckCase() {
return deckCase;
}
public void setDeckCase(int deckCase) {
this.deckCase = deckCase;
}
public int getDeckProtector() {
return deckProtector;
}
public void setDeckProtector(int deckProtector) {
this.deckProtector = deckProtector;
}
public String getLastDate() {
return lastDate;
}
public void setLastDate(String lastDate) {
this.lastDate = lastDate;
}
public String getUserId() {
return Integer.toString(userId);
}
public void setUserId(int userId) {
this.userId = userId;
}
}
package cn.garymb.ygomobile.deck_square.api_response;
import java.util.List;
public class ApiResponse {
private int code;
private String message;
private ApiData data;
public static class ApiData{
private int current;
private int size;
private int total;
private int pages;
private List<ApiDeckRecord> records;
// Getters and setters
public int getCurrent() {
return current;
}
public int getSize() {
return size;
}
public int getTotal() {
return total;
}
public int getPages() {
return pages;
}
public List<ApiDeckRecord> getRecords() {
return records;
}
}
// Getters and setters
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
public ApiData getData() {
return data;
}
}
package cn.garymb.ygomobile.deck_square.api_response;
public class LoginRequest {
public String account;
public String password;
public LoginRequest(String account, String password) {
this.account = account;
this.password = password;
}
}
package cn.garymb.ygomobile.deck_square.api_response;
public class LoginResponse {
public String token;
public Boolean success;
public User user;
public static class User {
public int id;
public String username;
}
}
package cn.garymb.ygomobile.deck_square.api_response;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import java.util.List;
public class MyDeckResponse {
public String code;
public String message;
public List<MyDeckData> data;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public List<MyDeckData> getData() {
return data;
}
public void setData(List<MyDeckData> data) {
this.data = data;
}
public static class MyDeckData implements Parcelable {
public String deckId;
public String deckContributor;
public String deckName;
public String deckRank;
public String deckLike;
public String deckUploadDate;
public String deckUpdateDate;
public int deckCoverCard1;
public int deckCoverCard2;
public int deckCoverCard3;
public String deckCase;
public String deckProtector;
public String deckMainSerial;
public String deckYdk;
public String userId;
public String isPublic;
public String isDelete;
protected MyDeckData(Parcel in) {
deckId = in.readString();
deckContributor = in.readString();
deckName = in.readString();
deckRank = in.readString();
deckLike = in.readString();
deckUploadDate = in.readString();
deckUpdateDate = in.readString();
deckCoverCard1 = in.readInt();
deckCoverCard2 = in.readInt();
deckCoverCard3 = in.readInt();
deckCase = in.readString();
deckProtector = in.readString();
deckMainSerial = in.readString();
deckYdk = in.readString();
userId = in.readString();
isPublic = in.readString();
isDelete = in.readString();
}
public static final Creator<MyDeckData> CREATOR = new Creator<MyDeckData>() {
@Override
public MyDeckData createFromParcel(Parcel in) {
return new MyDeckData(in);
}
@Override
public MyDeckData[] newArray(int size) {
return new MyDeckData[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeString(deckId);
dest.writeString(deckContributor);
dest.writeString(deckName);
dest.writeString(deckRank);
dest.writeString(deckLike);
dest.writeString(deckUploadDate);
dest.writeString(deckUpdateDate);
dest.writeInt(deckCoverCard1);
dest.writeInt(deckCoverCard2);
dest.writeInt(deckCoverCard3);
dest.writeString(deckCase);
dest.writeString(deckProtector);
dest.writeString(deckMainSerial);
dest.writeString(deckYdk);
dest.writeString(userId);
dest.writeString(isPublic);
dest.writeString(isDelete);
}
public String getDeckId() {
return deckId;
}
public void setDeckId(String deckId) {
this.deckId = deckId;
}
public String getDeckContributor() {
return deckContributor;
}
public void setDeckContributor(String deckContributor) {
this.deckContributor = deckContributor;
}
public String getDeckName() {
return deckName;
}
public void setDeckName(String deckName) {
this.deckName = deckName;
}
public String getDeckRank() {
return deckRank;
}
public void setDeckRank(String deckRank) {
this.deckRank = deckRank;
}
public String getDeckLike() {
return deckLike;
}
public void setDeckLike(String deckLike) {
this.deckLike = deckLike;
}
public String getDeckUploadDate() {
return deckUploadDate;
}
public void setDeckUploadDate(String deckUploadDate) {
this.deckUploadDate = deckUploadDate;
}
public String getDeckUpdateDate() {
return deckUpdateDate;
}
public void setDeckUpdateDate(String deckUpdateDate) {
this.deckUpdateDate = deckUpdateDate;
}
public int getDeckCoverCard1() {
return deckCoverCard1;
}
public void setDeckCoverCard1(int deckCoverCard1) {
this.deckCoverCard1 = deckCoverCard1;
}
public int getDeckCoverCard2() {
return deckCoverCard2;
}
public void setDeckCoverCard2(int deckCoverCard2) {
this.deckCoverCard2 = deckCoverCard2;
}
public int getDeckCoverCard3() {
return deckCoverCard3;
}
public void setDeckCoverCard3(int deckCoverCard3) {
this.deckCoverCard3 = deckCoverCard3;
}
public String getDeckCase() {
return deckCase;
}
public void setDeckCase(String deckCase) {
this.deckCase = deckCase;
}
public String getDeckProtector() {
return deckProtector;
}
public void setDeckProtector(String deckProtector) {
this.deckProtector = deckProtector;
}
public String getDeckMainSerial() {
return deckMainSerial;
}
public void setDeckMainSerial(String deckMainSerial) {
this.deckMainSerial = deckMainSerial;
}
public String getDeckYdk() {
return deckYdk;
}
public void setDeckYdk(String deckYdk) {
this.deckYdk = deckYdk;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getIsPublic() {
return isPublic;
}
public void setIsPublic(String isPublic) {
this.isPublic = isPublic;
}
public String getIsDelete() {
return isDelete;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
}
}
......@@ -29,7 +29,6 @@ import okhttp3.Response;
public class ExCardListAdapter extends BaseQuickAdapter<ExCardData, BaseViewHolder> {
private static final String TAG = ExCardListAdapter.class.getSimpleName();
private ImageLoader imageLoader;
public ExCardListAdapter(int layoutResId) {
super(layoutResId);
......
......@@ -39,12 +39,12 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatSpinner;
import androidx.recyclerview.widget.RecyclerViewItemListener;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.recyclerview.widget.FastScrollLinearLayoutManager;
import androidx.recyclerview.widget.ItemTouchHelperPlus;
import androidx.recyclerview.widget.OnItemDragListener;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerViewItemListener;
import com.app.hubert.guide.NewbieGuide;
import com.app.hubert.guide.model.GuidePage;
......@@ -75,6 +75,7 @@ import cn.garymb.ygomobile.bean.DeckType;
import cn.garymb.ygomobile.bean.events.CardInfoEvent;
import cn.garymb.ygomobile.bean.events.DeckFile;
import cn.garymb.ygomobile.core.IrrlichtBridge;
import cn.garymb.ygomobile.deck_square.DeckSquareActivity;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.loader.CardLoader;
import cn.garymb.ygomobile.loader.CardSearchInfo;
......@@ -200,6 +201,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
initBoomMenuButton(layoutView.findViewById(R.id.bmb));
layoutView.findViewById(R.id.btn_nav_search).setOnClickListener((v) -> doMenu(R.id.action_search));
layoutView.findViewById(R.id.btn_nav_list).setOnClickListener((v) -> doMenu(R.id.action_card_list));
layoutView.findViewById(R.id.open_deck_square).setOnClickListener((v) -> doMenu(R.id.open_deck_square));
tv_deck.setOnClickListener(v ->
YGODialogUtil.dialogDeckSelect(getActivity(), AppsSettings.get().getLastDeckPath(), this));
mContext = (BaseActivity) getActivity();
......@@ -310,6 +312,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
/**
* 在此处处理卡组中卡片的长按删除
*
* @param pos
*/
@Override
......@@ -851,6 +854,11 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
}
}
break;
case R.id.open_deck_square: {
Intent exCardIntent = new Intent(getActivity(), DeckSquareActivity.class);
startActivity(exCardIntent);
}
break;
case R.id.action_unsort:
//打乱
mDeckAdapater.unSort();
......
......@@ -543,6 +543,8 @@ public class DeckAdapater extends RecyclerView.Adapter<DeckViewHolder> implement
@Override
public void onBindViewHolder(DeckViewHolder holder, int position) {
//Populating data into the item through holder
//根据data的内容调整view的样式
DeckItem item = mItems.get(position);
holder.setItemType(item.getType());
if (item.getType() == DeckItemType.MainLabel || item.getType() == DeckItemType.SideLabel
......
......@@ -26,13 +26,13 @@ public class OkhttpUtil {
private static OkHttpClient okHttpClient;
public static void post(String address, Map<String, Object> map, Callback callback) {
post(address, map, null, null, 0, callback);
}
public static void post(String address, Map<String, Object> map, Header oyHeader, String tag, int timeout, Callback callback) {
post(address, map, null, oyHeader, tag, timeout, callback);
}
// public static void post(String address, Map<String, Object> map, Callback callback) {
// post(address, map, null, null, 0, callback);
// }
//
// public static void post(String address, Map<String, Object> map, Header oyHeader, String tag, int timeout, Callback callback) {
// post(address, map, null, oyHeader, tag, timeout, callback);
// }
public static void post(String address, Map<String, Object> map, String cookie, Header oyHeader, String tag, int timeout, Callback callback) {
okHttpClient = new OkHttpClient();
......@@ -198,7 +198,7 @@ public class OkhttpUtil {
client.newCall(request.build()).enqueue(callback);
}
public static Response synchronousGet(String address, Map<String, Object> map, String cookie) throws IOException {
public static Response synchronousGet(String address, Map<String, Object> map, Map<String, String> headers) throws IOException {
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder httpBuilder = HttpUrl.parse(address).newBuilder();
......@@ -210,10 +210,15 @@ public class OkhttpUtil {
Request.Builder request = new Request.Builder()
.url(httpBuilder.build());
Log.e("OkhttpUtil", "为" + httpBuilder.build());
if (!TextUtils.isEmpty(cookie)) {
request.addHeader("cookie", cookie);
Log.e("OkhttpUtil", "get " + httpBuilder.build());
if (headers != null) {
for (Map.Entry<String, String> header : headers.entrySet()) {
request.addHeader(header.getKey(), header.getValue().toString());
}
}
// if (!TextUtils.isEmpty(cookie)) {
// request.addHeader("cookie", cookie);
// }
return client.newCall(request.build()).execute();
}
......
......@@ -194,6 +194,31 @@ public class SharedPreferenceUtil {
getShareType().edit().putInt("deckEditType", type).apply();
}
public static String getServerToken() {
return getShareRecord().getString("server_token", null);
}
public static boolean setServerToken(String token) {
return getShareRecord().edit().putString("server_token", token).commit();
}
public static Integer getServerUserId() {
return getShareType().getInt("server_user_id", -1);
}
public static void setServerUserId(int userId) {
getShareType().edit().putInt("server_user_id", userId).apply();
}
public static boolean deleteServerToken() {
// Get SharedPreferences instance
SharedPreferences sharedPreferences = getShareRecord();
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.remove("server_token"); // Replace "key_name" with your actual key
return editor.commit(); // Or editor.commit() if you need immediate results
}
public static String[] getArray(int id) {
return App.get().getResources().getStringArray(id);
}
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="cn.garymb.ygomobile.deck_square.DeckSquareActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#aa000000" />
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/packagetablayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
app:tabGravity="fill"
app:tabMode="scrollable" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/login_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginBottom="16dp"
app:srcCompat="@android:drawable/ic_dialog_email" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ 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="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:gravity="center"
android:text="Login"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="@+id/et_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:hint="Username"
android:inputType="text" />
<EditText
android:id="@+id/et_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Password"
android:inputType="textPassword" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<Button
android:id="@+id/btn_cancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:text="Cancel" />
<Button
android:id="@+id/btn_login"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_weight="1"
android:backgroundTint="@color/colorPrimary"
android:text="Login" />
</LinearLayout>
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone" />
</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="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/tvTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:gravity="center"
android:text="Choose Action"
android:textSize="18sp"
android:textStyle="bold" />
<Button
android:id="@+id/btnDownload"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:drawableStart="@drawable/ic_download"
android:drawablePadding="8dp"
android:text="Download" />
<Button
android:id="@+id/btnLike"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawableStart="@drawable/ic_like"
android:drawablePadding="8dp"
android:text="Like" />
</LinearLayout>
\ No newline at end of file
......@@ -21,6 +21,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/open_deck_square"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginBottom="100dp"
android:text="deck store" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<com.tubb.smrv.SwipeMenuRecyclerView
android:id="@+id/list_deck_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@android:color/transparent"
android:dividerHeight="4dp"
android:padding="5dp"
android:scrollbars="vertical" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_deck_cards"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left"
android:orientation="vertical"
android:paddingLeft="4dp"
android:paddingTop="2dp"
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
android:id="@+id/mc_login_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="登录" />
<Button
android:id="@+id/mc_logout_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="注销" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.tubb.smrv.SwipeMenuRecyclerView
android:id="@+id/list_my_deck_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@android:color/transparent"
android:dividerHeight="4dp"
android:padding="5dp"
android:scrollbars="vertical"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="16dp" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_gravity="bottom|right"
android:layout_marginLeft="10dp"
android:orientation="horizontal"
android:weightSum="1">
<Button
android:id="@+id/refresh_data"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right|bottom"
android:text="刷新"></Button>
<Button
android:id="@+id/upload_deck"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|bottom"
android:text="上传卡组"></Button>
</FrameLayout>
<!--<com.google.android.material.floatingactionbutton.FloatingActionButton
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="刷新" />-->
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<?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:background="@color/holo_blue_bright"
android:orientation="vertical">
<ImageView
android:id="@+id/deck_info_image"
android:layout_width="@dimen/card_width_middle"
android:layout_height="@dimen/card_height_middle" />
<TextView
android:id="@+id/deck_id"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/deck_info_name"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!-- <TextView
android:id="@+id/deck_contributor"
android:layout_width="match_parent"
android:layout_height="wrap_content" />-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/deck_contributor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/deck_last_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</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>
\ No newline at end of file
<resources>
<dimen name="fab_margin">48dp</dimen>
</resources>
\ No newline at end of file
<resources>
<dimen name="fab_margin">200dp</dimen>
</resources>
\ No newline at end of file
<resources>
<dimen name="fab_margin">48dp</dimen>
</resources>
\ No newline at end of file
......@@ -383,4 +383,46 @@
<string name="about_user_privacy_policy">Explanation of the permissions used by YGOMObile</string>
<string name="open">Open the deck</string>
<string name="web_warn_save_deck">Opening the deck will close the webpage you are currently viewing. Do you want to close the webpage and open the deck</string>
<!-- Strings used for fragments for navigation -->
<string name="first_fragment_label">First Fragment</string>
<string name="second_fragment_label">Second Fragment</string>
<string name="next">Next</string>
<string name="previous">Previous</string>
<string name="lorem_ipsum">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam in scelerisque sem. Mauris
volutpat, dolor id interdum ullamcorper, risus dolor egestas lectus, sit amet mattis purus
dui nec risus. Maecenas non sodales nisi, vel dictum dolor. Class aptent taciti sociosqu ad
litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse blandit eleifend
diam, vel rutrum tellus vulputate quis. Aliquam eget libero aliquet, imperdiet nisl a,
ornare ex. Sed rhoncus est ut libero porta lobortis. Fusce in dictum tellus.\n\n
Suspendisse interdum ornare ante. Aliquam nec cursus lorem. Morbi id magna felis. Vivamus
egestas, est a condimentum egestas, turpis nisl iaculis ipsum, in dictum tellus dolor sed
neque. Morbi tellus erat, dapibus ut sem a, iaculis tincidunt dui. Interdum et malesuada
fames ac ante ipsum primis in faucibus. Curabitur et eros porttitor, ultricies urna vitae,
molestie nibh. Phasellus at commodo eros, non aliquet metus. Sed maximus nisl nec dolor
bibendum, vel congue leo egestas.\n\n
Sed interdum tortor nibh, in sagittis risus mollis quis. Curabitur mi odio, condimentum sit
amet auctor at, mollis non turpis. Nullam pretium libero vestibulum, finibus orci vel,
molestie quam. Fusce blandit tincidunt nulla, quis sollicitudin libero facilisis et. Integer
interdum nunc ligula, et fermentum metus hendrerit id. Vestibulum lectus felis, dictum at
lacinia sit amet, tristique id quam. Cras eu consequat dui. Suspendisse sodales nunc ligula,
in lobortis sem porta sed. Integer id ultrices magna, in luctus elit. Sed a pellentesque
est.\n\n
Aenean nunc velit, lacinia sed dolor sed, ultrices viverra nulla. Etiam a venenatis nibh.
Morbi laoreet, tortor sed facilisis varius, nibh orci rhoncus nulla, id elementum leo dui
non lorem. Nam mollis ipsum quis auctor varius. Quisque elementum eu libero sed commodo. In
eros nisl, imperdiet vel imperdiet et, scelerisque a mauris. Pellentesque varius ex nunc,
quis imperdiet eros placerat ac. Duis finibus orci et est auctor tincidunt. Sed non viverra
ipsum. Nunc quis augue egestas, cursus lorem at, molestie sem. Morbi a consectetur ipsum, a
placerat diam. Etiam vulputate dignissim convallis. Integer faucibus mauris sit amet finibus
convallis.\n\n
Phasellus in aliquet mi. Pellentesque habitant morbi tristique senectus et netus et
malesuada fames ac turpis egestas. In volutpat arcu ut felis sagittis, in finibus massa
gravida. Pellentesque id tellus orci. Integer dictum, lorem sed efficitur ullamcorper,
libero justo consectetur ipsum, in mollis nisl ex sed nisl. Donec maximus ullamcorper
sodales. Praesent bibendum rhoncus tellus nec feugiat. In a ornare nulla. Donec rhoncus
libero vel nunc consequat, quis tincidunt nisl eleifend. Cras bibendum enim a justo luctus
vestibulum. Fusce dictum libero quis erat maximus, vitae volutpat diam dignissim.
</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