Commit 17ef6134 authored by linfeng's avatar linfeng

活动修复

parent 3862f044
......@@ -9,6 +9,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.graphics.Bitmap;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.Uri;
......@@ -24,6 +25,7 @@ import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
......@@ -31,6 +33,8 @@ import android.widget.Toast;
import com.alibaba.android.arouter.launcher.ARouter;
import com.base.utils.ui.image.round.RoundImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import com.frame.base.url.Constance;
import com.frame.base.url.ImageUrl;
import com.frame.rv.config.RvFrameConfig;
......@@ -81,6 +85,7 @@ import com.rv.plugin.calendar.bean.PreRentDaysBean;
import com.rv.rvmine.MineFragment;
import com.rv.share.WebViewActivity;
import com.rv.share.utils.TransformationUtils;
import com.rv.share.utils.TransformationUtils10;
import com.rv.share.view.PromotionDialog;
import com.rv.tourism.R2;
import com.rv.tourism.TourismFragment;
......@@ -730,10 +735,13 @@ public class MainActivity extends BaseActivity<CommonPresenter> implements DownL
/**
* 发布会活动
*/
int width2;
int height2;
private void showConferenceEvent(CodeInfoBean codeInfoBean) {
if (codeInfoBean == null || codeInfoBean.getData() == null) {
return;
}
new ConferenceEventDialog(mActivity) {
@Override
public void helper(ViewHolder helper) {
......@@ -749,6 +757,25 @@ public class MainActivity extends BaseActivity<CommonPresenter> implements DownL
.apply(options)
.into(new TransformationUtils((ImageView) helper.getView(R.id.img_bg)));
// //获取图片真正的宽高
// Glide.with(MainActivity.this)
// .asBitmap()//强制Glide返回一个Bitmap对象
// .load(ImageUrl.IMG_APP_BG_ACTIVITY_50)
// .into(new SimpleTarget<Bitmap>() {
// @Override
// public void onResourceReady(@NonNull Bitmap bitmap, @Nullable Transition<? super Bitmap> transition) {
// width2 = bitmap.getWidth();
// height2 = bitmap.getHeight();
// }
// });
//
// Glide.with(MainActivity.this)
// .asBitmap()
// .load(ImageUrl.IMG_APP_BG_ACTIVITY_50)
// .apply(options)
// .into(new TransformationUtils10((ImageView) helper.getView(R.id.img_bg),width2,height2));
helper.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......
......@@ -44,8 +44,8 @@
android:layout_marginLeft="@dimen/size_10"
android:layout_marginTop="@dimen/size_20"
android:layout_marginRight="@dimen/size_10"
android:minWidth="@dimen/size_150"
android:minHeight="@dimen/size_150" />
android:minWidth="@dimen/dialog_act_width"
android:minHeight="@dimen/dialog_act_height" />
<TextView
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="dialog_width">150dp</dimen>
<dimen name="dialog_min_height">150dp</dimen>
<dimen name="dialog_act_width">150dp</dimen>
<dimen name="dialog_act_height">150dp</dimen>
<dimen name="height_share_ruler_top">108.34dp</dimen>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="dialog_width">200dp</dimen>
<dimen name="dialog_min_height">200dp</dimen>
<dimen name="dialog_act_width">200dp</dimen>
<dimen name="dialog_act_height">200dp</dimen>
<dimen name="height_share_ruler_top">240.45dp</dimen>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="dialog_width">300dp</dimen>
<dimen name="dialog_min_height">300dp</dimen>
<dimen name="dialog_act_width">300dp</dimen>
<dimen name="dialog_act_height">300dp</dimen>
<dimen name="height_share_ruler_top">216.67dp</dimen>
</resources>
package com.rv.share.utils;
import android.graphics.Bitmap;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.request.target.ImageViewTarget;
public class TransformationUtils10 extends ImageViewTarget<Bitmap> {
private int width;
private int height;
private ImageView target;
public TransformationUtils10(ImageView target, int width, int height) {
super(target);
this.target = target;
this.width = width;
this.height = height;
}
@Override
protected void setResource(Bitmap resource) {
target.setImageBitmap(resource);
if (resource == null) return;
//获取原图的宽高
// int width = resource.getWidth();
// int height = resource.getHeight();
//获取imageView的宽
int imageViewWidth = target.getWidth();
//计算缩放比例
float sy = (float) (imageViewWidth * 0.1) / (float) (width * 0.1);
//计算图片等比例放大后的高
int imageViewHeight = (int) (height * sy);
ViewGroup.LayoutParams params = target.getLayoutParams();
params.height = imageViewHeight;
target.setLayoutParams(params);
}
}
\ No newline at end of file
......@@ -50,13 +50,13 @@ public class RvWebView extends WebView {
// 支持 Js 使用
webSettings.setJavaScriptEnabled(true);
// 开启DOM缓存,默认状态下是不支持LocalStorage的
webSettings.setDomStorageEnabled(true);
// webSettings.setDomStorageEnabled(true);
// 开启数据库缓存
webSettings.setDatabaseEnabled(true);
// 支持自动加载图片
webSettings.setLoadsImagesAutomatically(hasKitkat());
// 设置 WebView 的缓存模式
webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
// webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
// 支持启用缓存模式
webSettings.setAppCacheEnabled(true);
// 设置 AppCache 最大缓存值(现在官方已经不提倡使用,已废弃)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment