app/src/main/java/com/egguncle/xposednavigationbar/ui/fragment/SetOtherFragment.java
public class SetOtherFragment extends BaseFragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
    private final static String TAG = SetOtherFragment.class.getName();

    private LinearLayout btnHomePoint;
    private TextView tvHomePosition;
    private LinearLayout btnClearMemLevel;
    private TextView tvClearMemLevel;
    private LinearLayout btnIconSize;
    private TextView tvIconSize;
    private LinearLayout btnNavbarHeight;
    private TextView tvNavbarHeight;
    //  private Switch swHook90;
    private Switch swRootDown;
    private Switch swChameleonNavbar;
    private Switch swVibrate;
    private Switch swHideAppIcon;
    private Switch swNavbarHeight;
    private Switch swGoHome;
    private LinearLayout settingAboutMarshmallow;

    private SPUtil spUtil;
    private Context mContext;
    private int navbarHeight;

    public SetOtherFragment() {
        mContext = MyApplication.getContext();
    }

    private String[] homePointStr = {
            ConstantStr.LEFT,
            ConstantStr.RIGHT,
            ConstantStr.DISMISS
    };

    private String[] clearMemLevels = {
            "50", "100", "130", "200", "170", "300", "400", "500"
    };

    @Override
    void initView(View view) {
        btnHomePoint = (LinearLayout) view.findViewById(R.id.btn_home_point);
        tvHomePosition = (TextView) view.findViewById(R.id.tv_home_position);
        btnClearMemLevel = (LinearLayout) view.findViewById(R.id.btn_clear_mem_level);
        tvClearMemLevel = (TextView) view.findViewById(R.id.tv_clear_mem_level);
        btnIconSize = (LinearLayout) view.findViewById(R.id.btn_icon_size);
        tvIconSize = (TextView) view.findViewById(R.id.tv_icon_size);
        //  swHook90 = (Switch) findViewById(R.id.sw_hook_90);
        swRootDown = (Switch) view.findViewById(R.id.sw_root_down);
        settingAboutMarshmallow = (LinearLayout) view.findViewById(R.id.setting_about_marshmallow);
        swChameleonNavbar = (Switch) view.findViewById(R.id.sw_chameleon_navbar);
        btnNavbarHeight = (LinearLayout) view.findViewById(R.id.btn_navbar_height);
        tvNavbarHeight = (TextView) view.findViewById(R.id.tv_navbar_height);
        swVibrate = (Switch) view.findViewById(R.id.sw_navbar_vibrate);
        swHideAppIcon = (Switch) view.findViewById(R.id.sw_hide_app_icon);
        swNavbarHeight = (Switch) view.findViewById(R.id.sw_navbar_height);
        swGoHome = (Switch) view.findViewById(R.id.sw_go_home);
    }

    @Override
    void initAction() {
        btnHomePoint.setOnClickListener(this);
        btnClearMemLevel.setOnClickListener(this);
        btnIconSize.setOnClickListener(this);
        btnNavbarHeight.setOnClickListener(this);
        swRootDown.setOnCheckedChangeListener(this);
        swChameleonNavbar.setOnCheckedChangeListener(this);
        swVibrate.setOnCheckedChangeListener(this);
        swHideAppIcon.setOnCheckedChangeListener(this);
        swNavbarHeight.setOnCheckedChangeListener(this);
        swGoHome.setOnCheckedChangeListener(this);
    }

    @Override
    void initVar() {
        spUtil = SPUtil.getInstance(mContext);
        int homePositon = spUtil.getHomePointPosition();
        tvHomePosition.setText(homePointStr[homePositon]);
        tvClearMemLevel.setText(spUtil.getClearMemLevel() + "");
        tvIconSize.setText(spUtil.getIconSize() + "");
        swRootDown.setChecked(spUtil.getRootDown());
        swChameleonNavbar.setChecked(spUtil.isChameleonNavBar());
        navbarHeight = spUtil.getNavbarHeight();
        tvNavbarHeight.setText(navbarHeight + "%");
        swVibrate.setChecked(spUtil.isNavbarVibrate());
        swHideAppIcon.setChecked(spUtil.isHideAppIcon());
        boolean navbarHeightOpt = spUtil.isNavbarHeightOpt();
        swNavbarHeight.setChecked(navbarHeightOpt);
        btnNavbarHeight.setVisibility(navbarHeightOpt ? View.VISIBLE : View.GONE);
        swGoHome.setChecked(spUtil.isGoHomeAfterClick());
        //在Android M 上有一个通知栏下拉动画缓慢的bug，这里为它添加一个设置选项，只有M可见
        if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
            settingAboutMarshmallow.setVisibility(View.VISIBLE);
        }

    }

    @Override
    int getLayoutId() {
        return R.layout.f_set_other;
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_home_point: {
                AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
                builder.setTitle(getString(R.string.home_point))
                        .setSingleChoiceItems(homePointStr, 0, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                spUtil.setHomePointPosition(i);
                                tvHomePosition.setText(homePointStr[i]);
                            }
                        }).setPositiveButton(R.string.ok, null);
                builder.create().show();
            }
            break;
            case R.id.btn_clear_mem_level: {
                AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
                builder.setTitle(getResources().getString(R.string.clear_mem_level))
                        .setSingleChoiceItems(clearMemLevels, 0, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                spUtil.setClearMemLevel(Integer.parseInt(clearMemLevels[i]));
                                Log.i(TAG, "onClick: " + clearMemLevels[i]);
                                tvClearMemLevel.setText(clearMemLevels[i]);
                            }
                        }).setPositiveButton(R.string.ok, null);
                builder.create().show();
            }
            break;
            case R.id.btn_icon_size: {
                View dialogView = View.inflate(view.getContext(), R.layout.d_icon_size, null);
                final TextView tvImgSize = (TextView) dialogView.findViewById(R.id.tv_img_size);
                final SeekBar skImgSize = (SeekBar) dialogView.findViewById(R.id.sk_img_size);
                //设置范围10～100
                skImgSize.setMax(90);
                int nowSize = Integer.parseInt(tvIconSize.getText().toString());
                skImgSize.setProgress(nowSize - 10);
                tvImgSize.setText(nowSize + " %");
                skImgSize.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                    @Override
                    public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
                        tvImgSize.setText(10 + i + " %");
                    }

                    @Override
                    public void onStartTrackingTouch(SeekBar seekBar) {

                    }

                    @Override
                    public void onStopTrackingTouch(SeekBar seekBar) {

                    }
                });
                AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
                builder.setView(dialogView)
                        .setTitle(getString(R.string.icon_size))
                        .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                int imgSize = skImgSize.getProgress() + 10;
                                tvIconSize.setText(imgSize + "");
                                spUtil.setIconSize(imgSize);
                            }
                        }).create().show();
            }
            break;
            case R.id.btn_navbar_height: {
                View dialogView = View.inflate(view.getContext(), R.layout.d_navbar_height, null);
                SeekBar skNavbarHeight = (SeekBar) dialogView.findViewById(R.id.sk_navbar_height);
                final TextView tvHeight = (TextView) dialogView.findViewById(R.id.tv_height);
                tvHeight.setText(navbarHeight + "%");
                skNavbarHeight.setMax(100);
                skNavbarHeight.setProgress(navbarHeight - 50);
                skNavbarHeight.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                    @Override
                    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                        tvHeight.setText(progress + 50 + "%");
                        navbarHeight = progress + 50;
                    }

                    @Override
                    public void onStartTrackingTouch(SeekBar seekBar) {

                    }

                    @Override
                    public void onStopTrackingTouch(SeekBar seekBar) {

                    }
                });
                AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
                builder.setView(dialogView)
                        .setTitle(R.string.navbar_height)
                        .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                spUtil.setNavbarHeight(navbarHeight);
                                tvNavbarHeight.setText(navbarHeight + "%");
                            }
                        }).create().show();
            }
            break;
        }
    }

    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        switch (buttonView.getId()) {
            case R.id.sw_chameleon_navbar: {
                spUtil.setChameleonNavbar(isChecked);
            }
            break;
            case R.id.sw_hide_app_icon: {
                spUtil.setHideAppIcon(isChecked);
                int mode = isChecked ? PackageManager.COMPONENT_ENABLED_STATE_DISABLED :
                        PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
                getActivity().getPackageManager().setComponentEnabledSetting(
                        new ComponentName(getActivity(), "com.egguncle.xposednavigationbar.ui.activity.HomeActivity-Alias"),
                        mode, PackageManager.DONT_KILL_APP);

            }
            break;
            case R.id.sw_navbar_height: {
                spUtil.setNavbarHeightOpt(isChecked);
                if (isChecked) {
                    btnNavbarHeight.setVisibility(View.VISIBLE);
                } else {
                    btnNavbarHeight.setVisibility(View.GONE);
                }
            }
            break;
            case R.id.sw_navbar_vibrate: {
                spUtil.setNavbarVibrate(isChecked);
            }
            break;
            case R.id.sw_root_down: {
                spUtil.setRootDown(isChecked);
            }
            break;
            case R.id.sw_go_home: {
                spUtil.setGoHomeAfterClick(isChecked);
            }
            break;
        }
    }
}
app/src/main/java/com/egguncle/xposednavigationbar/ui/fragment/SetFunFragment.java
public class SetFunFragment extends BaseFragment {
    private final static String TAG = SetFunFragment.class.getName();

