-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
cad3756
commit 306dc45
Showing
42 changed files
with
1,630 additions
and
27 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
CommonRes/src/main/java/com/gracefulwind/learnarms/commonres/widget/NoScrollViewPager.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,60 @@ | ||
package com.gracefulwind.learnarms.commonres.widget; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.MotionEvent; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.viewpager.widget.ViewPager; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* @ClassName: NoScrollViewPager | ||
* @Author: Gracefulwind | ||
* @CreateDate: 2022/2/22 | ||
* @Description: --------------------------- | ||
* 禁止滑动的viewPager | ||
* @UpdateUser: | ||
* @UpdateDate: 2022/2/22 | ||
* @UpdateRemark: | ||
* @Version: 1.0 | ||
* @Email: [email protected] | ||
*/ | ||
public class NoScrollViewPager extends ViewPager { | ||
|
||
private boolean noScroll = true; | ||
|
||
public NoScrollViewPager(@NonNull @NotNull Context context) { | ||
super(context); | ||
} | ||
|
||
public NoScrollViewPager(@NonNull @NotNull Context context, @Nullable @org.jetbrains.annotations.Nullable AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
//调用此方法 参数为true 即可禁止滑动 | ||
public void setNoScroll(boolean noScroll) { | ||
this.noScroll = noScroll; | ||
} | ||
|
||
@Override | ||
public boolean onTouchEvent(MotionEvent arg0) { | ||
if (noScroll){ | ||
return false; | ||
}else { | ||
return super.onTouchEvent(arg0); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean onInterceptTouchEvent(MotionEvent arg0) { | ||
if (noScroll){ | ||
return false; | ||
}else { | ||
return super.onInterceptTouchEvent(arg0); | ||
} | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
CommonSDK/src/main/java/com/gracefulwind/learnarms/commonsdk/base/DefaultFragment.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,39 @@ | ||
package com.gracefulwind.learnarms.commonsdk.base; | ||
|
||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.fragment.app.Fragment; | ||
|
||
import com.alibaba.android.arouter.facade.annotation.Route; | ||
import com.gracefulwind.learnarms.commonsdk.R; | ||
import com.gracefulwind.learnarms.commonsdk.core.RouterHub; | ||
|
||
/** | ||
* @ClassName: DefaultFragment | ||
* @Author: Gracefulwind | ||
* @CreateDate: 2022/2/22 | ||
* @Description: --------------------------- | ||
* defaultFragment 默认空白页面 | ||
* @UpdateUser: | ||
* @UpdateDate: 2022/2/22 | ||
* @UpdateRemark: | ||
* @Version: 1.0 | ||
* @Email: [email protected] | ||
*/ | ||
@Route(path = RouterHub.Default.DEFAULT_FRAGMENT) | ||
//@Route(path = "/degrade/fragment") | ||
public class DefaultFragment extends Fragment { | ||
View mRootView; | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
mRootView = inflater.inflate(R.layout.fragment_default, container, false); | ||
return mRootView; | ||
} | ||
} |
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
37 changes: 37 additions & 0 deletions
37
CommonSDK/src/main/java/com/gracefulwind/learnarms/commonsdk/utils/ARouterUtil.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,37 @@ | ||
package com.gracefulwind.learnarms.commonsdk.utils; | ||
|
||
import androidx.fragment.app.Fragment; | ||
|
||
import com.alibaba.android.arouter.launcher.ARouter; | ||
import com.gracefulwind.learnarms.commonsdk.base.DefaultFragment; | ||
import com.gracefulwind.learnarms.commonsdk.core.RouterHub; | ||
|
||
/** | ||
* @ClassName: ArouterUtil | ||
* @Author: Gracefulwind | ||
* @CreateDate: 2022/2/22 | ||
* @Description: --------------------------- | ||
* @UpdateUser: | ||
* @UpdateDate: 2022/2/22 | ||
* @UpdateRemark: | ||
* @Version: 1.0 | ||
* @Email: [email protected] | ||
*/ | ||
public class ARouterUtil { | ||
|
||
/** | ||
* 通过路由地址生成相应fragment,如果地址有误则生成default页面 | ||
* | ||
* */ | ||
public static Fragment getFragment(String path){ | ||
Object targetFragment = ARouter.getInstance().build(path).navigation(); | ||
if(null != targetFragment && targetFragment instanceof Fragment){ | ||
return (Fragment) targetFragment; | ||
} | ||
// return (Fragment) ARouter.getInstance().build(RouterHub.Default.DEFAULT_FRAGMENT).navigation(); | ||
//一直为null...为什么 | ||
// return (Fragment) ARouter.getInstance().build("/degrade/fragment").navigation(); | ||
return new DefaultFragment(); | ||
} | ||
|
||
} |
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,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
android:text="默认页面"/> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
29 changes: 29 additions & 0 deletions
29
...er/src/main/java/com/gracefulwind/learnarms/reader/mvp/contract/BookActivityContract.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,29 @@ | ||
package com.gracefulwind.learnarms.reader.mvp.contract; | ||
|
||
|
||
import com.jess.arms.mvp.IModel; | ||
import com.jess.arms.mvp.IView; | ||
|
||
/** | ||
* ================================================ | ||
* Description: | ||
* <p> | ||
* Created by MVPArmsTemplate on 2021/08/20 10:54 | ||
* <a href="mailto:[email protected]">Contact me</a> | ||
* <a href="https://github.com/JessYanCoding">Follow me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a> | ||
* ================================================ | ||
*/ | ||
public interface BookActivityContract { | ||
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 | ||
interface View extends IView { | ||
|
||
} | ||
|
||
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 | ||
interface Model extends IModel { | ||
|
||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...reader/src/main/java/com/gracefulwind/learnarms/reader/mvp/contract/BookMallContract.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,29 @@ | ||
package com.gracefulwind.learnarms.reader.mvp.contract; | ||
|
||
|
||
import com.jess.arms.mvp.IModel; | ||
import com.jess.arms.mvp.IView; | ||
|
||
/** | ||
* ================================================ | ||
* Description: | ||
* <p> | ||
* Created by MVPArmsTemplate on 2021/08/20 10:54 | ||
* <a href="mailto:[email protected]">Contact me</a> | ||
* <a href="https://github.com/JessYanCoding">Follow me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a> | ||
* ================================================ | ||
*/ | ||
public interface BookMallContract { | ||
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 | ||
interface View extends IView { | ||
|
||
} | ||
|
||
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 | ||
interface Model extends IModel { | ||
|
||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...reader/src/main/java/com/gracefulwind/learnarms/reader/mvp/contract/BookMineContract.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,29 @@ | ||
package com.gracefulwind.learnarms.reader.mvp.contract; | ||
|
||
|
||
import com.jess.arms.mvp.IModel; | ||
import com.jess.arms.mvp.IView; | ||
|
||
/** | ||
* ================================================ | ||
* Description: | ||
* <p> | ||
* Created by MVPArmsTemplate on 2021/08/20 10:54 | ||
* <a href="mailto:[email protected]">Contact me</a> | ||
* <a href="https://github.com/JessYanCoding">Follow me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a> | ||
* ================================================ | ||
*/ | ||
public interface BookMineContract { | ||
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 | ||
interface View extends IView { | ||
|
||
} | ||
|
||
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 | ||
interface Model extends IModel { | ||
|
||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...ader/src/main/java/com/gracefulwind/learnarms/reader/mvp/contract/BookSearchContract.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,29 @@ | ||
package com.gracefulwind.learnarms.reader.mvp.contract; | ||
|
||
|
||
import com.jess.arms.mvp.IModel; | ||
import com.jess.arms.mvp.IView; | ||
|
||
/** | ||
* ================================================ | ||
* Description: | ||
* <p> | ||
* Created by MVPArmsTemplate on 2021/08/20 10:54 | ||
* <a href="mailto:[email protected]">Contact me</a> | ||
* <a href="https://github.com/JessYanCoding">Follow me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a> | ||
* ================================================ | ||
*/ | ||
public interface BookSearchContract { | ||
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 | ||
interface View extends IView { | ||
|
||
} | ||
|
||
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 | ||
interface Model extends IModel { | ||
|
||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...eader/src/main/java/com/gracefulwind/learnarms/reader/mvp/contract/BookShelfContract.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,29 @@ | ||
package com.gracefulwind.learnarms.reader.mvp.contract; | ||
|
||
|
||
import com.jess.arms.mvp.IModel; | ||
import com.jess.arms.mvp.IView; | ||
|
||
/** | ||
* ================================================ | ||
* Description: | ||
* <p> | ||
* Created by MVPArmsTemplate on 2021/08/20 10:54 | ||
* <a href="mailto:[email protected]">Contact me</a> | ||
* <a href="https://github.com/JessYanCoding">Follow me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a> | ||
* ================================================ | ||
*/ | ||
public interface BookShelfContract { | ||
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 | ||
interface View extends IView { | ||
|
||
} | ||
|
||
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 | ||
interface Model extends IModel { | ||
|
||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...c/main/java/com/gracefulwind/learnarms/reader/mvp/di/component/BookActivityComponent.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,39 @@ | ||
package com.gracefulwind.learnarms.reader.mvp.di.component; | ||
|
||
import com.gracefulwind.learnarms.reader.mvp.contract.BookActivityContract; | ||
import com.gracefulwind.learnarms.reader.mvp.contract.BookMallContract; | ||
import com.gracefulwind.learnarms.reader.mvp.di.module.BookActivityModule; | ||
import com.gracefulwind.learnarms.reader.mvp.di.module.BookMallModule; | ||
import com.gracefulwind.learnarms.reader.mvp.ui.fragment.BookActivityFragment; | ||
import com.gracefulwind.learnarms.reader.mvp.ui.fragment.BookMallFragment; | ||
import com.jess.arms.di.component.AppComponent; | ||
import com.jess.arms.di.scope.ActivityScope; | ||
|
||
import dagger.BindsInstance; | ||
import dagger.Component; | ||
|
||
/** | ||
* ================================================ | ||
* Description: | ||
* <p> | ||
* Created by MVPArmsTemplate on 2021/08/20 10:54 | ||
* <a href="mailto:[email protected]">Contact me</a> | ||
* <a href="https://github.com/JessYanCoding">Follow me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a> | ||
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a> | ||
* ================================================ | ||
*/ | ||
@ActivityScope | ||
@Component(modules = BookActivityModule.class, dependencies = AppComponent.class) | ||
public interface BookActivityComponent { | ||
|
||
void inject(BookActivityFragment fragment); | ||
@Component.Builder | ||
interface Builder { | ||
@BindsInstance | ||
BookActivityComponent.Builder view(BookActivityContract.View view); | ||
BookActivityComponent.Builder appComponent(AppComponent appComponent); | ||
BookActivityComponent build(); | ||
} | ||
} |
Oops, something went wrong.