lmw
2023-06-06 7a563b559c48b9b339784c25fc5f0adc2ab5154e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.sinata.download;
 
import android.app.Activity;
import android.content.Context;
import android.os.Environment;
 
import com.sinata.download.service.ApkDownLoadListener;
 
import java.io.File;
 
/**
 * author:Created by zhaohaoting on 2019/6/25
 * email:526309416@qq.com
 * desc:必须先初始化此类
 */
public class DownloadLibrary {
 
    public static void init(Context context, int ic_launcher, Class<? extends Activity> entranceActivity, String parentFileName) {
        DownloadLibrary.context = context;
        DownloadLibrary.ic_launcher = ic_launcher;
        DownloadLibrary.entranceActivity = entranceActivity;
        DownloadLibrary.PARENT_FILE_NAME = parentFileName;
    }
 
    private static Context context;
    private static int ic_launcher;
    private static Class<? extends Activity> entranceActivity;
    private static ApkDownLoadListener apkDownLoadListener ;
 
    public static ApkDownLoadListener getApkDownLoadListener() {
        return apkDownLoadListener;
    }
 
    public static void setApkDownLoadListener(ApkDownLoadListener apkDownLoadListener) {
        DownloadLibrary.apkDownLoadListener = apkDownLoadListener;
    }
 
    public static String PARENT_FILE_NAME = "download";
    public static String MUSIC_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + PARENT_FILE_NAME + File.separator + "music/";
    public static String VIDEO_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + PARENT_FILE_NAME + File.separator + "video/";
    public static String PICTURE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + PARENT_FILE_NAME + File.separator + "picture/";
    public static String APK_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + PARENT_FILE_NAME + File.separator + "apk/";
    public static String FILE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + PARENT_FILE_NAME + File.separator + "file/";
 
    public static Context getContext() {
        return context;
    }
 
    public static int getIc_launcher() {
        return ic_launcher;
    }
 
    public static Class<? extends Activity> getEntranceActivity() {
        return entranceActivity;
    }
}