增加设置家和公司的ContentProvider
This commit is contained in:
@@ -16,7 +16,7 @@ import com.mogo.module.navi.manager.AddressManager;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @author zyz
|
||||
* @since 2019-10-02
|
||||
* <p>
|
||||
* 外部应用设置家和公司的地址
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.module.navi.cp;
|
||||
|
||||
import android.content.Context;
|
||||
import com.mogo.module.navi.bean.SearchPoi;
|
||||
import com.mogo.module.navi.constants.DataConstants;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-10-02
|
||||
* <p>
|
||||
* 设置家和地址的工具类
|
||||
*/
|
||||
public class AddressHelper {
|
||||
|
||||
public static void notifyHomeAddressChanged( Context context ) {
|
||||
if ( context == null ) {
|
||||
return;
|
||||
}
|
||||
context.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 notifyAddressChanged(@Nullable Context context,
|
||||
@NotNull SearchPoi searchPoi) {
|
||||
|
||||
if (searchPoi.getType()== DataConstants.TYPE_HOME_ADDRESS) {
|
||||
notifyHomeAddressChanged(context);
|
||||
}else {
|
||||
notifyCompanyAddressChanged(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import com.mogo.module.navi.constants.AMapConstants
|
||||
import com.mogo.module.navi.manager.AddressManager
|
||||
import com.mogo.module.navi.constants.DataConstants
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.cp.AddressHelper
|
||||
import com.mogo.module.navi.database.AppDataBase
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
@@ -169,6 +170,10 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
|
||||
|
||||
AddressHelper.notifyAddressChanged(context,searchPoi)
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
||||
Reference in New Issue
Block a user