导航菜单

页面标题

页面副标题

自健身 v3.3.4 - MainActivity.java 源代码

正在查看: 自健身 v3.3.4 应用的 MainActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.mu.gymtrain.Activity;

import android.content.res.Resources;
import android.view.KeyEvent;
import cn.jiguang.share.android.api.JShareInterface;
import cn.jiguang.share.android.api.PlatformConfig;
import cn.jpush.android.api.JPushInterface;
import com.blankj.utilcode.util.AdaptScreenUtils;
import com.clj.fastble.BleManager;
import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.mu.gymtrain.Base.BaseActivity;
import com.mu.gymtrain.Fragment.RootFragment;
import com.mu.gymtrain.R;
import com.mu.gymtrain.Utils.MessageUtils;
import com.mu.gymtrain.Utils.ShareUtils;
import com.pgyersdk.Pgyer;

public class MainActivity extends BaseActivity {
    private long oldClickTime;

    public int getContentLayout() {
        return R.layout.activity_main_layout;
    }

    public void initView() {
        loadRootFragment(R.id.rootView, new RootFragment());
    }

    public void initData() {
        initJPush();
        initBluetooth();
        Pgyer.setAppId("b37d93b6a7651920a3820a80bf57900c");
    }

    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == 4) {
            exit();
            return false;
        }
        return super.onKeyDown(keyCode, event);
    }

    private void exit() {
        long currentTimeMillis = System.currentTimeMillis();
        if (currentTimeMillis - this.oldClickTime > AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS) {
            this.oldClickTime = currentTimeMillis;
            MessageUtils.alertMessageCENTER("再按一次退出程序");
        } else {
            finish();
            System.exit(0);
        }
    }

    private void initBluetooth() {
        BleManager.getInstance().init(getApplication());
        BleManager.getInstance().enableLog(false).setReConnectCount(1, DefaultRenderersFactory.DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS).setSplitWriteNum(20).setConnectOverTime(10000L).setOperateTimeout(5000);
    }

    private void initJPush() {
        JPushInterface.setDebugMode(true);
        JPushInterface.init(this);
        PlatformConfig platformConfig = new PlatformConfig();
        JShareInterface.setDebugMode(true);
        platformConfig.setWechat(ShareUtils.WX_APP_ID, "9a944bf42c3c9306a9bfbd1c467db152");
        JShareInterface.init(this, platformConfig);
    }

    public Resources getResources() {
        return AdaptScreenUtils.adaptWidth(super.getResources(), 750);
    }
}