feat: 版本提测

This commit is contained in:
eggmanQQQ
2024-12-17 14:31:46 +08:00
parent a1e908183d
commit 2dd35ac0ce
63 changed files with 903 additions and 260 deletions

View File

@@ -336,6 +336,12 @@ public class SmartTabLayout extends HorizontalScrollView {
}
}
public void setViews(int count,TabProvider provider) {
setCustomTabView(provider);
tabStrip.removeAllViews();
populateTabViews(count);
}
/**
* Returns the view at the specified position in the tabs.
*
@@ -422,6 +428,34 @@ public class SmartTabLayout extends HorizontalScrollView {
}
}
private void populateTabViews(int count) {
try {
for (int i = 0; i < count; i++) {
final View tabView = tabProvider.createTabView(tabStrip, i, null);
if (tabView == null) {
throw new IllegalStateException("tabView is null.");
}
if (distributeEvenly) {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams();
lp.width = 0;
lp.weight = 1;
}
if (internalTabClickListener != null) {
tabView.setOnClickListener(internalTabClickListener);
}
tabStrip.addView(tabView);
}
} catch (IllegalStateException e) {
throw new RuntimeException(e);
}
}
private void scrollToTab(int tabIndex, float positionOffset) {
final int tabStripChildCount = tabStrip.getChildCount();
if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) {
@@ -525,7 +559,7 @@ public class SmartTabLayout extends HorizontalScrollView {
*
* @param position tab's position
*/
void onTabClicked(int position);
void onTabClicked(int position,View view);
}
/**
@@ -632,9 +666,11 @@ public class SmartTabLayout extends HorizontalScrollView {
for (int i = 0; i < tabStrip.getChildCount(); i++) {
if (v == tabStrip.getChildAt(i)) {
if (onTabClickListener != null) {
onTabClickListener.onTabClicked(i);
onTabClickListener.onTabClicked(i,v);
}
if (viewPager != null) {
viewPager.setCurrentItem(i);
}
viewPager.setCurrentItem(i);
return;
}
}

View File

@@ -77,7 +77,7 @@ public class DrawableTextView extends AppCompatTextView {
private boolean mHasSpecialFont;
//Drawable 相关
private int mDrawableLeftHeight, mDrawableLeftWidth, mDrawableRightHeight, mDrawableRightWidth, mDrawableTopHeight, mDrawableTopWidth, mDrawableBottomHeight, mDrawableBottomWidth;
public int mDrawableLeftHeight, mDrawableLeftWidth, mDrawableRightHeight, mDrawableRightWidth, mDrawableTopHeight, mDrawableTopWidth, mDrawableBottomHeight, mDrawableBottomWidth;
private Drawable mLeftDrawable, mRightDrawable, mTopDrawable, mBottomDrawable;
private int drawableTopPadding,drawableBottomPadding,drawableLeftPadding,drawableRightPadding;
@@ -589,7 +589,7 @@ public class DrawableTextView extends AppCompatTextView {
if (startColor != -1) this.startColor = startColor;
if (centerColor != -1) this.centerColor = centerColor;
if (endColor != -1) this.endColor = endColor;
if (radius != -1) this.radius = radius;
if (radius != -1f) this.radius = radius;
if (angle != -1) this.angle = angle;
GradientDrawable gradient = null;

View File

@@ -1392,7 +1392,29 @@ class GlideUtils {
val glideConfig = getGlideConfig(context)
glideConfig
?.asFile()
?.skipMemoryCache(true)
// ?.skipMemoryCache(true)
?.load(url)
?.addListener(listener)
?.submit()
}
/**
* 使用Glide下载图片,返回File
*/
fun downloadFromUrlToDrawable(
context: Context?,
url: String?,
listener: RequestListener<Drawable?>?
) {
if (context == null) {
LibLogger.error(TAG, "load context is null")
return
}
val glideConfig = getGlideConfig(context)
glideConfig
?.asDrawable()
// ?.skipMemoryCache(true)
?.load(url)
?.addListener(listener)
?.submit()