Commit a4796f21 authored by linfeng's avatar linfeng

bug修复

parents 493bec0a 0719dbf2
...@@ -8,8 +8,8 @@ android { ...@@ -8,8 +8,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 125 versionCode 126
versionName "1.2.5" versionName "1.2.6"
multiDexEnabled true multiDexEnabled true
//新版Gradle 是 implementation 为了兼容compile,写上这句话 //新版Gradle 是 implementation 为了兼容compile,写上这句话
......
...@@ -108,7 +108,6 @@ ...@@ -108,7 +108,6 @@
tools:ignore="GoogleAppIndexingWarning"> tools:ignore="GoogleAppIndexingWarning">
<activity <activity
android:name=".WelcomeActivity" android:name=".WelcomeActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/SplashTheme"> android:theme="@style/SplashTheme">
<intent-filter> <intent-filter>
......
...@@ -133,6 +133,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> { ...@@ -133,6 +133,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> {
getActivityPopup(); getActivityPopup();
checkVersion(); checkVersion();
} }
@Override @Override
......
...@@ -19,6 +19,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter; ...@@ -19,6 +19,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.frame.base.url.Constance; import com.frame.base.url.Constance;
import com.frame.rv.config.RvFrameConfig; import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.inter.OnViewHolder;
import com.ruiwenliu.wrapper.util.TimeManager; import com.ruiwenliu.wrapper.util.TimeManager;
import com.ruiwenliu.wrapper.util.ViewHolder; import com.ruiwenliu.wrapper.util.ViewHolder;
import com.ruiwenliu.wrapper.weight.TitleView; import com.ruiwenliu.wrapper.weight.TitleView;
...@@ -313,7 +314,7 @@ public class CarRentalListActivity extends BaseStatusActivity<CommonPresenter> i ...@@ -313,7 +314,7 @@ public class CarRentalListActivity extends BaseStatusActivity<CommonPresenter> i
countPage = bean.getData().getTotalPage(); countPage = bean.getData().getTotalPage();
mAdapter.setNewData(bean.getData().getData()); mAdapter.setNewData(bean.getData().getData());
if (bean.getData().getTotalCount() == 0) { if (bean.getData().getTotalCount() == 0) {
mAdapter.setEmptyView(getEmptyView(recyclerView, -1, mActivity.getString(R.string.rv_car_type_data_null))); mAdapter.setEmptyView(getEmptyView(recyclerView, -1, "暂无房车,请更改取车公司或时间"));
mAdapter.notifyDataSetChanged(); mAdapter.notifyDataSetChanged();
} }
...@@ -480,4 +481,26 @@ public class CarRentalListActivity extends BaseStatusActivity<CommonPresenter> i ...@@ -480,4 +481,26 @@ public class CarRentalListActivity extends BaseStatusActivity<CommonPresenter> i
public void onRefresh() { public void onRefresh() {
onFresh(); onFresh();
} }
/**
* 获取通用空布局
*
* @param mRecyclerView
* @param imageId
* @param empty
* @return
*/
protected View getEmptyView(RecyclerView mRecyclerView, final int imageId, final String empty) {
return getHelperView(mRecyclerView, R.layout.select_shop_empty, new OnViewHolder() {
@Override
public void helper(ViewHolder helper) {
if (imageId != -1) {
helper.setImageResource(com.ruiwenliu.wrapper.R.id.iv_flag, imageId);
}
helper.setText(com.ruiwenliu.wrapper.R.id.tv_tip, empty);
}
});
}
} }
...@@ -15,11 +15,14 @@ import android.widget.EditText; ...@@ -15,11 +15,14 @@ import android.widget.EditText;
import com.alibaba.android.arouter.facade.annotation.Autowired; import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.frame.base.url.Constance; import com.frame.base.url.Constance;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.util.LocationManager;
import com.ruiwenliu.wrapper.weight.TitleView; import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.LogUtil; import com.rv.component.utils.LogUtil;
import com.rv.home.R; import com.rv.home.R;
...@@ -60,13 +63,9 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -60,13 +63,9 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
String mNowCity; String mNowCity;
@Autowired @Autowired
int mCityId; int mCityId;
// private Map<String,String> mapSave;
private Disposable mDisposable = null; private Disposable mDisposable = null;
private CityListAdapter cityListAdapter; private CityListAdapter cityListAdapter;
private LocationManager locationManager;
// public static Intent getIntent(Context context, int type, String city, int id) {
// return new Intent(context, CityListActivity.class).putExtra("type", type).putExtra("location", city).putExtra("id", id);
// }
@Override @Override
protected int setLayout() { protected int setLayout() {
...@@ -76,16 +75,8 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -76,16 +75,8 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
@Override @Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) { protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle(mActivity.getString(R.string.rv_city_list)); titleView.setTitle(mActivity.getString(R.string.rv_city_list));
// String jsonCity= UtilsManager.getInstance(mActivity).getSPStringCode("city_json", "city"); titleView.setImageResource(R.id.iv_title_left, R.drawable.rv_common_icon_back_white);
// if(!TextUtils.isEmpty(jsonCity)){ cityListAdapter = new CityListAdapter(new ArrayList<MultiItemBean>(), listener, mNowCity);
// Log.d("===tag===",jsonCity);
// }
// mCityType = intent.getIntExtra("type", 1);
// mNowCity = intent.getStringExtra("location");
// mCityId = intent.getIntExtra("id", 1);
// hotCityAdapter = new HotCityAdapter(this, getHotCitys());
// gridView.setAdapter(hotCityAdapter);
cityListAdapter = new CityListAdapter(new ArrayList<MultiItemBean>(), listener);
recyclerView.setLayoutManager(new GridLayoutManager(this, 6)); recyclerView.setLayoutManager(new GridLayoutManager(this, 6));
recyclerView.setAdapter(cityListAdapter); recyclerView.setAdapter(cityListAdapter);
cityListAdapter.setSpanSizeLookup(new BaseQuickAdapter.SpanSizeLookup() { cityListAdapter.setSpanSizeLookup(new BaseQuickAdapter.SpanSizeLookup() {
...@@ -192,10 +183,6 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -192,10 +183,6 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
* 传送数据 * 传送数据
*/ */
private void sendData(String name, int id) { private void sendData(String name, int id) {
// if(mapSave==null){
// mapSave=new LinkedHashMap<>();
// }
// mapSave.put(name,name);
getIntent().putExtra("location", name); getIntent().putExtra("location", name);
getIntent().putExtra("id", id); getIntent().putExtra("id", id);
getIntent().putExtra("type", mCityType); getIntent().putExtra("type", mCityType);
...@@ -206,14 +193,14 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -206,14 +193,14 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
@Override @Override
public void onDestroy() { public void onDestroy() {
// if(mapSave!=null){
// UtilsManager.getInstance(mActivity).setSharePreferencesSave("city_json").putString("city", JSON.toJSONString(mapSave)).commit();
// UtilsManager.getInstance(mActivity).setShNull();
// }
if (mDisposable != null) { if (mDisposable != null) {
mDisposable.dispose(); mDisposable.dispose();
mDisposable = null; mDisposable = null;
} }
if (locationManager != null) {
locationManager.onDestroy();
}
super.onDestroy(); super.onDestroy();
} }
...@@ -260,9 +247,24 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -260,9 +247,24 @@ public class CityListActivity extends BaseStatusActivity<CommonPresenter> {
public void click(HotCityBean hotCityBean) { public void click(HotCityBean hotCityBean) {
sendData(hotCityBean.hotCityName, hotCityBean.hotCityId); sendData(hotCityBean.hotCityName, hotCityBean.hotCityId);
} }
};
@Override
public void reRelocation() {
createLoadingDialog().show();
if (locationManager == null) {
locationManager = new LocationManager(getApplicationContext());
}
locationManager.getLocationDetail(new BDAbstractLocationListener() {
@Override
public void onReceiveLocation(BDLocation location) {
createLoadingDialog().dismiss();
mNowCity = location.getCity();
cityListAdapter.setCurrentCity(mNowCity);
locationManager.stopLocation();
}
});
}
};
} }
...@@ -2,6 +2,7 @@ package com.rv.home.rv.module.ui.main.home; ...@@ -2,6 +2,7 @@ package com.rv.home.rv.module.ui.main.home;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
...@@ -28,6 +29,7 @@ import com.ruiwenliu.wrapper.base.BaseBean; ...@@ -28,6 +29,7 @@ import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.inter.OnViewHolder; import com.ruiwenliu.wrapper.inter.OnViewHolder;
import com.ruiwenliu.wrapper.util.UtilsManager; import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.util.ViewHolder; import com.ruiwenliu.wrapper.util.ViewHolder;
import com.rv.component.utils.DisplayUtil;
import com.rv.home.R; import com.rv.home.R;
import com.rv.home.R2; import com.rv.home.R2;
import com.rv.home.rv.module.basic.BaseStatusActivity; import com.rv.home.rv.module.basic.BaseStatusActivity;
...@@ -90,10 +92,18 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl ...@@ -90,10 +92,18 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
@Override @Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) { protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle(mActivity.getString(R.string.rv_select_shop)); if (shopType == 1) {
titleView.setTitle("选择取车公司");
} else if (shopType == 2) {
titleView.setTitle("选择还车公司");
}
titleView.setImageResource(R.id.iv_title_left, R.drawable.rv_common_icon_back_white);
Drawable drawable = getResources().getDrawable(R.drawable.icon_position);
drawable.setBounds(0, 0, DisplayUtil.dip2px(this, 12), DisplayUtil.dip2px(this, 15));
tvCurrentCity.setCompoundDrawables(drawable, null, null, null);
tvCurrentCity.setVisibility(View.VISIBLE);
if (!TextUtils.isEmpty(cityName)) { if (!TextUtils.isEmpty(cityName)) {
tvCurrentCity.setText("当前选择城市: " + cityName); tvCurrentCity.setText(cityName);
} }
getCityId(); getCityId();
mAdapter = new SelectShopAdapter(); mAdapter = new SelectShopAdapter();
...@@ -127,6 +137,7 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl ...@@ -127,6 +137,7 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
ARouter.getInstance() ARouter.getInstance()
.build(Constance.ACTIVITY_URL_CITYLIST) .build(Constance.ACTIVITY_URL_CITYLIST)
.withInt("mCityType", 2) .withInt("mCityType", 2)
.withString("mNowCity", cityName)
.navigation(SelectShopActivity.this, TYPE_REQUEST_CITY); .navigation(SelectShopActivity.this, TYPE_REQUEST_CITY);
} }
}); });
...@@ -175,7 +186,7 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl ...@@ -175,7 +186,7 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
processData((ShopListBean) result); processData((ShopListBean) result);
} else { } else {
mAdapter.getData().clear(); mAdapter.getData().clear();
mAdapter.setEmptyView(getEmptyView(recyclerView, -1, getString(R.string.rv_select_not_data))); mAdapter.setEmptyView(getEmptyView(recyclerView, -1, "暂无分公司,请换个城市试试!"));
mAdapter.notifyDataSetChanged(); mAdapter.notifyDataSetChanged();
mAdapter.loadMoreComplete(); mAdapter.loadMoreComplete();
} }
...@@ -277,7 +288,7 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl ...@@ -277,7 +288,7 @@ public class SelectShopActivity extends BaseStatusActivity<CommonPresenter> impl
.address(cityName)); .address(cityName));
mCityId = data.getIntExtra("id", 0); mCityId = data.getIntExtra("id", 0);
if (!TextUtils.isEmpty(cityName)) { if (!TextUtils.isEmpty(cityName)) {
tvCurrentCity.setText("当前选择城市: " + cityName); tvCurrentCity.setText(cityName);
} }
// getIntent().putExtra("type", mCityType); // getIntent().putExtra("type", mCityType);
mPage = 1; mPage = 1;
......
...@@ -4,6 +4,7 @@ import android.text.TextUtils; ...@@ -4,6 +4,7 @@ import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.GridView; import android.widget.GridView;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter; import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
...@@ -28,16 +29,24 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba ...@@ -28,16 +29,24 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba
public static final int TYPE_INDEX_CITY = 3; public static final int TYPE_INDEX_CITY = 3;
private GridClickListener mListener; private GridClickListener mListener;
private String currentCity;
private TextView tvCurrent;
public CityListAdapter(List<MultiItemBean> data, GridClickListener listener, String currentCity) {
public CityListAdapter(List<MultiItemBean> data, GridClickListener listener) {
super(data); super(data);
this.mListener = listener; this.mListener = listener;
this.currentCity = currentCity;
addItemType(TYPE_INDEX_HEAD, R.layout.rv_item_head); addItemType(TYPE_INDEX_HEAD, R.layout.rv_item_head);
addItemType(TYPE_INDEX_HOT, R.layout.rv_list_hot_city); addItemType(TYPE_INDEX_HOT, R.layout.rv_list_hot_city);
addItemType(TYPE_INDEX_CITY, R.layout.rv_item_city); addItemType(TYPE_INDEX_CITY, R.layout.rv_item_city);
} }
public void setCurrentCity(String currentCity) {
this.currentCity = currentCity;
if (tvCurrent != null)
tvCurrent.setText(TextUtils.isEmpty(this.currentCity) ? "定位失败" : "当前定位城市: " + this.currentCity);
}
@Override @Override
protected void convert(BaseViewHolder helper, MultiItemBean item) { protected void convert(BaseViewHolder helper, MultiItemBean item) {
switch (helper.getItemViewType()) { switch (helper.getItemViewType()) {
...@@ -47,8 +56,19 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba ...@@ -47,8 +56,19 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba
break; break;
case TYPE_INDEX_HOT: case TYPE_INDEX_HOT:
HotCityListBean hotCityListBean = (HotCityListBean) item; HotCityListBean hotCityListBean = (HotCityListBean) item;
final GridView gridView = helper.itemView.findViewById(R.id.gdv_hot_city); tvCurrent = helper.itemView.findViewById(R.id.tv_current_city);
tvCurrent.setText(TextUtils.isEmpty(currentCity) ? "定位失败" : "当前定位城市: " + currentCity);
TextView tvRelocation = helper.itemView.findViewById(R.id.tv_relocation);
tvRelocation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mListener != null) {
mListener.reRelocation();
}
}
});
final HotCityAdapter hotCityAdapter = new HotCityAdapter(mContext, hotCityListBean.getLists()); final HotCityAdapter hotCityAdapter = new HotCityAdapter(mContext, hotCityListBean.getLists());
final GridView gridView = helper.itemView.findViewById(R.id.gdv_hot_city);
gridView.setAdapter(hotCityAdapter); gridView.setAdapter(hotCityAdapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override @Override
...@@ -87,6 +107,16 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba ...@@ -87,6 +107,16 @@ public class CityListAdapter extends BaseMultiItemQuickAdapter<MultiItemBean, Ba
} }
public interface GridClickListener { public interface GridClickListener {
/****
* 选择城市
* @param hotCityBean
*/
void click(HotCityBean hotCityBean); void click(HotCityBean hotCityBean);
/******
* 重新定位
*/
void reRelocation();
} }
} }
package com.rv.home.rv.module.ui.main.home.adapter; package com.rv.home.rv.module.ui.main.home.adapter;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.graphics.Paint;
import android.net.Uri; import android.net.Uri;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
...@@ -37,11 +40,15 @@ public class SelectShopAdapter extends BaseQuickAdapter<ShopListBean.DataBeanX.D ...@@ -37,11 +40,15 @@ public class SelectShopAdapter extends BaseQuickAdapter<ShopListBean.DataBeanX.D
@Override @Override
protected void convert(BaseViewHolder helper, final ShopListBean.DataBeanX.DataBean item) { protected void convert(BaseViewHolder helper, final ShopListBean.DataBeanX.DataBean item) {
helper.setText(R.id.tv_name, item.getName()); helper.setText(R.id.tv_name, item.getName());
helper.setText(R.id.tv_position, "地址:" + item.getAddrDetail()); helper.setText(R.id.tv_position, "地址: " + item.getAddrDetail());
helper.setText(R.id.tv_contacts, "联系人: " + item.getLeader() + " " + item.getLeaderContactInfo());
helper.setText(R.id.tv_contacts, "联系人: " + item.getLeader());
helper.setOnClickListener(R.id.tv_call, new View.OnClickListener() { TextView tvCall = helper.itemView.findViewById(R.id.tv_call) ;
tvCall.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
tvCall.getPaint().setAntiAlias(true);//抗锯齿
tvCall.getPaint().setColor(Color.parseColor("#999999"));
tvCall.setText(item.getLeaderContactInfo());
tvCall.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (!TextUtils.isEmpty(item.getLeaderContactInfo())) { if (!TextUtils.isEmpty(item.getLeaderContactInfo())) {
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#DCDCDC" />
<corners
android:bottomLeftRadius="50dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="50dp"
android:topRightRadius="0dp" />
</shape>
\ No newline at end of file
...@@ -108,11 +108,6 @@ ...@@ -108,11 +108,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10" android:layout_marginTop="@dimen/size_10"
android:layout_marginBottom="@dimen/size_10" android:layout_marginBottom="@dimen/size_10"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
...@@ -120,33 +115,19 @@ ...@@ -120,33 +115,19 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/rv_get_car_address" android:text="@string/rv_get_car_address"
android:textColor="@color/textLightGrey" android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_14" /> android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_get_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10"
android:drawablePadding="@dimen/size_3"
android:gravity="center"
android:hint="@string/rv_city_list"
android:text=""
android:textColor="@color/textMain"
android:textSize="@dimen/text_14" />
</LinearLayout>
<TextView <TextView
android:id="@+id/tv_get_address" android:id="@+id/tv_get_address"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/size_15" android:layout_marginTop="@dimen/size_5"
android:layout_marginRight="@dimen/size_15"
android:layout_weight="1" android:layout_weight="1"
android:gravity="left" android:gravity="left|center_vertical"
android:hint="@string/rv_get_car_hint" android:hint="@string/rv_get_car_hint"
android:textSize="@dimen/text_14" /> android:textColorHint="@color/textMain"
android:textSize="@dimen/text_16" />
</LinearLayout> </LinearLayout>
<include layout="@layout/common_line" /> <include layout="@layout/common_line" />
...@@ -157,11 +138,6 @@ ...@@ -157,11 +138,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_15" android:layout_marginTop="@dimen/size_15"
android:layout_marginBottom="@dimen/size_10" android:layout_marginBottom="@dimen/size_10"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
...@@ -169,32 +145,19 @@ ...@@ -169,32 +145,19 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/rv_get_out_address" android:text="@string/rv_get_out_address"
android:textColor="@color/textLightGrey" android:textColor="@color/textLightGrey"
android:textSize="@dimen/text_14" /> android:textSize="@dimen/text_12" />
<TextView
android:id="@+id/tv_out_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_10"
android:drawablePadding="@dimen/size_3"
android:gravity="center"
android:hint="@string/rv_city_list"
android:text=""
android:textColor="@color/textMain"
android:textSize="@dimen/text_14" />
</LinearLayout>
<TextView <TextView
android:id="@+id/tv_out_address" android:id="@+id/tv_out_address"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/size_15" android:layout_marginTop="@dimen/size_5"
android:layout_marginRight="@dimen/size_15"
android:layout_weight="1" android:layout_weight="1"
android:gravity="left" android:gravity="left|center_vertical"
android:hint="@string/rv_get_out_hint" android:hint="@string/rv_get_car_hint"
android:textSize="@dimen/text_14" /> android:textColorHint="@color/textMain"
android:textSize="@dimen/text_16" />
</LinearLayout> </LinearLayout>
...@@ -241,7 +204,7 @@ ...@@ -241,7 +204,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="2019-22" android:text="2019-22"
android:textColor="@color/textGray" android:textColor="@color/colorMain"
android:textSize="@dimen/text_12" /> android:textSize="@dimen/text_12" />
<TextView <TextView
...@@ -263,7 +226,7 @@ ...@@ -263,7 +226,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:drawableBottom="@color/colorLine" android:drawableBottom="@drawable/icon_day_times"
android:gravity="center" android:gravity="center"
android:text="3天" android:text="3天"
android:textSize="@dimen/text_14" /> android:textSize="@dimen/text_14" />
...@@ -303,7 +266,7 @@ ...@@ -303,7 +266,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="2019-22" android:text="2019-22"
android:textColor="@color/textGray" android:textColor="@color/colorMain"
android:textSize="@dimen/text_12" /> android:textSize="@dimen/text_12" />
<TextView <TextView
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/size_50" android:layout_height="@dimen/size_50"
android:layout_weight="2" android:layout_weight="2"
android:paddingLeft="@dimen/size_2"
android:paddingRight="@dimen/size_2"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical"
android:paddingLeft="@dimen/size_2"
android:paddingRight="@dimen/size_2">
<TextView <TextView
android:id="@+id/tv_get_date" android:id="@+id/tv_get_date"
...@@ -52,14 +52,15 @@ ...@@ -52,14 +52,15 @@
android:layout_height="@dimen/size_50" android:layout_height="@dimen/size_50"
android:layout_weight="2.5" android:layout_weight="2.5"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="@dimen/size_2" android:paddingLeft="@dimen/size_2"
android:paddingRight="@dimen/size_2" android:paddingRight="@dimen/size_2">
android:orientation="horizontal">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -71,17 +72,19 @@ ...@@ -71,17 +72,19 @@
android:id="@+id/tv_get_address" android:id="@+id/tv_get_address"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end"
android:maxEms="8" android:maxEms="8"
android:singleLine="true" android:singleLine="true"
android:ellipsize="end"
android:textColor="@color/colorMain" android:textColor="@color/colorMain"
android:textSize="@dimen/text_10" /> android:textSize="@dimen/text_10" />
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:layout_width="wrap_content"
android:layout_width="@dimen/size_10"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/common_icon_rig_black"/> android:layout_marginLeft="@dimen/size_5"
android:src="@drawable/common_icon_rig_black" />
</LinearLayout> </LinearLayout>
...@@ -97,15 +100,16 @@ ...@@ -97,15 +100,16 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/size_50" android:layout_height="@dimen/size_50"
android:layout_weight="2.5" android:layout_weight="2.5"
android:paddingLeft="@dimen/size_2"
android:paddingRight="@dimen/size_2"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal"
android:paddingLeft="@dimen/size_2"
android:paddingRight="@dimen/size_2">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -117,17 +121,18 @@ ...@@ -117,17 +121,18 @@
android:id="@+id/tv_out_address" android:id="@+id/tv_out_address"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end"
android:maxEms="8" android:maxEms="8"
android:singleLine="true" android:singleLine="true"
android:ellipsize="end"
android:textColor="@color/colorMain" android:textColor="@color/colorMain"
android:textSize="@dimen/text_10" /> android:textSize="@dimen/text_10" />
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="@dimen/size_10"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/common_icon_rig_black"/> android:layout_marginLeft="@dimen/size_5"
android:src="@drawable/common_icon_rig_black" />
</LinearLayout> </LinearLayout>
<View <View
...@@ -142,10 +147,10 @@ ...@@ -142,10 +147,10 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/size_50" android:layout_height="@dimen/size_50"
android:layout_weight="1" android:layout_weight="1"
android:paddingLeft="@dimen/size_2"
android:paddingRight="@dimen/size_2"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical"
android:paddingLeft="@dimen/size_2"
android:paddingRight="@dimen/size_2">
<ImageView <ImageView
android:layout_width="@dimen/size_22" android:layout_width="@dimen/size_22"
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
android:gravity="center" android:gravity="center"
android:hint="上海" android:hint="上海"
android:orientation="horizontal" android:orientation="horizontal"
android:textColor="@color/colorMain"
android:textColorHint="@color/colorMain"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
<include layout="@layout/common_line" /> <include layout="@layout/common_line" />
......
...@@ -13,62 +13,49 @@ ...@@ -13,62 +13,49 @@
android:layout_marginLeft="@dimen/size_20" android:layout_marginLeft="@dimen/size_20"
android:layout_marginTop="@dimen/size_10" android:layout_marginTop="@dimen/size_10"
android:layout_marginRight="@dimen/size_20" android:layout_marginRight="@dimen/size_20"
android:layout_marginBottom="@dimen/size_10"
android:background="@drawable/shape_rv_textview_home_search" android:background="@drawable/shape_rv_textview_home_search"
android:gravity="center" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView
android:id="@+id/tv_current_city"
android:layout_width="@dimen/size_80"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="@drawable/shape_bg_select_company_search_position"
android:drawableLeft="@drawable/icon_position"
android:drawablePadding="@dimen/size_3"
android:ellipsize="end"
android:gravity="center_vertical"
android:minWidth="@dimen/size_100"
android:paddingLeft="@dimen/size_10"
android:singleLine="true"
android:textColor="@color/tv_gr999999"
android:textSize="@dimen/sp_12" />
<ImageView <ImageView
android:layout_width="@dimen/size_20" android:layout_width="@dimen/size_20"
android:layout_height="@dimen/size_20" android:layout_height="@dimen/size_20"
android:layout_marginLeft="@dimen/size_5"
android:src="@drawable/rv_common_icon_search" /> android:src="@drawable/rv_common_icon_search" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_5" android:layout_marginLeft="@dimen/size_5"
android:text="输入城市名称,查找对应城市的门店" android:text="搜索其他城市查看分公司"
android:textColor="@color/text_Gray" android:textColor="@color/tv_gr999999"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
</LinearLayout> </LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:layout_marginTop="5dp"
android:background="@color/gray_f5f5f5">
<TextView
android:id="@+id/tv_current_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/size_20"
android:text="当前定位城市"
android:textSize="@dimen/sp_12" />
<TextView
android:id="@+id/tv_relocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/size_20"
android:drawableLeft="@drawable/icon_location"
android:drawablePadding="@dimen/size_5"
android:text="重新定位"
android:textColor="#fdb51c"
android:textSize="@dimen/sp_12" />
</RelativeLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/gray_f5f5f5"> android:background="@color/gray_f5f5f5"
android:paddingBottom="@dimen/size_10">
<include layout="@layout/common_refresh" /> <include layout="@layout/common_refresh" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_10" android:layout_marginLeft="@dimen/size_10"
android:layout_marginTop="@dimen/size_10"
android:layout_marginRight="@dimen/size_10" android:layout_marginRight="@dimen/size_10"
android:layout_marginBottom="@dimen/size_10"
android:background="@color/colorWrite" android:background="@color/colorWrite"
app:cardCornerRadius="@dimen/size_5"> app:cardCornerRadius="@dimen/size_5">
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
android:layout_weight="1" android:layout_weight="1"
android:text="欣信房车控股集团" android:text="欣信房车控股集团"
android:textColor="@color/textMain" android:textColor="@color/textMain"
android:textSize="@dimen/text_18" android:textSize="@dimen/text_18" />
android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tv_position" android:id="@+id/tv_position"
...@@ -52,23 +51,22 @@ ...@@ -52,23 +51,22 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:textSize="@dimen/text_12"
android:id="@+id/tv_contacts" android:id="@+id/tv_contacts"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="联系人" /> android:text="联系人"
android:textSize="@dimen/text_12" />
<TextView <TextView
android:id="@+id/tv_call" android:id="@+id/tv_call"
android:layout_width="@dimen/size_70" android:layout_width="wrap_content"
android:layout_height="@dimen/size_25" android:layout_height="@dimen/size_25"
android:layout_marginLeft="@dimen/size_5" android:layout_marginLeft="@dimen/size_5"
android:background="@drawable/shape_rv_button_green" android:autoLink="all"
android:gravity="center" android:gravity="center"
android:text="拨打电话" android:text="137****7148"
android:textColor="#6DB186" android:textColor="@color/tv_gr999999"
android:textSize="@dimen/sp_12" android:textSize="@dimen/sp_12" />
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/size_140" android:layout_height="wrap_content"
android:background="#ffffff" android:background="#ffffff"
android:orientation="vertical"> android:orientation="vertical">
...@@ -14,11 +14,44 @@ ...@@ -14,11 +14,44 @@
android:textSize="@dimen/text_12" /> android:textSize="@dimen/text_12" />
<GridView <GridView
android:listSelector="@android:color/transparent"
android:id="@+id/gdv_hot_city" android:id="@+id/gdv_hot_city"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/size_80"
android:layout_marginBottom="@dimen/size_10" android:layout_marginBottom="@dimen/size_10"
android:listSelector="@android:color/transparent"
android:numColumns="4" /> android:numColumns="4" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/size_42"
android:layout_marginTop="5dp"
android:background="@color/gray_f5f5f5">
<TextView
android:id="@+id/tv_current_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/size_15"
android:text="当前定位城市"
android:textColor="#666666"
android:textSize="@dimen/sp_12" />
<TextView
android:id="@+id/tv_relocation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/size_20"
android:drawableLeft="@drawable/icon_location"
android:drawablePadding="@dimen/size_5"
android:gravity="center"
android:text="重新定位"
android:textColor="#fdb51c"
android:textSize="@dimen/sp_12" />
</RelativeLayout>
</LinearLayout> </LinearLayout>
...@@ -20,9 +20,8 @@ ...@@ -20,9 +20,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/iv_flag" android:layout_below="@id/iv_flag"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:text="当前城市暂无门店" android:text="暂无分公司,请换个城市试试!"
android:textColor="@color/colorGray" android:textColor="#333333"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_14" />
android:textStyle="bold" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -47,12 +47,12 @@ ...@@ -47,12 +47,12 @@
<string name="rv_ok">确定</string> <string name="rv_ok">确定</string>
<string name="rv_rental_car">租房车</string> <string name="rv_rental_car">租房车</string>
<string name="rv_rental_car_content">开启生活新旅程</string> <string name="rv_rental_car_content">开启生活新旅程</string>
<string name="rv_get_car_address">取车公司</string> <string name="rv_get_car_address">取车公司</string>
<string name="rv_get_car_address_">取车地址:</string> <string name="rv_get_car_address_">取车地址:</string>
<string name="rv_get_car_hint">输入取车地址</string> <string name="rv_get_car_hint">选择取车分公司</string>
<string name="rv_get_out_address">还车公司</string> <string name="rv_get_out_address">车公司</string>
<string name="rv_get_out_address_">还车地址:</string> <string name="rv_get_out_address_">还车地址:</string>
<string name="rv_get_out_hint">输入还车地址</string> <string name="rv_get_out_hint">选择还车分公司</string>
<string name="rv_full_time_driver">欣新专职司机(600/天)</string> <string name="rv_full_time_driver">欣新专职司机(600/天)</string>
<string name="rv_immediately_car">立即选车</string> <string name="rv_immediately_car">立即选车</string>
<string name="rv_hot_car_type">热门车型</string> <string name="rv_hot_car_type">热门车型</string>
......
package com.rv.share; package com.rv.share;
import android.Manifest;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.CardView; import android.support.v7.widget.CardView;
import android.view.View; import android.view.View;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.Button; import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity; import com.ruiwenliu.wrapper.base.BaseStatusActivity;
...@@ -107,11 +113,16 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> { ...@@ -107,11 +113,16 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> {
if (id == R.id.tv_back_title) { if (id == R.id.tv_back_title) {
finish(); finish();
} else if (id == R.id.btn_share) { } else if (id == R.id.btn_share) {
mPresenter.showShareDialog(llContent, rvWebView); preShare();
} }
} }
private RvWebView.WebViewListener listener = new RvWebView.WebViewListener() { private RvWebView.WebViewListener listener = new RvWebView.WebViewListener() {
@Override
public void share(String url, String imgUrl, String title, String circleTitle, String desc) {
}
@Override @Override
public void share(String url, String title, String desc) { public void share(String url, String title, String desc) {
} }
...@@ -123,4 +134,35 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> { ...@@ -123,4 +134,35 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> {
}; };
/**
* 预备下载 进行 6.0权限检查
*/
private void preShare() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
mPresenter.showShareDialog(llContent, rvWebView);
} else {
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
mPresenter.showShareDialog(llContent, rvWebView);
} else {//申请权限
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1001);
}
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case 1001:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
mPresenter.showShareDialog(llContent, rvWebView);
;
} else {
Toast.makeText(getApplicationContext(), "授权失败,无法分享海报", Toast.LENGTH_SHORT).show();
}
break;
}
}
} }
package com.rv.share; package com.rv.share;
import android.Manifest;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.CardView; import android.support.v7.widget.CardView;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
...@@ -12,6 +18,7 @@ import android.widget.Button; ...@@ -12,6 +18,7 @@ import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.base.utils.ui.image.round.RoundImageView; import com.base.utils.ui.image.round.RoundImageView;
import com.ruiwenliu.wrapper.SPConstance; import com.ruiwenliu.wrapper.SPConstance;
...@@ -46,8 +53,8 @@ public class ReativeBillActivity extends BaseStatusActivity<ReativeBillPresenter ...@@ -46,8 +53,8 @@ public class ReativeBillActivity extends BaseStatusActivity<ReativeBillPresenter
Button btnShare; Button btnShare;
@BindView(R2.id.ll_bill_content) @BindView(R2.id.ll_bill_content)
CardView llBillContent; CardView llBillContent;
@BindView(R2.id.ll_content) // @BindView(R2.id.ll_content)
LinearLayout llContent; // LinearLayout llContent;
public static Intent getIntent(Context context, String url) { public static Intent getIntent(Context context, String url) {
Intent intent = new Intent(context, ReativeBillActivity.class); Intent intent = new Intent(context, ReativeBillActivity.class);
...@@ -87,15 +94,63 @@ public class ReativeBillActivity extends BaseStatusActivity<ReativeBillPresenter ...@@ -87,15 +94,63 @@ public class ReativeBillActivity extends BaseStatusActivity<ReativeBillPresenter
} }
@OnClick({R2.id.btn_save_bill, R2.id.btn_share,R2.id.tv_back_title}) @OnClick({R2.id.btn_save_bill, R2.id.btn_share, R2.id.tv_back_title})
public void onViewClicked(View view) { public void onViewClicked(View view) {
int id = view.getId(); int id = view.getId();
if (id == R.id.tv_back_title) { if (id == R.id.tv_back_title) {
finish(); finish();
} else if (id == R.id.btn_save_bill) { } else if (id == R.id.btn_save_bill) {
mPresenter.saveBill(llContent); preShare(0, 1001);
} else if (id == R.id.btn_share) { } else if (id == R.id.btn_share) {
mPresenter.saveShare(llContent); preShare(1, 1002);
} }
} }
/**
* 预备下载 进行 6.0权限检查
*/
private void preShare(int type, int requestCode) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
if (type == 0) {
mPresenter.saveBill(llBillContent);
} else {
mPresenter.share(llBillContent);
}
} else {
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
if (type == 0) {
mPresenter.saveBill(llBillContent);
} else {
mPresenter.share(llBillContent);
}
} else {//申请权限
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, requestCode);
}
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case 1001:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
mPresenter.saveBill(llBillContent);
} else {
Toast.makeText(getApplicationContext(), "授权失败,无法分享海报", Toast.LENGTH_SHORT).show();
}
break;
case 1002:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
mPresenter.share(llBillContent);
} else {
Toast.makeText(getApplicationContext(), "授权失败,无法分享海报", Toast.LENGTH_SHORT).show();
}
break;
}
}
} }
...@@ -117,7 +117,7 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> { ...@@ -117,7 +117,7 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> {
if (id == R.id.tv_weixin) { if (id == R.id.tv_weixin) {
mPresenter.shareWx(shareUrl, "新人专享大礼包,快去领!", " "); mPresenter.shareWx(shareUrl, "新人专享大礼包,快去领!", " ");
} else if (id == R.id.tv_weixin_circle) { } else if (id == R.id.tv_weixin_circle) {
mPresenter.shareWxC(shareUrl, "新人专享大礼包,快去领!", " "); mPresenter.shareWxC(shareUrl, "【滴房车】新人专享大礼包,快去领!", " ");
} else if (id == R.id.tv_bill) { } else if (id == R.id.tv_bill) {
startActivity(ReativeBillActivity.getIntent(this, shareUrl)); startActivity(ReativeBillActivity.getIntent(this, shareUrl));
} else if (id == R.id.tv_more) { } else if (id == R.id.tv_more) {
......
...@@ -91,9 +91,14 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> { ...@@ -91,9 +91,14 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> {
} }
private RvWebView.WebViewListener listener = new RvWebView.WebViewListener() { private RvWebView.WebViewListener listener = new RvWebView.WebViewListener() {
@Override
public void share(String url, String imgUrl, String title, String circleTitle, String desc) {
mPresenter.showShareDialog(url, imgUrl, title, circleTitle, desc);
}
@Override @Override
public void share(String url, String title, String desc) { public void share(String url, String title, String desc) {
mPresenter.showShareDialog(url, title, desc); mPresenter.showShareDialog(url, null, title, null, desc);
} }
@Override @Override
......
...@@ -100,19 +100,30 @@ public class BillPresenter extends CommonPresenter { ...@@ -100,19 +100,30 @@ public class BillPresenter extends CommonPresenter {
return bmp; return bmp;
} }
public File saveBitmapFile(Bitmap bitmap) { private File saveBitmapFile(Bitmap bitmap) {
File file = new File(StorageUtils.getCachePath(getPresenterContext()) + System.currentTimeMillis() + ".jpg");//将要保存图片的路径 File parent = new File(StorageUtils.getPhotoSavePath(getPresenterContext()));
if (!parent.exists()) {
parent.mkdirs();
}
File file = new File(parent, System.currentTimeMillis() + ".jpg");//将要保存图片的路径
BufferedOutputStream bos = null;
try { try {
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file)); bos = new BufferedOutputStream(new FileOutputStream(file));
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bos); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bos);
bos.flush(); bos.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (bos != null) {
try {
bos.close(); bos.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
}
}
StorageUtils.notifyImageChange(getPresenterContext(), file.getPath());
return file; return file;
} }
......
package com.rv.share.presenter; package com.rv.share.presenter;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.support.v7.widget.CardView;
import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import com.base.utils.ui.datetime.picker.Utils;
import com.base.utils.ui.datetime.selector.util.TextUtil;
import com.rv.home.rv.module.basic.presenter.CommonPresenter; import com.rv.home.rv.module.basic.presenter.CommonPresenter;
import com.rv.share.ReativeBillActivity;
import com.rv.share.utils.ShareUtils;
import com.rv.share.utils.StorageUtils; import com.rv.share.utils.StorageUtils;
import com.rv.share.view.ShareChoiceDialog;
import com.umeng.socialize.ShareAction; import com.umeng.socialize.ShareAction;
import com.umeng.socialize.bean.SHARE_MEDIA; import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.media.UMImage; import com.umeng.socialize.media.UMImage;
...@@ -20,8 +28,11 @@ import java.io.IOException; ...@@ -20,8 +28,11 @@ import java.io.IOException;
public class ReativeBillPresenter extends CommonPresenter { public class ReativeBillPresenter extends CommonPresenter {
private UMImage image = null; private ShareChoiceDialog dialog = null;
private ShareAction shareAction = null; private ShareAction shareAction = null;
private View view = null;
private Bitmap bitmap = null;
private UMImage image = null;
/***** /*****
* 保存海报 * 保存海报
...@@ -29,10 +40,10 @@ public class ReativeBillPresenter extends CommonPresenter { ...@@ -29,10 +40,10 @@ public class ReativeBillPresenter extends CommonPresenter {
*/ */
public void saveBill(View view) { public void saveBill(View view) {
if (view != null) { if (view != null) {
Bitmap bitmap = viewConversionBitmap(view); Bitmap bitmap = ShareUtils.viewConversionBitmap(view);
File file = null; File file = null;
if (bitmap != null) { if (bitmap != null) {
file = saveBitmapFile(bitmap); file = ShareUtils.saveBitmapFile(getPresenterContext(), bitmap);
} }
if (file != null) { if (file != null) {
Toast.makeText(getPresenterContext(), "海报保存在" + file.getAbsolutePath(), Toast.LENGTH_LONG).show(); Toast.makeText(getPresenterContext(), "海报保存在" + file.getAbsolutePath(), Toast.LENGTH_LONG).show();
...@@ -40,25 +51,21 @@ public class ReativeBillPresenter extends CommonPresenter { ...@@ -40,25 +51,21 @@ public class ReativeBillPresenter extends CommonPresenter {
} }
} }
/*****
* 保存海报 /******
* @param view * 分享
*/ */
public void saveShare(View view) { public void share(View view) {
if (view != null) { this.view = view;
Bitmap bitmap = viewConversionBitmap(view); if (dialog == null) {
File file = null; dialog = new ShareChoiceDialog.Builder(getPresenterContext())
if (bitmap != null) { .setShareListener(myListener)
file = saveBitmapFile(bitmap); .setWxVisiable(true)
} .setWxCVisiable(true)
if (file != null) { .setQQVisiable(true)
image = new UMImage(getPresenterContext(), file);//bitmap文件 .create();
image.compressStyle = UMImage.CompressStyle.SCALE;//大小压缩,默认为大小压缩,适合普通很大的图
image.compressStyle = UMImage.CompressStyle.QUALITY;//质量压缩,适合长图的分享
image.compressFormat = Bitmap.CompressFormat.PNG;
share(SHARE_MEDIA.WEIXIN_CIRCLE, image, "");
}
} }
dialog.show();
} }
/****** /******
...@@ -76,37 +83,70 @@ public class ReativeBillPresenter extends CommonPresenter { ...@@ -76,37 +83,70 @@ public class ReativeBillPresenter extends CommonPresenter {
shareAction.share(); shareAction.share();
} }
private ShareChoiceDialog.ShareListener myListener = new ShareChoiceDialog.ShareListener() {
/** private void shareDeal() {
* view转bitmap if (view != null && bitmap == null) {
*/ bitmap = ShareUtils.viewConversionBitmap(view);
private Bitmap viewConversionBitmap(View v) {
int w = v.getWidth();
int h = v.getHeight();
int startX = (int) v.getX();
int startY = (int) v.getY();
Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_4444);
Canvas c = new Canvas(bmp);
c.drawColor(Color.WHITE);
v.layout(startX, startY, w + startX, h + startY);
v.draw(c);
return bmp;
}
private File saveBitmapFile(Bitmap bitmap) {
File file = new File(StorageUtils.getCachePath(getPresenterContext()) + (int) (System.currentTimeMillis() / 1000000) + ".jpg");//将要保存图片的路径
if (file.exists()) {
return file;
}
try {
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bos);
bos.flush();
bos.close();
} catch (IOException e) {
e.printStackTrace();
}
return file;
} }
File file = null;
if (bitmap != null) {
file = ShareUtils.saveBitmapFile(getPresenterContext(), bitmap);
}
if (file != null) {
image = new UMImage(getPresenterContext(), file);//bitmap文件
image.compressStyle = UMImage.CompressStyle.SCALE;//大小压缩,默认为大小压缩,适合普通很大的图
image.compressStyle = UMImage.CompressStyle.QUALITY;//质量压缩,适合长图的分享
image.compressFormat = Bitmap.CompressFormat.PNG;
}
}
@Override
public void copyShare() {
}
@Override
public void wxShare() {
if (image == null) {
shareDeal();
}
if (image != null) {
share(SHARE_MEDIA.WEIXIN, image, "");
}
}
@Override
public void wxCShare() {
if (image == null) {
shareDeal();
}
if (image != null) {
share(SHARE_MEDIA.WEIXIN_CIRCLE, image, "");
}
}
@Override
public void qqShare() {
}
@Override
public void billShare() {
}
@Override
public void close() {
}
};
// @Override
// public void detachView() {
// super.detachView();
// if (bitmap != null) {
// bitmap.recycle();
// }
// }
} }
...@@ -17,6 +17,7 @@ import com.rv.component.utils.DisplayUtil; ...@@ -17,6 +17,7 @@ import com.rv.component.utils.DisplayUtil;
import com.rv.home.rv.module.basic.presenter.CommonPresenter; import com.rv.home.rv.module.basic.presenter.CommonPresenter;
import com.rv.share.R; import com.rv.share.R;
import com.rv.share.ReativeBillActivity; import com.rv.share.ReativeBillActivity;
import com.rv.share.utils.ShareUtils;
import com.rv.share.view.ShareChoiceDialog; import com.rv.share.view.ShareChoiceDialog;
import com.umeng.socialize.ShareAction; import com.umeng.socialize.ShareAction;
import com.umeng.socialize.UMShareListener; import com.umeng.socialize.UMShareListener;
...@@ -59,7 +60,7 @@ public class SharePresenter extends CommonPresenter { ...@@ -59,7 +60,7 @@ public class SharePresenter extends CommonPresenter {
shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener); shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener);
} }
UMImage image = new UMImage(getPresenterContext(), R.drawable.share_logo); UMImage image = new UMImage(getPresenterContext(), R.drawable.icon_share);
UMWeb web = new UMWeb(mUrl); UMWeb web = new UMWeb(mUrl);
web.setTitle(mTitle);//标题 web.setTitle(mTitle);//标题
web.setThumb(image); //缩略图 web.setThumb(image); //缩略图
...@@ -78,7 +79,7 @@ public class SharePresenter extends CommonPresenter { ...@@ -78,7 +79,7 @@ public class SharePresenter extends CommonPresenter {
if (shareAction == null) { if (shareAction == null) {
shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener); shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener);
} }
UMImage image = new UMImage(getPresenterContext(), R.drawable.share_logo); UMImage image = new UMImage(getPresenterContext(), R.drawable.icon_share);
UMWeb web = new UMWeb(mUrl); UMWeb web = new UMWeb(mUrl);
web.setTitle(mTitle + " " + mDescript);//标题 web.setTitle(mTitle + " " + mDescript);//标题
web.setThumb(image); //缩略图 web.setThumb(image); //缩略图
...@@ -134,7 +135,7 @@ public class SharePresenter extends CommonPresenter { ...@@ -134,7 +135,7 @@ public class SharePresenter extends CommonPresenter {
@Override @Override
public void copyShare() { public void copyShare() {
if (!TextUtils.isEmpty(mUrl)) { if (!TextUtils.isEmpty(mUrl)) {
copy(mUrl); ShareUtils.copy(getPresenterContext(), mUrl);
} }
} }
...@@ -167,16 +168,4 @@ public class SharePresenter extends CommonPresenter { ...@@ -167,16 +168,4 @@ public class SharePresenter extends CommonPresenter {
public void close() { public void close() {
} }
}; };
/*******
* 复制地址
* @param url
*/
private void copy(String url) {
ClipboardManager cm = (ClipboardManager) getPresenterContext().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData mClipData = ClipData.newRawUri("Label", Uri.parse(url));
cm.setPrimaryClip(mClipData);
Toast.makeText(getPresenterContext(), "复制成功", Toast.LENGTH_SHORT).show();
}
} }
...@@ -32,14 +32,18 @@ public class WebViewPresenter extends CommonPresenter { ...@@ -32,14 +32,18 @@ public class WebViewPresenter extends CommonPresenter {
private String mUrl = null; private String mUrl = null;
private String mTitle = null; private String mTitle = null;
private String mDescript = null; private String mDescript = null;
private String mImgUrl;
private String mCircleTitle;
private RvWebView webView; private RvWebView webView;
public void setWebView(RvWebView webView) { public void setWebView(RvWebView webView) {
this.webView = webView; this.webView = webView;
} }
public void showShareDialog(String url, String title, String descript) { public void showShareDialog(String url, String imgUrl, String title, String circleTitle, String descript) {
this.mUrl = url; this.mUrl = url;
this.mImgUrl = imgUrl;
this.mCircleTitle = circleTitle;
this.mTitle = title; this.mTitle = title;
this.mDescript = descript; this.mDescript = descript;
if (dialog == null) { if (dialog == null) {
...@@ -62,8 +66,12 @@ public class WebViewPresenter extends CommonPresenter { ...@@ -62,8 +66,12 @@ public class WebViewPresenter extends CommonPresenter {
if (shareAction == null) { if (shareAction == null) {
shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener); shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener);
} }
UMImage image;
UMImage image = new UMImage(getPresenterContext(), R.drawable.share_logo); if (!TextUtils.isEmpty(mImgUrl)) {
image = new UMImage(getPresenterContext(), mImgUrl);
} else {
image = new UMImage(getPresenterContext(), R.drawable.icon_share);
}
UMWeb web = new UMWeb(mUrl); UMWeb web = new UMWeb(mUrl);
web.setTitle(mTitle);//标题 web.setTitle(mTitle);//标题
web.setThumb(image); //缩略图 web.setThumb(image); //缩略图
...@@ -82,9 +90,15 @@ public class WebViewPresenter extends CommonPresenter { ...@@ -82,9 +90,15 @@ public class WebViewPresenter extends CommonPresenter {
if (shareAction == null) { if (shareAction == null) {
shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener); shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener);
} }
UMImage image = new UMImage(getPresenterContext(), R.drawable.share_logo);
UMImage image;
if (!TextUtils.isEmpty(mImgUrl)) {
image = new UMImage(getPresenterContext(), mImgUrl);
} else {
image = new UMImage(getPresenterContext(), R.drawable.icon_share);
}
UMWeb web = new UMWeb(mUrl); UMWeb web = new UMWeb(mUrl);
web.setTitle(mTitle);//标题 web.setTitle(TextUtils.isEmpty(mCircleTitle) ? mTitle : mCircleTitle);//标题
web.setThumb(image); //缩略图 web.setThumb(image); //缩略图
shareAction.setPlatform(SHARE_MEDIA.WEIXIN_CIRCLE)//传入平台 shareAction.setPlatform(SHARE_MEDIA.WEIXIN_CIRCLE)//传入平台
.withMedia(web); .withMedia(web);
...@@ -128,9 +142,9 @@ public class WebViewPresenter extends CommonPresenter { ...@@ -128,9 +142,9 @@ public class WebViewPresenter extends CommonPresenter {
@Override @Override
public void onResult(SHARE_MEDIA share_media) { public void onResult(SHARE_MEDIA share_media) {
if (webView != null) { // if (webView != null) {
webView.loadUrl("javascript:shareSuccess()"); // webView.loadUrl("javascript:shareSuccess()");
} // }
} }
@Override @Override
......
package com.rv.share.utils;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.net.Uri;
import android.view.View;
import android.widget.Toast;
import com.rv.share.R;
import com.umeng.socialize.ShareAction;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.media.UMImage;
import com.umeng.socialize.media.UMWeb;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class ShareUtils {
/*******
* 复制地址
* @param url
*/
public static void copy(Context context, String url) {
ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData mClipData = ClipData.newRawUri("Label", Uri.parse(url));
cm.setPrimaryClip(mClipData);
Toast.makeText(context, "复制成功", Toast.LENGTH_SHORT).show();
}
/**
* view转bitmap
*/
public static Bitmap viewConversionBitmap(View v) {
int w = v.getWidth();
int h = v.getHeight();
int startX = (int) v.getX();
int startY = (int) v.getY();
Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_4444);
Canvas c = new Canvas(bmp);
c.drawColor(Color.WHITE);
v.layout(startX, startY, w + startX, h + startY);
v.draw(c);
return bmp;
}
public static File saveBitmapFile(Context context, Bitmap bitmap) {
File parent = new File(StorageUtils.getPhotoSavePath(context));
if (!parent.exists()) {
parent.mkdirs();
}
File file = new File(parent, System.currentTimeMillis() + ".jpg");//将要保存图片的路径
if (file.exists()) {
return file;
}
BufferedOutputStream bos = null;
try {
bos = new BufferedOutputStream(new FileOutputStream(file));
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bos);
bos.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (bos != null) {
try {
bos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
StorageUtils.notifyImageChange(context, file.getPath());
return file;
}
}
package com.rv.share.utils; package com.rv.share.utils;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment; import android.os.Environment;
import java.io.File;
public class StorageUtils { public class StorageUtils {
public static String getCachePath(Context context) { private final static String DIR = "image";
/********
* 获取图片保存路径
* @param context
* @return
*/
public static String getPhotoSavePath(Context context) {
String cachePath = null; String cachePath = null;
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
|| !Environment.isExternalStorageRemovable()) { || !Environment.isExternalStorageRemovable()) {
cachePath = context.getExternalCacheDir().getPath(); cachePath = Environment.getExternalStorageDirectory().getPath();
} else { } else {
cachePath = context.getCacheDir().getPath(); cachePath = context.getCacheDir().getPath();
} }
return cachePath; return cachePath + File.separator + DIR + File.separator;
}
public static void notifyImageChange(Context context, String filePath) {
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
Uri uri = Uri.fromFile(new File(filePath));
intent.setData(uri);
context.sendBroadcast(intent); // 发送广播通知相册
} }
} }
package com.rv.share.view;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.rv.component.utils.DisplayUtil;
import com.rv.share.R;
public class BillDialog extends Dialog {
public BillDialog(@NonNull Context context) {
super(context);
}
public BillDialog(Context context, int themeResId) {
super(context, themeResId);
}
public static class Builder {
private Context mContext;
private ImageView imgClose;
private View.OnClickListener mListener;
private String content;
private LinearLayout llWebview;
public Builder(Context context, View.OnClickListener listener) {
mContext = context;
this.mListener = listener;
}
public Builder(Context context) {
mContext = context;
}
public Builder setContent(String content) {
this.content = content;
return this;
}
public Builder show() {
final BillDialog dialog = create();
dialog.show();
return this;
}
/**
* 创建定制的对话框
*/
public BillDialog create() {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final BillDialog dialog = new BillDialog(mContext, R.style.DialogActivityTheme);
// 获取对话框的布局
View layout = inflater.inflate(R.layout.dialog_bill, null);
// 为对话框添加布局和设置大小
dialog.addContentView(layout, new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT));
this.llWebview = layout.findViewById(R.id.ll_webview);
RvWebView view = new RvWebView(mContext, listener);
llWebview.addView(view);
view.loadUrl("https://www.baidu.com");
this.imgClose = layout.findViewById(R.id.img_close);
this.imgClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
//默认不能点击对话框其他区域退出 和按返回键退出
dialog.setCancelable(true);
dialog.setContentView(layout);
return dialog;
}
private RvWebView.WebViewListener listener = new RvWebView.WebViewListener() {
@Override
public void share(String url, String title, String desc) {
}
@Override
public void finish() {
}
};
}
}
...@@ -61,15 +61,15 @@ public class PromotionDialog extends Dialog { ...@@ -61,15 +61,15 @@ public class PromotionDialog extends Dialog {
// 为对话框添加布局和设置大小 // 为对话框添加布局和设置大小
dialog.addContentView(layout, new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT)); dialog.addContentView(layout, new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT));
this.button = layout.findViewById(R.id.button); this.button = layout.findViewById(R.id.button);
if (this.act != null && !TextUtils.isEmpty(this.act.getButtonImages())) { // if (this.act != null && !TextUtils.isEmpty(this.act.getButtonImages())) {
GlideManager.getInstance(mContext).loadImage2(this.act.getButtonImages(), this.button); // GlideManager.getInstance(mContext).loadImage2(this.act.getButtonImages(), this.button);
} // }
this.imgBg = layout.findViewById(R.id.img_bg); this.imgBg = layout.findViewById(R.id.img_bg);
if (this.act != null && !TextUtils.isEmpty(this.act.getBackground())) { if (this.act != null && !TextUtils.isEmpty(this.act.getBackground())) {
GlideManager.getInstance(mContext).loadImage2(this.act.getBackground(), this.imgBg); GlideManager.getInstance(mContext).loadImage2(this.act.getBackground(), this.imgBg);
} }
this.imgClose = layout.findViewById(R.id.img_close); this.imgClose = layout.findViewById(R.id.img_close);
this.button.setOnClickListener(mListener); layout.setOnClickListener(mListener);
this.imgClose.setOnClickListener(new View.OnClickListener() { this.imgClose.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
......
...@@ -163,6 +163,26 @@ public class RvWebView extends WebView { ...@@ -163,6 +163,26 @@ public class RvWebView extends WebView {
} }
} }
/*******
* @param url
* 跳转url
* @param imgUrl
* 活动图片url
* @param title
* 标题
* @param titleCircle
* 朋友圈标题
* @param desc
* 描述
*/
@JavascriptInterface
public void share(String url, String imgUrl, String title, String titleCircle, String desc) {
if (listener != null) {
listener.share(url, imgUrl, title, titleCircle, desc);
}
}
@JavascriptInterface @JavascriptInterface
public void toMyWallet() { public void toMyWallet() {
...@@ -170,7 +190,7 @@ public class RvWebView extends WebView { ...@@ -170,7 +190,7 @@ public class RvWebView extends WebView {
@JavascriptInterface @JavascriptInterface
public String getCode() { public String getCode() {
String code = Cookie.getStringValue(getContext(), "my_code", ""); String code = Cookie.getStringValue(getContext(), SPConstance.USER_JSON_CODE, "");
return code; return code;
} }
...@@ -183,6 +203,8 @@ public class RvWebView extends WebView { ...@@ -183,6 +203,8 @@ public class RvWebView extends WebView {
public interface WebViewListener { public interface WebViewListener {
void share(String url, String imgUrl, String title, String circleTitle, String desc);
void share(String url, String title, String desc); void share(String url, String title, String desc);
void finish(); void finish();
......
...@@ -84,7 +84,7 @@ public class ShareChoiceDialog implements View.OnClickListener { ...@@ -84,7 +84,7 @@ public class ShareChoiceDialog implements View.OnClickListener {
tvBill.setOnClickListener(this); tvBill.setOnClickListener(this);
tvCancle.setOnClickListener(this); tvCancle.setOnClickListener(this);
dialog.setContentView(view); dialog.setContentView(view);
dialog.setCancelable(false); dialog.setCancelable(true);
} }
public void show() { public void show() {
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
android:textSize="@dimen/text_18" android:textSize="@dimen/text_18"
android:textStyle="normal" /> android:textStyle="normal" />
<include layout="@layout/common_line" /> <include layout="@layout/common_line" />
<FrameLayout <FrameLayout
...@@ -29,15 +28,21 @@ ...@@ -29,15 +28,21 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#55eeeeee"> android:background="#55eeeeee">
<LinearLayout <ScrollView
android:id="@+id/ll_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_10" android:layout_marginLeft="13dp"
android:layout_marginTop="@dimen/size_15" android:layout_marginTop="@dimen/size_15"
android:layout_marginRight="@dimen/size_10" android:layout_marginRight="13dp"
android:layout_marginBottom="@dimen/size_70" android:layout_marginBottom="@dimen/size_70"
android:gravity="center"> android:scrollbars="none">
<!--<LinearLayout-->
<!--android:background="#55eeeeee"-->
<!--android:id="@+id/ll_content"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:gravity="center">-->
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
android:id="@+id/ll_bill_content" android:id="@+id/ll_bill_content"
...@@ -53,8 +58,7 @@ ...@@ -53,8 +58,7 @@
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/size_200" android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/bg_bill" /> android:src="@drawable/bg_bill" />
<LinearLayout <LinearLayout
...@@ -84,8 +88,8 @@ ...@@ -84,8 +88,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="155****5918" android:text="155****5918"
android:textColor="#000000" android:textColor="@color/colorMain"
android:textSize="@dimen/sp_16" /> android:textSize="@dimen/text_18" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -101,25 +105,25 @@ ...@@ -101,25 +105,25 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="right"
android:layout_marginRight="@dimen/size_10" android:layout_marginRight="17dp"
android:layout_weight="1" android:layout_weight="1"
android:gravity="right|center_vertical" android:gravity="right|center_vertical"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/img_qrcode" android:id="@+id/img_qrcode"
android:layout_width="@dimen/size_100" android:layout_width="@dimen/size_80"
android:layout_height="@dimen/size_100" android:layout_height="@dimen/size_80"
android:src="@drawable/icon_share_wx" /> android:src="@drawable/icon_share_wx" />
<TextView <TextView
android:layout_width="@dimen/size_100" android:layout_width="@dimen/size_80"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_8" android:layout_marginTop="@dimen/size_8"
android:gravity="center" android:gravity="center"
android:text="长按领奖励" android:text="长按领奖励"
android:textColor="#000000" android:textColor="@color/colorMain"
android:textSize="13sp" /> android:textSize="@dimen/sp_12" />
</LinearLayout> </LinearLayout>
...@@ -138,7 +142,8 @@ ...@@ -138,7 +142,8 @@
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</LinearLayout> <!--</LinearLayout>-->
</ScrollView>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -170,7 +175,7 @@ ...@@ -170,7 +175,7 @@
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/bg_bill_share" android:background="@drawable/bg_bill_share"
android:gravity="center" android:gravity="center"
android:text="分享朋友圈" android:text="马上分享"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/sp_16" /> android:textSize="@dimen/sp_16" />
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#FCE2A8" android:background="#ffe5d0"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical" android:orientation="vertical"
......
...@@ -6,16 +6,17 @@ ...@@ -6,16 +6,17 @@
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <FrameLayout
android:layout_width="300dp" android:layout_width="wrap_content"
android:layout_height="300dp" android:layout_height="wrap_content"
android:minWidth="300dp" android:minHeight="@dimen/dialog_min_height"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/img_bg" android:id="@+id/img_bg"
android:scaleType="fitXY" android:layout_width="@dimen/dialog_act_width"
android:layout_width="300dp" android:layout_height="@dimen/dialog_act_height"
android:layout_height="300dp" /> android:minHeight="@dimen/dialog_min_height"
android:scaleType="fitXY" />
<ImageView <ImageView
...@@ -27,7 +28,8 @@ ...@@ -27,7 +28,8 @@
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/size_10" android:layout_marginBottom="@dimen/size_10"
android:gravity="center" /> android:gravity="center"
android:visibility="gone" />
</FrameLayout> </FrameLayout>
...@@ -38,5 +40,4 @@ ...@@ -38,5 +40,4 @@
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:src="@drawable/home_icon_close" /> android:src="@drawable/home_icon_close" />
</LinearLayout> </LinearLayout>
<?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">200dp</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">266.67dp</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">400dp</dimen>
</resources>
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