|
| 1 | +/* |
| 2 | + * Copyright 2017 JessYan |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package com.timecat.module.files; |
| 17 | + |
| 18 | +import android.app.Application; |
| 19 | +import android.content.Context; |
| 20 | + |
| 21 | +import com.jess.arms.base.delegate.AppLifecycles; |
| 22 | +import com.jess.arms.di.module.GlobalConfigModule; |
| 23 | +import com.jess.arms.integration.ConfigModule; |
| 24 | + |
| 25 | +import java.util.List; |
| 26 | + |
| 27 | +import androidx.annotation.Keep; |
| 28 | +import androidx.annotation.NonNull; |
| 29 | +import androidx.fragment.app.FragmentManager; |
| 30 | +import me.zhanghai.android.files.app.AppProviderKt; |
| 31 | + |
| 32 | +/** |
| 33 | + * ================================================ |
| 34 | + * 组件的全局配置信息在此配置, 需要将此实现类声明到 AndroidManifest 中 |
| 35 | + * CommonSDK 中已有 {@link com.timecat.component.commonsdk.core.GlobalConfiguration} 配置有所有组件都可公用的配置信息 |
| 36 | + * 这里用来配置一些组件自身私有的配置信息 |
| 37 | + * |
| 38 | + * @see com.jess.arms.base.delegate.AppDelegate |
| 39 | + * @see com.jess.arms.integration.ManifestParser |
| 40 | + * @see <a href="https://github.com/JessYanCoding/ArmsComponent/wiki#3.3">ConfigModule wiki 官方文档</a> |
| 41 | + * Created by JessYan on 12/04/2017 17:25 |
| 42 | + * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a> |
| 43 | + * <a href="https://github.com/JessYanCoding">Follow me</a> |
| 44 | + * ================================================ |
| 45 | + */ |
| 46 | +@Keep |
| 47 | +public final class GlobalConfiguration implements ConfigModule { |
| 48 | + |
| 49 | + @Override |
| 50 | + public void applyOptions(Context context, GlobalConfigModule.Builder builder) { |
| 51 | + |
| 52 | + } |
| 53 | + |
| 54 | + @Override |
| 55 | + public void injectAppLifecycle(Context context, List<AppLifecycles> lifecycles) { |
| 56 | + // AppLifecycles 的所有方法都会在基类 Application 的对应的生命周期中被调用,所以在对应的方法中可以扩展一些自己需要的逻辑 |
| 57 | + // 可以根据不同的逻辑添加多个实现类 |
| 58 | + |
| 59 | + lifecycles.add(new AppLifecycles() { |
| 60 | + @Override |
| 61 | + public void attachBaseContext(@NonNull Context base) { |
| 62 | + |
| 63 | + } |
| 64 | + |
| 65 | + @Override |
| 66 | + public void onCreate(@NonNull Application application) { |
| 67 | + AppProviderKt.initApplication(application); |
| 68 | + } |
| 69 | + |
| 70 | + @Override |
| 71 | + public void onTerminate(@NonNull Application application) { |
| 72 | + |
| 73 | + } |
| 74 | + }); |
| 75 | + } |
| 76 | + |
| 77 | + @Override |
| 78 | + public void injectActivityLifecycle(Context context, List<Application.ActivityLifecycleCallbacks> lifecycles) { |
| 79 | + |
| 80 | + } |
| 81 | + |
| 82 | + @Override |
| 83 | + public void injectFragmentLifecycle(Context context, List<FragmentManager.FragmentLifecycleCallbacks> lifecycles) { |
| 84 | + |
| 85 | + } |
| 86 | + |
| 87 | +} |
0 commit comments