    private RecyclerView rcvSetting;
    private View parentView;

    private RcvHomeAdapter rcvHomeAdapter;
    private static ArrayList<ShortCut> shortCutList;

    private SPUtil spUtil;
    private Context mContext;


    public SetFunFragment() {
        mContext = MyApplication.getContext();
    }

    public void setContext(Context context) {
        mContext = context;
        if (rcvHomeAdapter != null) {
            rcvHomeAdapter.setContext(context);
        }
    }

    @Override
    void initView(View view) {
        rcvSetting = (RecyclerView) view.findViewById(R.id.rcv_setting);
        parentView = view.findViewById(R.id.parent_view);
        rcvSetting.setLayoutManager(new LinearLayoutManager(view.getContext()));
    }

    @Override
    void initAction() {

    }

    @Override
    void initVar() {
        shortCutList = new ArrayList<>();
        rcvHomeAdapter = new RcvHomeAdapter(mContext, shortCutList);
        rcvSetting.setAdapter(rcvHomeAdapter);
        //设置rcv可拖动
        MyItemTouchHelper myItemTouchHelper = new MyItemTouchHelper(onItemTouchCallbackListener);
        myItemTouchHelper.attachToRecyclerView(rcvSetting);

        //获取原有的设置数据
        spUtil = SPUtil.getInstance(mContext);
        List<ShortCut> list = spUtil.getAllShortCutData();
        if (list != null && list.size() != 0) {
            shortCutList.addAll(list);
            rcvHomeAdapter.notifyDataSetChanged();
        }
    }

