Commit 526ead6a authored by wangfugui's avatar wangfugui

intermediate backup

parent 1637acf5
...@@ -153,6 +153,11 @@ ...@@ -153,6 +153,11 @@
android:theme="@style/AppTheme.Mycard" android:theme="@style/AppTheme.Mycard"
android:launchMode="singleTop" android:launchMode="singleTop"
/> />
<activity
android:name="cn.garymb.ygomobile.ex_card.ExCardActivity2"
android:theme="@style/AppTheme.Mycard"
android:launchMode="singleTop"
/>
<!-- 为防止Service被系统回收,可以尝试通过提高服务的优先级解决,1000是最高优先级,数字越小,优先级越低 --> <!-- 为防止Service被系统回收,可以尝试通过提高服务的优先级解决,1000是最高优先级,数字越小,优先级越低 -->
<!--android:priority="1000"--> <!--android:priority="1000"-->
<service <service
......
package cn.garymb.ygomobile.ex_card;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.widget.Toolbar;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import java.util.List;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.activities.BaseActivity;
public class ExCardActivity2 extends BaseActivity {
private Context context;
private Toolbar toolbar;
public static TabLayout tabLayout;
public static ViewPager viewPager;
private PackageTabAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ex_card2);
toolbar = (Toolbar) findViewById(R.id.toolbar);
if (getSupportActionBar() == null) {
setSupportActionBar(toolbar);
} else {
toolbar.setVisibility(View.GONE);
}
getSupportActionBar().setTitle("Packages");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setOffscreenPageLimit(2);
tabLayout = (TabLayout) findViewById(R.id.packagetablayout);
createTabFragment();
List<ExCard> exCardList = this.getIntent()
.getParcelableArrayListExtra("exCardList");
List<ExCardLogItem> exCardLogItemList = this.getIntent()
.getParcelableArrayListExtra("exCardLogList");
}
private void createTabFragment() {
adapter = new PackageTabAdapter(getSupportFragmentManager(), tabLayout);
viewPager.setAdapter(adapter);
/* setupWithViewPager() is used to link the TabLayout to the ViewPager */
tabLayout.setupWithViewPager(viewPager);
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
}
package cn.garymb.ygomobile.ex_card;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import cn.garymb.ygomobile.lite.R;
/**
* A simple {@link Fragment} subclass.
* Use the {@link ExCardFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class ExCardFragment extends Fragment {
private View layoutView;
private ExCardListAdapter mExCardListAdapter;
private RecyclerView mExCardListView;
private List<ExCard> dataList = new ArrayList<>();
public void setDataList(){
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
layoutView = inflater.inflate(R.layout.fragment_ex_card, container, false);
initView(layoutView);
Log.i("webCrawler", "excardfragment onCreateView");
return layoutView;
}
public void initView(View layoutView) {
mExCardListView = layoutView.findViewById(R.id.list_ex_card);
mExCardListAdapter = new ExCardListAdapter(R.layout.item_ex_card, dataList);
mExCardListView.setAdapter(mExCardListAdapter);
initButton();
}
public void initButton() {
}
}
\ No newline at end of file
...@@ -2,6 +2,7 @@ package cn.garymb.ygomobile.ex_card; ...@@ -2,6 +2,7 @@ package cn.garymb.ygomobile.ex_card;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import com.bumptech.glide.RequestBuilder; import com.bumptech.glide.RequestBuilder;
......
package cn.garymb.ygomobile.ex_card;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
import cn.garymb.ygomobile.lite.R;
public class ExCardLogFragment extends Fragment {
private View layoutView;
private ExCardLogAdapter mExCardLogAdapter;
private ExpandableListView mExCardLogView;
private List<ExCardLogItem> dataList = new ArrayList<>();//TODO 把数据传入
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
layoutView = inflater.inflate(R.layout.fragment_ex_card_log, container, false);
initView(layoutView);
return layoutView;
}
public void initView(View layoutView) {
mExCardLogView = layoutView.findViewById(R.id.expandableListView);
mExCardLogAdapter = new ExCardLogAdapter(getContext(), dataList);
mExCardLogView.setAdapter(mExCardLogAdapter);
initButton();
}
public void initButton() {
}
}
\ No newline at end of file
package cn.garymb.ygomobile.ex_card;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import com.google.android.material.tabs.TabLayout;
/**
* Tab的适配器,用来实现页面切换
*/
public class PackageTabAdapter extends FragmentStatePagerAdapter {
TabLayout tabLayout;
public PackageTabAdapter(FragmentManager fm, TabLayout _tabLayout) {
super(fm);
this.tabLayout = _tabLayout;
}
@Override
public Fragment getItem(int position) {
Log.i("webCrawler", "getItem");
Fragment fragment = null;
if (position == 0)
{
fragment = new ExCardFragment();//TODO
}
else if (position == 1)
{
fragment = new ExCardLogFragment();
}
return fragment;
}
@Override
public int getCount() {
return 2;
}
@Override
public CharSequence getPageTitle(int position) {
String title = null;
if (position == 0)
{
title = "Domestic";
}
else if (position == 1)
{
title = "International";
}
return title;
}
}
...@@ -66,6 +66,7 @@ import cn.garymb.ygomobile.bean.events.ServerInfoEvent; ...@@ -66,6 +66,7 @@ import cn.garymb.ygomobile.bean.events.ServerInfoEvent;
import cn.garymb.ygomobile.ex_card.ExCard; import cn.garymb.ygomobile.ex_card.ExCard;
import cn.garymb.ygomobile.ex_card.ExCardActivity; import cn.garymb.ygomobile.ex_card.ExCardActivity;
import cn.garymb.ygomobile.bean.events.ExCardEvent; import cn.garymb.ygomobile.bean.events.ExCardEvent;
import cn.garymb.ygomobile.ex_card.ExCardActivity2;
import cn.garymb.ygomobile.ex_card.ExCardLogItem; import cn.garymb.ygomobile.ex_card.ExCardLogItem;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.loader.ImageLoader; import cn.garymb.ygomobile.loader.ImageLoader;
...@@ -778,7 +779,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene ...@@ -778,7 +779,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
} }
} }
Intent intent = new Intent(getActivity(), ExCardActivity.class); Intent intent = new Intent(getActivity(), ExCardActivity2.class);
intent.putParcelableArrayListExtra("exCardLogList", exCardLogList); intent.putParcelableArrayListExtra("exCardLogList", exCardLogList);
intent.putParcelableArrayListExtra("exCardList", exCardList); intent.putParcelableArrayListExtra("exCardList", exCardList);
if (exCardList.isEmpty() && exCardLogList.isEmpty()) { if (exCardList.isEmpty() && exCardLogList.isEmpty()) {
......
...@@ -7,25 +7,33 @@ ...@@ -7,25 +7,33 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<androidx.viewpager.widget.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.tabs.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ExpandableListView <ExpandableListView
android:id="@+id/expandableListView" android:id="@+id/expandableListView"
android:layout_height="0dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_weight="3" android:layout_height="wrap_content"
android:indicatorLeft="?android:attr/expandableListPreferredItemIndicatorLeft"
android:divider="@android:color/darker_gray" android:divider="@android:color/darker_gray"
android:dividerHeight="0.5dp" /> android:dividerHeight="0.5dp"
android:indicatorLeft="?android:attr/expandableListPreferredItemIndicatorLeft" />
<com.tubb.smrv.SwipeMenuRecyclerView <com.tubb.smrv.SwipeMenuRecyclerView
android:id="@+id/list_ex_cards" android:id="@+id/list_ex_cards"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_weight="13"
android:divider="@android:color/transparent" android:divider="@android:color/transparent"
android:dividerHeight="4dp" android:dividerHeight="4dp"
android:padding="5dp" android:padding="5dp"
android:scrollbars="vertical" /> android:scrollbars="vertical" />
</androidx.viewpager.widget.ViewPager>
<Button <Button
android:id="@+id/web_btn_download_prerelease" android:id="@+id/web_btn_download_prerelease"
android:layout_width="match_parent" android:layout_width="match_parent"
......
<?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"
>
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:paddingBottom="5dp"
app:elevation="0dp">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<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="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<?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"
android:id="@+id/fragment_ex_card">
<androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:openDrawer="right">
<FrameLayout
android:id="@+id/layout_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.tubb.smrv.SwipeMenuRecyclerView
android:id="@+id/list_ex_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@android:color/transparent"
android:dividerHeight="4dp"
android:padding="5dp"
android:scrollbars="vertical" />
<LinearLayout
android:layout_width="60dp"
android:layout_height="100dp"
android:layout_gravity="bottom|right"
android:layout_marginRight="20dp"
android:layout_marginBottom="70dp"
android:orientation="vertical">
<Button
android:id="@+id/btn_search"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:background="@drawable/search"
android:gravity="center" />
<TextView
android:id="@+id/search_result_count"
android:layout_width="60dp"
android:layout_height="30dp"
android:background="@drawable/radius"
android:gravity="center_horizontal"
android:text="0"
android:textColor="@color/gold"
android:textStyle="bold" />
</LinearLayout>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
android:orientation="vertical">
<include
android:id="@+id/nav_view_list"
layout="@layout/nav_card_search" />
</LinearLayout>
</androidx.drawerlayout.widget.DrawerLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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">
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@android:color/darker_gray"
android:dividerHeight="0.5dp"
android:indicatorLeft="?android:attr/expandableListPreferredItemIndicatorLeft" />
</FrameLayout>
...@@ -354,4 +354,6 @@ ...@@ -354,4 +354,6 @@
<string name="reChatJoining">relogining\.\.\.</string> <string name="reChatJoining">relogining\.\.\.</string>
<string name="settings_data_language">Language</string> <string name="settings_data_language">Language</string>
<string name="settings_data_language_about">change language of YGOPro UI and card database </string> <string name="settings_data_language_about">change language of YGOPro UI and card database </string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</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