-
Notifications
You must be signed in to change notification settings - Fork 60
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
hss
committed
Nov 7, 2019
1 parent
184975c
commit b94973c
Showing
12 changed files
with
435 additions
and
52 deletions.
There are no files selected for viewing
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
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
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
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
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 |
---|---|---|
@@ -1,10 +1,46 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:orientation="vertical" | ||
android:layout_height="match_parent"> | ||
<ScrollView | ||
android:layout_width="match_parent" | ||
android:layout_weight="1" | ||
android:visibility="gone" | ||
android:layout_height="0dp"> | ||
<LinearLayout | ||
android:orientation="vertical" | ||
android:padding="15dp" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
<ImageView | ||
android:id="@+id/iv_1" | ||
android:background="@drawable/shape_main_list_bg" | ||
android:layout_width="150dp" | ||
android:layout_height="150dp" /> | ||
<ImageView | ||
android:id="@+id/iv_2" | ||
android:background="@drawable/shape_main_list_bg" | ||
android:layout_width="match_parent" | ||
android:layout_height="150dp" /> | ||
<ImageView | ||
android:id="@+id/iv_3" | ||
android:background="@drawable/shape_main_list_bg" | ||
android:layout_width="wrap_content" | ||
android:adjustViewBounds="true" | ||
android:layout_height="150dp" /> | ||
<ImageView | ||
android:id="@+id/iv_4" | ||
android:background="@drawable/shape_main_list_bg" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" /> | ||
</LinearLayout> | ||
</ScrollView> | ||
|
||
<android.support.v7.widget.RecyclerView | ||
android:id="@+id/recy" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"/> | ||
android:layout_weight="2" | ||
android:layout_height="0dp"/> | ||
|
||
</LinearLayout> |
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
Binary file not shown.
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
45 changes: 45 additions & 0 deletions
45
glide/src/main/java/com/hss01248/glideloader/transform/BaseTransForm.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,45 @@ | ||
package com.hss01248.glideloader.transform; | ||
|
||
import android.graphics.Bitmap; | ||
import android.graphics.Canvas; | ||
import android.graphics.Paint; | ||
|
||
import com.bumptech.glide.Glide; | ||
import com.bumptech.glide.load.Transformation; | ||
import com.bumptech.glide.load.engine.Resource; | ||
import com.hss01248.image.MyUtil; | ||
import com.hss01248.image.config.GlobalConfig; | ||
|
||
import java.security.PublicKey; | ||
|
||
public class BaseTransForm { | ||
|
||
|
||
public static Bitmap scale(Resource<Bitmap> resource, int outWidth, int outHeight){ | ||
Bitmap source = resource.get(); | ||
|
||
int width = source.getWidth(); | ||
int height = source.getHeight(); | ||
|
||
int samplesize = MyUtil.calculateScaleRatio(width,height,outWidth,outHeight,1); | ||
|
||
|
||
|
||
int scaledWidth = width / samplesize; | ||
int scaledHeight = height / samplesize; | ||
|
||
Bitmap bitmap = Glide.get(GlobalConfig.context).getBitmapPool().get(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888); | ||
if (bitmap == null) { | ||
bitmap = Bitmap.createBitmap(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888); | ||
} | ||
|
||
Canvas canvas = new Canvas(bitmap); | ||
canvas.scale(1 / (float) samplesize, 1 / (float) samplesize); | ||
Paint paint = new Paint(); | ||
paint.setFlags(Paint.FILTER_BITMAP_FLAG); | ||
canvas.drawBitmap(source, 0, 0, paint); | ||
return bitmap; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.