    @Override
    int getLayoutId() {
        return R.layout.f_set_func;
    }

    /**
     * 根据选择的内容，来向shortcutlist添加数据
     *
     * @param code 对应的功能码
     */
    private void addToShortCutList(int code) {
        //限制最大按钮数
        if (shortCutList.size() >= 10) {
            Snackbar.make(parentView,
                    getResources().getString(R.string.taps_too_mang_sc),
                    Snackbar.LENGTH_SHORT).show();
        } else {
            Log.i(TAG, "addToShortCutList: add ");
            ShortCut sc = new ShortCut();
            sc.setCode(code);
            shortCutList.add(sc);
        }
    }

    public void coverData(List<Integer> data) {
        for (Integer code : data) {
            Log.i(TAG, "onClick: " + code);
            addToShortCutList(code);
        }
        rcvHomeAdapter.notifyDataSetChanged();
    }

    public ArrayList<ShortCut> getShortCutCodes() {
        return shortCutList;
    }

    private MyItemTouchHelpCallBack.OnItemTouchCallbackListener onItemTouchCallbackListener = new MyItemTouchHelpCallBack.OnItemTouchCallbackListener() {
        @Override
        public void onSwiped(int adapterPosition) {
            // 滑动删除的时候，从数据源移除，并刷新这个Item。
            if (shortCutList != null) {
                shortCutList.remove(adapterPosition);
                rcvHomeAdapter.notifyItemRemoved(adapterPosition);
            }
        }

        @Override
        public boolean onMove(int srcPosition, int targetPosition) {
            if (shortCutList != null) {
                // 更换数据源中的数据Item的位置
                Collections.swap(shortCutList, srcPosition, targetPosition);
                // 更新UI中的Item的位置，主要是给用户看到交互效果
                rcvHomeAdapter.notifyItemMoved(srcPosition, targetPosition);
                Log.i(TAG, "onMove: ---");
                return true;
            }
            return false;
        }
    };


}
app/src/main/java/com/egguncle/xposednavigationbar/util/SPUtil.java
public class SPUtil {
    private static SharedPreferences mSharedPreferences;
    private static SharedPreferences.Editor mEditor;
    private static SPUtil instance;
    public static final String SP_NAME = "xpnavbar";
    private static final String TAPS_APPEAR = "taps";
    //在原导航键上添加一个小点，点击后出现扩展的部分
    private static final String HOME_POINT = "home_point";
    private static final String LANGUAGE = "LANGUAGE";
    public static final String LANGUAGE_CHINESE = "zh";
    public static final String LANGUAGE_ENGLICH = "en";
    public final static int LEFT = 0;
    public final static int RIGHT = 1;
    public final static int DISMISS = 2;
    public static final String CLEAR_MEM_LEVEL = "clear_mem_level";
    private static final String ICON_SIZE = "icon_size";
    private static final String HookHorizontal = "hook_horizontal";
    public static final String ROOT_DOWN = "root_down";
    public static final String CHAMELEON_NAVBAR = "chameleon_navbar";
    public static final String NAVBAR_HEIGHT = "navbar_height";
    public static final String NAVBAR_VIBRATE = "navbar_vibrate";
    public static final String HIDE_APP_ICON = "hide_app_icon";
    public static final String NAVBAR_HEIGHT_OPT = "navbar_height_opt";
    public static final String GO_HOME_AFTER_CLICK="go_home_after_click";

    //以json形式存储app的设置信息
    private static final String SHORT_CUT_DATA = "short_cut_data";

    private SPUtil() {

    }

    public static SPUtil getInstance(Context context) {
        if (instance == null) {
            synchronized (SPUtil.class) {
                instance = new SPUtil();
                mSharedPreferences = context.getSharedPreferences(SP_NAME, Context.MODE_WORLD_READABLE);
                mEditor = mSharedPreferences.edit();
            }
        }
        return instance;
    }


    /**
     * 存储app快捷方式信息
     *
     * @param list
     */
    public synchronized void saveShortCut(ArrayList<ShortCut> list) {
        ShortCutData data = new ShortCutData();
        data.setData(list);
        Gson gson = new Gson();
        String json = gson.toJson(data);
        mEditor.putString(SHORT_CUT_DATA, json);
        mEditor.commit();
    }


    /**
     * 从sp的data标签里获得所有app快捷方式的存储信息
     *
     * @return
     */
    public synchronized ArrayList<ShortCut> getAllShortCutData() {
        Gson gson = new Gson();
        ArrayList<ShortCut> list = new ArrayList<>();
        String data = mSharedPreferences.getString(SHORT_CUT_DATA, "");
        if ("".equals(data)) {
            return null;
        }
        List<ShortCut> saveData = gson.fromJson(data, ShortCutData.class).getData();
        if (saveData != null) {
            list.addAll(saveData);
        }
        return list;
    }

