package com.kfzs.duanduan.view;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.provider.Settings;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.view.View;

import com.sheep.gamegroup.model.entity.DialogConfig;
import com.sheep.gamegroup.util.ActivityManager;
import com.sheep.gamegroup.util.ViewUtil;
import com.sheep.jiuyan.samllsheep.SheepApp;

/**
 * 空间不足提示框
 *  @auther realicing
 */

public class DialogStorageLow {

    public static AlertDialog showDialog(String msgMore) {
        final Activity activity = ActivityManager.getInstance().currentActivity();
        return ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("温馨提示").setMsgMore("存储空间不足\n请释放一些储存空间，并重新尝试安装!" + (TextUtils.isEmpty(msgMore) ? "" : ("\n"+msgMore)))
            .setBtnRightText("取消").setBtnLeftText("管理应用").setBtnLeftOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent intent = new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
                        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        activity.startActivity(intent);
                    }
                }));
    }
}
