Merge branch 'feature/v1.0.3' of http://gitlab.zhidaoauto.com/ecos/yycp-service/Launcher into feature/v1.0.3

This commit is contained in:
unknown
2020-04-07 11:42:53 +08:00
6 changed files with 29 additions and 23 deletions

View File

@@ -114,6 +114,8 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
@Override
protected void initViews() {
getWindow().setBackgroundDrawable( null );
mCardsContainer = findViewById( R.id.module_main_id_cards_container );
mCardsContainer.setOrientation( OrientedViewPager.Orientation.HORIZONTAL );
mTransformer = new HorizentalStackTransformer( this );

View File

@@ -1,8 +1,10 @@
package com.mogo.module.navi.cp;
import android.content.Context;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.module.navi.bean.SearchPoi;
import com.mogo.module.navi.constants.DataConstants;
import com.mogo.utils.logger.Logger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -14,27 +16,22 @@ import org.jetbrains.annotations.Nullable;
*/
public class AddressHelper {
public static void notifyHomeAddressChanged( Context context ) {
if ( context == null ) {
return;
}
context.getContentResolver().notifyChange( DataConstants.CONTENT_HOME_ADDRESS_URI, null );
private static final String TAG = "AddressHelper";
public static void notifyHomeAddressChanged( ) {
AbsMogoApplication.getApp().getContentResolver().notifyChange( DataConstants.CONTENT_HOME_ADDRESS_URI, null );
}
public static void notifyCompanyAddressChanged( Context context ) {
if ( context == null ) {
return;
}
context.getContentResolver().notifyChange( DataConstants.CONTENT_COMPANY_ADDRESS_URI, null );
public static void notifyCompanyAddressChanged( ) {
AbsMogoApplication.getApp().getContentResolver().notifyChange( DataConstants.CONTENT_COMPANY_ADDRESS_URI, null );
}
public static void notifyAddressChanged(@Nullable Context context,
@NotNull SearchPoi searchPoi) {
if (searchPoi.getType()== DataConstants.TYPE_HOME_ADDRESS) {
notifyHomeAddressChanged(context);
public static void notifyAddressChanged(
int type) {
if (type== DataConstants.TYPE_HOME_ADDRESS) {
notifyHomeAddressChanged();
}else {
notifyCompanyAddressChanged(context);
notifyCompanyAddressChanged();
}
}
}

View File

@@ -13,6 +13,7 @@ import com.mogo.module.navi.database.AppDataBase
import com.mogo.module.navi.ui.search.ChoosePathFragment
import com.mogo.module.navi.ui.setting.SettingAddressFragment
import com.mogo.service.fragmentmanager.FragmentDescriptor
import com.mogo.utils.UiThreadHandler
import io.reactivex.Observable
import io.reactivex.ObservableEmitter
import io.reactivex.ObservableOnSubscribe
@@ -24,6 +25,7 @@ import org.greenrobot.eventbus.EventBus
* @author zyz
* 2020-01-12.
*/
@SuppressLint("StaticFieldLeak")
object AddressManager {
var homeAddress: SearchPoi? = null
var companyAddress: SearchPoi? = null
@@ -60,6 +62,7 @@ object AddressManager {
SearchServiceHolder.push(
newInstance, MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT
)
}
}
@@ -80,8 +83,10 @@ object AddressManager {
SearchServiceHolder.fragmentManager.push(build)
}
private lateinit var context: Context
@SuppressLint("CheckResult") fun init(context: Context) {
this.context=context
poiDao = AppDataBase.getDatabase(context)
.poiDao()
poiDao
@@ -120,7 +125,7 @@ object AddressManager {
ObservableOnSubscribe<String> {
poiDao.delete(homeAddress)
homeAddress?.name=""
AddressHelper.notifyAddressChanged(context, homeAddress!!)
AddressHelper.notifyAddressChanged( 1)
homeAddress=null
})
@@ -135,7 +140,7 @@ object AddressManager {
ObservableOnSubscribe<String> {
poiDao.delete(companyAddress)
companyAddress?.name=""
AddressHelper.notifyAddressChanged(context, companyAddress!!)
AddressHelper.notifyAddressChanged( 0)
companyAddress=null
})

View File

@@ -300,9 +300,7 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
}
UiThreadHandler.postDelayed(Runnable {
AddressHelper.notifyAddressChanged(activity, searchPoi)
}, 100)
}
override fun onDestroyView() {

View File

@@ -159,6 +159,9 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
.windowCenterLocation
moveMapToCenter()
UiThreadHandler.postDelayed({
if (!isAdded) {
return@postDelayed
}
var decodeResource = BitmapFactory.decodeResource(resources, R.mipmap.icon_choose_position2)
val options = MogoMarkerOptions()
.icon(decodeResource)
@@ -180,10 +183,10 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
AddressManager.insert(searchPoi)
Observable.create(
ObservableOnSubscribe<String> {
AppDataBase.getDatabase(context)
AppDataBase.getDatabase(activity)
.poiDao()
.insert(searchPoi)
AddressHelper.notifyAddressChanged(searchPoi.type)
})
.subscribeOn(Schedulers.io())
.subscribe()

View File

@@ -170,6 +170,7 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
ivIcon.setImageResource(R.drawable.module_service_ic_rc_accident2);
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_red_info);
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_red);
break;
case MarkerPoiTypeEnum.FOURS_NEALY:
ivIcon.setImageResource(R.drawable.icon_map_marker_shear_news);
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);