    /**
     * 在打开设置界面的时候会有一个对话框提示，如果点击不再提示，则不再显示
     */
    public void nolongerTaps() {
        mEditor.putBoolean(TAPS_APPEAR, false);
        mEditor.commit();
    }

    public boolean getTapsStatus() {
        return mSharedPreferences.getBoolean(TAPS_APPEAR, true);
    }

    /**
     * 设置主导航栏上小点的位置 左 右 或者不显示
     *
     * @param position
     */
    public void setHomePointPosition(int position) {
        mEditor.putInt(HOME_POINT, position);
        mEditor.commit();
    }

    public int getHomePointPosition() {
        try {
            return mSharedPreferences.getInt(HOME_POINT, LEFT);
        } catch (Exception e) {
            return LEFT;
        }
    }


    /**
     * 设置内存清理等级
     *
     * @param level
     */
    public void setClearMemLevel(int level) {
        mEditor.putInt(CLEAR_MEM_LEVEL, level);
        mEditor.commit();
    }

    public int getClearMemLevel() {
        return mSharedPreferences.getInt(CLEAR_MEM_LEVEL, ConstantStr.IMPORTANCE_VISIBLE);
    }

    /**
     * 设置图标大小
     *
     * @param
     */
    public void setIconSize(int size) {
        mEditor.putInt(ICON_SIZE, size);
        mEditor.commit();
    }

    public int getIconSize() {
        return mSharedPreferences.getInt(ICON_SIZE, 40);
    }

    public void setLanguage(String language) {
        mEditor.putString(LANGUAGE, language);
        mEditor.commit();
    }

    public String getLanguage() {
        return mSharedPreferences.getString(LANGUAGE, "");
    }

    public void setHookHorizontal(boolean isHook) {
        mEditor.putBoolean(HookHorizontal, isHook);
        mEditor.commit();
    }

    public boolean getHookHorizontal() {
        return mSharedPreferences.getBoolean(HookHorizontal, false);
    }

    public void setRootDown(boolean b) {
        mEditor.putBoolean(ROOT_DOWN, b);
        mEditor.commit();
    }

    public boolean getRootDown() {
        return mSharedPreferences.getBoolean(ROOT_DOWN, false);
    }

    public void setChameleonNavbar(boolean change) {
        mEditor.putBoolean(CHAMELEON_NAVBAR, change);
        mEditor.commit();
    }

    public boolean isChameleonNavBar() {
        return mSharedPreferences.getBoolean(CHAMELEON_NAVBAR, false);
    }

    public void setNavbarHeight(int height) {
        mEditor.putInt(NAVBAR_HEIGHT, height);
        mEditor.commit();
    }

    public int getNavbarHeight() {
        return mSharedPreferences.getInt(NAVBAR_HEIGHT, 100);
    }

    public boolean isNavbarVibrate() {
        return mSharedPreferences.getBoolean(NAVBAR_VIBRATE, false);
    }

    public void setNavbarVibrate(boolean vibrate) {
        mEditor.putBoolean(NAVBAR_VIBRATE, vibrate);
        mEditor.commit();
    }

    public void setHideAppIcon(boolean hide) {
        mEditor.putBoolean(HIDE_APP_ICON, hide);
        mEditor.commit();
    }

    public boolean isHideAppIcon() {
        return mSharedPreferences.getBoolean(HIDE_APP_ICON, false);
    }

    public void setNavbarHeightOpt(boolean isOpen) {
        mEditor.putBoolean(NAVBAR_HEIGHT_OPT, isOpen);
        mEditor.commit();
    }

    public boolean isNavbarHeightOpt() {
        return mSharedPreferences.getBoolean(NAVBAR_HEIGHT_OPT, false);
    }

    public void setGoHomeAfterClick(boolean goHome){
        mEditor.putBoolean(GO_HOME_AFTER_CLICK, goHome);
        mEditor.commit();
    }

    public boolean isGoHomeAfterClick(){
        return mSharedPreferences.getBoolean(GO_HOME_AFTER_CLICK, false);
    }
}
app/src/main/java/com/egguncle/xposednavigationbar/hook/util/XpLog.java
public class XpLog {

    private final static String TAG = "XpNavbar";

    public static void i(String logContent) {
        if (DEBUG)
            XposedBridge.log("[I/" + TAG + "] " + logContent);
    }

    public static void e(String logContent) {
        if (DEBUG)
        XposedBridge.log("[E/" + TAG + "] " + logContent);
    }

    public static void e(Throwable e) {
        if (DEBUG)
        XposedBridge.log("[E/" + TAG + "] " + e.getMessage());
    }

    public static void w(String logContent) {
        if (DEBUG)
        XposedBridge.log("[W/" + TAG + "] " + logContent);
    }

}
app/src/main/java/com/egguncle/xposednavigationbar/model/ShortCut.java
public class ShortCut implements Parcelable{
    //快捷小功能的名字对应的编码
    private int code;
//    //快捷小功能的标识符
//    private String shortCutName;
    //是否开启了这个功能
    private boolean open;
    //第几页
    private int page;
    //该页的第几个位置
    private int postion;

    //自定义图标路径
    private String iconPath;

    //如果是shell快捷指令，则应该还有一个指令内容
    private String shellStr;

