Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复问题 #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ android {
}
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
ndkVersion rootProject.ext.android.ndkVersion
defaultConfig {
applicationId rootProject.ext.android.applicationId
minSdkVersion rootProject.ext.android.minSdkVersion
Expand Down
1 change: 1 addition & 0 deletions config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ext {
applicationId : "com.mvvm.mvvmcomponent",
versionCode : 1,
versionName : "1.0",
ndkVersion : '21.3.6528147'
]

//version 版本控制
Expand Down
1 change: 1 addition & 0 deletions library-base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ dependencies {
api rootProject.ext.dependencies["gson"]
api rootProject.ext.dependencies["rxjava2"]
api rootProject.ext.dependencies["rxpermissions"]
api rootProject.ext.dependencies["arouter-api"]
api rootProject.ext.dependencies["mmkv"]
api rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
api rootProject.ext.dependencies["immersionbar"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.drz.common.adapter;
package com.drz.base.adapter;

import android.app.Activity;
import android.app.Application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.alibaba.android.arouter.launcher.ARouter;
import com.drz.base.adapter.ScreenAutoAdapter;
import com.tencent.mmkv.MMKV;

import java.util.List;

/**
Expand All @@ -30,6 +34,10 @@ public class BaseApplication extends Application
public void onCreate()
{
super.onCreate();
// 在此初始化是为了其他模块可以使用
ARouter.init(this);
MMKV.initialize(this);
ScreenAutoAdapter.setup(this);
setApplication(this);
}

Expand Down
1 change: 0 additions & 1 deletion library-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ dependencies {
api 'com.scwang.smart:refresh-layout-kernel:2.0.0-alpha-1'
api 'com.scwang.smart:refresh-header-classics:2.0.0-alpha-1'
api 'com.scwang.smart:refresh-footer-classics:2.0.0-alpha-1'
api rootProject.ext.dependencies["arouter-api"]
api 'com.orhanobut:logger:2.2.0'
api 'org.jetbrains:annotations:15.0'
api 'com.blankj:utilcodex:1.26.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public boolean isLoggable(int priority, @Nullable String tag)
ARouter.openLog(); // 开启日志
ARouter.openDebug(); // 使用InstantRun的时候,需要打开该开关,上线之后关闭,否则有安全风险
}
ARouter.init(application);
MMKV.initialize(application);
Logger.i("基础层初始化完毕 -- onInitAhead");

return false;
Expand Down
68 changes: 50 additions & 18 deletions module-home/src/main/java/com/drz/home/daily/DailyModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.zhouyou.http.exception.ApiException;

import android.text.TextUtils;
import android.util.Log;

import io.reactivex.disposables.Disposable;

Expand Down Expand Up @@ -79,6 +80,7 @@ public void onError(ApiException e)
@Override
public void onSuccess(String s)
{
// e("DailyModel", "onSuccess: " + s.replace("\r", "").replace("\n","").replace("\t", ""));
parseJson(s);
}
});
Expand Down Expand Up @@ -160,24 +162,54 @@ private void paresFollowCard(List<BaseCustomViewModel> viewModels,
FollowCardBean cardBean)
{
FollowCardViewModel followCardViewModel = new FollowCardViewModel();
followCardViewModel.coverUrl =
cardBean.getData().getContent().getData().getCover().getDetail();
followCardViewModel.videoTime =
cardBean.getData().getContent().getData().getDuration();
followCardViewModel.authorUrl =
cardBean.getData().getContent().getData().getAuthor().getIcon();
followCardViewModel.description =
cardBean.getData().getContent().getData().getAuthor().getName()
+ " / #"
+ cardBean.getData().getContent().getData().getCategory();
followCardViewModel.title =
cardBean.getData().getContent().getData().getTitle();
followCardViewModel.video_description = cardBean.getData().getContent().getData().getDescription();
followCardViewModel.userDescription = cardBean.getData().getContent().getData().getAuthor().getDescription();
followCardViewModel.playerUrl = cardBean.getData().getContent().getData().getPlayUrl();
followCardViewModel.blurredUrl = cardBean.getData().getContent().getData().getCover().getBlurred();
followCardViewModel.videoId = cardBean.getData().getContent().getData().getId();
viewModels.add(followCardViewModel);
if (cardBean.getData() != null && cardBean.getData().getContent().getData() != null){
FollowCardBean.DataBeanX.ContentBean.DataBean bean = cardBean.getData().getContent().getData();
if (bean.getCover()!= null){
followCardViewModel.coverUrl =
bean.getCover().getDetail();
followCardViewModel.blurredUrl = bean.getCover().getBlurred();
}

followCardViewModel.videoTime =
cardBean.getData().getContent().getData().getDuration();

if (bean.getAuthor() != null){
followCardViewModel.authorUrl =
cardBean.getData().getContent().getData().getAuthor().getIcon();
followCardViewModel.description =
cardBean.getData().getContent().getData().getAuthor().getName()
+ " / #"
+ cardBean.getData().getContent().getData().getCategory();
followCardViewModel.userDescription = bean.getAuthor().getDescription();

}

followCardViewModel.title =
cardBean.getData().getContent().getData().getTitle();
followCardViewModel.video_description = cardBean.getData().getContent().getData().getDescription();
followCardViewModel.playerUrl = cardBean.getData().getContent().getData().getPlayUrl();
followCardViewModel.videoId = cardBean.getData().getContent().getData().getId();
viewModels.add(followCardViewModel);
}
}

public static void e(String tag, String msg) {
if (tag == null || tag.length() == 0
|| msg == null || msg.length() == 0)
return;

int segmentSize = 3 * 1024;
long length = msg.length();
if (length <= segmentSize ) {// 长度小于等于限制直接打印
Log.e(tag, msg);
}else {
while (msg.length() > segmentSize ) {// 循环分段打印日志
String logContent = msg.substring(0, segmentSize );
msg = msg.replace(logContent, "");
Log.e(tag, logContent);
}
Log.e(tag, msg);// 打印剩余日志
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import com.drz.base.loadsir.LoadingCallback;
import com.drz.base.loadsir.TimeoutCallback;
import com.drz.common.IModuleInit;
import com.drz.common.adapter.ScreenAutoAdapter;
import com.kingja.loadsir.core.LoadSir;
import com.limpoxe.support.servicemanager.ServiceManager;
import com.orhanobut.logger.Logger;
import com.zhouyou.http.EasyHttp;
import com.zhouyou.http.cache.converter.GsonDiskConverter;
Expand All @@ -29,7 +27,6 @@ public class MainModuleInit implements IModuleInit
@Override
public boolean onInitAhead(BaseApplication application)
{
ScreenAutoAdapter.setup(application);
EasyHttp.init(application);
if (application.issDebug())
{
Expand Down
4 changes: 1 addition & 3 deletions module-main/src/main/java/com/drz/main/ui/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.drz.main.ui;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentPagerAdapter;

Expand All @@ -14,8 +13,7 @@
import com.drz.base.activity.MvvmBaseActivity;
import com.drz.base.storage.MmkvHelper;
import com.drz.base.viewmodel.IMvvmBaseViewModel;
import com.drz.base.viewmodel.MvmBaseViewModel;
import com.drz.common.adapter.ScreenAutoAdapter;
import com.drz.base.adapter.ScreenAutoAdapter;
import com.drz.common.router.RouterActivityPath;
import com.drz.common.router.RouterFragmentPath;
import com.drz.main.R;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.drz.base.base.BaseApplication;
import com.drz.base.storage.MmkvHelper;
import com.drz.common.adapter.ScreenAutoAdapter;
import com.drz.common.config.ModuleLifecycleConfig;
import com.drz.base.adapter.ScreenAutoAdapter;
import com.drz.main.R;
import com.drz.main.ui.MainActivity;
import com.gyf.immersionbar.BarHide;
import com.gyf.immersionbar.ImmersionBar;

Expand Down
1 change: 1 addition & 0 deletions module-more/src/main/alone/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package="com.drz.more">

<application
android:name="com.drz.base.base.BaseApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand Down
1 change: 1 addition & 0 deletions module-player/src/main/alone/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package="com.drz.player">

<application
android:name="com.drz.base.base.BaseApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.drz.player;

import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.util.ArrayList;

Expand All @@ -9,7 +8,7 @@
import com.alibaba.android.arouter.launcher.ARouter;
import com.drz.base.activity.MvvmBaseActivity;
import com.drz.base.livedatabus.LiveDatabus;
import com.drz.common.adapter.ScreenAutoAdapter;
import com.drz.base.adapter.ScreenAutoAdapter;
import com.drz.common.contract.BaseCustomViewModel;
import com.drz.common.router.RouterActivityPath;
import com.drz.player.adapter.ProviderVideoPagerAdapter;
Expand All @@ -18,18 +17,13 @@
import com.drz.player.databinding.PlayerItemVideoHeaderViewBinding;
import com.drz.video.helper.VideoPlayerHelper;
import com.gyf.immersionbar.ImmersionBar;
import com.kingja.loadsir.core.LoadSir;
import com.orhanobut.logger.Logger;
import com.scwang.smart.refresh.header.ClassicsHeader;
import com.shuyu.gsyvideoplayer.GSYVideoManager;
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack;
import com.shuyu.gsyvideoplayer.utils.OrientationUtils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.hardware.SensorEventListener;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.OrientationEventListener;
Expand Down
1 change: 1 addition & 0 deletions module-user/src/main/alone/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package="com.drz.user">

<application
android:name="com.drz.base.base.BaseApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand Down
2 changes: 1 addition & 1 deletion module-user/src/main/java/com/drz/user/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private void initView() {
ObjectAnimator animator2 = ObjectAnimator.ofFloat(binding.loginBgImage2, "alpha", 0f, 1.0f);
ObjectAnimator animatorScale1 = ObjectAnimator.ofFloat(binding.loginBgImage1, "scaleX", 1.0f, 1.3f);
ObjectAnimator animatorScale2 = ObjectAnimator.ofFloat(binding.loginBgImage1, "scaleY", 1.0f, 1.3f);
AnimatorSet animatorSet1 = new AnimatorSet();
AnimatorSet animatorSet1 = new AnimatorSet();
animatorSet1.setDuration(5000);
animatorSet1.play(animator1).with(animator2).with(animatorScale1).with(animatorScale2);
animatorSet1.addListener(new Animator.AnimatorListener() {
Expand Down
1 change: 1 addition & 0 deletions module.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if (isBuildModule.toBoolean()) {
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
ndkVersion rootProject.ext.android.ndkVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
Expand Down