Commit 99b371e8 authored by linfeng's avatar linfeng

bug修复

parent a48f4280
......@@ -7,8 +7,8 @@ android {
applicationId "com.xxfc.rv"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 112
versionName "1.1.2"
versionCode 113
versionName "1.1.3"
multiDexEnabled true
//新版Gradle 是 implementation 为了兼容compile,写上这句话
......
......@@ -34,6 +34,8 @@ public class CampDetailsBean extends BaseBean {
private String name;// ":"asdf",---->店铺名
private String address;//":"广东省广州市aasdfasdf",
private String phone;
private double longitude;//": 118.773832,
private double latitude;//": 32.031698,
public String getName() {
return name;
......@@ -58,5 +60,21 @@ public class CampDetailsBean extends BaseBean {
public void setPhone(String phone) {
this.phone = phone;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
}
}
......@@ -193,8 +193,8 @@ public class CampDetailActivity extends BaseStatusActivity<CampPresenter> {
.withString("addrDetail", data.getData().getAddress())
.withString("phone", data.getData().getPhone())
.withString("name", data.getData().getName())
.withDouble("latitude", latitude)
.withDouble("longitude", longitude)
.withDouble("latitude", data.getData().getLatitude())
.withDouble("longitude", data.getData().getLongitude())
.navigation();
}
}
......
......@@ -300,7 +300,9 @@ public class CarDetailActivity extends BaseStatusActivity<CommonPresenter> {
.withString("icon", mCarBean.getVehicleModel().getIcon())
.withString("name", mCarBean.getVehicleModel().getName())
.withString("keyword", mCarBean.getVehicleModel().getKeyword())
.withDouble("price", mCarBean.getVehicleModel().getPrice()).navigation();
.withDouble("price", mCarBean.getVehicleModel().getPrice())
.withString("url",url)
.navigation();
} else if (snsPlatform.mShowWord.equals("复制链接")) {
copyText();
......
......@@ -410,13 +410,8 @@ public class CarRentalListActivity extends BaseStatusActivity<CommonPresenter> i
tvGetDate.setText("取" + DateUtils.formatDate66(begDate));
tvOutDate.setText("还" + DateUtils.formatDate66(endDate));
dataBean.setDayNum(Integer.valueOf(copyDay + ""));
try {
dataBean.setStartTime(TimeManager.dateToStamp(begDate));
dataBean.setEndTime(TimeManager.dateToStamp(endDate));
} catch (ParseException e) {
e.printStackTrace();
}
dataBean.setStartTime(DateUtils.StringToTimeMillis2(begDate));
dataBean.setEndTime(DateUtils.StringToTimeMillis2(endDate));
onFresh();
} else if (requestCode == 110 && resultCode == RESULT_OK) {
......
......@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.os.Bundle;
......@@ -15,6 +16,12 @@ import android.widget.TextView;
import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.frame.base.url.Constance;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.swipe.SwipeBackActivity;
import com.ruiwenliu.wrapper.util.glide.GlideManager;
......@@ -30,6 +37,9 @@ import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.shareboard.SnsPlatform;
import com.umeng.socialize.utils.ShareBoardlistener;
import java.util.HashMap;
import java.util.Map;
import butterknife.BindView;
import butterknife.OnClick;
......@@ -58,6 +68,8 @@ public class ShareImageActivity extends SwipeBackActivity<CommonPresenter> {
String keyword;
@Autowired()
double price;
@Autowired()
String url;
@Override
protected void loadData(Bundle savedInstanceState, Intent intent) {
......@@ -76,6 +88,11 @@ public class ShareImageActivity extends SwipeBackActivity<CommonPresenter> {
tvName.setText(name);
tvContent.setText(keyword);
tvPrice.setText(String.format("%1$s%2$s", price, this.getString(R.string.rv_day)));
//生成带中间图标的二维码
Bitmap success = createQRImage(url, 300, 300,
BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));
ivCode.setImageBitmap(success);
}
@Override
......@@ -182,4 +199,99 @@ public class ShareImageActivity extends SwipeBackActivity<CommonPresenter> {
}
public static Bitmap createQRImage(String content, int widthPix, int heightPix,
Bitmap logoBm) {
try {
//配置参数
Map<EncodeHintType, Object> hints = new HashMap<>();
hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
//容错级别
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
//设置空白边距的宽度
hints.put(EncodeHintType.MARGIN, 1); //default is 4
// 图像数据转换,使用了矩阵转换
BitMatrix bitMatrix = null;
try {
bitMatrix = new QRCodeWriter().encode(content, BarcodeFormat.QR_CODE, widthPix,
heightPix, hints);
} catch (WriterException e) {
e.printStackTrace();
}
int[] pixels = new int[widthPix * heightPix];
// 下面这里按照二维码的算法,逐个生成二维码的图片,
// 两个for循环是图片横列扫描的结果
for (int y = 0; y < heightPix; y++) {
for (int x = 0; x < widthPix; x++) {
if (bitMatrix.get(x, y)) {
pixels[y * widthPix + x] = 0xff000000;
} else {
pixels[y * widthPix + x] = 0xffffffff;
}
}
}
// 生成二维码图片的格式,使用ARGB_8888
Bitmap bitmap = Bitmap.createBitmap(widthPix, heightPix, Bitmap.Config.ARGB_8888);
bitmap.setPixels(pixels, 0, widthPix, 0, 0, widthPix, heightPix);
if (logoBm != null) {
bitmap = Logo(bitmap, logoBm);
}
//必须使用compress方法将bitmap保存到文件中再进行读取。直接返回的bitmap是没有任何压缩的,
// 内存消耗巨大!
return bitmap;
// return bitmap != null && bitmap.compress(Bitmap.CompressFormat.JPEG, 100);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private static Bitmap Logo(Bitmap src, Bitmap logo) {
if (src == null) {
return null;
}
if (logo == null) {
return src;
}
//获取图片的宽高
int srcWidth = src.getWidth();
int srcHeight = src.getHeight();
int logoWidth = logo.getWidth();
int logoHeight = logo.getHeight();
if (srcWidth == 0 || srcHeight == 0) {
return null;
}
if (logoWidth == 0 || logoHeight == 0) {
return src;
}
//logo大小为二维码整体大小的1/5
float scaleFactor = srcWidth * 1.0f / 5 / logoWidth;
Bitmap bitmap = Bitmap.createBitmap(srcWidth, srcHeight, Bitmap.Config.ARGB_8888);
try {
Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(src, 0, 0, null);
canvas.scale(scaleFactor, scaleFactor, srcWidth / 2, srcHeight / 2);
canvas.drawBitmap(logo, (srcWidth - logoWidth) / 2, (srcHeight - logoHeight) / 2, null);
canvas.save();
canvas.restore();
} catch (Exception e) {
bitmap = null;
e.getStackTrace();
}
return bitmap;
}
}
......@@ -99,13 +99,6 @@ public class GetOnTheCarQRCodeActivity extends BaseStatusActivity<PickerPresente
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
}
@OnClick({R2.id.iv_back, R2.id.iv_customer_service})
public void onViewClicked(View view) {
int id = view.getId();
......
......@@ -31,6 +31,7 @@ import com.rv.component.dialog.PaymentTypeSelection;
import com.rv.home.R;
import com.rv.home.R2;
import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.basic.WebActivity;
import com.rv.home.rv.module.basic.presenter.PickerPresenter;
import com.rv.home.rv.module.ui.main.home.bean.OrderPayBean;
import com.rv.home.rv.module.ui.main.home.order.bean.OrderListBean;
......@@ -51,7 +52,7 @@ import io.reactivex.schedulers.Schedulers;
import static com.ruiwenliu.wrapper.weight.webview.SafeWebView.hasKitkat;
/**
* 旅游详情页面
* 旅游订单详情页面
*/
public class TravelOrderDetailsActivity extends BaseStatusActivity<PickerPresenter> {
......@@ -435,6 +436,11 @@ public class TravelOrderDetailsActivity extends BaseStatusActivity<PickerPresent
}
@JavascriptInterface
public void onClick() {
startActivity(WebActivity.getIntent(mActivity, mActivity.getString(R.string.rv_charge_details), ApiConfig.HTTP_URL_CAR_TYPE_COSTDETAIL));
}
@JavascriptInterface
public void showMore() {
......
......@@ -649,6 +649,7 @@
android:textSize="@dimen/text_18" />
<LinearLayout
android:id="@+id/ll_item_activity_all"
android:layout_width="match_parent"
android:layout_height="@dimen/size_30"
android:gravity="center_vertical"
......
......@@ -191,7 +191,7 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
@OnClick({R2.id.iv_notification, R2.id.iv_avatar, R2.id.tv_login, R2.id.tv_verified, R2.id.rl_item_to_be_paid, R2.id.rl_item_staying,
R2.id.rl_item_traveling, R2.id.rl_item_completed, R2.id.rl_item_all, R2.id.rl_item_collection, R2.id.rl_item_personal_information,
R2.id.rl_item_setting, R2.id.rl_item_driver, R2.id.rl_item_traveler, R2.id.rl_item_my_pat, R2.id.tv_view_privileges})
R2.id.rl_item_setting, R2.id.rl_item_driver, R2.id.rl_item_traveler, R2.id.rl_item_my_pat, R2.id.tv_view_privileges, R2.id.rl_item_my_release})
public void onViewClicked(View view) {
int id = view.getId();
if (id == R.id.iv_notification){
......
......@@ -74,6 +74,7 @@ public class CollectionActivity extends BaseStatusActivity<CommonPresenter> impl
.withString("name", dataBean.getName())
.withString("content", dataBean.getUnit())
.withString("url", dataBean.getCover())
.withDouble("price",dataBean.getPrice())
.navigation();
}else if (1 == dataBean.getType()){
......
......@@ -170,6 +170,7 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements B
.withString("name", dataBean.getName())
.withString("content", dataBean.getContent())
.withString("url", dataBean.getCover())
.withDouble("price",Double.valueOf(dataBean.getPrice()))
.navigation();
}
});
......
......@@ -134,6 +134,7 @@ public class PopularTourListActivity extends BaseStatusActivity<TourismPresenter
.withString("name",item.getName())
.withString("content",item.getContent())
.withString("url",item.getCover())
.withDouble("price",Double.valueOf(item.getPrice()))
.navigation();
}
});
......
......@@ -104,6 +104,9 @@ public class TravelDetailsActivity extends BaseStatusActivity<TourismPresenter>
@Autowired()
String url;
@Autowired()
double price;
// public static Intent getIntent(Context context, BeanTourAround.DataBeanX.DataBean dataBean) {
// return new Intent(context, TravelDetailsActivity.class)
......@@ -334,7 +337,9 @@ public class TravelDetailsActivity extends BaseStatusActivity<TourismPresenter>
.withString("icon",url)
.withString("name",name)
.withString("keyword",content)
.withDouble("price",0).navigation();
.withDouble("price",price)
.withString("url",webUrl)
.navigation();
} else if (snsPlatform.mShowWord.equals("复制链接")) {
copyText();
}
......
......@@ -77,6 +77,7 @@ public class TravelSearchActivity extends BaseStatusActivity<SearchPresenter> {
.withString("name", dataBean.getName())
.withString("content", dataBean.getContent())
.withString("url", dataBean.getCover())
.withDouble("price",Double.valueOf(dataBean.getPrice()))
.navigation();
finish();
}
......@@ -147,6 +148,7 @@ public class TravelSearchActivity extends BaseStatusActivity<SearchPresenter> {
map.put("query", search);
map.put("page", page);
map.put("limit", "10");
map.put("distance", 10.0);
map.put("latitudel", latLatitude);
map.put("longitude", lonLongitude);
mPresenter.getData(0, SearchApi.QUERY_RIM_LIST, BeanTravelSearch.class, map, true);
......
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