    public ShortCut(){}

    protected ShortCut(Parcel in) {
        code = in.readInt();
        open = in.readByte() != 0;
        page = in.readInt();
        postion = in.readInt();
        iconPath = in.readString();
        shellStr = in.readString();
    }

    public static final Creator<ShortCut> CREATOR = new Creator<ShortCut>() {
        @Override
        public ShortCut createFromParcel(Parcel in) {
            return new ShortCut(in);
        }

        @Override
        public ShortCut[] newArray(int size) {
            return new ShortCut[size];
        }
    };

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getPostion() {
        return postion;
    }

    public void setPostion(int postion) {
        this.postion = postion;
    }

    public int getCode() {return code;}

    public void setCode(int code) {this.code = code;}

    public boolean isOpen() {
        return open;
    }

    public void setOpen(boolean open) {
        this.open = open;
    }

    public String getShellStr() {
        return shellStr;
    }

    public void setShellStr(String shellStr) {
        this.shellStr = shellStr;
    }
    public String getIconPath() {
        return iconPath;
    }

    public void setIconPath(String iconPath) {
        this.iconPath = iconPath;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(code);
        parcel.writeByte((byte) (open ? 1 : 0));
        parcel.writeInt(page);
        parcel.writeInt(postion);
        parcel.writeString(iconPath);
        parcel.writeString(shellStr);
    }
}
app/src/main/java/com/egguncle/xposednavigationbar/ui/fragment/MomoFragment.java
public class MomoFragment extends BaseFragment {
    private RecyclerView rcvMomo;

    private List<Momo> momoList;
    private MomoAdapter adapter;


    @Override
    void initView(View view) {
        rcvMomo = (RecyclerView) view.findViewById(R.id.rcv_momo);
        rcvMomo.setLayoutManager(new LinearLayoutManager(view.getContext()));
        momoList = new ArrayList<>();
        adapter = new MomoAdapter(momoList, view.getContext());
        rcvMomo.setAdapter(adapter);
    }

    @Override
    void initAction() {

    }

    @Override
    void initVar() {
        momoList.addAll(DataSupport.findAll(Momo.class));
        adapter.notifyDataSetChanged();
    }

    @Override
    int getLayoutId() {
        return R.layout.f_momo;
    }
}
app/src/main/java/com/egguncle/xposednavigationbar/constant/XpNavBarAction.java
public class XpNavBarAction {
    public final static String ACT_NAV_BAR_DATA = "com.egguncle.xpnavbar.navbardata";
    public final static String ACT_CLOSE_ACT_PANEL = "com.egguncle.xpnavbar.closeactpanel";
    public final static String ACT_EXPEND_STATUS_BAR = "com.egguncle.xpnavbar.expendstatusbar";
    public final static String ACTION_CLIPBOARD = "com.egguncle.xposednavigationbar.ui.activity.ClipboardActivity";
    public final static String ACTION_START_ACT = "com.egguncle.xposednavigationbar.ui.activity.AppShortCutActivity";
    public final static String ACTION_QUICK_NOTICE = "com.egguncle.xposednavigationbar.ui.activity.QuickNotificationActivity";
    public final static String ACTION_PHONE_WINDOW_MANAGER = "com.egguncle.xposednavigationbar.phonewindowmanager";
    public final static String ACTION_PHONE_STATUSBAR = "com.egguncle.xposednavigationbar.phonestatusbar";
    public final static String ACTION_FORCE_STOP_AC = "com.egguncle.xpnavbar.forcestoppackage";
    public final static String ACT_NAV_BAR_COLOR="com.egguncle.xpnavbar.navbarcolor";
}
app/src/main/java/com/egguncle/xposednavigationbar/constant/ConstantStr.java
public class ConstantStr {
    public final static String PKG_NAME = "com.egguncle.xposednavigationbar";
    public final static String SHORT_CUT_DATA = "short_cut_data";

    public final static String BACK = "back";
    public final static String NEXT_PAGE = "next";
    public final static String PREVIOUS = "previous";
    public final static String DOWN = "down";
    public final static String CLEAR_NOTIFICATION = "clear_notification";
    public final static String SCREEN_OFF = "screen_off";
    public final static String CLEAR_MEM = "clear_mem";
    public final static String QUICK_NOTICE = "quick_notice";
    public final static String LIGHT = "light";
    public final static String VOLUME = "volume";
    public final static String SMALL_POINT = "small_point";
    public final static String HOME = "home";
    public final static String START_ACTS = "start_acts";
    public final static String NEXT_PLAY = "ic_next";
    public final static String PLAY_MUSIC = "ic_play";
    public final static String PLAY_PREVIOUS = "ic_previous";

    public final static String CLOCK = "clock";

