Commit 2100b983 authored by fallenstardust's avatar fallenstardust

add card searcher guide

parent 61ac5959
package cn.garymb.ygomobile.ui.cards; 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.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.Gravity; import android.view.Gravity;
...@@ -11,13 +16,18 @@ import android.widget.Button; ...@@ -11,13 +16,18 @@ import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.widget.RecyclerViewItemListener; import androidx.appcompat.widget.RecyclerViewItemListener;
import androidx.appcompat.widget.Toolbar;
import androidx.drawerlayout.widget.DrawerLayout; import androidx.drawerlayout.widget.DrawerLayout;
import androidx.recyclerview.widget.FastScrollLinearLayoutManager; import androidx.recyclerview.widget.FastScrollLinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; 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 com.bumptech.glide.Glide;
import com.ourygo.assistant.util.DuelAssistantManagement; import com.ourygo.assistant.util.DuelAssistantManagement;
...@@ -112,6 +122,7 @@ class CardSearchActivityImpl extends BaseActivity implements CardLoader.CallBack ...@@ -112,6 +122,7 @@ class CardSearchActivityImpl extends BaseActivity implements CardLoader.CallBack
intentSearch(intentSearchMessage); intentSearch(intentSearchMessage);
isInitCdbOk = true; isInitCdbOk = true;
}); });
showNewbieGuide();
} }
@Override @Override
...@@ -346,4 +357,56 @@ class CardSearchActivityImpl extends BaseActivity implements CardLoader.CallBack ...@@ -346,4 +357,56 @@ class CardSearchActivityImpl extends BaseActivity implements CardLoader.CallBack
mDrawerlayout.openDrawer(Constants.CARD_SEARCH_GRAVITY); mDrawerlayout.openDrawer(Constants.CARD_SEARCH_GRAVITY);
} }
} }
//https://www.jianshu.com/p/99649af3b191
public void showNewbieGuide() {
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();
NewbieGuide.with(this)//with方法可以传入Activity或者Fragment,获取引导页的依附者
.setLabel("searchCardGuide")
.addGuidePage(
GuidePage.newInstance().setEverywhereCancelable(true)
.setBackgroundColor(0xbc000000)
.addHighLightWithOptions(findViewById(R.id.btn_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.search_result_count), 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_search_result_count);
}
})
)
.alwaysShow(true)//总是显示,调试时可以打开
.show();
}
} }
...@@ -151,7 +151,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie ...@@ -151,7 +151,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
//萌卡 //萌卡
StartMycard(); StartMycard();
checkNotch(); checkNotch();
showNewbieGuide(); showNewbieGuide("homePage");
} }
@Override @Override
...@@ -253,6 +253,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie ...@@ -253,6 +253,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
dialogPlus.show(); dialogPlus.show();
} else if (event.join) { } else if (event.join) {
joinRoom(event.position); joinRoom(event.position);
showNewbieGuide("joinRoom");
} else { } else {
mServerListManager.showEditDialog(event.position); mServerListManager.showEditDialog(event.position);
} }
...@@ -392,8 +393,12 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie ...@@ -392,8 +393,12 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
builder.setContentView(R.layout.dialog_room_name); builder.setContentView(R.layout.dialog_room_name);
EditText editText = builder.bind(R.id.room_name); EditText editText = builder.bind(R.id.room_name);
ListView listView = builder.bind(R.id.room_list); ListView listView = builder.bind(R.id.room_list);
TextView text_abt_roomlist = builder.bind(R.id.abt_room_list);
SimpleListAdapter simpleListAdapter = new SimpleListAdapter(getContext()); SimpleListAdapter simpleListAdapter = new SimpleListAdapter(getContext());
simpleListAdapter.set(AppsSettings.get().getLastRoomList()); simpleListAdapter.set(AppsSettings.get().getLastRoomList());
if (AppsSettings.get().getLastRoomList().size() > 0)
text_abt_roomlist.setVisibility(View.VISIBLE);
else text_abt_roomlist.setVisibility(View.GONE);
listView.setAdapter(simpleListAdapter); listView.setAdapter(simpleListAdapter);
listView.setOnItemClickListener((a, v, pos, index) -> { listView.setOnItemClickListener((a, v, pos, index) -> {
String name = simpleListAdapter.getItemById(index); String name = simpleListAdapter.getItemById(index);
...@@ -686,7 +691,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie ...@@ -686,7 +691,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
} }
//https://www.jianshu.com/p/99649af3b191 //https://www.jianshu.com/p/99649af3b191
public void showNewbieGuide() { public void showNewbieGuide(String scene) {
HighlightOptions options = new HighlightOptions.Builder()//绘制一个高亮虚线圈 HighlightOptions options = new HighlightOptions.Builder()//绘制一个高亮虚线圈
.setOnHighlightDrewListener(new OnHighlightDrewListener() { .setOnHighlightDrewListener(new OnHighlightDrewListener() {
@Override @Override
...@@ -711,6 +716,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie ...@@ -711,6 +716,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
canvas.drawRect(rectF, paint); canvas.drawRect(rectF, paint);
} }
}).build(); }).build();
if (scene == "homePage") {
NewbieGuide.with(this)//with方法可以传入Activity或者Fragment,获取引导页的依附者 NewbieGuide.with(this)//with方法可以传入Activity或者Fragment,获取引导页的依附者
.setLabel("homepageGuide") .setLabel("homepageGuide")
.addGuidePage( .addGuidePage(
...@@ -770,7 +776,25 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie ...@@ -770,7 +776,25 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
} }
}) })
) )
.alwaysShow(true)//总是显示,调试时可以打开 //.alwaysShow(true)//总是显示,调试时可以打开
.show(); .show();
} else if (scene == "joinRoom") {
NewbieGuide.with(this)
.setLabel("joinRoomGuide")
.addGuidePage(
GuidePage.newInstance().setEverywhereCancelable(true)
.setBackgroundColor(0xbc000000)
.setLayoutRes(R.layout.view_guide_home)
.setOnLayoutInflatedListener(new OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(View view, Controller controller) {
view.findViewById(R.id.view_abt_join_room).setVisibility(View.VISIBLE);
}
})
)
.show();
}
} }
} }
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<!--include layout="@layout/content_toolbar" /-->
<com.tubb.smrv.SwipeMenuRecyclerView <com.tubb.smrv.SwipeMenuRecyclerView
android:id="@+id/list_cards" android:id="@+id/list_cards"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -21,8 +21,9 @@ ...@@ -21,8 +21,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:text="@string/abt_room_list" android:text="@string/guide_abt_room_list"
android:textSize="10sp" /> android:textSize="10sp"
android:visibility="gone"/>
<ListView <ListView
android:id="@+id/room_list" android:id="@+id/room_list"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -205,4 +205,19 @@ ...@@ -205,4 +205,19 @@
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="15sp" /> 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:shadowColor="#000000"
android:shadowDy="2"
android:shadowRadius="2"
android:text="@string/guide_join_room"
android:textColor="@color/white"
android:textSize="15sp"
android:visibility="invisible"/>
</FrameLayout> </FrameLayout>
\ No newline at end of file
...@@ -297,5 +297,10 @@ ...@@ -297,5 +297,10 @@
<string name="guide_help">Help\: specifically guide How to use YGOMobile and learn Master Rules</string> <string name="guide_help">Help\: specifically guide How to use YGOMobile and learn Master Rules</string>
<string name="guide_settings">Settings\: turn on Expansions and DuelAssistant.set game avatars, background, cardback. </string> <string name="guide_settings">Settings\: turn on Expansions and DuelAssistant.set game avatars, background, cardback. </string>
<string name="guide_reset">Reset Resources\: click to reset when pictures or any files are mistaken deleted</string> <string name="guide_reset">Reset Resources\: click to reset when pictures or any files are mistaken deleted</string>
<string name="abt_room_list">Inputted password will be recorded. Lone-Press to delete record(s)</string> <string name="guide_abt_room_list">Inputted password will be recorded. Lone-Press to delete record(s)</string>
<string name="guide_join_room">you can join game without password to start random duel with default mode
\n use specified password and share other players to join same game
\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>
</resources> </resources>
...@@ -297,5 +297,10 @@ ...@@ -297,5 +297,10 @@
<string name="guide_help">教程:包含软件具体使用方法和大师规则学习(划重点)</string> <string name="guide_help">教程:包含软件具体使用方法和大师规则学习(划重点)</string>
<string name="guide_settings">设置:启动决斗助手,使用先行卡(如果有),更改游戏头像,背景,卡背等</string> <string name="guide_settings">设置:启动决斗助手,使用先行卡(如果有),更改游戏头像,背景,卡背等</string>
<string name="guide_reset">重置资源:发现缺图等文件误删情况时点击重置</string> <string name="guide_reset">重置资源:发现缺图等文件误删情况时点击重置</string>
<string name="abt_room_list">输入的密码会被记录;长按某个记录可以删除</string> <string name="guide_abt_room_list">输入的密码会被记录;长按某个记录可以删除</string>
<string name="guide_join_room">不输入密码可加入随机默认模式决斗
\n也可以输入密码进行好友约战
\n更多决斗模式密码请参考软件使用教程</string>
<string name="guide_button_search">点击编辑搜索条件</string>
<string name="guide_search_result_count">这里显示搜索结果卡片数量</string>
</resources> </resources>
...@@ -300,5 +300,10 @@ ...@@ -300,5 +300,10 @@
<string name="guide_help">Help\: specifically guide How to use YGOMobile and learn Master Rules</string> <string name="guide_help">Help\: specifically guide How to use YGOMobile and learn Master Rules</string>
<string name="guide_settings">Settings\: turn on Expansions and DuelAssistant.set game avatars, background, cardback. </string> <string name="guide_settings">Settings\: turn on Expansions and DuelAssistant.set game avatars, background, cardback. </string>
<string name="guide_reset">Reset Resources\: click to reset when pictures or any files are mistaken deleted</string> <string name="guide_reset">Reset Resources\: click to reset when pictures or any files are mistaken deleted</string>
<string name="abt_room_list">Inputted password will be recorded. Lone-Press to delete record(s)</string> <string name="guide_abt_room_list">Inputted password will be recorded. Lone-Press to delete record(s)</string>
<string name="guide_join_room">you can join game without password to start random duel with default mode
\n use specified password and share other players to join same game
\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>
</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