Browse Source

释放资源,避免内存泄漏

调味吧台
liup 7 months ago
parent
commit
128befe2e6
9 changed files with 29 additions and 13 deletions
  1. +6
    -0
      app/src/main/java/com/bonait/bnframework/common/view/AddGoodDialog.java
  2. +1
    -7
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java
  3. +3
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/GoodPeiFangActivity.java
  4. +1
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java
  5. +1
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_fragment.java
  6. +4
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_good_control.java
  7. +7
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java
  8. +6
    -6
      app/src/main/res/layout/fragment_gongneng.xml
  9. BIN
     

+ 6
- 0
app/src/main/java/com/bonait/bnframework/common/view/AddGoodDialog.java View File

@@ -397,4 +397,10 @@ public class AddGoodDialog extends Dialog {
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
};

@Override
public void dismiss() {
super.dismiss();
MessageManager.getInstance().unRegisterMessageReceiver(activity_ma);
}
}

+ 1
- 7
app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java View File

@@ -81,15 +81,8 @@ import com.bonait.bnframework.common.message.MessageManager;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.loadinggood_adapter;
import com.bonait.bnframework.modules.home.adapter.wl_adapter;
import com.bonait.bnframework.modules.home.fragment.mode.SerialInter;
import com.bonait.bnframework.modules.home.fragment.mode.SerialManage;
import com.bonait.bnframework.modules.home.fragment.mode.SerialPortRead;
import com.bonait.bnframework.modules.home.fragment.mode.ShaoMaSave;
//import com.bonait.bnframework.modules.home.fragment.mode.ShaomaTest;
import com.bonait.bnframework.modules.home.fragment.mode.add_makegood_control;
import com.bonait.bnframework.modules.home.fragment.mode.add_manguan_control;
import com.bonait.bnframework.modules.home.fragment.mode.add_pf_control;
import com.bumptech.glide.Glide;
import com.litao.slider.NiftySlider;
import com.orhanobut.logger.Logger;
@@ -822,6 +815,7 @@ public class MakeGoodFragment extends BaseFragment {

rv_right.setAdapter(null);
Glide.get(getContext()).clearMemory();
MessageManager.getInstance().unRegisterMessageReceiver(getActivity());
}

/**


+ 3
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/GoodPeiFangActivity.java View File

@@ -420,9 +420,12 @@ public class GoodPeiFangActivity extends BaseActivity {

@Override
public void onDestroy() {
add_pf.destroy();
add_good.destroy();
super.onDestroy();
rv_right.setAdapter(null);
Glide.get(this).clearMemory();
MessageManager.getInstance().unRegisterMessageReceiver(this);
}

@Override


+ 1
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java View File

@@ -228,6 +228,7 @@ public class SilosNewActivity extends BaseActivity {
@Override
public void onDestroy() {
super.onDestroy();
MessageManager.getInstance().unRegisterMessageReceiver(this);
}

@Override


+ 1
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_fragment.java View File

@@ -114,6 +114,7 @@ public class Silos_item_fragment extends BaseFragment {
public void onDestroy() {
super.onDestroy();
Logger.d("我的fragment销毁");
MessageManager.getInstance().unRegisterMessageReceiver(getActivity());
}

/**


+ 4
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_good_control.java View File

@@ -227,6 +227,10 @@ public class add_good_control extends LinearLayout {
});
}

public void destroy(){
MessageManager.getInstance().unRegisterMessageReceiver(activity_ma);
}

public String ids="";
/**
* 数据验证


+ 7
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java View File

@@ -317,6 +317,13 @@ public class add_pf_control extends LinearLayout implements MyClickListener {
}
}

public void destroy(){
Activity activity = findActivity(acontext);
if (activity != null) {
MessageManager.getInstance().unRegisterMessageReceiver(activity);
}
}

/**
* 保存数据
*/


+ 6
- 6
app/src/main/res/layout/fragment_gongneng.xml View File

@@ -245,20 +245,20 @@
android:background="@color/app_color_blue" >
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="?attr/qmui_topbar_height">
<Button
android:id="@+id/btn_sync"
android:layout_width="100dp"
android:layout_height="match_parent"
android:background="null"
android:layout_height="?attr/qmui_topbar_height"
android:background="#00000000"
android:textSize="16sp"
android:layout_centerHorizontal="true"/>
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="wrap_content"
android:layout_height="?attr/qmui_topbar_height"
android:src="@mipmap/yxz"
android:layout_gravity="center"
android:scaleType="fitXY"
android:scaleType="fitCenter"
/>
</FrameLayout>



BIN
View File


Loading…
Cancel
Save