    public final static int FUNC_BACK_CODE = -2;
    public final static int FUNC_SMALL_POINT_CODE = -1;
    public final static int FUNC_DOWN_CODE = 0;
    public final static int FUNC_QUICK_NOTICE_CODE = 1;
    public final static int FUNC_SCREEN_OFF_CODE = 2;
    public final static int FUNC_CLEAR_NOTIFICATION_CODE = 3;
    public final static int FUNC_CLEAR_MEM_CODE = 4;
    public final static int FUNC_VOLUME_CODE = 5;
    public final static int FUNC_LIGHT_CODE = 6;
    public final static int FUNC_HOME_CODE = 7;
    public final static int FUNC_START_ACTS_CODE = 8;
    public final static int FUNC_PREVIOUS_PLAY_CODE = 9;
    public final static int FUNC_PLAY_MUSIC_CODE = 10;
    public final static int FUNC_NEXT_PLAY_CODE = 11;
    public final static int FUNC_WECHAT_SACNNER_CODE = 12;
    public final static int FUNC_ALIPAY_SACNNER_CODE = 13;
    public final static int FUNC_SCREEN_SHOT_CODE = 14;
    //Android自带的三个按钮
    public final static int FUNC_NAV_BACK_CODE = 15;
    public final static int FUNC_NAV_HOME_CODE = 16;
    public final static int FUNC_NAV_RECENT_CODE = 17;

    public final static int FUNC_CLIPBOARD_CODE = 18;
    public final static int FUNC_COMMAND_CODE = 19;

    public final static int FUNC_NAV_HIDE_CODE = 20;

    public static final String HOME_POINT = "home_point";
    public static final String LEFT = "left";
    public static final String RIGHT = "right";
    public static final String DISMISS = "notShow";

    public static final int IMPORTANCE_PERSISTENT = 50;
    public static final int IMPORTANCE_FOREGROUND = 100;
    public static final int IMPORTANCE_VISIBLE = 200;
    public static final int IMPORTANCE_PERCEPTIBLE = 130;
    public static final int IMPORTANCE_CANT_SAVE_STATE = 170;
    public static final int IMPORTANCE_SERVICE = 300;
    public static final int IMPORTANCE_BACKGROUND = 400;
    public static final int IMPORTANCE_EMPTY = 500;

//    public static final String IMPORTANCE_PERSISTENT_NAME = "IMPORTANCE_PERSISTENT";
//    public static final String IMPORTANCE_FOREGROUND_NAME = "IMPORTANCE_FOREGROUND";
//    public static final String IMPORTANCE_VISIBLE_NAME = "IMPORTANCE_VISIBLE";
//    public static final String IMPORTANCE_PERCEPTIBLE_NAME = "IMPORTANCE_PERCEPTIBLE";
//    public static final String IMPORTANCE_CANT_SAVE_STATE_NAME = "IMPORTANCE_CANT_SAVE_STATE";
//    public static final String IMPORTANCE_SERVICE_NAME = "IMPORTANCE_SERVICE_NAME";
//    public static final String IMPORTANCE_BACKGROUND_NAME = "IMPORTANCE_BACKGROUND";
//    public static final String IMPORTANCE_EMPTY_NAME = "IMPORTANCE_EMPTY";

    public static final String ICON_SIZE = "icon_size";

    public static final String TYPE = "type";
    public static final int CLEAR_NOTIFICATIONS = 0;
    public static final int RECENT_TASKS = 1;
    public static final int SHOW_NAVBAR = 2;
    public static final int HIDE_NAVBAR = 3;
    public static final int TAKE_SCREENSHOT = 4;
    public static final int NAVBAR_H = 5;

    public static final String NAVBAR_HEIGHT = "navbar_height";

    public static final String ACTION_COMMAND = "com.egguncle.xposednavigationbar.command";
    public static final String COMMAND_STR="command_str";
}
app/src/main/java/com/egguncle/xposednavigationbar/hook/hookutil/DataHook.java
public class DataHook {
    //用于加载图片资源
    public static Map<Integer, byte[]> mapImgRes = new HashMap<>();
    public static int iconScale;
    public static boolean expandStatusBarWithRoot;
    //用于获取保存的快捷按键设置
    public static List<ShortCut> shortCutList;
    public static int homePointPosition;

    //内存清理强度
    public static int clearMenLevel;
    public static boolean chameleonNavbar;
    public static int navbarHeight;
    public static boolean rootDown;
    public static boolean vibrate;
    public static boolean navbarOpt;
    public static boolean goHomeAfterClick;


