Commit f2d28839 authored by fallenstardust's avatar fallenstardust

迁移mycard为fragment

parent 823d7c33
...@@ -143,22 +143,6 @@ ...@@ -143,22 +143,6 @@
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" /> android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
<activity
android:name="cn.garymb.ygomobile.ui.cards.CardSearchActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:label="@string/card_search"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
<activity
android:name="cn.garymb.ygomobile.ui.cards.DeckManagerActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:label="@string/deck_manager"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
<activity <activity
android:name="cn.garymb.ygomobile.ui.file.FileActivity" android:name="cn.garymb.ygomobile.ui.file.FileActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize" android:configChanges="orientation|keyboardHidden|navigation|screenSize"
...@@ -172,12 +156,6 @@ ...@@ -172,12 +156,6 @@
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/AppTheme.Mycard" android:theme="@style/AppTheme.Mycard"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" /> android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
<activity
android:name="cn.garymb.ygomobile.ui.mycard.MyCardActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:launchMode="singleTop"
android:theme="@style/AppTheme.Mycard"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"/>
<activity <activity
android:name="cn.garymb.ygomobile.ui.mycard.mcchat.McchatActivity" android:name="cn.garymb.ygomobile.ui.mycard.mcchat.McchatActivity"
......
...@@ -51,6 +51,7 @@ public class MyCard { ...@@ -51,6 +51,7 @@ public class MyCard {
public MyCard(Activity context) { public MyCard(Activity context) {
mContext = context; mContext = context;
//context.getActionBar().hide();
lastModified = context.getSharedPreferences("lastModified", Context.MODE_PRIVATE); lastModified = context.getSharedPreferences("lastModified", Context.MODE_PRIVATE);
mDefWebViewClient = new DefWebViewClient() { mDefWebViewClient = new DefWebViewClient() {
@Override @Override
...@@ -108,21 +109,6 @@ public class MyCard { ...@@ -108,21 +109,6 @@ public class MyCard {
return mHomeUrl; return mHomeUrl;
} }
// public String getLoginUrl() throws NoSuchAlgorithmException, InvalidKeyException {
// Uri.Builder payloadBuilder = new Uri.Builder();
// payloadBuilder.appendQueryParameter("return_sso_url", return_sso_url);
// byte[] payload = Base64.encode(payloadBuilder.build().getQuery().getBytes(UTF_8), Base64.NO_WRAP);
//
// Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
// SecretKeySpec secret_key = new SecretKeySpec(key.getBytes(UTF_8), "HmacSHA256");
// sha256_HMAC.init(secret_key);
// String signature = byteArrayToHexString(sha256_HMAC.doFinal(payload));
// Uri.Builder requestBuilder = Uri.parse(sso_url).buildUpon();
// requestBuilder.appendQueryParameter("sso", new String(payload, UTF_8));
// requestBuilder.appendQueryParameter("sig", signature);
// return requestBuilder.build().toString();
// }
public String getBBSUrl() { public String getBBSUrl() {
return mCommunityUrl; return mCommunityUrl;
} }
...@@ -152,10 +138,6 @@ public class MyCard { ...@@ -152,10 +138,6 @@ public class MyCard {
public interface MyCardListener { public interface MyCardListener {
void onLogin(String name, String icon, String statu); void onLogin(String name, String icon, String statu);
void watchReplay();
void puzzleMode();
void openDrawer(); void openDrawer();
void closeDrawer(); void closeDrawer();
...@@ -205,7 +187,7 @@ public class MyCard { ...@@ -205,7 +187,7 @@ public class MyCard {
this.activity = activity; this.activity = activity;
mListener = listener; mListener = listener;
} }
/*
@JavascriptInterface @JavascriptInterface
public void edit_deck() { public void edit_deck() {
activity.startActivity(new Intent(activity, DeckManagerFragment.class)); activity.startActivity(new Intent(activity, DeckManagerFragment.class));
...@@ -224,7 +206,7 @@ public class MyCard { ...@@ -224,7 +206,7 @@ public class MyCard {
activity.runOnUiThread(mListener::puzzleMode); activity.runOnUiThread(mListener::puzzleMode);
} }
} }
*/
@JavascriptInterface @JavascriptInterface
public void openDrawer() { public void openDrawer() {
if (mListener != null) { if (mListener != null) {
......
...@@ -20,7 +20,7 @@ import org.jivesoftware.smack.XMPPException; ...@@ -20,7 +20,7 @@ import org.jivesoftware.smack.XMPPException;
import java.io.IOException; import java.io.IOException;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.mycard.MyCardActivity; import cn.garymb.ygomobile.ui.mycard.MycardFragment;
import cn.garymb.ygomobile.ui.mycard.mcchat.management.ServiceManagement; import cn.garymb.ygomobile.ui.mycard.mcchat.management.ServiceManagement;
import cn.garymb.ygomobile.ui.mycard.mcchat.management.UserManagement; import cn.garymb.ygomobile.ui.mycard.mcchat.management.UserManagement;
import cn.garymb.ygomobile.utils.YGOUtil; import cn.garymb.ygomobile.utils.YGOUtil;
...@@ -43,7 +43,7 @@ public class SplashActivity extends Activity { ...@@ -43,7 +43,7 @@ public class SplashActivity extends Activity {
su.setIsConnected(false); su.setIsConnected(false);
sp_jz.setVisibility(View.GONE); sp_jz.setVisibility(View.GONE);
sp_tv.setText(getString(R.string.logining_failed)); sp_tv.setText(getString(R.string.logining_failed));
YGOUtil.show( getString(R.string.failed_reason) + msg.obj); YGOUtil.show(getString(R.string.failed_reason) + msg.obj);
break; break;
case 1: case 1:
startActivity(new Intent(SplashActivity.this, McchatActivity.class)); startActivity(new Intent(SplashActivity.this, McchatActivity.class));
...@@ -65,7 +65,7 @@ public class SplashActivity extends Activity { ...@@ -65,7 +65,7 @@ public class SplashActivity extends Activity {
case 5: case 5:
/*sp_jz.setVisibility(View.GONE); /*sp_jz.setVisibility(View.GONE);
sp_tv.setText("用户名或密码为空");*/ sp_tv.setText("用户名或密码为空");*/
startActivity(new Intent(SplashActivity.this, MyCardActivity.class)); startActivity(new Intent(SplashActivity.this, MycardFragment.class));
finish(); finish();
break; break;
...@@ -145,28 +145,28 @@ public class SplashActivity extends Activity { ...@@ -145,28 +145,28 @@ public class SplashActivity extends Activity {
String password = UserManagement.getUserPassword(); String password = UserManagement.getUserPassword();
if (name != null && password != null) { if (name != null && password != null) {
Message me = new Message(); Message me = new Message();
me.what = 0; me.what = 0;
try { try {
su.login(name, password); su.login(name, password);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
me.obj = "InterruptedException:"+e; me.obj = "InterruptedException:" + e;
han.sendMessage(me); han.sendMessage(me);
} catch (IOException e) { } catch (IOException e) {
me.obj = "IOException:"+e; me.obj = "IOException:" + e;
e.printStackTrace(); e.printStackTrace();
han.sendMessage(me); han.sendMessage(me);
} catch (SmackException e) { } catch (SmackException e) {
me.obj = "SmackException:"+e; me.obj = "SmackException:" + e;
e.printStackTrace(); e.printStackTrace();
han.sendMessage(me); han.sendMessage(me);
} catch (XMPPException e) { } catch (XMPPException e) {
me.obj = "XMPPException:"+e; me.obj = "XMPPException:" + e;
e.printStackTrace(); e.printStackTrace();
han.sendMessage(me); han.sendMessage(me);
} catch (Exception e){ } catch (Exception e) {
me.obj = "其他错误:"+e; me.obj = "其他错误:" + e;
e.printStackTrace(); e.printStackTrace();
han.sendMessage(me); han.sendMessage(me);
} }
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:fitsSystemWindows="true"
tools:openDrawer="left">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatTextView
android:visibility="gone"
android:id="@+id/tv_back_mc"
android:background="@drawable/click_background"
android:textColor="@color/black"
android:layout_width="match_parent"
android:text="返回萌卡大厅"
android:textSize="13sp"
android:textStyle="bold"
android:gravity="center"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:layout_height="wrap_content"/>
<cn.garymb.ygomobile.ui.mycard.MyCardWebView
android:id="@+id/webbrowser"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/progressBar"
style="@style/StyleProgressBarMini"
android:layout_width="match_parent"
android:layout_height="5px" />
</cn.garymb.ygomobile.ui.mycard.MyCardWebView>
</LinearLayout>
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_main"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="@color/white"
app:headerLayout="@layout/nav_mycard_head"
app:itemIconTint="@color/gold"
app:itemTextColor="@color/mediumPurple"
app:menu="@menu/nav_mycard_menu" />
</androidx.drawerlayout.widget.DrawerLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fragment_mycard" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:clipToPadding="false"
android:fitsSystemWindows="false"
tools:openDrawer="left">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatTextView
android:visibility="gone"
android:id="@+id/tv_back_mc"
android:background="@drawable/click_background"
android:textColor="@color/black"
android:layout_width="match_parent"
android:text="返回萌卡大厅"
android:textSize="13sp"
android:textStyle="bold"
android:gravity="center"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:layout_height="wrap_content"/>
<cn.garymb.ygomobile.ui.mycard.MyCardWebView
android:id="@+id/webbrowser"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/progressBar"
style="@style/StyleProgressBarMini"
android:layout_width="match_parent"
android:layout_height="5px" />
</cn.garymb.ygomobile.ui.mycard.MyCardWebView>
</LinearLayout>
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_main"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="@color/white"
app:headerLayout="@layout/nav_mycard_head"
app:itemIconTint="@color/gold"
app:itemTextColor="@color/mediumPurple"
app:menu="@menu/nav_mycard_menu" />
</LinearLayout> </androidx.drawerlayout.widget.DrawerLayout>
\ No newline at end of file \ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
android:background="#80000000" android:background="#80000000"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <fragment android:name="cn.garymb.ygomobile.ui.preference.fragments.SettingFragment"
android:id="@+id/fragment" android:id="@+id/fragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_head_height"
android:orientation="vertical"
android:paddingTop="24dp"
tools:showIn="@layout/activity_home">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/nav_icon_width"
android:layout_height="@dimen/nav_icon_height"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:src="@drawable/ic_icon" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_about_author_pref"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/white" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/settings_author"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@color/white" />
<Button
android:id="@+id/nav_webpage"
android:layout_width="124dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_margin="5dp"
android:background="@drawable/button_bg"
android:gravity="center"
android:text="@string/donation"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
android:background="@color/mediumPurple" android:background="@color/mediumPurple"
android:orientation="vertical" android:orientation="vertical"
android:paddingTop="20dp" android:paddingTop="20dp"
tools:showIn="@layout/activity_online_mycard"> tools:showIn="@layout/fragment_mycard">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -16,13 +16,4 @@ ...@@ -16,13 +16,4 @@
android:id="@+id/action_arena" android:id="@+id/action_arena"
android:icon="@drawable/ic_highlight" android:icon="@drawable/ic_highlight"
android:title="@string/arena" /> android:title="@string/arena" />
<item
android:id="@+id/action_deck_manager"
android:icon="@drawable/ic_edit"
android:title="@string/deck_manager" />
<item
android:id="@+id/action_quit"
android:icon="@drawable/ic_close_black_24dp"
android:title="@string/quit" />
</menu> </menu>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<intent <intent
android:action="android.intent.action.VIEW" android:action="android.intent.action.VIEW"
android:targetClass="cn.garymb.ygomobile.ui.mycard.MyCardActivity" android:targetClass="cn.garymb.ygomobile.ui.mycard.MycardFragment"
android:targetPackage="cn.garymb.ygomobile" /> android:targetPackage="cn.garymb.ygomobile" />
<categories android:name="android.shortcut.conversation" /> <categories android:name="android.shortcut.conversation" />
</shortcut> </shortcut>
......
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