Commit 1b20a7be authored by wangfugui's avatar wangfugui

删除DeckSquareActivity

parent a6273141
......@@ -161,15 +161,7 @@
android:name="cn.garymb.ygomobile.ex_card.ExCardActivity"
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"
......
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.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;
}
}
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