    public static void init(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
        XSharedPreferences pre = new XSharedPreferences(BuildConfig.APPLICATION_ID, "xpnavbar");
        pre.makeWorldReadable();

        String json = pre.getString(ConstantStr.SHORT_CUT_DATA, "");
        XpLog.i("short_cut_data " + json);
        expandStatusBarWithRoot = pre.getBoolean(SPUtil.ROOT_DOWN, false);
        clearMenLevel = pre.getInt(SPUtil.CLEAR_MEM_LEVEL, 200);
        //获取主导行栏小点的位置
        homePointPosition = pre.getInt(ConstantStr.HOME_POINT, 0);
        chameleonNavbar = pre.getBoolean(SPUtil.CHAMELEON_NAVBAR, false);
        rootDown = pre.getBoolean(SPUtil.ROOT_DOWN, false);
        vibrate = pre.getBoolean(SPUtil.NAVBAR_VIBRATE, false);
        //获取快捷按钮设置数据
        Gson gson = new Gson();
        //在第一次激活重新启动的时候，可能因为没有设置任何快捷按钮，导致这里报错
        try {
            shortCutList = gson.fromJson(json, ShortCutData.class).getData();
        } catch (Exception e) {
            shortCutList = new ArrayList<>();
        }

        //获取图片缩放大小
        iconScale = pre.getInt(ConstantStr.ICON_SIZE, 40);

        navbarHeight = pre.getInt(SPUtil.NAVBAR_HEIGHT, 100);

        navbarOpt = pre.getBoolean(SPUtil.NAVBAR_HEIGHT_OPT, false);

        goHomeAfterClick = pre.getBoolean(SPUtil.GO_HOME_AFTER_CLICK, false);

        //加载图片资源文件
        Resources res = XModuleResources.createInstance(startupParam.modulePath, null);
        byte[] backImg = XposedHelpers.assetAsByteArray(res, "back.png");
        byte[] clearMenImg = XposedHelpers.assetAsByteArray(res, "clear_mem.png");
        byte[] clearNotificationImg = XposedHelpers.assetAsByteArray(res, "clear_notification.png");
        byte[] downImg = XposedHelpers.assetAsByteArray(res, "down.png");
        byte[] lightImg = XposedHelpers.assetAsByteArray(res, "light.png");
        byte[] quickNoticesImg = XposedHelpers.assetAsByteArray(res, "quick_notices.png");
        byte[] screenOffImg = XposedHelpers.assetAsByteArray(res, "screenoff.png");
        //  byte[] upImg = XposedHelpers.assetAsByteArray(res, "up.png");
        byte[] volume = XposedHelpers.assetAsByteArray(res, "volume.png");
        byte[] smallPonit = XposedHelpers.assetAsByteArray(res, "small_point.png");
        byte[] home = XposedHelpers.assetAsByteArray(res, "ic_home.png");
        byte[] startActs = XposedHelpers.assetAsByteArray(res, "start_acts.png");
        byte[] playMusic = XposedHelpers.assetAsByteArray(res, "ic_music.png");
        byte[] pauseMusic = XposedHelpers.assetAsByteArray(res, "ic_pause.png");
        byte[] previousMusic = XposedHelpers.assetAsByteArray(res, "ic_previous.png");
        byte[] nextMusic = XposedHelpers.assetAsByteArray(res, "ic_next.png");
        byte[] scanWeChat = XposedHelpers.assetAsByteArray(res, "wechat_qr.png");
        byte[] scanAlipay = XposedHelpers.assetAsByteArray(res, "alipay_qr.png");
        byte[] screenshot = XposedHelpers.assetAsByteArray(res, "ic_image.png");
        byte[] navBack = XposedHelpers.assetAsByteArray(res, "ic_sysbar_back.png");
        byte[] navHome = XposedHelpers.assetAsByteArray(res, "ic_sysbar_home.png");
        byte[] navRecent = XposedHelpers.assetAsByteArray(res, "ic_sysbar_recent.png");
        byte[] clipBoard = XposedHelpers.assetAsByteArray(res, "ic_clipboard.png");
        byte[] command = XposedHelpers.assetAsByteArray(res, "ic_command.png");
        byte[] navHide = XposedHelpers.assetAsByteArray(res, "ic_nav_down.png");

        mapImgRes.put(ConstantStr.FUNC_BACK_CODE, backImg);
        mapImgRes.put(ConstantStr.FUNC_CLEAR_MEM_CODE, clearMenImg);
        mapImgRes.put(ConstantStr.FUNC_CLEAR_NOTIFICATION_CODE, clearNotificationImg);
        mapImgRes.put(ConstantStr.FUNC_DOWN_CODE, downImg);
        mapImgRes.put(ConstantStr.FUNC_LIGHT_CODE, lightImg);
        mapImgRes.put(ConstantStr.FUNC_QUICK_NOTICE_CODE, quickNoticesImg);
        mapImgRes.put(ConstantStr.FUNC_SCREEN_OFF_CODE, screenOffImg);
        //  mapImgRes.put(ConstantStr.UP, upImg);
        mapImgRes.put(ConstantStr.FUNC_VOLUME_CODE, volume);
        mapImgRes.put(ConstantStr.FUNC_SMALL_POINT_CODE, smallPonit);
        mapImgRes.put(ConstantStr.FUNC_HOME_CODE, home);
        mapImgRes.put(ConstantStr.FUNC_START_ACTS_CODE, startActs);
        mapImgRes.put(ConstantStr.FUNC_PLAY_MUSIC_CODE, playMusic);
        mapImgRes.put(ConstantStr.FUNC_NEXT_PLAY_CODE, nextMusic);
        mapImgRes.put(ConstantStr.FUNC_PREVIOUS_PLAY_CODE, previousMusic);
        mapImgRes.put(ConstantStr.FUNC_WECHAT_SACNNER_CODE, scanWeChat);
        mapImgRes.put(ConstantStr.FUNC_ALIPAY_SACNNER_CODE, scanAlipay);
        mapImgRes.put(ConstantStr.FUNC_SCREEN_SHOT_CODE, screenshot);
        mapImgRes.put(ConstantStr.FUNC_NAV_BACK_CODE, navBack);
        mapImgRes.put(ConstantStr.FUNC_NAV_HOME_CODE, navHome);
        mapImgRes.put(ConstantStr.FUNC_NAV_RECENT_CODE, navRecent);
        mapImgRes.put(ConstantStr.FUNC_CLIPBOARD_CODE, clipBoard);
        mapImgRes.put(ConstantStr.FUNC_COMMAND_CODE, command);
        mapImgRes.put(ConstantStr.FUNC_NAV_HIDE_CODE, navHide);
    }

}
app/src/main/java/com/egguncle/xposednavigationbar/model/XpNavBarSetting.java
public class XpNavBarSetting implements Parcelable {
    //快捷设置的内容数据
    private List<ShortCut> mShortCutData;

