1
0
Fork 0
master
xiaoyu 2021-01-22 10:33:55 +08:00
parent 897a30bb48
commit 57ca7b3d40
2 changed files with 111 additions and 15 deletions

View File

@ -69,6 +69,6 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.finogeeks.lib:finapplet:2.13.38'
implementation 'com.finogeeks.lib:finapplet:2.13.48-alpha20210121V04'
implementation "com.tencent.tbs.tbssdk:sdk:43967"
}

View File

@ -7,6 +7,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import com.finogeeks.lib.applet.page.view.moremenu.MoreMenuItem;
import com.finogeeks.lib.applet.page.view.moremenu.MoreMenuType;
import com.finogeeks.lib.applet.rest.model.GrayAppletVersionConfig;
import com.finogeeks.lib.applet.sdk.api.IAppletHandler;
@ -32,46 +33,141 @@ public class AppletHandler implements IAppletHandler {
this.mContext = context;
}
/**
*
*
* @param appId ID
* @return
*/
@Nullable
@Override
public List<GrayAppletVersionConfig> getGrayAppletVersionConfigs(@NotNull String appId) {
return null;
}
/**
* "更多"
*
* @param appId ID
* @return "更多"
*/
@Nullable
@Override
public List<MoreMenuItem> getRegisteredMoreMenuItems(@NotNull String appId) {
List<MoreMenuItem> moreMenuItems = new ArrayList<>();
moreMenuItems.add(new MoreMenuItem(0x01, android.R.drawable.star_big_on, "菜单一", true));
moreMenuItems.add(new MoreMenuItem(0x02, android.R.drawable.star_big_off, "菜单二", true));
moreMenuItems.add(new MoreMenuItem(0x03, android.R.drawable.star_big_on, "菜单三菜单三菜单三菜单三菜单三", true));
moreMenuItems.add(new MoreMenuItem(0x04, android.R.drawable.star_big_off, "菜单四", true));
moreMenuItems.add(new MoreMenuItem(0x05, android.R.drawable.star_big_on, "菜单五", true));
moreMenuItems.add(new MoreMenuItem(0x06, android.R.drawable.star_big_off, "菜单六", true));
moreMenuItems.add(new MoreMenuItem(0x07, android.R.drawable.star_big_on, "菜单七", true));
moreMenuItems.add(new MoreMenuItem(0x08, android.R.drawable.star_big_off, "菜单八", true));
moreMenuItems.add(new MoreMenuItem(0x09, android.R.drawable.star_big_on, "菜单九", true));
return moreMenuItems;
List<MoreMenuItem> items = new ArrayList<>();
MoreMenuItem item0 = new MoreMenuItem("WXShareAPPFriends", "微信好朋友", MoreMenuType.ON_MINI_PROGRAM);
items.add(item0);
MoreMenuItem item1 = new MoreMenuItem("WXShareAPPMoments", "微信朋友圈", MoreMenuType.ON_MINI_PROGRAM, true);
items.add(item1);
MoreMenuItem item2 = new MoreMenuItem("ShareSinaWeibo", "新浪微博", MoreMenuType.ON_MINI_PROGRAM);
items.add(item2);
MoreMenuItem item3 = new MoreMenuItem("ShareQQFirends", "QQ", MoreMenuType.ON_MINI_PROGRAM);
items.add(item3);
MoreMenuItem item4 = new MoreMenuItem("ShareDingDing", "Dingding", MoreMenuType.ON_MINI_PROGRAM);
items.add(item4);
MoreMenuItem item5 = new MoreMenuItem("ShareLinks", "标题以后端配置为准", MoreMenuType.ON_MINI_PROGRAM);
items.add(item5);
MoreMenuItem item6 = new MoreMenuItem("SharePicture", "SharePicture", MoreMenuType.ON_MINI_PROGRAM);
items.add(item6);
MoreMenuItem item7 = new MoreMenuItem("Restart", "Restart", MoreMenuType.COMMON);
items.add(item7);
MoreMenuItem item8 = new MoreMenuItem("Desktop", "Desktop", MoreMenuType.COMMON);
items.add(item8);
return items;
}
/**
*
*
* @return [Map]
*/
@Nullable
@Override
public Map<String, String> getUserInfo() {
return null;
}
/**
* "关闭"
*
* @param appId ID
*/
@Override
public void onNavigationBarCloseButtonClicked(@NotNull String appId) {
Toast.makeText(mContext, "点击了小程序 " + appId + " 的导航栏关闭按钮", Toast.LENGTH_SHORT).show();
}
/**
* "更多"
*
* @param appId ID
* @param path
* @param menuItemId ID
* @param appInfo jsonidid
* [appInfo]
* {
* "appTitle": "凡泰小程序",
* "appAvatar": "https:\/\/www.finogeeks.club\/statics\/images\/swan_mini\/swan_logo.png",
* "appId": "5df36b3f687c5c00013e9fd1",
* "userId": "finogeeks",
* "params": {
* "title": "apt-test-tweet-接口测试发布的动态!@#¥%……&*",
* "desc": "您身边的服务专家",
* "imageUrl": "finfile:\/\/tmp_fc15edd8-2ff6-4c54-9ee9-fe5ee034033d1576550313667.png",
* "path": "pages\/tweet\/tweet-detail.html?fcid=%40staff_staff1%3A000000.finogeeks.com&timelineId=db0c2098-031e-41c4-b9c6-87a5bbcf681d&shareId=3dfa2f78-19fc-42fc-b3a9-4779a6dac654",
* "appInfo": {
* "weixin": {
* "path": "\/studio\/pages\/tweet\/tweet-detail",
* "query": {
* "fcid": "@staff_staff1:000000.finogeeks.com",
* "timelineId": "db0c2098-031e-41c4-b9c6-87a5bbcf681d"
* }
* }
* }
* }
* }
* @param bitmap [appInfo].params.imageUrlhttphttps
* [appInfo].params.imageUrl[bitmap]
* @param callback
*/
@Override
public void onRegisteredMoreMenuItemClicked(@NotNull String appId, int menuItemId) {
Toast.makeText(mContext, "点击了小程序 " + appId + " 注入的菜单 " + menuItemId, Toast.LENGTH_SHORT).show();
public void onRegisteredMoreMenuItemClicked(@NotNull String appId, @NotNull String path, @NotNull String menuItemId, @Nullable String appInfo, @Nullable Bitmap bitmap, @NotNull IAppletCallback callback) {
Toast.makeText(mContext, "小程序" + appId + "的" + path + "页面的菜单" + menuItemId + "被点击了appInfo : " + appInfo + " bitmap : " + bitmap, Toast.LENGTH_SHORT).show();
callback.onSuccess(null);
}
/**
*
*
* @param appInfo jsonidid
* [appInfo]
* {
* "appTitle": "凡泰小程序",
* "appAvatar": "https:\/\/www.finogeeks.club\/statics\/images\/swan_mini\/swan_logo.png",
* "appId": "5df36b3f687c5c00013e9fd1",
* "userId": "finogeeks",
* "params": {
* "title": "apt-test-tweet-接口测试发布的动态!@#¥%……&*",
* "desc": "您身边的服务专家",
* "imageUrl": "finfile:\/\/tmp_fc15edd8-2ff6-4c54-9ee9-fe5ee034033d1576550313667.png",
* "path": "pages\/tweet\/tweet-detail.html?fcid=%40staff_staff1%3A000000.finogeeks.com&timelineId=db0c2098-031e-41c4-b9c6-87a5bbcf681d&shareId=3dfa2f78-19fc-42fc-b3a9-4779a6dac654",
* "appInfo": {
* "weixin": {
* "path": "\/studio\/pages\/tweet\/tweet-detail",
* "query": {
* "fcid": "@staff_staff1:000000.finogeeks.com",
* "timelineId": "db0c2098-031e-41c4-b9c6-87a5bbcf681d"
* }
* }
* }
* }
* }
* @param bitmap [appInfo].params.imageUrlhttphttps
* [appInfo].params.imageUrl[bitmap]
* @param callback
*/
@Override
public void shareAppMessage(@NotNull String appInfo, @Nullable Bitmap bitmap, @NotNull IAppletCallback iAppletCallback) {
public void shareAppMessage(@NotNull String appInfo, @Nullable Bitmap bitmap, @NotNull IAppletCallback callback) {
Toast.makeText(mContext, "点击了转发按钮,去实现您的转发/分享逻辑吧", Toast.LENGTH_SHORT).show();
}
}