소스 검색

ui tune up

hanjing 6 년 전
부모
커밋
7f5ed78b44

+ 5 - 4
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -1965,12 +1965,13 @@ public class CommonUtil {
      * appId为应用id,开发者可联系后台获取
      * id 用户uid
      */
-    public boolean initMiDong(Activity activity, String id) {
+    public boolean initMiDong(Context activity, String id) {
         if (!SheepApp.getInstance().isInitMidong() && !TextUtils.isEmpty(id)) {
             String appId = "40";
             String cUId = String.valueOf(id);
             String appKey = "ad9a30556666207";
-            AdManager.getInstance(SheepApp.getInstance()).init(activity, appId, cUId, appKey);
+            if(SheepApp.getInstance().getCurrentActivity()!=null)
+            AdManager.getInstance(SheepApp.getInstance()).init(SheepApp.getInstance().getCurrentActivity(), appId, cUId, appKey);
             SheepApp.getInstance().setInitMidong(true);
             return true;
         }
@@ -2313,14 +2314,14 @@ public class CommonUtil {
         clickBanner(activity, item);
     }
 
-    public void clickBanner(Activity activity, SlideshowEty item) {
+    public void clickBanner(Context activity, SlideshowEty item) {
         if (item == null) {
             return;
         }
         clickBanner(activity, item.getId(), item.getType(), item.getExt());
     }
 
-    public void clickBanner(Activity activity, int id, int type, String extString) {
+    public void clickBanner(Context activity, int id, int type, String extString) {
         UMConfigUtils.onEvent(UMConfigUtils.Event.BANNER_CLICK_HORIZONTAL);
         UMConfigUtils.IdEvent.BANNER.commit(id);
         Ext ext;

+ 20 - 14
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -1011,7 +1011,11 @@ public class Jump2View {
      * @param context
      * @param webParams
      */
-    public void goWeb(Context context, WebParams webParams) {
+    public void goWeb(Context context, WebParams webParams){
+        goWeb(context, webParams, false);
+    }
+
+    public void goWeb(Context context, WebParams webParams, boolean needNewTask) {
         String url = webParams.checkShowTitle().getUrl();
         if (TextUtils.isEmpty(url)) {
             G.showToast(R.string.service_data_error);
@@ -1037,6 +1041,9 @@ public class Jump2View {
         }
         Intent intent = new Intent(context, ActWebX5.class);
         intent.putExtra(WebParams.class.getSimpleName(), webParams);
+        if(needNewTask){
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        }
         if (webParams.isForResult()) {
             ((Activity) context).startActivityForResult(intent, webParams.getAction());
         } else {
@@ -1982,7 +1989,7 @@ public class Jump2View {
     /**
      * 游戏代充
      */
-    public void goGameRecharge(Activity activity, Object o) {
+    public void goGameRecharge(Context activity, Object o) {
         if (!Config.IS_OPEN_GAME_RECHARGE) {//关闭游戏直充功能
             G.showToast(R.string.un_use_function);
             return;
@@ -2033,7 +2040,7 @@ public class Jump2View {
     /**
      * 幂动科技
      */
-    public void goMiDong(final Activity activity, Object o) {
+    public void goMiDong(final Context activity, Object o) {
         CommonUtil.getInstance().initMiDong(activity, DataUtil.getInstance().getUserId());
         if (SheepApp.getInstance().isInitMidong()) {
             Intent intent = new Intent(activity, ActMiDong.class);
@@ -2045,9 +2052,9 @@ public class Jump2View {
     /**
      * 小米游戏列表
      */
-    public void goXiaomiGameList(Activity activity, Object o) {
-        Intent intent = new Intent(activity, ActXiaomiGame.class);
-        activity.startActivity(intent);
+    public void goXiaomiGameList(Context context, Object o) {
+        Intent intent = new Intent(context, ActXiaomiGame.class);
+        context.startActivity(intent);
         XIAOMI_GAME_LIST.onEvent();
     }
 
@@ -2193,20 +2200,19 @@ public class Jump2View {
     /**
      * 点击看点
      *
-     * @param activity
      */
-    public void goWatchFocus(Activity activity, RouserArticlesEntity entity) {
+    public void goWatchFocus(Context context, RouserArticlesEntity entity) {
         try {
             String deepLink = entity.getDeeplink().trim();
             Intent intent = Intent.parseUri(deepLink, Intent.URI_INTENT_SCHEME);
             intent.setComponent(null);
-            activity.startActivity(intent);
+            context.startActivity(intent);
         } catch (Exception e) {
             e.printStackTrace();
             if (TestUtil.isTest())
                 G.showToast(e.getMessage());
             else
-                G.showToast(activity.getString(R.string.not_install, entity.getApp_name()));
+                G.showToast(context.getString(R.string.not_install, entity.getApp_name()));
         }
         CommonUtil.getInstance().awakenDetail(entity);
     }
@@ -2216,7 +2222,7 @@ public class Jump2View {
      *
      * @param activity
      */
-    public void goWatchFocus(final Activity activity, int id) {
+    public void goWatchFocus(final Context activity, int id) {
         SheepApp.getInstance().getNetComponent().getApiService().awakenAppArticle(id)
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
@@ -2706,7 +2712,7 @@ public class Jump2View {
      *
      * @param activity
      */
-    public void gotoVip(Activity activity) {
+    public void gotoVip(Context activity) {
         WebParams webParams = new WebParams(Config.getUrlByPath(Config.PATH_BUY_VIP)).setShowTitle(false);
         goWeb(activity, webParams);
     }
@@ -2727,7 +2733,7 @@ public class Jump2View {
      * @param activity
      * @return 原生启动成功返回true
      */
-    public boolean gotoLongMao(Activity activity) {
+    public boolean gotoLongMao(Context activity) {
         if (!PackageUtil.isAppInstalled(SheepApp.getInstance(), Config.LONG_MAO_APP_PACKAGE_NAME)) {
             CommonUtil.getInstance().initUrlConfigByNet(Config.KEY_LMJC_URL, url -> {
                 if (TextUtils.isEmpty(url)) {
@@ -2769,7 +2775,7 @@ public class Jump2View {
      *
      * @param activity
      */
-    public void gotoYfShop(Activity activity) {
+    public void gotoYfShop(Context activity) {
         CommonUtil.getInstance().initUrlConfigByNet(Config.KEY_YF_SHOP_URL, url -> {
             if (TextUtils.isEmpty(url))
                 url = SheepApp.getInstance().getConnectAddress().getYfShotHomeSheep();

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/util/SysAppUtil.java

@@ -96,7 +96,7 @@ import static com.sheep.gamegroup.util.UMConfigUtils.Event.UPGRADE_DIALOG_BT;
 public class SysAppUtil {
 
     private static Dialog dialog;
-    public static void startAlermApp(Activity activity, String msg, int hour, int min){
+    public static void startAlermApp(Context context, String msg, int hour, int min){
         boolean notDone = true;
         if(Build.VERSION.SDK_INT > 18) {
             try {
@@ -114,8 +114,8 @@ public class SysAppUtil {
                 arrayList.add(Calendar.SUNDAY);
                 intent.putExtra(AlarmClock.EXTRA_DAYS, arrayList);
                 intent.putExtra(AlarmClock.EXTRA_VIBRATE, true);
-                if (intent.resolveActivity(activity.getPackageManager()) != null) {
-                    activity.startActivity(intent);
+                if (intent.resolveActivity(context.getPackageManager()) != null) {
+                    context.startActivity(intent);
                     notDone = false;
                 }
             } catch (Exception e) {

+ 20 - 23
app/src/main/java/com/sheep/gamegroup/view/activity/MiddleSchemeAct.java

@@ -57,44 +57,40 @@ public class MiddleSchemeAct extends Activity {
             return;
         switch (action) {
             case Intent.ACTION_VIEW:
-                finish();
                 Uri uri = intent.getData();
                 if (uri != null) {
-                    // 完整的url信息
-//                    if (TestUtil.isTest())
-//                        G.showToast(uri.toString());
-                    LogUtil.println("SheepApp mActivityCount" + SheepApp.getInstance().mActivityCount);
                     if (SheepApp.getInstance().mActivityCount == 0 && !"game_coupon".equals(uri.getQueryParameter("type"))) {
                         ActionUtil.getInstance().addNextAction("scheme", uri);
                         tryGoSplashAct(SheepApp.getInstance(), uri);
                     } else {
-                        parseAndJumpUri(SheepApp.getInstance().getCurrentActivity(), uri);
+                        parseAndJumpUri(SheepApp.getInstance(), uri);
                     }
                 }
+                finish();
                 break;
         }
     }
 
     //解析并跳转
-    public static void parseAndJumpUri(Activity activity, Uri uri) {
+    public static void parseAndJumpUri(Context context, Uri uri) {
         String type = uri.getQueryParameter("type");
         if (type == null) {
 //            尝试获取game_id
             //sheep://small.kfzs.com/xmy?game_id=1385&code=976873
-            tryGoSplashAct(activity, uri);
+            tryGoSplashAct(context, uri);
             return;
         }
         //尝试解密数据
         String json = BaseMessageConverter.decrypt(uri.getQueryParameter("data"));
         switch (type) {
             default://尝试获取game_id
-                tryGoSplashAct(activity, uri);
+                tryGoSplashAct(context, uri);
                 break;
             //sheep://small.kfzs.com/xmy?type=bind_mobile
             //sheep://small.kfzs.com/xmy?type=bm
             case "bm"://跳转绑定手机
             case "bind_mobile"://跳转绑定手机
-                Jump2View.getInstance().goBindPhone(activity, null);
+                Jump2View.getInstance().goBindPhone(context, null);
                 break;
             //sheep://small.kfzs.com/xmy?type=welfare
             //sheep://small.kfzs.com/xmy?type=wfa
@@ -104,17 +100,18 @@ public class MiddleSchemeAct extends Activity {
                 break;
             case "game_coupon":
                 Jump2View.getInstance().goWeb(
-                        activity,
+                        context,
                         new WebParams(
                                 Config.getUrlByPath(Config.PATH_MY_GAME_COUPON, "authorization", json),
-                                "代金券中心"));
+                                "代金券中心"),
+                        true);
                 break;
             //sheep://small.kfzs.com/xmy?type=jhl&data={"Jump":"1"}
             case "jump_home_list"://跳转homeList
             case "jhl":
                 try {
                     HomeListEntity item = JSONObject.parseObject(json, HomeListEntity.class);
-                    CommonUtil.getInstance().goNative(activity, item, "view");
+                    CommonUtil.getInstance().goNative(context, item, "view");
                 } catch (Exception e) {
                     e.printStackTrace();
                     if (TestUtil.isTest() && TextUtils.isEmpty(e.getMessage()))
@@ -126,7 +123,7 @@ public class MiddleSchemeAct extends Activity {
             case "jum":
                 try {
                     UserCenterModule item = JSONObject.parseObject(json, UserCenterModule.class);
-                    CommonUtil.getInstance().goNative(activity, item, "view");
+                    CommonUtil.getInstance().goNative(context, item, "view");
                 } catch (Exception e) {
                     e.printStackTrace();
                     if (TestUtil.isTest() && TextUtils.isEmpty(e.getMessage()))
@@ -145,7 +142,7 @@ public class MiddleSchemeAct extends Activity {
             case "jss":
                 try {
                     SlideshowEty item = JSONObject.parseObject(json, SlideshowEty.class);
-                    CommonUtil.getInstance().clickBanner(activity, item);
+                    CommonUtil.getInstance().clickBanner(context, item);
                 } catch (Exception e) {
                     e.printStackTrace();
                     if (TestUtil.isTest() && TextUtils.isEmpty(e.getMessage()))
@@ -164,13 +161,13 @@ public class MiddleSchemeAct extends Activity {
                 boolean packageNameIsEmpty = TextUtils.isEmpty(packageName);
                 boolean classNameIsEmpty = TextUtils.isEmpty(className);
                 if (packageNameIsEmpty && classNameIsEmpty) {
-                    tryGoSplashAct(activity, uri);
+                    tryGoSplashAct(context, uri);
                 } else if (packageNameIsEmpty) {
-                    runApp(activity, activity.getPackageName(), className);
+                    runApp(context, context.getPackageName(), className);
                 } else if (classNameIsEmpty) {
-                    PackageUtil.startApp(activity, packageName);
+                    PackageUtil.startApp(context, packageName);
                 } else {
-                    runApp(activity, packageName, className);
+                    runApp(context, packageName, className);
                 }
                 break;
             //sheep://small.kfzs.com/xmy?type=po&a=6506346179440152576&b=1
@@ -179,7 +176,7 @@ public class MiddleSchemeAct extends Activity {
                 String order_no = uri.getQueryParameter("a");
                 String merchandise_id = uri.getQueryParameter("b");
                 String url = String.format(Locale.CHINA, "http://%s/#/placing-orders/%s?merchandise_id=%s", TextUtils.equals("sheep", BuildConfig.FLAVOR) ? "smallstation.kfzs.com/iqiyi_vip_member" : "10.8.220.248:8080", order_no, merchandise_id);
-                ViewUtil.showMsgDialog(activity, new DialogConfig().setMsg("你有一个拼单邀请,是否立即前往?")
+                ViewUtil.showMsgDialog(context, new DialogConfig().setMsg("你有一个拼单邀请,是否立即前往?")
                         .setBtnLeftText("取消").setBtnRightText("前往")
                         .setBtnRightOnClickListener(view -> Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), new WebParams(url).setTitle("爱奇艺会员VIP"))));
                 break;
@@ -187,7 +184,7 @@ public class MiddleSchemeAct extends Activity {
             case "startAlermApp":
                 int hour = NumberFormatUtils.parseInteger(uri.getQueryParameter("hour"), 7);
                 int min = NumberFormatUtils.parseInteger(uri.getQueryParameter("min"), 5);
-                SysAppUtil.startAlermApp(activity, activity.getString(R.string.smallsheep_checkin_task), hour, min);
+                SysAppUtil.startAlermApp(context, context.getString(R.string.smallsheep_checkin_task), hour, min);
                 break;
         }
 //                    LogUtil.println("ActMain", "checkScheme","url: " + url);
@@ -216,11 +213,11 @@ public class MiddleSchemeAct extends Activity {
 //                    }
     }
 
-    public static void runApp(Activity activity, String packageName, String className) {
+    public static void runApp(Context context, String packageName, String className) {
         try {
             Intent intent = new Intent();
             intent.setClassName(packageName, className);
-            activity.startActivity(intent);
+            context.startActivity(intent);
         } catch (Exception e) {
             e.printStackTrace();
             if (TestUtil.isTest() && TextUtils.isEmpty(e.getMessage()))

+ 6 - 0
app/src/main/res/layout/include_item_sdk_user.xml

@@ -58,11 +58,17 @@
                 android:id="@+id/item_sdk_nick_name"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
+                android:lines="1"
+                android:maxLength="15"
+                android:ellipsize="end"
                 android:text="账号"
                 android:textColor="#000000"
                 android:textSize="14sp" />
             <TextView
                 android:id="@+id/item_sdk_user_name"
+                android:lines="1"
+                android:maxLength="20"
+                android:ellipsize="end"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="8dp"