9 Commits ef4f2f6e4c ... 2847a82a64

Autore SHA1 Messaggio Data
  ltt 2847a82a64 pass 1 anno fa
  ltt 76b636bada pass 1 anno fa
  ltt fe734b3ca2 Merge branch 'dev-ranklist' 1 anno fa
  xl121 d3b7aaa237 1 1 anno fa
  xl121 3a644554c9 1 1 anno fa
  xl121 27502a7e17 1 1 anno fa
  xl121 a25cdec638 1 1 anno fa
  Huping fcb8bb6e0a 修复创建群组bug 1 anno fa
  Huping 0a6243db55 修复创建群组bug 1 anno fa
27 ha cambiato i file con 1424 aggiunte e 90 eliminazioni
  1. 11 2
      TMessagesProj/src/main/AndroidManifest.xml
  2. 1 1
      TMessagesProj/src/main/java/org/telegram/cricdit/ui/MeActivity.java
  3. 7 4
      TMessagesProj/src/main/java/org/telegram/cricdit/ui/SplashActivity.java
  4. 66 2
      TMessagesProj/src/main/java/org/telegram/messenger/GcmPushListenerService.java
  5. 9 3
      TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
  6. 78 0
      TMessagesProj/src/main/java/org/telegram/onecric/adapter/SubscribeTypeAdapter.java
  7. 10 0
      TMessagesProj/src/main/java/org/telegram/onecric/mvp/bean/CricketMatchBean.java
  8. 43 0
      TMessagesProj/src/main/java/org/telegram/onecric/mvp/bean/SubscribeTypeBean.java
  9. 3 0
      TMessagesProj/src/main/java/org/telegram/onecric/mvp/presenter/CricketDetailPresenter.java
  10. 47 0
      TMessagesProj/src/main/java/org/telegram/onecric/mvp/presenter/SubscribePresenter.java
  11. 10 3
      TMessagesProj/src/main/java/org/telegram/onecric/net/ApiStores.java
  12. 117 8
      TMessagesProj/src/main/java/org/telegram/onecric/ui/activity/CricketDetailActivity.java
  13. 540 0
      TMessagesProj/src/main/java/org/telegram/onecric/ui/activity/NewCricketDetailActivity.java
  14. 93 4
      TMessagesProj/src/main/java/org/telegram/onecric/utils/DialogUtil.java
  15. 71 0
      TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java
  16. 30 24
      TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
  17. 7 0
      TMessagesProj/src/main/res/drawable/shape_c8c8c8_5dp_rec.xml
  18. 7 0
      TMessagesProj/src/main/res/drawable/shape_c_e05526_10dp_rec.xml
  19. 18 5
      TMessagesProj/src/main/res/layout/activity_cricket_detail.xml
  20. 212 0
      TMessagesProj/src/main/res/layout/dialog_select_subscribe.xml
  21. 31 0
      TMessagesProj/src/main/res/layout/subscribe_type_item.xml
  22. BIN
      TMessagesProj/src/main/res/mipmap-xhdpi/subscribe.png
  23. BIN
      TMessagesProj/src/main/res/mipmap-xhdpi/unsubscribe.png
  24. 1 0
      TMessagesProj/src/main/res/values/strings.xml
  25. 10 12
      TMessagesProj/src/main/res/values/styles.xml
  26. 0 20
      TMessagesProj_App/bundleAfat/release/output-metadata.json
  27. 2 2
      gradle.properties

+ 11 - 2
TMessagesProj/src/main/AndroidManifest.xml

@@ -43,8 +43,8 @@
     <uses-permission android:name="android.permission.WAKE_LOCK" />
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.GET_ACCOUNTS" />
-<!--    <uses-permission android:name="android.permission.READ_CONTACTS" />-->
-<!--    <uses-permission android:name="android.permission.WRITE_CONTACTS" />-->
+    <!--    <uses-permission android:name="android.permission.READ_CONTACTS" />-->
+    <!--    <uses-permission android:name="android.permission.WRITE_CONTACTS" />-->
     <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
     <uses-permission android:name="android.permission.READ_PROFILE" />
     <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
@@ -765,6 +765,15 @@
 
         <service android:name="org.telegram.cricdit.service.SyncDataService" />
 
+        <service
+            android:name=".GcmPushListenerService"
+            android:exported="false">
+            <intent-filter>
+                <action android:name="com.google.firebase.MESSAGING_EVENT" />
+            </intent-filter>
+        </service>
+
+
     </application>
 
 </manifest>

+ 1 - 1
TMessagesProj/src/main/java/org/telegram/cricdit/ui/MeActivity.java

@@ -347,7 +347,7 @@ public class MeActivity extends BaseTabActivity<MePresenter> implements MeView {
         });
 
         mCommonAboutUs.setOnClickListener(v -> {
-            presentFragment(new WebviewActivity(Constants.WEB_URL_ABOUT_US + System.currentTimeMillis(), ""));
+            presentFragment(new WebviewActivity(Constants.WEB_URL_ABOUT_US, ""));
         });
 
         view.findViewById(R.id.me_profile_post_container).setOnClickListener(v -> {

+ 7 - 4
TMessagesProj/src/main/java/org/telegram/cricdit/ui/SplashActivity.java

@@ -20,12 +20,15 @@ public class SplashActivity extends Activity {
 
     protected void initView() {
 //        boolean isFirstLaunch = SPUtils.getInstance().get("isFirstLaunch", true);
-//        if (isFirstLaunch) {
+
+        if (getIntent().getExtras() == null) {
             startActivity(new Intent(this, LaunchActivity.class));
             finish();
-//        } else {
-//
-//        }
+        } else {
+            Intent intent = getIntent();
+            intent.setClass(SplashActivity.this, LaunchActivity.class);
+            startActivity(intent);
+        }
 
     }
 }

+ 66 - 2
TMessagesProj/src/main/java/org/telegram/messenger/GcmPushListenerService.java

@@ -8,14 +8,31 @@
 
 package org.telegram.messenger;
 
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.media.RingtoneManager;
+import android.net.Uri;
+import android.os.Build;
+import android.text.TextUtils;
+import android.util.Log;
+
 import androidx.annotation.NonNull;
+import androidx.core.app.NotificationCompat;
 
 import com.google.firebase.messaging.FirebaseMessagingService;
 import com.google.firebase.messaging.RemoteMessage;
 
+import org.telegram.cricdit.utils.GsonHel;
+import org.telegram.cricdit.utils.SPUtils;
+import org.telegram.onecric.ui.activity.CricketDetailActivity;
+
 import java.util.Map;
 
 public class GcmPushListenerService extends FirebaseMessagingService {
+    private static final String TAG = "GcmPushListenerService";
 
     @Override
     public void onMessageReceived(RemoteMessage message) {
@@ -26,12 +43,17 @@ public class GcmPushListenerService extends FirebaseMessagingService {
         if (BuildVars.LOGS_ENABLED) {
             FileLog.d("FCM received data: " + data + " from: " + from);
         }
-        System.out.println("werwqeer 2   " + data.get("p"));
-        PushListenerController.processRemoteMessage(PushListenerController.PUSH_TYPE_FIREBASE, data.get("p"), time);
+//        System.out.println("werwqeer 2   " + data);
+
+        sendNotification(message);
+
+//        PushListenerController.processRemoteMessage(PushListenerController.PUSH_TYPE_FIREBASE, data.get("p"), time);
     }
 
     @Override
     public void onNewToken(@NonNull String token) {
+        Log.d(TAG, "Refreshed token: " + token);
+        SPUtils.getInstance().save("registration_token", token);
         AndroidUtilities.runOnUIThread(() -> {
             if (BuildVars.LOGS_ENABLED) {
                 FileLog.d("Refreshed FCM token: " + token);
@@ -42,4 +64,46 @@ public class GcmPushListenerService extends FirebaseMessagingService {
             System.out.println("werwqeer 1   " + token);
         });
     }
+
+    /**
+     * Create and show a simple notification containing the received FCM message.
+     *
+     * @param messageBody FCM message body received.
+     */
+    private void sendNotification(RemoteMessage remoteMessage) {
+        Intent intent = new Intent();
+        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        Map<String, String> bundle = remoteMessage.getData();
+        if (bundle.size() > 0) {
+            intent.setClass(this, CricketDetailActivity.class);
+            intent.putExtra("matchId", Integer.parseInt(bundle.get("matchId")));
+            intent.putExtra("isNotification", true);
+            PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
+                    PendingIntent.FLAG_IMMUTABLE);
+
+            String channelId = "fcm_default_channel";
+            Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
+            NotificationCompat.Builder notificationBuilder =
+                    new NotificationCompat.Builder(this, channelId)
+                            .setSmallIcon(R.drawable.launcher_icon)
+                            .setContentTitle(remoteMessage.getNotification().getTitle())
+                            .setContentText(remoteMessage.getNotification().getBody())
+                            .setAutoCancel(true)
+                            .setSound(defaultSoundUri)
+                            .setContentIntent(pendingIntent);
+
+            NotificationManager notificationManager =
+                    (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+
+            // Since android Oreo notification channel is needed.
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+                NotificationChannel channel = new NotificationChannel(channelId,
+                        "Channel human readable title",
+                        NotificationManager.IMPORTANCE_DEFAULT);
+                notificationManager.createNotificationChannel(channel);
+            }
+
+            notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
+        }
+    }
 }

+ 9 - 3
TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java

@@ -16387,10 +16387,16 @@ public class MessagesController extends BaseController implements NotificationCe
                 try {
                     String string = response.body().string();
                     if (!TextUtils.isEmpty(string)) {
-                        BaseCrcmaBean baseBean = GsonHel.fromJson(string, BaseCrcmaBean.class);
-                        if (baseBean != null && baseBean.data != null && !TextUtils.isEmpty(baseBean.data.num)) {
-                            ToastUtil.show(ApplicationLoader.applicationContext, LocaleController.getString(R.string.CdCrcma) + baseBean.data.num);
+
+                        if (string.contains("\"data\":\"\"")) {
+
+                        } else {
+                            BaseCrcmaBean baseBean = GsonHel.fromJson(string, BaseCrcmaBean.class);
+                            if (baseBean != null && baseBean.data != null && !TextUtils.isEmpty(baseBean.data.num)) {
+                                ToastUtil.show(ApplicationLoader.applicationContext, LocaleController.getString(R.string.CdCrcma) + baseBean.data.num);
+                            }
                         }
+
                     }
 
                 } catch (IOException e) {

+ 78 - 0
TMessagesProj/src/main/java/org/telegram/onecric/adapter/SubscribeTypeAdapter.java

@@ -0,0 +1,78 @@
+package org.telegram.onecric.adapter;
+
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.Switch;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.BaseViewHolder;
+
+import org.telegram.messenger.R;
+import org.telegram.onecric.mvp.bean.SubscribeTypeBean;
+
+import java.util.List;
+
+/**
+ * 开发公司:东莞市梦幻科技有限公司
+ * 时间:2022/8/27
+ */
+public class SubscribeTypeAdapter extends BaseQuickAdapter<SubscribeTypeBean, BaseViewHolder> {
+    private Switch aSwitch;
+
+    public SubscribeTypeAdapter(Switch aSwitch, int layoutResId, @Nullable List<SubscribeTypeBean> data) {
+        super(layoutResId, data);
+        this.aSwitch = aSwitch;
+    }
+
+    @Override
+    protected void convert(@NonNull BaseViewHolder helper, SubscribeTypeBean item) {
+        TextView tv_name = helper.getView(R.id.tv_name);
+        tv_name.setText(item.getName());
+        CheckBox checkbox = helper.getView(R.id.checkbox);
+        if (aSwitch.isChecked()) {
+            checkbox.setEnabled(true);
+        } else {
+            checkbox.setEnabled(false);
+        }
+        checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (isChecked) {
+                    item.setIs_subscribe(1);
+                } else {
+                    item.setIs_subscribe(0);
+                }
+            }
+        });
+        List<SubscribeTypeBean> list = getData();
+        aSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (!isChecked) {
+                    for (SubscribeTypeBean item : list) {
+                        item.setSelect_subscribe(item.getIs_subscribe());
+                        if (item.getIs_subscribe() == 1) {
+                            item.setIs_subscribe(0);
+                        }
+                    }
+                } else {
+                    for (SubscribeTypeBean item : list) {
+                        if (item.getSelect_subscribe() == 1) {
+                            item.setIs_subscribe(1);
+                        }
+                    }
+                }
+                notifyDataSetChanged();
+            }
+        });
+        if (item.getIs_subscribe() == 1) {
+            checkbox.setChecked(true);
+        } else {
+            checkbox.setChecked(false);
+        }
+    }
+}

