Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
1.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelzero committed Sep 17, 2021
1 parent 983f2ac commit a5a98e0
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 59 deletions.
4 changes: 4 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-parcelize")
id("com.didi.dokit")
}
setupAppModule {
defaultConfig {
Expand Down Expand Up @@ -52,4 +53,7 @@ dependencies {
implementation(project(":FrescoImageLoader"))
implementation(project(":SketchImageViewLoader"))
implementation(project(":coilimageloader"))

debugImplementation("io.github.didi.dokit:dokitx:3.5.0-beta01")
releaseImplementation("io.github.didi.dokit:dokitx-no-op:3.5.0-beta01")
}
3 changes: 2 additions & 1 deletion app/src/main/java/net/mikaelzero/app/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package net.mikaelzero.app
import android.app.Application
import android.content.Context
import androidx.multidex.MultiDex
import com.didichuxing.doraemonkit.DoKit
import net.mikaelzero.mojito.Mojito
import net.mikaelzero.mojito.loader.glide.GlideImageLoader
import net.mikaelzero.mojito.view.sketch.SketchImageLoadFactory
Expand All @@ -17,6 +18,6 @@ class App : Application() {

override fun onCreate() {
super.onCreate()

DoKit.Builder(this).build()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.widget.ImageView
import android.widget.TextView
import net.mikaelzero.mojito.interfaces.ActivityCoverLoader
import net.mikaelzero.mojito.interfaces.IMojitoActivity
import net.mikaelzero.mojito.interfaces.IMojitoFragment

/**
* @Author: MikaelZero
Expand All @@ -22,7 +21,7 @@ class BilibiliActivityCoverLoader : ActivityCoverLoader {
numTv = view.findViewById(R.id.numTv)
val closeIv = view.findViewById<ImageView>(R.id.closeIv)
closeIv.setOnClickListener {
context.getCurrentFragment().backToMin()
context.getCurrentFragment()?.backToMin()
}
}

Expand All @@ -39,7 +38,7 @@ class BilibiliActivityCoverLoader : ActivityCoverLoader {
}

@SuppressLint("SetTextI18n")
override fun pageChange(iMojitoFragment: IMojitoFragment, totalSize: Int, position: Int) {
override fun pageChange(totalSize: Int, position: Int) {
numTv?.text = (position + 1).toString() + "/" + totalSize
}

Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/net/mikaelzero/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ class MainActivity : AppCompatActivity() {
Glide.get(this).clearMemory()
Thread { Glide.get(this).clearDiskCache() }.start()
GlideImageLoader.with(applicationContext).cleanCache()
val imagePipeline = Fresco.getImagePipeline()
imagePipeline.clearMemoryCaches()
imagePipeline.clearDiskCaches()
imagePipeline.clearCaches()
FrescoImageLoader.with(applicationContext).cleanCache()
// val imagePipeline = Fresco.getImagePipeline()
// imagePipeline.clearMemoryCaches()
// imagePipeline.clearDiskCaches()
// imagePipeline.clearCaches()
// FrescoImageLoader.with(applicationContext).cleanCache()
}
}

Expand Down
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ buildscript {
repositories {
google()
maven("https://jitpack.io")
maven("https://oss.sonatype.org/content/repositories/public")
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath(rootProject.extra["androidPlugin"].toString())
classpath(rootProject.extra["kotlinPlugin"].toString())
classpath(rootProject.extra["mavenPublishPlugin"].toString())
classpath("io.github.didi.dokit:dokitx-plugin:3.5.0.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
}
}
tasks.register<Delete>(name = "clean") {
Expand All @@ -20,6 +23,7 @@ allprojects {
repositories {
google()
maven("https://jitpack.io")
maven("https://oss.sonatype.org/content/repositories/public")
mavenCentral()
gradlePluginPortal()
}
Expand Down
14 changes: 13 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@ targetSdk=30
compileSdk=30
# Maven
GROUP=com.github.mikaelzero
VERSION_NAME=1.8.1
VERSION_NAME=1.8.2
DOKIT_PLUGIN_SWITCH=true
#// DOKIT读取三方库会和booster冲突 如果你的项目中也集成了booster 建议将开关改成false
DOKIT_THIRD_LIB_SWITCH=true
#// 插件日志
DOKIT_LOG_SWITCH=true
#// dokit 慢函数开关
DOKIT_METHOD_SWITCH=true
#// dokit 函数调用栈层级
DOKIT_METHOD_STACK_LEVEL=4
#// 0:默认模式 打印函数调用栈 需添加指定入口 默认为application onCreate 和attachBaseContext
#// 1:普通模式 运行时打印某个函数的耗时 全局业务代码函数插入
DOKIT_METHOD_STRATEGY=1
2 changes: 1 addition & 1 deletion mojito/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ dependencies {
implementation(mojito.Library.ANDROIDX_RECYCLER_VIEW)
implementation(mojito.Library.KOTLINX_STDLIB)
implementation("com.gyf.immersionbar:immersionbar:3.0.0")
implementation("androidx.exifinterface:exifinterface:1.3.2")
implementation("androidx.exifinterface:exifinterface:1.3.3")
implementation("androidx.viewpager2:viewpager2:1.0.0")
}
3 changes: 0 additions & 3 deletions mojito/src/main/java/net/mikaelzero/mojito/MojitoBuilder.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package net.mikaelzero.mojito

import android.graphics.drawable.Drawable
import android.view.View
import android.widget.FrameLayout
import androidx.annotation.IdRes
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import androidx.viewpager.widget.ViewPager
import net.mikaelzero.mojito.bean.ActivityConfig
import net.mikaelzero.mojito.bean.ViewParams
import net.mikaelzero.mojito.interfaces.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,27 @@ public void attach(FrameLayout parent) {
}

@Override
public void onShow(ViewPager2 viewPager) {
public void onShow(ViewPager viewPager) {
numTv.setVisibility(View.VISIBLE);
if (viewPager.getAdapter() != null) {
viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

}

@Override
public void onPageSelected(int position) {
String str = (position + 1) + "/" + viewPager.getAdapter().getItemCount();
String str = (position + 1) + "/" + viewPager.getAdapter().getCount();
numTv.setText(str);
}

@Override
public void onPageScrollStateChanged(int state) {

}
});
String firstStr = (viewPager.getCurrentItem() + 1) + "/" + viewPager.getAdapter().getItemCount();
String firstStr = (viewPager.getCurrentItem() + 1) + "/" + viewPager.getAdapter().getCount();
numTv.setText(firstStr);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ interface ActivityCoverLoader {
* 手指松开后的状态
*/
fun fingerRelease(isToMax: Boolean, isToMin: Boolean)
fun pageChange(iMojitoFragment: IMojitoFragment, totalSize: Int, position: Int)
fun pageChange(totalSize: Int, position: Int)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface IIndicator {

void attach(FrameLayout parent);

void onShow(ViewPager2 viewPager);
void onShow(ViewPager viewPager);

/**
* 拖动的时候 移动的 X 和 Y 距离
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import android.content.Context
* @Description:
*/
interface IMojitoActivity {
fun getCurrentFragment(): IMojitoFragment
fun getCurrentFragment(): IMojitoFragment?
fun getContext():Context
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.fragment.app.Fragment
* @Description:
*/
interface IMojitoFragment {
fun providerContext():Fragment?
fun providerContext(): Fragment?
fun loadTargetUrl()
fun backToMin()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package net.mikaelzero.mojito.tools;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import androidx.viewpager.widget.ViewPager;

/**
* @Author: MikaelZero
* @CreateDate: 2020/6/13 11:56 AM
* @Description:
*/
public class NoScrollViewPager extends ViewPager {
private boolean isLocked;

public NoScrollViewPager(Context context) {
super(context);
}

public NoScrollViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}

@Override
public void setCurrentItem(int item, boolean smoothScroll) {
super.setCurrentItem(item, smoothScroll);
}

@Override
public void setCurrentItem(int item) {
super.setCurrentItem(item, false);
}

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (!isLocked) {
try {
return super.onInterceptTouchEvent(ev);
} catch (IllegalArgumentException ex) {
ex.printStackTrace();
return false;
}
}
return false;
}

@Override
public boolean onTouchEvent(MotionEvent event) {
return !isLocked && super.onTouchEvent(event);
}

public void setLocked(boolean isLocked) {
this.isLocked = isLocked;
}

public boolean isLocked() {
return isLocked;
}
}
Loading

0 comments on commit a5a98e0

Please sign in to comment.