-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
75 changed files
with
2,872 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
plugins { | ||
id 'com.android.application' | ||
} | ||
|
||
android { | ||
compileSdk 30 | ||
|
||
defaultConfig { | ||
applicationId "com.dyj.requestpagingscheduleemulator" | ||
minSdk 27 | ||
targetSdk 30 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
// 支持使用viewBinding | ||
buildFeatures { | ||
viewBinding = true | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.appcompat:appcompat:1.3.1' | ||
implementation 'com.google.android.material:material:1.3.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3' | ||
|
||
//引入Rv管理 | ||
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.7' | ||
|
||
implementation 'io.github.scwang90:refresh-layout-kernel:2.0.5' //核心必须依赖 | ||
implementation 'io.github.scwang90:refresh-header-material:2.0.5' //谷歌刷新头 | ||
|
||
// 引入的崩溃管理和跳转UI哭 | ||
implementation 'com.github.tamsiree.RxTool:RxKit:2.6.3' | ||
implementation 'com.github.tamsiree.RxTool:RxUI:2.6.3' | ||
|
||
//ViewBinding | ||
implementation 'com.github.DylanCaiCoding.ViewBindingKTX:viewbinding-base:2.0.6' | ||
implementation 'com.github.DylanCaiCoding.ViewBindingKTX:viewbinding-brvah:2.0.6' | ||
|
||
//glide | ||
implementation 'com.github.bumptech.glide:glide:4.13.0' | ||
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0' | ||
|
||
|
||
testImplementation 'junit:junit:4.+' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.3' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/dyj/requestpagingscheduleemulator/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.dyj.requestpagingscheduleemulator; | ||
|
||
import android.content.Context; | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
assertEquals("com.dyj.requestpagingscheduleemulator", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.dyj.requestpagingscheduleemulator"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:name=".app.App" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.RequestPagingScheduleEmulator"> | ||
<activity | ||
android:name=".module.result.activity.ResultActivity" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".module.main.activity.SplashActivity" | ||
android:exported="true" | ||
android:theme="@style/splashTheme"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name=".module.main.activity.MainActivity" | ||
android:exported="false"></activity> | ||
</application> | ||
|
||
</manifest> |
52 changes: 52 additions & 0 deletions
52
app/src/main/java/com/dyj/requestpagingscheduleemulator/app/App.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.dyj.requestpagingscheduleemulator.app; | ||
|
||
import android.app.Application; | ||
import android.content.ContentProvider; | ||
import android.os.Build; | ||
|
||
import com.dyj.requestpagingscheduleemulator.util.ActivityUtil; | ||
import com.dyj.requestpagingscheduleemulator.util.LogUtil; | ||
import com.dyj.requestpagingscheduleemulator.util.MyUtil; | ||
import com.tamsiree.rxkit.RxTool; | ||
|
||
/** | ||
* @author :Dyj | ||
* @date :Created in 2022/7/1 16:26 | ||
* @description:自定义MyApplication | ||
* @modified By: | ||
* @version: 1.0 | ||
*/ | ||
public class App extends Application { | ||
/** | ||
* Called when the application is starting, before any activity, service, | ||
* or receiver objects (excluding content providers) have been created. | ||
* | ||
* <p>Implementations should be as quick as possible (for example using | ||
* lazy initialization of state) since the time spent in this function | ||
* directly impacts the performance of starting the first activity, | ||
* service, or receiver in a process.</p> | ||
* | ||
* <p>If you override this method, be sure to call {@code super.onCreate()}.</p> | ||
* | ||
* <p class="note">Be aware that direct boot may also affect callback order on | ||
* Android {@link Build.VERSION_CODES#N} and later devices. | ||
* Until the user unlocks the device, only direct boot aware components are | ||
* allowed to run. You should consider that all direct boot unaware | ||
* components, including such {@link ContentProvider}, are | ||
* disabled until user unlock happens, especially when component callback | ||
* order matters.</p> | ||
*/ | ||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
//初始化 | ||
MyUtil.initialize(this); | ||
//设置UI工具 | ||
RxTool.init(this); | ||
//设置打印开关 | ||
LogUtil.setIsLog(true); | ||
//注册Activity生命周期 | ||
registerActivityLifecycleCallbacks(ActivityUtil.getActivityLifecycleCallbacks()); | ||
|
||
} | ||
} |
113 changes: 113 additions & 0 deletions
113
app/src/main/java/com/dyj/requestpagingscheduleemulator/base/BaseActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
package com.dyj.requestpagingscheduleemulator.base; | ||
|
||
|
||
import android.content.Context; | ||
import android.content.pm.ActivityInfo; | ||
import android.content.res.Configuration; | ||
import android.os.Bundle; | ||
import android.os.Handler; | ||
import android.view.View; | ||
|
||
import androidx.annotation.Nullable; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.viewbinding.ViewBinding; | ||
|
||
import com.dyj.requestpagingscheduleemulator.util.MyUtil; | ||
import com.dylanc.viewbinding.base.ViewBindingUtil; | ||
|
||
/** | ||
* @author :Dyj | ||
* @date :Created in 2022/4/12 22:14 | ||
* @description:所有Activity继承自BaseActivity | ||
* @modified By: | ||
* @version: 1.0 | ||
*/ | ||
public abstract class BaseActivity<P extends BasePresenter<? extends BaseView>,VB extends ViewBinding> extends AppCompatActivity implements BaseView { | ||
|
||
private VB binding; | ||
|
||
/** | ||
* presenter层的引用 | ||
*/ | ||
protected P presenter; | ||
|
||
|
||
/** | ||
* 初始化presenter,也是与Activity的绑定 | ||
* | ||
* @return 返回new的Presenter层的值 | ||
*/ | ||
protected abstract P createPresenter(); | ||
|
||
|
||
/** | ||
* 载入view的一些操作 | ||
*/ | ||
protected abstract void initView(); | ||
|
||
|
||
/** | ||
* 载入数据操作 | ||
*/ | ||
protected abstract void initData(); | ||
|
||
|
||
/** | ||
* {@inheritDoc} | ||
* <p> | ||
* Perform initialization of all fragments. | ||
* | ||
* @param savedInstanceState | ||
*/ | ||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
//强制使用竖屏 | ||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | ||
binding = ViewBindingUtil.inflateWithGeneric(this, getLayoutInflater()); | ||
setContentView(binding.getRoot()); | ||
presenter = createPresenter(); | ||
initView(); | ||
initData(); | ||
} | ||
|
||
/** | ||
* 解除presenter与Activity的绑定 | ||
*/ | ||
@Override | ||
protected void onDestroy() { | ||
super.onDestroy(); | ||
if (presenter != null){ | ||
presenter.detachView(); | ||
} | ||
} | ||
|
||
@Override | ||
public void showLoading() { | ||
MyUtil.showLoading(this); | ||
} | ||
|
||
@Override | ||
public void SuccessHideLoading() { | ||
new Handler().postDelayed(MyUtil::dismissSuccessLoading,500); | ||
} | ||
|
||
@Override | ||
public void FailedHideLoading() { | ||
new Handler().postDelayed(MyUtil::dismissFailedLoading,500); | ||
} | ||
|
||
/** | ||
* 查看当前是否为深色模式 | ||
* | ||
* @param context 传入当前context | ||
* @return 返回ture 偶然false | ||
*/ | ||
public Boolean getDarkModeStatus(Context context){ | ||
int mode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; | ||
return mode == Configuration.UI_MODE_NIGHT_YES; | ||
} | ||
public VB getBinding() { | ||
return binding; | ||
} | ||
} |
Oops, something went wrong.