    private int mHomePointPosition;
    private int mIconSize;
    private boolean mRootDown;
    private int mClearMenLevel;
    private boolean mChameleonNavbar;
    private int mNavbarHeight;
    private boolean mVibrate;
    private boolean mNavbarHeightOpt;
    private boolean mGoHomeAfterClick;

    public final static int LEFT = 0;
    public final static int RIGHT = 1;
    public final static int DISMISS = 2;

    public XpNavBarSetting(List<ShortCut> shortCutData, int homePointPosition, int iconSize,
                           boolean rootDown, int clearMenLevel, boolean chameleonNavbar, int navbarHeight,
                           boolean vibrate, boolean navbarHeightOpt, boolean goHomeAfterClick) {
        mShortCutData = shortCutData;
        mHomePointPosition = homePointPosition;
        mIconSize = iconSize;
        mRootDown = rootDown;
        mClearMenLevel = clearMenLevel;
        mChameleonNavbar = chameleonNavbar;
        mNavbarHeight = navbarHeight;
        mVibrate = vibrate;
        mNavbarHeightOpt = navbarHeightOpt;
        mGoHomeAfterClick = goHomeAfterClick;
    }


    protected XpNavBarSetting(Parcel in) {
        mShortCutData = in.createTypedArrayList(ShortCut.CREATOR);
        mHomePointPosition = in.readInt();
        mIconSize = in.readInt();
        mRootDown = in.readByte() != 0;
        mClearMenLevel = in.readInt();
        mChameleonNavbar = in.readByte() != 0;
        mNavbarHeight = in.readInt();
        mVibrate = in.readByte() != 0;
        mNavbarHeightOpt = in.readByte() != 0;
        mGoHomeAfterClick = in.readByte() != 0;
    }

    public static final Creator<XpNavBarSetting> CREATOR = new Creator<XpNavBarSetting>() {
        @Override
        public XpNavBarSetting createFromParcel(Parcel in) {
            return new XpNavBarSetting(in);
        }

        @Override
        public XpNavBarSetting[] newArray(int size) {
            return new XpNavBarSetting[size];
        }
    };

    public List<ShortCut> getShortCutData() {
        return mShortCutData;
    }

    public int getHomePointPosition() {
        return mHomePointPosition;
    }

    public int getIconSize() {
        return mIconSize;
    }

    public boolean isRootDown() {
        return mRootDown;
    }

    public boolean isChameleonNavbar() {
        return mChameleonNavbar;
    }

    public int getClearMenLevel() {
        return mClearMenLevel;
    }

    public int getNavbarHeight() {
        return mNavbarHeight;
    }

    public boolean isVibrate() {
        return mVibrate;
    }

    public boolean isNavbarHeightOpt() {
        return mNavbarHeightOpt;
    }

    public boolean isGoHomeAfterClick() {
        return mGoHomeAfterClick;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeTypedList(mShortCutData);
        dest.writeInt(mHomePointPosition);
        dest.writeInt(mIconSize);
        dest.writeByte((byte) (mRootDown ? 1 : 0));
        dest.writeInt(mClearMenLevel);
        dest.writeByte((byte) (mChameleonNavbar ? 1 : 0));
        dest.writeInt(mNavbarHeight);
        dest.writeByte((byte) (mVibrate ? 1 : 0));
        dest.writeByte((byte) (mNavbarHeightOpt ? 1 : 0));
        dest.writeByte((byte) (mGoHomeAfterClick ? 1 : 0));
    }
}


Question: import android.app.ActivityManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.design.widget.TabLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import com.egguncle.xposednavigationbar.BuildConfig;
import com.egguncle.xposednavigationbar.R;
import com.egguncle.xposednavigationbar.constant.ConstantStr;
import com.egguncle.xposednavigationbar.constant.XpNavBarAction;
import com.egguncle.xposednavigationbar.hook.hookutil.DataHook;
import com.egguncle.xposednavigationbar.hook.util.XpLog;
import com.egguncle.xposednavigationbar.model.ShortCut;
import com.egguncle.xposednavigationbar.model.XpNavBarSetting;
import com.egguncle.xposednavigationbar.ui.fragment.MomoFragment;
import com.egguncle.xposednavigationbar.ui.fragment.SetFunFragment;
import com.egguncle.xposednavigationbar.ui.fragment.SetOtherFragment;
import com.egguncle.xposednavigationbar.util.SPUtil;
import java.util.ArrayList;
import java.util.List;
/*
 *     Navigation bar function expansion module
 *     Copyright (C) 2017 egguncle cicadashadow@gmail.com
 *
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.egguncle.xposednavigationbar.ui.activity;






public class HomeActivity extends BaseActivity {
    private final static String TAG = HomeActivity.class.getName();

    private SectionsPagerAdapter mSectionsPagerAdapter;

    private FloatingActionButton fabAddFunc;
    private SetFunFragment setFunFragment;
Answer:     private SetOtherFragment setOtherFragment;