Commit 6e789d4c authored by fallenstardust's avatar fallenstardust

卡组编辑添加新手引导

parent 388eb3db
package cn.garymb.ygomobile.ui.cards;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.RectF;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.RecyclerViewItemListener;
......@@ -12,6 +18,13 @@ import androidx.drawerlayout.widget.DrawerLayout;
import androidx.recyclerview.widget.FastScrollLinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.app.hubert.guide.NewbieGuide;
import com.app.hubert.guide.core.Controller;
import com.app.hubert.guide.listener.OnHighlightDrewListener;
import com.app.hubert.guide.listener.OnLayoutInflatedListener;
import com.app.hubert.guide.model.GuidePage;
import com.app.hubert.guide.model.HighLight;
import com.app.hubert.guide.model.HighlightOptions;
import com.bumptech.glide.Glide;
import java.io.IOException;
......@@ -38,16 +51,16 @@ public abstract class BaseCardsAcitivity extends BaseActivity implements CardLoa
private ImageLoader mImageLoader;
protected StringManager mStringManager = DataManager.get().getStringManager();
protected LimitManager mLimitManager = DataManager.get().getLimitManager();
protected int screenWidth;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_deck_cards);
AnimationShake2();
mImageLoader = ImageLoader.get(this);
mDrawerlayout = $(R.id.drawer_layout);
screenWidth = getResources().getDisplayMetrics().widthPixels;
mListView = $(R.id.list_cards);
mCardListAdapater = new CardListAdapter(this, mImageLoader);
mCardListAdapater.setEnableSwipe(true);
......@@ -59,6 +72,118 @@ public abstract class BaseCardsAcitivity extends BaseActivity implements CardLoa
mCardLoader.setCallBack(this);
mCardSelector = new CardSearcher($(R.id.nav_view_list), mCardLoader);
mCardSelector.setCallBack(this);
showNewbieGuide("deckmain");
}
//https://www.jianshu.com/p/99649af3b191
public void showNewbieGuide(String scene) {
HighlightOptions options = new HighlightOptions.Builder()//绘制一个高亮虚线圈
.setOnHighlightDrewListener(new OnHighlightDrewListener() {
@Override
public void onHighlightDrew(Canvas canvas, RectF rectF) {
Paint paint = new Paint();
paint.setColor(Color.WHITE);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(20);
paint.setPathEffect(new DashPathEffect(new float[]{20, 20}, 0));
canvas.drawCircle(rectF.centerX(), rectF.centerY(), rectF.width() / 2 + 10, paint);
}
}).build();
HighlightOptions options2 = new HighlightOptions.Builder()//绘制一个高亮虚线矩形
.setOnHighlightDrewListener(new OnHighlightDrewListener() {
@Override
public void onHighlightDrew(Canvas canvas, RectF rectF) {
Paint paint = new Paint();
paint.setColor(Color.WHITE);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(20);
paint.setPathEffect(new DashPathEffect(new float[]{20, 20}, 0));
canvas.drawRect(rectF, paint);
}
}).build();
if (scene.equals("deckmain")) {
NewbieGuide.with(this)//with方法可以传入Activity或者Fragment,获取引导页的依附者
.setLabel("deckmainGuide")
.addGuidePage(
GuidePage.newInstance().setEverywhereCancelable(true)
.setBackgroundColor(0xbc000000)
.addHighLightWithOptions(findViewById(R.id.deck_menu), HighLight.Shape.CIRCLE, options)
.setLayoutRes(R.layout.view_guide_home)
.setOnLayoutInflatedListener(new OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(View view, Controller controller) {
//可只创建一个引导layout并把相关内容都放在其中并GONE,获得ID并初始化相应为显示
view.findViewById(R.id.view_abt_bmb).setVisibility(View.VISIBLE);
}
})
)
.addGuidePage(
GuidePage.newInstance().setEverywhereCancelable(true)
.setBackgroundColor(0xbc000000)
.addHighLightWithOptions(findViewById(R.id.nav_search), HighLight.Shape.CIRCLE, options)
.setLayoutRes(R.layout.view_guide_home)
.setOnLayoutInflatedListener(new OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(View view, Controller controller) {
TextView tv = view.findViewById(R.id.text_about);
tv.setVisibility(View.VISIBLE);
tv.setText(R.string.guide_button_search);
}
})
)
.addGuidePage(
GuidePage.newInstance().setEverywhereCancelable(true)
.setBackgroundColor(0xbc000000)
.addHighLightWithOptions(findViewById(R.id.nav_list), HighLight.Shape.CIRCLE, options)
.setLayoutRes(R.layout.view_guide_home)
.setOnLayoutInflatedListener(new OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(View view, Controller controller) {
TextView tv = view.findViewById(R.id.text_about);
tv.setVisibility(View.VISIBLE);
tv.setText(R.string.guide_button_search_result);
}
})
)
.addGuidePage(
GuidePage.newInstance().setEverywhereCancelable(true)
.setBackgroundColor(0xbc000000)
.addHighLightWithOptions(findViewById(R.id.tv_deckmanger), HighLight.Shape.CIRCLE, options2)
.setLayoutRes(R.layout.view_guide_home)
.setOnLayoutInflatedListener(new OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(View view, Controller controller) {
TextView tv = view.findViewById(R.id.text_about);
tv.setVisibility(View.VISIBLE);
tv.setText(R.string.guide_view_deck_manager);
}
})
)
.addGuidePage(
GuidePage.newInstance().setEverywhereCancelable(true)
.setBackgroundColor(0xbc000000)
.addHighLightWithOptions(new RectF(screenWidth / 10, screenWidth / 20, screenWidth / 5, screenWidth / 20 + screenWidth / 10 * 254 / 177), HighLight.Shape.RECTANGLE, options2)
.setLayoutRes(R.layout.view_guide_home)
.setOnLayoutInflatedListener(new OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(View view, Controller controller) {
TextView tv = view.findViewById(R.id.text_abt_mid);
tv.setVisibility(View.VISIBLE);
tv.setText(R.string.guide_view_move_card);
}
})
)
.alwaysShow(true)//总是显示,调试时可以打开
.show();
}
}
protected int getDimen(int id) {
......@@ -178,6 +303,7 @@ public abstract class BaseCardsAcitivity extends BaseActivity implements CardLoa
}
if (autoClose && mDrawerlayout.isDrawerOpen(Constants.CARD_RESULT_GRAVITY)) {
mDrawerlayout.closeDrawer(Constants.CARD_RESULT_GRAVITY);
showNewbieGuide("searchResult");
} else if (isLoad) {
mDrawerlayout.openDrawer(Constants.CARD_RESULT_GRAVITY);
}
......
......@@ -8,7 +8,6 @@ import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.text.InputType;
import android.text.TextUtils;
......
......@@ -81,11 +81,11 @@ public class YGODialogUtil {
File file = new File(selectDeckPath);
if (file.exists()) {
String name = file.getParentFile().getName();
String lastName=file.getParentFile().getParentFile().getName();
String lastName = file.getParentFile().getParentFile().getName();
if (name.equals("pack") || name.equals("cacheDeck")) {
//卡包
typeSelectPosition = 0;
} else if (name.equals("Decks")&&lastName.equals(Constants.WINDBOT_PATH)) {
} else if (name.equals("Decks") && lastName.equals(Constants.WINDBOT_PATH)) {
//ai卡组
typeSelectPosition = 1;
} else if (name.equals("deck") && lastName.equals(Constants.PREF_DEF_GAME_DIR)) {
......@@ -379,10 +379,10 @@ public class YGODialogUtil {
}
private static void showAllDeckUtil() {
ImageUtil.reImageColor(IMAGE_MOVE, iv_move);
ImageUtil.reImageColor(IMAGE_MOVE, iv_move);//可用时用原图标色
ImageUtil.reImageColor(IMAGE_DEL, iv_del);
ImageUtil.reImageColor(IMAGE_COPY, iv_copy);
tv_del.setTextColor(YGOUtil.c(R.color.holo_blue_bright));
tv_del.setTextColor(YGOUtil.c(R.color.holo_blue_bright));//可用时字色蓝
tv_copy.setTextColor(YGOUtil.c(R.color.holo_blue_bright));
tv_move.setTextColor(YGOUtil.c(R.color.holo_blue_bright));
ll_del.setEnabled(true);
......@@ -394,7 +394,7 @@ public class YGODialogUtil {
ImageUtil.setGrayImage(IMAGE_MOVE, iv_move);
ImageUtil.setGrayImage(IMAGE_DEL, iv_del);
ImageUtil.setGrayImage(IMAGE_COPY, iv_copy);
tv_del.setTextColor(YGOUtil.c(R.color.star_rank));
tv_del.setTextColor(YGOUtil.c(R.color.star_rank));//不可用时字色灰
tv_copy.setTextColor(YGOUtil.c(R.color.star_rank));
tv_move.setTextColor(YGOUtil.c(R.color.star_rank));
ll_del.setEnabled(false);
......
......@@ -6,18 +6,10 @@ import android.content.DialogInterface;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import cn.garymb.ygomobile.bean.DeckType;
import cn.garymb.ygomobile.bean.events.DeckFile;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.adapters.TextSelectAdapter;
import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.utils.IOUtils;
import cn.garymb.ygomobile.utils.YGODialogUtil;
import cn.garymb.ygomobile.utils.YGOUtil;
public class DeckTypeTouchHelperCallback extends ItemTouchHelper.Callback {
......
......@@ -37,6 +37,7 @@
android:weightSum="1">
<LinearLayout
android:id="@+id/tv_deckmanger"
android:layout_width="0dp"
android:layout_height="@dimen/item_and_text_height"
android:layout_weight="1"
......@@ -72,6 +73,7 @@
android:visibility="gone" />
<LinearLayout
android:id="@+id/nav_list"
android:layout_width="60dp"
android:layout_height="match_parent"
android:orientation="vertical">
......@@ -92,6 +94,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/nav_search"
android:layout_width="60dp"
android:layout_height="match_parent"
android:orientation="vertical">
......@@ -112,6 +115,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/deck_menu"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
......@@ -176,9 +180,9 @@
android:id="@+id/sp_limit_list"
android:layout_width="wrap_content"
android:layout_height="@dimen/item_height"
android:gravity="fill_horizontal"
android:layout_weight="1"
android:ellipsize="end" />
android:ellipsize="end"
android:gravity="fill_horizontal" />
<TextView
android:id="@+id/result_count"
......
......@@ -3,6 +3,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_abt_mid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="20dp"
android:textColor="@color/white"
android:visibility="invisible" />
<LinearLayout
android:id="@+id/view_abt_menu"
android:layout_width="match_parent"
......@@ -170,8 +179,9 @@
android:id="@+id/text_about"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_gravity="bottom"
android:layout_margin="20dp"
android:paddingBottom="70dp"
android:shadowColor="#000000"
android:shadowDy="2"
android:shadowRadius="2"
......@@ -205,19 +215,131 @@
android:textColor="@color/white"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/view_abt_bmb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="10dp"
android:orientation="vertical"
android:paddingBottom="80dp"
android:visibility="gone">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shadowColor="#000000"
android:shadowDy="2"
android:shadowRadius="2"
android:text="@string/guide_menu"
android:textColor="@color/white"
android:textSize="15sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:shadowColor="#000000"
android:shadowDy="2"
android:shadowRadius="2"
android:text="@string/deck_name"
android:textColor="@color/white"
android:textSize="15sp" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/save" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="5dp"
android:shadowColor="#000000"
android:shadowDy="2"
android:shadowRadius="2"
android:text="@string/save_deck"
android:textColor="@color/white"
android:textSize="15sp" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/delete" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="5dp"
android:shadowColor="#000000"
android:shadowDy="2"
android:shadowRadius="2"
android:text="@string/delete"
android:textColor="@color/white"
android:textSize="15sp" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/search" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="5dp"
android:shadowColor="#000000"
android:shadowDy="2"
android:shadowRadius="2"
android:text="@string/deck_back_up"
android:textColor="@color/white"
android:textSize="15sp" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/shareicon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="5dp"
android:shadowColor="#000000"
android:shadowDy="2"
android:shadowRadius="2"
android:text="@string/share_deck"
android:textColor="@color/white"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/view_abt_join_room"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|bottom"
android:gravity="center|left"
android:layout_marginHorizontal="20dp"
android:layout_marginBottom="100dp"
android:gravity="center|left"
android:shadowColor="#000000"
android:shadowDy="2"
android:shadowRadius="2"
android:text="@string/guide_join_room"
android:textColor="@color/white"
android:textSize="15sp"
android:visibility="invisible"/>
android:visibility="invisible" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="40dp"
android:gravity="center"
android:text="密码用于好友约战,或者指定模式\n密码可以不填"
android:textColor="@android:color/white"
android:textSize="20sp" />
<ImageView
android:id="@+id/iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"
android:src="@drawable/cube" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="输入密码后会保存在历史记录\n长按对应记录即可删除"
android:textColor="@android:color/white" />
</RelativeLayout>
\ No newline at end of file
......@@ -279,6 +279,7 @@
<string name="my_favorites">즐겨 찾기★</string>
<string name="ypk_installed">확장 카드 팩 파일이 설치되었습니다</string>
<string name="ypk_go_setting">확장 카드 팩을 사용하려면 확장 카드 팩이 활성화되어 있어야합니다.</string>
<string name="ypk_delete">Long-press name to delete</string>
<string name="install_failed_bcos">설치에 실패했습니다. 이유:</string>
<string name="deck_back_up">백업</string>
<string name="deck_restore">복원</string>
......@@ -303,6 +304,9 @@
\n더 많은 듀얼 모드 비밀번호는 앱 튜토리얼을 참고하십시오</string>
<string name="guide_button_search">겁색 기준을 편집하려면 터치하십시오</string>
<string name="guide_search_result_count">여기에 검색 결과를 표시합니다</string>
<string name="guide_button_search_result">click to see search result\n also here will shows favorite cards</string>
<string name="guide_view_deck_manager">click to change Decks\n you can manage deck categories here</string>
<string name="guide_view_move_card">press a card to move it to other place\nlong-press this card to delete it</string>
<string name="about_delete_ex">만약 확장 카드를 사용하면서 문제가 발생했을 경우, 삭제하는 것도 좋은 선택이다</string>
<string name="title_delete_ex">확장 삭제</string>
<string name="file_installed">문건 나왔습니다.</string>
......
......@@ -279,6 +279,7 @@
<string name="my_favorites">我的收藏★</string>
<string name="ypk_installed">拓展卡包文件已安装</string>
<string name="ypk_go_setting">这是拓展卡包文件,要使用须启用扩展卡包</string>
<string name="ypk_delete">长按相应名称以删除</string>
<string name="install_failed_bcos">安装失败,原因:</string>
<string name="deck_back_up">备份</string>
<string name="deck_restore">还原</string>
......@@ -290,7 +291,7 @@
使用本软件此类功能将申请以下必要权限:
\n安装未知应用权限:安装更新包,备份、还原卡组必需
\n存储权限:备份、还原卡组,自定义背景、头像、卡背必需</string>
<string name="guide_menu">功能菜单:\n软件主要功能如"</string>
<string name="guide_menu">功能菜单:\n主要功能如"</string>
<string name="guide_mycard">萌卡平台:\n提供众多对战服务\n包含排位,观战,聊天与论坛等</string>
<string name="guide_serverlist">直连服务器列表\n点击一个服务器块即可加入相应的在线游戏</string>
<string name="guide_server_edit">编辑按钮:\n点击编辑相应的服务器信息。\n如改游戏昵称等</string>
......@@ -303,7 +304,10 @@
\n更多决斗模式密码请参考软件使用教程</string>
<string name="guide_button_search">点击编辑搜索条件</string>
<string name="guide_search_result_count">这里显示搜索结果卡片数量</string>
<string name="title_delete_ex">清空扩展卡包</string>
<string name="guide_button_search_result">点击显示搜索结果\n默认显示收藏的卡片</string>
<string name="guide_view_deck_manager">点击切换卡组\n也可以在此管理多个卡组分类</string>
<string name="guide_view_move_card">按住一张卡片可以拖动到其他位置\n长按这张卡片即可删除它</string>
<string name="title_delete_ex">删除扩展卡包</string>
<string name="ask_delete_ex">点击确认以清空</string>
<string name="about_delete_ex">如果遇到拓展卡包问题时删除是个不错的办法</string>
<string name="file_installed">文件已导入</string>
......
......@@ -282,6 +282,7 @@
<string name="my_favorites">myFav★</string>
<string name="ypk_installed">expansion file installed</string>
<string name="ypk_go_setting">check \"Use Expansions\" to use it</string>
<string name="ypk_delete">Long-press name to delete</string>
<string name="install_failed_bcos">file install failed, because\:</string>
<string name="deck_back_up">BackUp</string>
<string name="deck_restore">Restore</string>
......@@ -306,6 +307,9 @@
\n more duel model password you can see the tortuial.</string>
<string name="guide_button_search">click search buttton to edit search criteria</string>
<string name="guide_search_result_count">here shows search result count</string>
<string name="guide_button_search_result">click to see search result\n also here will shows favorite cards</string>
<string name="guide_view_deck_manager">click to change Decks\n you can manage deck categories here</string>
<string name="guide_view_move_card">press a card to move it to other place\nlong-press this card to delete it</string>
<string name="title_delete_ex">delete expansions</string>
<string name="about_delete_ex">if you need to delte all expansion cards</string>
<string name="file_installed">file loaded</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