+ 10 - 0
TMessagesProj/src/main/java/org/telegram/onecric/mvp/bean/CricketMatchBean.java

@@ -31,6 +31,16 @@ public class CricketMatchBean implements Serializable {
     private String date;
     private String opponent_name;
 
+    public int getIs_subscribe() {
+        return is_subscribe;
+    }
+
+    public void setIs_subscribe(int is_subscribe) {
+        this.is_subscribe = is_subscribe;
+    }
+
+    private int is_subscribe;
+
     public int getId() {
         return id;
     }

+ 43 - 0
TMessagesProj/src/main/java/org/telegram/onecric/mvp/bean/SubscribeTypeBean.java

@@ -0,0 +1,43 @@
+package org.telegram.onecric.mvp.bean;
+
+public class SubscribeTypeBean {
+    private String type;
+
+    private String name;
+
+    private int is_subscribe;
+
+    public int getSelect_subscribe() {
+        return select_subscribe;
+    }
+
+    public void setSelect_subscribe(int select_subscribe) {
+        this.select_subscribe = select_subscribe;
+    }
+
+    private int select_subscribe;
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getType() {
+        return this.type;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setIs_subscribe(int is_subscribe) {
+        this.is_subscribe = is_subscribe;
+    }
+
+    public int getIs_subscribe() {
+        return this.is_subscribe;
+    }
+}

+ 3 - 0
TMessagesProj/src/main/java/org/telegram/onecric/mvp/presenter/CricketDetailPresenter.java

@@ -5,6 +5,7 @@ import android.text.TextUtils;
 import com.alibaba.fastjson.JSONObject;
 
 import org.telegram.cricdit.utils.GsonHel;
+import org.telegram.cricdit.utils.SPUtils;
 import org.telegram.onecric.base.BasePresenter;
 import org.telegram.onecric.mvp.bean.CricketMatchBean;
 import org.telegram.onecric.mvp.bean.UpdatesBean;
@@ -26,6 +27,8 @@ public class CricketDetailPresenter extends BasePresenter<CricketDetailView> {
         TimeZone timeZone = TimeZone.getDefault();
         jsonObject.put("timezone", timeZone.getID());
         jsonObject.put("match_id", matchId);
+        jsonObject.put("app", "cricdit");
+        jsonObject.put("registrationId", SPUtils.getInstance().get("registration_token", ""));
         addSubscription(apiStores.getCricketDetail(getRequestBody(jsonObject)), new ApiCallback() {
             @Override
             public void onSuccess(String data, String msg) {

+ 47 - 0
TMessagesProj/src/main/java/org/telegram/onecric/mvp/presenter/SubscribePresenter.java

@@ -0,0 +1,47 @@
+package org.telegram.onecric.mvp.presenter;
+
+import com.alibaba.fastjson.JSONObject;
+
+
+import org.telegram.cricdit.utils.SPUtils;
+import org.telegram.messenger.UserConfig;
+import org.telegram.onecric.base.BasePresenter;
+import org.telegram.onecric.net.ApiCallback;
+import org.telegram.onecric.net.ApiClient;
+import org.telegram.onecric.net.ApiStores;
+
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.observers.DisposableObserver;
+import io.reactivex.schedulers.Schedulers;
+
+public class SubscribePresenter extends BasePresenter {
+
+    public void doSubscribe(String mid, String type, DisposableObserver observer) {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("mid", mid);
+        jsonObject.put("type", type);
+        jsonObject.put("app", "cricdit");
+        jsonObject.put("registrationId", SPUtils.getInstance().get("registration_token", ""));
+//        if (UserConfig.getInstance(UserConfig.selectedAccount).isClientActivated()) {
+//            jsonObject.put("user_id", UserConfig.getInstance(UserConfig.selectedAccount).getCurrentUser().id + "");
+//        }
+        ApiClient.retrofit().create(ApiStores.class)
+                .doSubscribe(getRequestBody(jsonObject))
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribeWith(observer);
+//        addSubscription(apiStores.doSubscribe(getRequestBody(jsonObject)), observer);
+    }
+
+    public void getSubscribeType(int mid, DisposableObserver observer) {
+        ApiClient.retrofit().create(ApiStores.class)
+                .getSubscribeType(mid)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribeWith(observer);
+//        JSONObject jsonObject = new JSONObject();
+//        jsonObject.put("mid", mid);
+//        addSubscription(apiStores.getSubscribeType(getRequestBody(jsonObject)), observer);
+    }
+
+}

+ 10 - 3
TMessagesProj/src/main/java/org/telegram/onecric/net/ApiStores.java

@@ -689,12 +689,12 @@ public interface ApiStores {
     //获取篮球赛事列表
     @GET("api/Basketball_database/tournamentList")
     Observable<JsonObject> getBasketBallMatchDataList(@Query("country_id") int country_id,
-                                            @Query("category_id") int category_id);
+                                                      @Query("category_id") int category_id);
 
     //获取篮球赛事列表
     @GET("api/Football_database/tournamentList")
     Observable<JsonObject> getFootBallMatchDataList(@Query("country_id") int country_id,
-                                            @Query("category_id") int category_id);
+                                                    @Query("category_id") int category_id);
 
     //获取篮球赛事详情
     @GET("api/Basketball_database/competitionInfo")
@@ -831,6 +831,14 @@ public interface ApiStores {
     @POST("api/Cricket/cricket_match_detail_scorecard")
     Observable<JsonObject> getMatchScorecard(@Body RequestBody body);
 
+    //订阅赛事消息推送   todo 完成
+    @POST("api/Cricket/subscribe_add")
+    Observable<JsonObject> doSubscribe(@Body RequestBody body);
+
+    //获取订阅推送消息的类型
+    @GET("api/Cricket/subscribe_type")
+    Observable<JsonObject> getSubscribeType(@Query("mid") int mid);
+
     //获取新赛事列表 3.15
     @GET("api/Cricketnew/cricket_match_day")
     Observable<JsonObject> getCricketDayMatchList(@Query("timezone") String timezone,
@@ -843,5 +851,4 @@ public interface ApiStores {
     @GET("api/Cricketnew/get_search")
     Observable<JsonObject> searchMatchNew(@Query("timezone") String timezone,@Query("content") String content,@Query("type")String type,@Query("page")int page);
 
-
 }

+ 117 - 8
TMessagesProj/src/main/java/org/telegram/onecric/ui/activity/CricketDetailActivity.java

@@ -19,26 +19,35 @@ import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentPagerAdapter;
 import androidx.viewpager.widget.ViewPager;
 
+import com.alibaba.fastjson.JSONObject;
 import com.google.android.material.tabs.TabLayout;
 import com.lxj.xpopup.XPopup;
 
 import org.telegram.cricdit.utils.ToastUtil;
 import org.telegram.cricdit.view.popup.ReportBottomPopup;
 import org.telegram.messenger.R;
+import org.telegram.messenger.UserConfig;
 import org.telegram.onecric.base.MvpActivity;
 import org.telegram.onecric.config.HttpConstant;
 import org.telegram.onecric.mvp.bean.CricketMatchBean;
+import org.telegram.onecric.mvp.bean.SubscribeTypeBean;
 import org.telegram.onecric.mvp.bean.UpdatesBean;
 import org.telegram.onecric.mvp.presenter.CricketDetailPresenter;
+import org.telegram.onecric.mvp.presenter.SubscribePresenter;
 import org.telegram.onecric.mvp.view.CricketDetailView;
+import org.telegram.onecric.net.ApiCallback;
 import org.telegram.onecric.ui.fragment.CricketFantasyFragment;
 import org.telegram.onecric.ui.fragment.CricketInfoFragment;
 import org.telegram.onecric.ui.fragment.CricketLiveFragment;
 import org.telegram.onecric.ui.fragment.CricketScorecardFragment;
 import org.telegram.onecric.ui.fragment.CricketSquadFragment;
 import org.telegram.onecric.ui.fragment.CricketUpdatesFragment;
+import org.telegram.onecric.utils.DialogUtil;
 import org.telegram.onecric.utils.GlideUtil;
 import org.telegram.onecric.utils.ShareUtil;
+import org.telegram.ui.ActionBar.BaseFragment;
+import org.telegram.ui.LaunchActivity;
+import org.telegram.ui.LoginActivity;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -49,6 +58,9 @@ import java.util.List;
  */
 public class CricketDetailActivity extends MvpActivity<CricketDetailPresenter> implements CricketDetailView, View.OnClickListener {
 
+    private boolean isNotification;
+    private ImageView subscribeIv;
+
 
     public static void forward(Context context, int matchId) {
         Intent intent = new Intent(context, CricketDetailActivity.class);
@@ -114,6 +126,7 @@ public class CricketDetailActivity extends MvpActivity<CricketDetailPresenter> i
     @Override
     protected void initView() {
         mMatchId = getIntent().getIntExtra("matchId", 0);
+        isNotification = getIntent().getBooleanExtra("isNotification", false);
         actionType = getIntent().getIntExtra("actionType",0);
         ll_content = findViewById(R.id.ll_content);
         cl_one = findViewById(R.id.cl_one);
@@ -139,21 +152,22 @@ public class CricketDetailActivity extends MvpActivity<CricketDetailPresenter> i
         mFlWebview2 = findViewById(R.id.fl_webview2);
         mWvAnimation = findViewById(R.id.wv_animation);
         mWvVideo = findViewById(R.id.wv_video);
+        subscribeIv = findViewById(R.id.iv_subscribe);
 
         findViewById(R.id.tv_animation).setOnClickListener(this);
         findViewById(R.id.tv_video).setOnClickListener(this);
         findViewById(R.id.iv_back_three).setOnClickListener(this);
         findViewById(R.id.iv_back_four).setOnClickListener(this);
 
-        ((ImageView)findViewById(R.id.iv_right)).setBackgroundResource(R.mipmap.icon_share2);
-        ((ImageView)findViewById(R.id.iv_right)).setOnClickListener(new View.OnClickListener() {
+        ((ImageView) findViewById(R.id.iv_right)).setBackgroundResource(R.mipmap.icon_share2);
+        ((ImageView) findViewById(R.id.iv_right)).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 ShareUtil.shareText(mActivity, "", HttpConstant.CRICKET_DETAIL_URL + mMatchId);
             }
         });
 
-        ((ImageView)findViewById(R.id.inner_report)).setOnClickListener(new View.OnClickListener() {
+        ((ImageView) findViewById(R.id.inner_report)).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 new XPopup.Builder(CricketDetailActivity.this)
@@ -191,6 +205,9 @@ public class CricketDetailActivity extends MvpActivity<CricketDetailPresenter> i
         initViewPager();
         mvpPresenter.getDetail(mMatchId);
         mvpPresenter.getUpdatesDetail(mMatchId);
+        if (isNotification) {
+            mViewPager.setCurrentItem(2);
+        }
     }
 
     private void initViewPager() {
@@ -258,11 +275,11 @@ public class CricketDetailActivity extends MvpActivity<CricketDetailPresenter> i
 
             ((CricketFantasyFragment)mViewList.get(0)).getData(mMatchId, model.getHome_name(), model.getHome_logo(), model.getAway_name(), model.getAway_logo());
             if (!TextUtils.isEmpty(model.getTournament_id())) {
-                ((CricketInfoFragment)mViewList.get(1)).getList(model.getHome_id(), model.getAway_id(), Integer.valueOf(model.getTournament_id()));
+                ((CricketInfoFragment) mViewList.get(1)).getList(model.getHome_id(), model.getAway_id(), Integer.valueOf(model.getTournament_id()));
             }
             //TODO 暂时屏蔽
 //            ((CricketSquadFragment)mViewList.get(5)).getList(mMatchId, model.getHome_name(), model.getHome_logo(), model.getAway_name(), model.getAway_logo());
-            ((CricketSquadFragment)mViewList.get(4)).getList(mMatchId, model.getHome_name(), model.getHome_logo(), model.getAway_name(), model.getAway_logo());
+            ((CricketSquadFragment) mViewList.get(4)).getList(mMatchId, model.getHome_name(), model.getHome_logo(), model.getAway_name(), model.getAway_logo());
 
             if (model.getStatus() == 0) {
                 cl_one.setVisibility(View.GONE);
@@ -293,7 +310,7 @@ public class CricketDetailActivity extends MvpActivity<CricketDetailPresenter> i
                     str = str + model.getVenue_name();
                 }
                 tv_desc_two.setText(str);
-            }else {
+            } else {
                 cl_one.setVisibility(View.VISIBLE);
                 cl_two.setVisibility(View.GONE);
                 if (!TextUtils.isEmpty(model.getHome_name())) {
@@ -320,12 +337,41 @@ public class CricketDetailActivity extends MvpActivity<CricketDetailPresenter> i
                     tv_desc.setText(model.getMatch_result());
                 }
             }
+            if (model.getStatus() == 2) {
+                subscribeIv.setVisibility(View.GONE);
+            } else {
+                subscribeIv.setVisibility(View.VISIBLE);// TODO: 2023/2/15  这里在订阅接口调试好后要放开为visible
+                if (model.getIs_subscribe() == 1) {//已经订阅过了
+                    subscribeIv.setImageResource(R.mipmap.subscribe);
+                } else {
+                    subscribeIv.setImageResource(R.mipmap.unsubscribe);
+                }
+                subscribeIv.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+//                        if (!UserConfig.getInstance(UserConfig.selectedAccount).isClientActivated()) {
+//                            ToastUtil.show(CricketDetailActivity.this, getString(R.string.please_login));
+//                            // TODO: 2023/3/16  需要跳转到登陆界面
+////                            return;
+//                        }
+                        getSubscribeType(model, subscribeIv);
+                        // TODO: 2023/2/14  订阅消息推送
+//                    //这里先弹出一个订阅消息的内容选择框  待选择好后点击确定订阅按钮再调用订阅接口
+//                    DialogUtil.showSelectSubscribeDialog(mContext, item.getHome_name() + " VS " + item.getAway_name(), new DialogUtil.SelectSubscribeBack() {
+//                        @Override
+//                        public void onSelectSubscribe(String type) {
+//                            doSubscribe(item.getMatch_id() + "", , subscribeIv);
+//                        }
+//                    });
+                    }
+                });
+            }
             //初始化动画直播地址
             initWebViewOne(mModel.getLive_path());
             //初始化视频直播地址
 //            initWebViewTwo(mModel.getLive_url());
             //请求记分卡数据
-            ((CricketScorecardFragment)mViewList.get(3)).getData(mModel);
+            ((CricketScorecardFragment) mViewList.get(3)).getData(mModel);
         }
     }
 
@@ -401,7 +447,7 @@ public class CricketDetailActivity extends MvpActivity<CricketDetailPresenter> i
 
     @Override
     public void getDataFail(String msg) {
-        ToastUtil.show(mActivity,msg);
+        ToastUtil.show(mActivity, msg);
         finish();
     }
 
@@ -437,4 +483,67 @@ public class CricketDetailActivity extends MvpActivity<CricketDetailPresenter> i
             mWvVideo.destroy();
         }
     }
+
+    private void doSubscribe(String matchId, String type, ImageView subscribeIv) {//订阅推送消息
+        new SubscribePresenter().doSubscribe(matchId, type, new ApiCallback() {
+            @Override
+            public void onSuccess(String data, String msg) {
+                if (!TextUtils.isEmpty(type)) {
+                    subscribeIv.setImageResource(R.mipmap.subscribe);
+                } else {
+                    subscribeIv.setImageResource(R.mipmap.unsubscribe);
+                }
+            }
+
+            @Override
+            public void onFailure(String msg) {
+                ToastUtil.show(CricketDetailActivity.this, msg);
+            }
+
+            @Override
+            public void onError(String msg) {
+                ToastUtil.show(CricketDetailActivity.this, msg);
+            }
+
+            @Override
+            public void onFinish() {
+
+            }
+        });
+    }
+
+    private void getSubscribeType(CricketMatchBean item, ImageView subscribeIv) {//订阅推送消息
+        showLoadingDialog();
+        new SubscribePresenter().getSubscribeType(item.getId(), new ApiCallback() {
+            @Override
+            public void onSuccess(String data, String msg) {
+                dismissLoadingDialog();
+                if (data != null) {
+                    List<SubscribeTypeBean> list = JSONObject.parseArray(JSONObject.parseObject(data).getString("list"), SubscribeTypeBean.class);
+                    //这里先弹出一个订阅消息的内容选择框  待选择好后点击确定订阅按钮再调用订阅接口
+                    DialogUtil.showSelectSubscribeDialog(CricketDetailActivity.this, item.getHome_name() + " VS " + item.getAway_name(), list, new DialogUtil.SelectSubscribeBack() {
+                        @Override
+                        public void onSelectSubscribe(String type) {
+                            doSubscribe(item.getId() + "", type, subscribeIv);
+                        }
+                    });
+                }
+            }
+
+            @Override
+            public void onFailure(String msg) {
+                dismissLoadingDialog();
+            }
+
+            @Override
+            public void onError(String msg) {
+                dismissLoadingDialog();
+            }
+
+            @Override
+            public void onFinish() {
+                dismissLoadingDialog();
+            }
+        });
+    }
 }

+ 540 - 0
TMessagesProj/src/main/java/org/telegram/onecric/ui/activity/NewCricketDetailActivity.java

@@ -0,0 +1,540 @@
+//package org.telegram.onecric.ui.activity;
+//
+//import android.content.Context;
+//import android.content.Intent;
+//import android.text.SpannableStringBuilder;
+//import android.text.Spanned;
+//import android.text.TextUtils;
+//import android.text.style.ForegroundColorSpan;
+//import android.view.View;
+//import android.view.ViewGroup;
+//import android.webkit.WebSettings;
+//import android.webkit.WebView;
+//import android.widget.FrameLayout;
+//import android.widget.ImageView;
+//import android.widget.LinearLayout;
+//import android.widget.TextView;
+//
+//import androidx.fragment.app.Fragment;
+//import androidx.fragment.app.FragmentPagerAdapter;
+//import androidx.viewpager.widget.ViewPager;
+//
+//import com.alibaba.fastjson.JSONObject;
+//import com.google.android.material.tabs.TabLayout;
+//import com.lxj.xpopup.XPopup;
+//
+//import org.telegram.cricdit.base.BaseTabActivity;
+//import org.telegram.cricdit.utils.ToastUtil;
+//import org.telegram.cricdit.view.popup.ReportBottomPopup;
+//import org.telegram.messenger.R;
+//import org.telegram.messenger.UserConfig;
+//import org.telegram.onecric.config.HttpConstant;
+//import org.telegram.onecric.mvp.bean.CricketMatchBean;
+//import org.telegram.onecric.mvp.bean.SubscribeTypeBean;
+//import org.telegram.onecric.mvp.bean.UpdatesBean;
+//import org.telegram.onecric.mvp.presenter.CricketDetailPresenter;
+//import org.telegram.onecric.mvp.presenter.SubscribePresenter;
+//import org.telegram.onecric.mvp.view.CricketDetailView;
+//import org.telegram.onecric.net.ApiCallback;
+//import org.telegram.onecric.ui.fragment.CricketFantasyFragment;
+//import org.telegram.onecric.ui.fragment.CricketInfoFragment;
+//import org.telegram.onecric.ui.fragment.CricketLiveFragment;
+//import org.telegram.onecric.ui.fragment.CricketScorecardFragment;
+//import org.telegram.onecric.ui.fragment.CricketSquadFragment;
+//import org.telegram.onecric.utils.DialogUtil;
+//import org.telegram.onecric.utils.GlideUtil;
+//import org.telegram.onecric.utils.ShareUtil;
+//
+//import java.util.ArrayList;
+//import java.util.List;
+//
+///**
+// * 开发公司:东莞市梦幻科技有限公司
+// * 时间:2022/8/27
+// */
+//public class NewCricketDetailActivity extends BaseTabActivity<CricketDetailPresenter> implements CricketDetailView, View.OnClickListener {
+//
+//    private boolean isNotification;
+//    private ImageView subscribeIv;
+//
+//
+//    public static void forward(Context context, int matchId) {
+//        Intent intent = new Intent(context, NewCricketDetailActivity.class);
+//        intent.putExtra("matchId", matchId);
+//        context.startActivity(intent);
+//    }
+//
+//    private int mMatchId;
+//    private FrameLayout mFlWebview1;
+//    private WebView mWvAnimation;
+//    private FrameLayout mFlWebview2;
+//    private WebView mWvVideo;
+//    private LinearLayout ll_content;
+//    //已开始
+//    private ViewGroup cl_one;
+//    private TextView tv_home_name;
+//    private ImageView iv_home_logo;
+//    private TextView tv_home_score;
+//    private TextView tv_home_round;
+//    private TextView tv_away_name;
+//    private ImageView iv_away_logo;
+//    private TextView tv_away_score;
+//    private TextView tv_away_round;
+//    private TextView tv_desc;
+//    //未开始
+//    private ViewGroup cl_two;
+//    private TextView tv_home_name_two;
+//    private ImageView iv_home_logo_two;
+//    private TextView tv_center;
+//    private ImageView iv_away_logo_two;
+//    private TextView tv_away_name_two;
+//    private TextView tv_desc_two;
+//    private TabLayout tabLayout;
+//    public ViewPager mViewPager;
+//    private List<Fragment> mViewList;
+//
+//    private CricketMatchBean mModel;
+//
+////    @Override
+////    public boolean getStatusBarTextColor() {
+////        return true;
+////    }
+//
+//    @Override
+//    protected int getLayoutResId() {
+//        return R.layout.activity_cricket_detail;
+//    }
+//
+//    @Override
+//    public String setActionBarTitle() {
+//        return null;
+//    }
+//
+//    @Override
+//    protected CricketDetailPresenter createPresenter() {
+//        return new CricketDetailPresenter(this);
+//    }
+//
+//    @Override
+//    protected void initView(View view) {
+//        mMatchId = getIntent().getIntExtra("matchId", 0);
+//        isNotification = getIntent().getBooleanExtra("isNotification", false);
+//        ll_content = view.findViewById(R.id.ll_content);
+//        cl_one = view.findViewById(R.id.cl_one);
+//        tv_home_name = view.findViewById(R.id.tv_home_name);
+//        iv_home_logo = view.findViewById(R.id.iv_home_logo);
+//        tv_home_score = view.findViewById(R.id.tv_home_score);
+//        tv_home_round = view.findViewById(R.id.tv_home_round);
+//        tv_away_name = view.findViewById(R.id.tv_away_name);
+//        iv_away_logo = view.findViewById(R.id.iv_away_logo);
+//        tv_away_score = view.findViewById(R.id.tv_away_score);
+//        tv_away_round = view.findViewById(R.id.tv_away_round);
+//        tv_desc = view.findViewById(R.id.tv_desc);
+//        cl_two = view.findViewById(R.id.cl_two);
+//        tv_home_name_two = view.findViewById(R.id.tv_home_name_two);
+//        iv_home_logo_two = view.findViewById(R.id.iv_home_logo_two);
+//        tv_center = view.findViewById(R.id.tv_center);
+//        iv_away_logo_two = view.findViewById(R.id.iv_away_logo_two);
+//        tv_away_name_two = view.findViewById(R.id.tv_away_name_two);
+//        tv_desc_two = view.findViewById(R.id.tv_desc_two);
+//        tabLayout = view.findViewById(R.id.tab_layout);
+//        mViewPager = view.findViewById(R.id.view_pager);
+//        mFlWebview1 = view.findViewById(R.id.fl_webview1);
+//        mFlWebview2 = view.findViewById(R.id.fl_webview2);
+//        mWvAnimation = view.findViewById(R.id.wv_animation);
+//        mWvVideo = view.findViewById(R.id.wv_video);
+//        subscribeIv = view.findViewById(R.id.iv_subscribe);
+//
+//        view.findViewById(R.id.tv_animation).setOnClickListener(this);
+//        view.findViewById(R.id.tv_video).setOnClickListener(this);
+//        view.findViewById(R.id.iv_back_three).setOnClickListener(this);
+//        view.findViewById(R.id.iv_back_four).setOnClickListener(this);
+//
+//        ((ImageView) view.findViewById(R.id.iv_right)).setBackgroundResource(R.mipmap.icon_share2);
+//        ((ImageView) view.findViewById(R.id.iv_right)).setOnClickListener(new View.OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                ShareUtil.shareText(getContext(), "", HttpConstant.CRICKET_DETAIL_URL + mMatchId);
+//            }
+//        });
+//
+//        ((ImageView) view.findViewById(R.id.inner_report)).setOnClickListener(new View.OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                new XPopup.Builder(getContext())
+//                        .moveUpToKeyboard(false) //如果不加这个,评论弹窗会移动到软键盘上面
+//                        .enableDrag(true)
+//                        .isDestroyOnDismiss(true) //对于只使用一次的弹窗,推荐设置这个
+//                        .asCustom(new ReportBottomPopup(getContext()))
+//                        .show();
+//            }
+//        });
+//
+//        initData();
+//
+//    }
+//
+//    protected void initData() {
+//        tabLayout.addTab(tabLayout.newTab().setText(getContext().getString(R.string.fantasy)));
+//        tabLayout.addTab(tabLayout.newTab().setText(getContext().getString(R.string.info)));
+//        tabLayout.addTab(tabLayout.newTab().setText(getContext().getString(R.string.live)));
+//        tabLayout.addTab(tabLayout.newTab().setText(getContext().getString(R.string.scorecard)));
+////        tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.highlights)));
+//        //TODO 暂时屏蔽
+////        tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.updates)));
+//        tabLayout.addTab(tabLayout.newTab().setText(getContext().getString(R.string.squad)));
+//
+//        mViewList = new ArrayList<>();
+//        mViewList.add(CricketFantasyFragment.newInstance());
+//        mViewList.add(CricketInfoFragment.newInstance(mMatchId));
+//        mViewList.add(CricketLiveFragment.newInstance(mMatchId));
+//        mViewList.add(CricketScorecardFragment.newInstance());
+////        mViewList.add(CricketFantasyFragment.newInstance());
+//        //TODO 暂时屏蔽
+////        mViewList.add(CricketUpdatesFragment.newInstance());
+//        mViewList.add(CricketSquadFragment.newInstance());
+//
+//        initViewPager();
+//        mvpPresenter.getDetail(mMatchId);
+//        mvpPresenter.getUpdatesDetail(mMatchId);
+//        if (isNotification) {
+//            mViewPager.setCurrentItem(2);
+//        }
+//    }
+//
+//    private void initViewPager() {
+//        tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
+//            @Override
+//            public void onTabSelected(TabLayout.Tab tab) {
+//                mViewPager.setCurrentItem(tab.getPosition());
+//            }
+//
+//            @Override
+//            public void onTabUnselected(TabLayout.Tab tab) {
+//
+//            }
+//
+//            @Override
+//            public void onTabReselected(TabLayout.Tab tab) {
+//
+//            }
+//        });
+//        //初始化viewpager
+//        mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
+//            @Override
+//            public void onPageScrolled(int i, float v, int i1) {
+//
+//            }
+//
+//            @Override
+//            public void onPageSelected(int i) {
+//                tabLayout.getTabAt(i).select();
+//            }
+//
+//            @Override
+//            public void onPageScrollStateChanged(int i) {
+//
+//            }
+//        });
+//        mViewPager.setOffscreenPageLimit(mViewList.size());
+//        mViewPager.setAdapter(new FragmentPagerAdapter() {
+//            @Override
+//            public Fragment getItem(int i) {
+//                return mViewList.get(i);
+//            }
+//
+//            @Override
+//            public int getCount() {
+//                return mViewList.size();
+//            }
+//        });
+//    }
+//
+//    @Override
+//    public void showLoading() {
+//
+//    }
+//
+//    @Override
+//    public void hideLoading() {
+//
+//    }
+//
+//    @Override
+//    public void getDataSuccess(CricketMatchBean model) {
+//        if (model != null) {
+//            mModel = model;
+//            ((CricketFantasyFragment) mViewList.get(0)).getData(mMatchId, model.getHome_name(), model.getHome_logo(), model.getAway_name(), model.getAway_logo());
+//            if (!TextUtils.isEmpty(model.getTournament_id())) {
+//                ((CricketInfoFragment) mViewList.get(1)).getList(model.getHome_id(), model.getAway_id(), Integer.valueOf(model.getTournament_id()));
+//            }
+//            //TODO 暂时屏蔽
+////            ((CricketSquadFragment)mViewList.get(5)).getList(mMatchId, model.getHome_name(), model.getHome_logo(), model.getAway_name(), model.getAway_logo());
+//            ((CricketSquadFragment) mViewList.get(4)).getList(mMatchId, model.getHome_name(), model.getHome_logo(), model.getAway_name(), model.getAway_logo());
+//
+//            if (model.getStatus() == 0) {
+//                cl_one.setVisibility(View.GONE);
+//                cl_two.setVisibility(View.VISIBLE);
+//                if (!TextUtils.isEmpty(model.getHome_name())) {
+//                    tv_home_name_two.setText(model.getHome_name());
+//                }
+//                GlideUtil.loadTeamImageDefault(getContext(), model.getHome_logo(), iv_home_logo_two);
+//
+//                if (!TextUtils.isEmpty(model.getAway_name())) {
+//                    tv_away_name_two.setText(model.getAway_name());
+//                }
+//                GlideUtil.loadTeamImageDefault(getContext(), model.getAway_logo(), iv_away_logo_two);
+//                String strOne = getContext().getString(R.string.match_starts_in);
+//                if (!TextUtils.isEmpty(model.getLive_time())) {
+//                    String strTwo = model.getLive_time();
+//                    SpannableStringBuilder builder = new SpannableStringBuilder(strOne + strTwo);
+//                    builder.setSpan(new ForegroundColorSpan(getContext().getResources().getColor(R.color.c_DC3C23)), strOne.length(), (strOne.length() + strTwo.length()), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
+//                    tv_center.setText(builder);
+//                } else {
+//                    tv_center.setText(strOne);
+//                }
+//                String str = "";
+//                if (!TextUtils.isEmpty(model.getMatch_result())) {
+//                    str = model.getMatch_result() + "\n";
+//                }
+//                if (!TextUtils.isEmpty(model.getVenue_name())) {
+//                    str = str + model.getVenue_name();
+//                }
+//                tv_desc_two.setText(str);
+//            } else {
+//                cl_one.setVisibility(View.VISIBLE);
+//                cl_two.setVisibility(View.GONE);
+//                if (!TextUtils.isEmpty(model.getHome_name())) {
+//                    tv_home_name.setText(model.getHome_name());
+//                }
+//                GlideUtil.loadTeamImageDefault(this, model.getHome_logo(), iv_home_logo);
+//                if (!TextUtils.isEmpty(model.getHome_display_score())) {
+//                    tv_home_score.setText(model.getHome_display_score());
+//                }
+//                if (!TextUtils.isEmpty(model.getHome_display_overs())) {
+//                    tv_home_round.setText("(" + model.getHome_display_overs() + ")");
+//                }
+//                if (!TextUtils.isEmpty(model.getAway_name())) {
+//                    tv_away_name.setText(model.getAway_name());
+//                }
+//                GlideUtil.loadTeamImageDefault(this, model.getAway_logo(), iv_away_logo);
+//                if (!TextUtils.isEmpty(model.getAway_display_score())) {
+//                    tv_away_score.setText(model.getAway_display_score());
+//                }
+//                if (!TextUtils.isEmpty(model.getAway_display_overs())) {
+//                    tv_away_round.setText("(" + model.getAway_display_overs() + ")");
+//                }
+//                if (!TextUtils.isEmpty(model.getMatch_result())) {
+//                    tv_desc.setText(model.getMatch_result());
+//                }
+//            }
+//            if (model.getStatus() == 2) {
+//                subscribeIv.setVisibility(View.GONE);
+//            } else {
+//                subscribeIv.setVisibility(View.VISIBLE);// TODO: 2023/2/15  这里在订阅接口调试好后要放开为visible
+//                if (model.getIs_subscribe() == 1) {//已经订阅过了
+//                    subscribeIv.setImageResource(R.mipmap.subscribe);
+//                } else {
+//                    subscribeIv.setImageResource(R.mipmap.unsubscribe);
+//                }
+//                subscribeIv.setOnClickListener(new View.OnClickListener() {
+//                    @Override
+//                    public void onClick(View v) {
+//                        if (!UserConfig.getInstance(UserConfig.selectedAccount).isClientActivated()) {
+//                            ToastUtil.show(NewCricketDetailActivity.this, getString(R.string.please_login));
+//                            // TODO: 2023/3/16  需要跳转到登陆界面
+////                            return;
+//                        }
+//                        getSubscribeType(model, subscribeIv);
+//                        // TODO: 2023/2/14  订阅消息推送
+////                    //这里先弹出一个订阅消息的内容选择框  待选择好后点击确定订阅按钮再调用订阅接口
+////                    DialogUtil.showSelectSubscribeDialog(mContext, item.getHome_name() + " VS " + item.getAway_name(), new DialogUtil.SelectSubscribeBack() {
+////                        @Override
+////                        public void onSelectSubscribe(String type) {
+////                            doSubscribe(item.getMatch_id() + "", , subscribeIv);
+////                        }
+////                    });
+//                    }
+//                });
+//            }
+//            //初始化动画直播地址
+//            initWebViewOne(mModel.getLive_path());
+//            //初始化视频直播地址
+////            initWebViewTwo(mModel.getLive_url());
+//            //请求记分卡数据
+//            ((CricketScorecardFragment) mViewList.get(3)).getData(mModel);
+//        }
+//    }
+//
+//    @Override
+//    public void getUpdatesDataSuccess(List<UpdatesBean> list) {
+//        //TODO 暂时屏蔽
+////        ((CricketUpdatesFragment)mViewList.get(4)).setData(list);
+//    }
+//
+//    private void initWebViewOne(String url) {
+//        if (TextUtils.isEmpty(url)) {
+//            return;
+//        }
+//        /* 设置支持Js */
+//        mWvAnimation.getSettings().setJavaScriptEnabled(true);
+//        /* 设置为true表示支持使用js打开新的窗口 */
+//        mWvAnimation.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
+//
+//        /* 设置缓存模式 */
+//        mWvAnimation.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
+//        mWvAnimation.getSettings().setDomStorageEnabled(true);
+//
+//        /* 设置为使用webview推荐的窗口 */
+////        mWebView.getSettings().setUseWideViewPort(true);
+//        /* 设置为使用屏幕自适配 */
+//        mWvAnimation.getSettings().setLoadWithOverviewMode(true);
+//        /* 设置是否允许webview使用缩放的功能,我这里设为false,不允许 */
+//        mWvAnimation.getSettings().setBuiltInZoomControls(false);
+//        /* 提高网页渲染的优先级 */
+//        mWvAnimation.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
+//
+//        /* HTML5的地理位置服务,设置为true,启用地理定位 */
+//        mWvAnimation.getSettings().setGeolocationEnabled(true);
+//        /* 设置可以访问文件 */
+//        mWvAnimation.getSettings().setAllowFileAccess(true);
+//
+//        // 设置UserAgent标识
+////        mWebView.getSettings().setUserAgentString(mWebView.getSettings().getUserAgentString() + " app-shikuimapp");
+//        mWvAnimation.loadUrl(url);
+//    }
+//
+//    private void initWebViewTwo(String url) {
+//        if (TextUtils.isEmpty(url)) {
+//            return;
+//        }
+//        /* 设置支持Js */
+//        mWvVideo.getSettings().setJavaScriptEnabled(true);
+//        /* 设置为true表示支持使用js打开新的窗口 */
+//        mWvVideo.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
+//
+//        /* 设置缓存模式 */
+//        mWvVideo.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
+//        mWvVideo.getSettings().setDomStorageEnabled(true);
+//
+//        /* 设置为使用webview推荐的窗口 */
+////        mWebView.getSettings().setUseWideViewPort(true);
+//        /* 设置为使用屏幕自适配 */
+//        mWvVideo.getSettings().setLoadWithOverviewMode(true);
+//        /* 设置是否允许webview使用缩放的功能,我这里设为false,不允许 */
+//        mWvVideo.getSettings().setBuiltInZoomControls(false);
+//        /* 提高网页渲染的优先级 */
+//        mWvVideo.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
+//
+//        /* HTML5的地理位置服务,设置为true,启用地理定位 */
+//        mWvVideo.getSettings().setGeolocationEnabled(true);
+//        /* 设置可以访问文件 */
+//        mWvVideo.getSettings().setAllowFileAccess(true);
+//
+//        // 设置UserAgent标识
+////        mWebView.getSettings().setUserAgentString(mWebView.getSettings().getUserAgentString() + " app-shikuimapp");
+//        mWvVideo.loadUrl(url);
+//    }
+//
+//    @Override
+//    public void getDataFail(String msg) {
+//        ToastUtil.show(mActivity, msg);
+//        finish();
+//    }
+//
+//    @Override
+//    public void onClick(View v) {
+//        int id = v.getId();
+//        if (id == R.id.tv_animation) {
+//            if (mModel != null) {
+//                mFlWebview1.setVisibility(View.VISIBLE);
+//                mFlWebview2.setVisibility(View.GONE);
+//                ll_content.setVisibility(View.GONE);
+//            }
+//        } else if (id == R.id.tv_video) {
+//            if (mModel != null) {
+//                mFlWebview1.setVisibility(View.GONE);
+//                mFlWebview2.setVisibility(View.VISIBLE);
+//                ll_content.setVisibility(View.GONE);
+//            }
+//        } else if (id == R.id.iv_back_three || id == R.id.iv_back_four) {
+//            mFlWebview1.setVisibility(View.GONE);
+//            mFlWebview2.setVisibility(View.GONE);
+//            ll_content.setVisibility(View.VISIBLE);
+//        }
+//    }
+//
+//    @Override
+//    protected void onDestroy() {
+//        super.onDestroy();
+//        if (mWvAnimation != null) {
+//            mWvAnimation.destroy();
+//        }
+//        if (mWvVideo != null) {
+//            mWvVideo.destroy();
+//        }
+//    }
+//
+//    private void doSubscribe(String matchId, String type, ImageView subscribeIv) {//订阅推送消息
+//        new SubscribePresenter().doSubscribe(matchId, type, new ApiCallback() {
+//            @Override
+//            public void onSuccess(String data, String msg) {
+//                if (!TextUtils.isEmpty(type)) {
+//                    subscribeIv.setImageResource(R.mipmap.subscribe);
+//                } else {
+//                    subscribeIv.setImageResource(R.mipmap.unsubscribe);
+//                }
+//            }
+//
+//            @Override
+//            public void onFailure(String msg) {
+//                ToastUtil.show(NewCricketDetailActivity.this, msg);
+//            }
+//
+//            @Override
+//            public void onError(String msg) {
+//                ToastUtil.show(NewCricketDetailActivity.this, msg);
+//            }
+//
+//            @Override
+//            public void onFinish() {
+//
+//            }
+//        });
+//    }
+//
+//    private void getSubscribeType(CricketMatchBean item, ImageView subscribeIv) {//订阅推送消息
+//        showLoadingDialog();
+//        new SubscribePresenter().getSubscribeType(item.getId(), new ApiCallback() {
+//            @Override
+//            public void onSuccess(String data, String msg) {
+//                dismissLoadingDialog();
+//                if (data != null) {
+//                    List<SubscribeTypeBean> list = JSONObject.parseArray(JSONObject.parseObject(data).getString("list"), SubscribeTypeBean.class);
+//                    //这里先弹出一个订阅消息的内容选择框  待选择好后点击确定订阅按钮再调用订阅接口
+//                    DialogUtil.showSelectSubscribeDialog(NewCricketDetailActivity.this, item.getHome_name() + " VS " + item.getAway_name(), list, new DialogUtil.SelectSubscribeBack() {
+//                        @Override
+//                        public void onSelectSubscribe(String type) {
+//                            doSubscribe(item.getId() + "", type, subscribeIv);
+//                        }
+//                    });
+//                }
+//            }
+//
+//            @Override
+//            public void onFailure(String msg) {
+//                dismissLoadingDialog();
+//            }
+//
+//            @Override
+//            public void onError(String msg) {
+//                dismissLoadingDialog();
+//            }
+//
+//            @Override
+//            public void onFinish() {
+//                dismissLoadingDialog();
+//            }
+//        });
+//    }
+//}

+ 93 - 4
TMessagesProj/src/main/java/org/telegram/onecric/utils/DialogUtil.java

@@ -26,18 +26,27 @@ import android.view.View;
 import android.view.ViewGroup;
 import android.view.Window;
 import android.view.WindowManager;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
 import android.widget.DatePicker;
 import android.widget.EditText;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
+import android.widget.Switch;
 import android.widget.TextView;
 
 
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
 import org.telegram.cricdit.utils.ToastUtil;
 import org.telegram.messenger.R;
+import org.telegram.onecric.adapter.SubscribeTypeAdapter;
+import org.telegram.onecric.mvp.bean.SubscribeTypeBean;
 
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.List;
 
 
 /**
@@ -72,7 +81,7 @@ public class DialogUtil {
         return loadingDialog(context, "");
     }
 
-//    public static void showSimpleTipDialog(Context context, String content) {
+    //    public static void showSimpleTipDialog(Context context, String content) {
 //        showSimpleTipDialog(context, null, content);
 //    }
 //
@@ -222,8 +231,8 @@ public class DialogUtil {
             textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DpUtil.dp2px(54)));
             textView.setTextColor(0xff323232);
             textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
-            textView.setGravity(Gravity.CENTER_VERTICAL|Gravity.LEFT);
-            textView.setPadding(DpUtil.dp2px(17), 0 ,0, 0);
+            textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
+            textView.setPadding(DpUtil.dp2px(17), 0, 0, 0);
             textView.setText(array.valueAt(i));
             textView.setTag(array.keyAt(i));
             textView.setOnClickListener(itemListener);
@@ -243,7 +252,8 @@ public class DialogUtil {
 //        });
         dialog.show();
     }
-//
+
+    //
 //    public static void showBuyNobleDialog(Context context, String noble, SimpleCallback callback) {
 //        final Dialog dialog = new Dialog(context, R.style.dialog);
 //        dialog.setContentView(R.layout.dialog_buy_noble);
@@ -894,4 +904,83 @@ public class DialogUtil {
 //        picker.setOnAddressPickListener(listener);
 //        picker.show();
 //    }
+
+    public interface SelectSubscribeBack {
+        void onSelectSubscribe(String type);
+    }
+
+    public static void showSelectSubscribeDialog(Context context, String matchTitle, List<SubscribeTypeBean> list, SelectSubscribeBack callback) {
+        final Dialog dialog = new Dialog(context, R.style.dialog);
+        dialog.setContentView(R.layout.dialog_select_subscribe);
+        dialog.setCancelable(true);
+        dialog.setCanceledOnTouchOutside(true);
+        dialog.getWindow().setWindowAnimations(R.style.bottomToTopAnim);
+        WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
+        params.width = WindowManager.LayoutParams.MATCH_PARENT;
+        params.gravity = Gravity.BOTTOM;
+        dialog.getWindow().setAttributes(params);
+        TextView tv_match_title = (TextView) dialog.findViewById(R.id.tv_match_title);
+        RecyclerView rv_type = (RecyclerView) dialog.findViewById(R.id.rv_type);
+        Switch btn_switch = (Switch) dialog.findViewById(R.id.btn_switch);
+        rv_type.setLayoutManager(new LinearLayoutManager(context));
+        SubscribeTypeAdapter adapter = new SubscribeTypeAdapter(btn_switch, R.layout.subscribe_type_item, list);
+        rv_type.setAdapter(adapter);
+        tv_match_title.setText(matchTitle);
+        TextView tv_save = (TextView) dialog.findViewById(R.id.tv_save);
+        CheckBox checkBox1 = (CheckBox) dialog.findViewById(R.id.checkbox_1);
+        CheckBox checkBox2 = (CheckBox) dialog.findViewById(R.id.checkbox_2);
+        CheckBox checkBox3 = (CheckBox) dialog.findViewById(R.id.checkbox_3);
+        CheckBox checkBox4 = (CheckBox) dialog.findViewById(R.id.checkbox_4);
+        CheckBox checkBox5 = (CheckBox) dialog.findViewById(R.id.checkbox_5);
+        CheckBox checkBox6 = (CheckBox) dialog.findViewById(R.id.checkbox_6);
+        btn_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            boolean checked1, checked2, checked3, checked4, checked5, checked6;
+
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (!isChecked) {
+                    checked1 = checkBox1.isChecked();
+                    checked2 = checkBox2.isChecked();
+                    checked3 = checkBox3.isChecked();
+                    checked4 = checkBox4.isChecked();
+                    checked5 = checkBox5.isChecked();
+                    checked6 = checkBox6.isChecked();
+                    checkBox1.setChecked(false);
+                    checkBox2.setChecked(false);
+                    checkBox3.setChecked(false);
+                    checkBox4.setChecked(false);
+                    checkBox5.setChecked(false);
+                    checkBox6.setChecked(false);
+                } else {
+                    checkBox1.setChecked(checked1);
+                    checkBox2.setChecked(checked2);
+                    checkBox3.setChecked(checked3);
+                    checkBox4.setChecked(checked4);
+                    checkBox5.setChecked(checked5);
+                    checkBox6.setChecked(checked6);
+                }
+            }
+        });
+        tv_save.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                dialog.dismiss();
+                if (callback != null) {
+                    String type = "";
+                    for (int i = 0; i < list.size(); i++) {
+                        if (list.get(i).getIs_subscribe() == 1) {
+                            if (i == 0) {
+                                type += list.get(i).getType();
+                            }
+                            if (i > 0) {
+                                type += "," + list.get(i).getType();
+                            }
+                        }
+                    }
+                    callback.onSelectSubscribe(type);
+                }
+            }
+        });
+        dialog.show();
+    }
 }

+ 71 - 0
TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java

@@ -19,6 +19,8 @@ import android.annotation.SuppressLint;
 import android.app.Activity;
 import android.app.ActivityManager;
 import android.app.Dialog;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
@@ -49,6 +51,7 @@ import android.text.Spanned;
 import android.text.TextUtils;
 import android.text.style.ForegroundColorSpan;
 import android.util.Base64;
+import android.util.Log;
 import android.util.SparseIntArray;
 import android.util.TypedValue;
 import android.view.ActionMode;
@@ -81,9 +84,12 @@ import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
 
 import com.google.android.gms.common.api.Status;
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
 import com.google.firebase.appindexing.Action;
 import com.google.firebase.appindexing.FirebaseUserActions;
 import com.google.firebase.appindexing.builders.AssistActionBuilder;
+import com.google.firebase.messaging.FirebaseMessaging;
 import com.lxj.xpopup.XPopup;
 
 import org.telegram.PhoneFormat.PhoneFormat;
@@ -137,6 +143,7 @@ import org.telegram.messenger.browser.Browser;
 import org.telegram.messenger.voip.VideoCapturerDevice;
 import org.telegram.messenger.voip.VoIPPendingCall;
 import org.telegram.messenger.voip.VoIPService;
+import org.telegram.onecric.ui.activity.CricketDetailActivity;
 import org.telegram.onecric.ui.activity.MatchActivity;
 import org.telegram.onecric.ui.activity.NewMatchActivity;
 import org.telegram.tgnet.ConnectionsManager;
@@ -308,6 +315,30 @@ public class LaunchActivity extends BasePermissionsActivity implements ActionBar
     public static final int BLUETOOTH_CONNECT_TYPE = 0;
     private SparseIntArray requestedPermissions = new SparseIntArray();
     private int requsetPermissionsPointer = 5934;
+    private static final String TAG = "LaunchActivity";
+
+
+    private void getFCMToken() {
+        FirebaseMessaging.getInstance().getToken()
+                .addOnCompleteListener(new OnCompleteListener<String>() {
+                    @Override
+                    public void onComplete(@NonNull Task<String> task) {
+                        if (!task.isSuccessful()) {
+                            Log.w(TAG, "Fetching FCM registration token failed", task.getException());
+                            return;
+                        }
+
+                        // Get new FCM registration token
+                        String token = task.getResult();
+
+                        // Log and toast
+                        String msg = getString(R.string.msg_token_fmt, token);
+                        SPUtils.getInstance().save("registration_token", token);
+                        Log.e(TAG, msg);
+//                        Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
+                    }
+                });
+    }
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -316,6 +347,7 @@ public class LaunchActivity extends BasePermissionsActivity implements ActionBar
                     .detectLeakedClosableObjects()
                     .build());
         }
+        getFCMToken();
         ApplicationLoader.postInitApplication();
         AndroidUtilities.checkDisplaySize(this, getResources().getConfiguration());
         currentAccount = UserConfig.selectedAccount;
@@ -1546,6 +1578,42 @@ public class LaunchActivity extends BasePermissionsActivity implements ActionBar
         });
     }
 
+
+    private void handleNotification(Intent pintent) {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+            // Create channel to show notifications.
+            String channelId = "fcm_default_channel";
+            String channelName = "match_detail";
+            NotificationManager notificationManager =
+                    getSystemService(NotificationManager.class);
+            notificationManager.createNotificationChannel(new NotificationChannel(channelId,
+                    channelName, NotificationManager.IMPORTANCE_LOW));
+        }
+
+        // If a notification message is tapped, any data accompanying the notification
+        // message is available in the intent extras. In this sample the launcher
+        // intent is fired when the notification is tapped, so any accompanying data would
+        // be handled here. If you want a different intent fired, set the click_action
+        // field of the notification message to the desired intent. The launcher intent
+        // is used when no click_action is specified.
+        //
+        // Handle possible data accompanying notification message.
+        // [START handle_data_extras]
+        if (pintent.getExtras() != null) {
+//            for (String key : getIntent().getExtras().keySet()) {
+//                Object value = getIntent().getExtras().get(key);
+//                Log.d(TAG, "Key: " + key + " Value: " + value);
+//            }
+            Intent intent = new Intent();
+            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+            Bundle bundle = pintent.getExtras();
+            intent.setClass(this, CricketDetailActivity.class);
+            intent.putExtra("matchId", Integer.parseInt(bundle.getString("matchId")));
+            intent.putExtra("isNotification", true);
+            startActivity(intent);
+        }
+    }
+
     @SuppressLint("Range")
     private boolean handleIntent(Intent intent, boolean isNew, boolean restore, boolean fromPassword) {
         if (AndroidUtilities.handleProxyIntent(this, intent)) {
@@ -4662,6 +4730,9 @@ public class LaunchActivity extends BasePermissionsActivity implements ActionBar
     public void onNewIntent(Intent intent) {
         super.onNewIntent(intent);
         handleIntent(intent, true, false, false);
+        if (intent.getExtras() != null) {
+            handleNotification(intent);
+        }
     }
 
     @Override

+ 30 - 24
TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java

@@ -468,7 +468,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
     private int settingsSectionRow;
     private int settingsSectionRow2;
     private int notificationRow;
-    private int groupTabRow;
+//    private int groupTabRow;
     private int languageRow;
     private int privacyRow;
     private int dataRow;
@@ -3105,12 +3105,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
                 onWriteButtonClick();
             } else if (position == premiumRow) {
                 presentFragment(new PremiumPreviewFragment("settings"));
-            } else if (position == groupTabRow) {
-                //TODO 点击后跳转
-                if (chatInfo!=null && chatInfo.can_set_username) {
-
-                }
-            } else if (position == personFollowRow) {
+            }
+//            else if (position == groupTabRow) {
+//                //TODO 点击后跳转
+//                if (chatInfo!=null && chatInfo.can_set_username) {
+//
+//                }
+//            }
+            else if (position == personFollowRow) {
                 //TODO 点击后跳转
                 follow2();
             } else {
@@ -6428,7 +6430,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
         settingsSectionRow = -1;
         settingsSectionRow2 = -1;
         notificationRow = -1;
-        groupTabRow = -1;
+//        groupTabRow = -1;
         languageRow = -1;
         premiumRow = -1;
         premiumSectionsRow = -1;
@@ -6649,7 +6651,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
             }
             notificationsRow = rowCount++;
 
-            groupTabRow = rowCount++;
+//            groupTabRow = rowCount++;
 
             infoSectionRow = rowCount++;
 
@@ -8278,14 +8280,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
                 case VIEW_TYPE_TEXT_DETAIL:
                     TextDetailCell detailCell = (TextDetailCell) holder.itemView;
                     //TODO 设置群标签
-                    if (position == groupTabRow) {
-                        System.out.println("qwerqwerrrr   "+chatInfo.can_set_username);
-
-                        if (chatInfo.can_set_username) {
-
-                        }
-                        detailCell.setTextAndValue("Label","None",false);
-                    }
+//                    if (position == groupTabRow) {
+//                        System.out.println("qwerqwerrrr   "+chatInfo.can_set_username);
+//
+//                        if (chatInfo.can_set_username) {
+//
+//                        }
+//                        detailCell.setTextAndValue("Label","None",false);
+//                    }
 
                     if (position == usernameRow) {
                         Drawable drawable = ContextCompat.getDrawable(detailCell.getContext(), R.drawable.msg_qr_mini);
@@ -8737,9 +8739,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
                 return VIEW_TYPE_PERSION_DETAIL;
             } else if (position == personFollowRow) {
                 return VIEW_TYPE_PERSION_FOLLOW;
-            } else if (position == groupTabRow) {
-                return VIEW_TYPE_TEXT_DETAIL;
             }
+//            else if (position == groupTabRow) {
+//                return VIEW_TYPE_TEXT_DETAIL;
+//            }
 //            else if (position == premiumRow) {
 //                return VIEW_TYPE_PREMIUM_TEXT_CELL;
 //            }
@@ -10391,7 +10394,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
             put(++pointer, settingsSectionRow, sparseIntArray);
             put(++pointer, settingsSectionRow2, sparseIntArray);
             put(++pointer, notificationRow, sparseIntArray);
-            put(++pointer, groupTabRow, sparseIntArray);
+//            put(++pointer, groupTabRow, sparseIntArray);
             put(++pointer, languageRow, sparseIntArray);
             put(++pointer, premiumRow, sparseIntArray);
             put(++pointer, premiumSectionsRow, sparseIntArray);
@@ -10549,10 +10552,13 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
                 if (response.body() != null) {
                     try {
                         String string = response.body().string();
-                        ProfileSelfProfileBean profileSelfProfileBean = GsonHel.fromJson(string, ProfileSelfProfileBean.class);
-                        if (profileSelfProfileBean != null && profileSelfProfileBean.data != null) {
-                            isFollow = profileSelfProfileBean.data.is_follow;
-                            listAdapter.notifyItemChanged(personFollowRow);
+                        if (string.contains("\"data\":\"\"")) {
+                        } else {
+                            ProfileSelfProfileBean profileSelfProfileBean = GsonHel.fromJson(string, ProfileSelfProfileBean.class);
+                            if (profileSelfProfileBean != null && profileSelfProfileBean.data != null) {
+                                isFollow = profileSelfProfileBean.data.is_follow;
+                                listAdapter.notifyItemChanged(personFollowRow);
+                            }
                         }
                     } catch (IOException e) {
                         e.printStackTrace();

+ 7 - 0
TMessagesProj/src/main/res/drawable/shape_c8c8c8_5dp_rec.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners android:radius="5dp"/>
+
+    <solid android:color="@color/c_EEEEEE"/>
+</shape>

+ 7 - 0
TMessagesProj/src/main/res/drawable/shape_c_e05526_10dp_rec.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <solid android:color="@color/c_E05526" />
+
+    <corners android:radius="10dp" />
+</shape>

+ 18 - 5
TMessagesProj/src/main/res/layout/activity_cricket_detail.xml

@@ -38,10 +38,23 @@
                 </LinearLayout>
 
                 <ImageView
+                    android:id="@+id/iv_subscribe"
+                    android:layout_width="50dp"
+                    android:layout_height="50dp"
+                    android:paddingStart="7dp"
+                    android:paddingTop="14dp"
+                    android:paddingEnd="14dp"
+                    android:paddingBottom="14dp"
+                    app:layout_constraintBottom_toBottomOf="@id/btn_left"
+                    app:layout_constraintEnd_toStartOf="@id/inner_report"
+                    app:layout_constraintTop_toTopOf="@id/btn_left"
+                    android:src="@mipmap/unsubscribe"
+                    android:visibility="gone" />
+
+                <ImageView
                     android:id="@+id/iv_right"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_marginRight="20dp"
                     app:layout_constraintBottom_toBottomOf="@id/btn_left"
                     app:layout_constraintRight_toRightOf="parent"
                     app:layout_constraintTop_toTopOf="@id/btn_left" />
@@ -53,13 +66,13 @@
                     android:layout_gravity="end"
                     android:paddingStart="7dp"
                     android:paddingTop="14dp"
-                    app:layout_constraintBottom_toBottomOf="@id/btn_left"
-                    app:layout_constraintEnd_toStartOf="@id/iv_right"
-                    app:layout_constraintTop_toTopOf="@id/btn_left"
                     android:paddingEnd="14dp"
                     android:paddingBottom="14dp"
                     android:src="@drawable/msg_report"
-                    />
+                    app:layout_constraintBottom_toBottomOf="@id/btn_left"
+                    app:layout_constraintEnd_toStartOf="@id/iv_right"
+                    app:layout_constraintTop_toTopOf="@id/btn_left"
+                    app:layout_constraintVertical_bias="0.0" />
 
             </androidx.constraintlayout.widget.ConstraintLayout>
 

+ 212 - 0
TMessagesProj/src/main/res/layout/dialog_select_subscribe.xml

@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@color/white"
+    android:orientation="vertical"
+    android:paddingLeft="10dp"
+    android:paddingTop="20dp"
+    android:paddingRight="10dp"
+    android:paddingBottom="30dp">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center_vertical"
+        android:orientation="horizontal">
+
+        <LinearLayout
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:orientation="vertical">
+
+            <TextView
+                android:id="@+id/tv_match_title"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text=""
+                android:textColor="@color/c_666666"
+                android:textSize="9sp" />
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="5dp"
+                android:text="Get Alerts For This Match"
+                android:textColor="@color/c_333333"
+                android:textSize="11sp"
+                android:textStyle="bold" />
+        </LinearLayout>
+
+        <Switch
+            android:id="@+id/btn_switch"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginRight="12dp"
+            android:checked="true" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/dp_10"
+        android:background="@drawable/shape_c8c8c8_5dp_rec"
+        android:orientation="vertical"
+        android:paddingLeft="10dp"
+        android:paddingTop="20dp"
+        android:paddingRight="10dp"
+        android:paddingBottom="20dp">
+
+
+        <androidx.recyclerview.widget.RecyclerView
+            android:id="@+id/rv_type"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" />
+
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:visibility="gone">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="Match Started"
+                android:textColor="@color/black"
+                android:textSize="11sp"
+                android:textStyle="normal" />
+
+            <CheckBox
+                android:id="@+id/checkbox_1"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:checked="true" />
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:visibility="gone">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="Toss and Line-ups Out"
+                android:textColor="@color/black"
+                android:textSize="11sp"
+                android:textStyle="normal" />
+
+            <CheckBox
+                android:id="@+id/checkbox_2"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:checked="true" />
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:visibility="gone">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="Wickets"
+                android:textColor="@color/black"
+                android:textSize="11sp"
+                android:textStyle="normal" />
+
+            <CheckBox
+                android:id="@+id/checkbox_3"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:checked="true" />
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/dp_10"
+            android:visibility="gone">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="Milestones"
+                android:textColor="@color/black"
+                android:textSize="11sp"
+                android:textStyle="normal" />
+
+            <CheckBox
+                android:id="@+id/checkbox_4"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:checked="false" />
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:visibility="gone">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="Delay and Breaks"
+                android:textColor="@color/black"
+                android:textSize="11sp"
+                android:textStyle="normal" />
+
+            <CheckBox
+                android:id="@+id/checkbox_5"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:checked="false" />
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:visibility="gone">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="Result"
+                android:textColor="@color/black"
+                android:textSize="11sp"
+                android:textStyle="normal" />
+
+            <CheckBox
+                android:id="@+id/checkbox_6"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:checked="true" />
+        </LinearLayout>
+
+    </LinearLayout>
+
+    <TextView
+        android:id="@+id/tv_save"
+        android:layout_width="match_parent"
+        android:layout_height="30dp"
+        android:layout_marginTop="10dp"
+        android:background="@drawable/shape_c_e05526_10dp_rec"
+        android:gravity="center"
+        android:text="SAVE PREFERENCES"
+        android:textColor="@color/white"
+        android:textSize="13sp"
+        android:textStyle="bold" />
+</LinearLayout>

+ 31 - 0
TMessagesProj/src/main/res/layout/subscribe_type_item.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="10dp"
+        android:visibility="visible"
+        tools:ignore="MissingConstraints">
+
+        <TextView
+            android:id="@+id/tv_name"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text=""
+            android:textColor="@color/black"
+            android:textSize="11sp"
+            android:textStyle="normal" />
+
+        <CheckBox
+            android:id="@+id/checkbox"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:checked="true" />
+    </LinearLayout>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

BIN
TMessagesProj/src/main/res/mipmap-xhdpi/subscribe.png


BIN
TMessagesProj/src/main/res/mipmap-xhdpi/unsubscribe.png


+ 1 - 0
TMessagesProj/src/main/res/values/strings.xml

@@ -6068,6 +6068,7 @@
         "when a user tries to pick up one of cards.\n\n"
     </string>
     <string name="action_settings">Settings</string>
+    <string name="msg_token_fmt" translatable="false">FCM registration Token: %s</string>
 
     <!--    3.16新加-->
     <string name="match_search_hint">Search for tours and teams...</string>

+ 10 - 12
TMessagesProj/src/main/res/values/styles.xml

@@ -1,4 +1,4 @@
-<resources xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">
+<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
 
     <!--THEMES-->
 
@@ -19,17 +19,17 @@
     </style>
 
     <!--冷启动优化-->
-    <style name="ItemSelectedStyle" >
+    <style name="ItemSelectedStyle">
         <item name="android:selectableItemBackground">@null</item>
         <item name="android:selectableItemBackgroundBorderless">@null</item>
     </style>
 
-<!--    <style name="CustomDateDialog" parent="@android:style/Theme.Dialog">-->
-<!--        <item name="android:windowFrame">@null</item>-->
-<!--        <item name="android:windowNoTitle">true</item>-->
-<!--        <item name="android:windowBackground">@color/transparent</item>-->
-<!--        <item name="android:windowIsTranslucent">true</item>-->
-<!--    </style>-->
+    <!--    <style name="CustomDateDialog" parent="@android:style/Theme.Dialog">-->
+    <!--        <item name="android:windowFrame">@null</item>-->
+    <!--        <item name="android:windowNoTitle">true</item>-->
+    <!--        <item name="android:windowBackground">@color/transparent</item>-->
+    <!--        <item name="android:windowIsTranslucent">true</item>-->
+    <!--    </style>-->
 
     <style name="CustomDateDialog" parent="@android:style/Theme.Dialog">
         <item name="android:windowFrame">@null</item>
@@ -39,7 +39,7 @@
         <item name="android:windowBackground">@color/transparent</item>
         <item name="android:backgroundDimAmount">0.5</item>
         <!--显示区域以外是否使用黑色半透明背景-->
-<!--        <item name="android:backgroundDimEnabled">true</item>-->
+        <!--        <item name="android:backgroundDimEnabled">true</item>-->
     </style>
 
     <style name="UpdateDialog" parent="@android:style/Theme.Dialog">
@@ -340,8 +340,6 @@
     </style>
 
 
-
-
     <!-- 底部弹出动画 -->
     <style name="DialogBottomAnim" parent="android:Animation">
         <item name="android:windowEnterAnimation">@anim/dialog_enter</item>
@@ -365,7 +363,7 @@
         <item name="android:textStyle">bold</item>
     </style>
 
-<!-- semibold -->
+    <!-- semibold -->
     <style name="TvItemTitleStyle">
         <item name="android:fontFamily">@font/noto_sans_display_semibold</item>
         <item name="android:textSize">15sp</item>

+ 0 - 20
TMessagesProj_App/bundleAfat/release/output-metadata.json

@@ -1,20 +0,0 @@
-{
-  "version": 3,
-  "artifactType": {
-    "type": "APK",
-    "kind": "Directory"
-  },
-  "applicationId": "com.cricdit.cricdit",
-  "variantName": "bundleAfatRelease",
-  "elements": [
-    {
-      "type": "SINGLE",
-      "filters": [],
-      "attributes": [],
-      "versionCode": 23,
-      "versionName": "0.2.2",
-      "outputFile": "Cricdit0.2.2.apk"
-    }
-  ],
-  "elementType": "File"
-}

+ 2 - 2
gradle.properties

@@ -15,8 +15,8 @@
 #Sat Mar 12 05:53:50 MSK 2016
 #APP_VERSION_NAME=9.0.2
 #APP_VERSION_CODE=2808
-APP_VERSION_NAME=0.2.3
-APP_VERSION_CODE=24
+APP_VERSION_NAME=0.2.5
+APP_VERSION_CODE=26
 #APP_PACKAGE=org.telegram.messenger
 APP_PACKAGE=com.cricdit.cricdit
 RELEASE_KEY_PASSWORD=123456