钱包页面自动刷新
This commit is contained in:
parent
0e8ea7147f
commit
c8b6e75d7d
@ -0,0 +1,22 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.event;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/10/20 14:43
|
||||
* @description:
|
||||
*/
|
||||
public class WalletEvent {
|
||||
|
||||
private String message;
|
||||
|
||||
public WalletEvent(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ import android.view.KeyEvent
|
||||
import android.widget.*
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.arpa.hndahesudintocctmsdriver.R
|
||||
import com.arpa.hndahesudintocctmsdriver.event.WalletEvent
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.HomeFragment
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.login.LoginActivity
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.my.MyFragment
|
||||
@ -23,6 +24,7 @@ import com.arpa.hndahesudintocctmsdriver.util.view.PanDuanUtil
|
||||
import com.google.gson.Gson
|
||||
import com.gyf.cactus.ext.cactusUpdateNotification
|
||||
import com.permissionx.guolindev.PermissionX
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
@Suppress("DIVISION_BY_ZERO")
|
||||
@SuppressLint("SetTextI18n")
|
||||
@ -93,6 +95,7 @@ class MainActivity : BaseAppCompatActivity() {
|
||||
bt.hide(fs[bt.index])
|
||||
bt.selectItem(fs[1])
|
||||
} else {
|
||||
EventBus.getDefault().post(WalletEvent("refresh"))
|
||||
bt.setDefaultFragment(fs[1])
|
||||
}
|
||||
bt.index = 1
|
||||
|
@ -15,6 +15,8 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.event.VehicleEvent;
|
||||
import com.arpa.hndahesudintocctmsdriver.event.WalletEvent;
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.UserParts;
|
||||
import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
@ -32,6 +34,8 @@ import com.arpa.hndahesudintocctmsdriver.util.http.RequsetCodeConstants;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseFragment;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseRecyclerView;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
@ -123,6 +127,7 @@ public class WalletFragment extends BaseFragment{
|
||||
@Override
|
||||
public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
|
||||
root=inflater.inflate(R.layout.fragmengt_qianbao,container,false);
|
||||
EventBus.getDefault().register(this);
|
||||
dataName2="bcb";
|
||||
con=root.getContext();
|
||||
rv=root.findViewById(R.id.rv);
|
||||
@ -317,5 +322,14 @@ public class WalletFragment extends BaseFragment{
|
||||
// .show();
|
||||
// }
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void processResult(WalletEvent event) {
|
||||
Log.e("-msg-", event.getMessage());
|
||||
refreshLayout.autoRefresh();
|
||||
}
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user