1. 修复现场整改时,问题状态是‘问题审核通过’而不是“整改未审核”的问题;
2. 修改任意拍照界面的多图片展示方式为Glide,减少内存溢出的可能性;
3. 新增图片类型枚举类,罗列原有的图片类型,并新增“铭牌”和“监测设备”;
4. 修复导航功能可能导致空指针的问题;
5. 任意拍界面新增按分类拍摄功能;
6. 修复现场整改界面打开崩溃问题;
已修改11个文件
已添加3个文件
315 ■■■■ 文件已修改
.idea/compiler.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/gradle.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/misc.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/build.gradle 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/activity/ProblemDetailActivity.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/adapter/PhotoListAdapter.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/model/enumreation/MediaFileType.kt 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt 109 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraViewModel.kt 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuChangeActivity.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuNewGitActivity.kt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/dialog_camera.xml 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/dialog_camera_2.xml 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/compiler.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="CompilerConfiguration">
    <bytecodeTargetLevel target="1.8" />
  </component>
</project>
.idea/gradle.xml
@@ -17,6 +17,7 @@
          </set>
        </option>
        <option name="resolveModulePerSourceSet" value="false" />
        <option name="useQualifiedModuleNames" value="true" />
      </GradleProjectSettings>
    </option>
  </component>
.idea/misc.xml
@@ -44,7 +44,7 @@
      </value>
    </option>
  </component>
  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
  <component name="SvnBranchConfigurationManager">
    <option name="myConfigurationMap">
      <map>
app/build.gradle
@@ -13,8 +13,8 @@
        applicationId "cn.flightfeather.thirdapp"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 20
        versionName "1.1.14.02"
        versionCode 21
        versionName "1.1.14.04"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        renderscriptTargetApi 25
        renderscriptSupportModeEnabled true
app/src/main/java/cn/flightfeather/thirdapp/activity/ProblemDetailActivity.java
@@ -941,7 +941,7 @@
                        sw_change.setVisibility(View.GONE);
                        tv_problemChange.setText("已整改");
                        problemlistVoCurrent.setIschanged(true);
                        problemlistVoCurrent.setExtension3(Domain.PROBLEM_CHECK_PASS);
                        problemlistVoCurrent.setExtension3(Domain.CHANGE_UNCHECKED);
                        problemlistVoCurrent.setRemark(application.getCurrentUser().getAcountname());
                    } else if (type == InspectionDetailActivity.PROBLEM_RECHECK) {
                        sw_recheck.setVisibility(View.GONE);
app/src/main/java/cn/flightfeather/thirdapp/adapter/PhotoListAdapter.java
@@ -42,6 +42,12 @@
    @Override
    public void onBindViewHolder(PhotoListHolder holder, int position) {
        Mediafile mediafile = mediafileList.get(position);
        if (mediafile.getGuid() == null) {
            Glide.with(context)
                    .load(R.drawable.icon_add_photo)
                    .into(holder.iv_photo);
        } else {
//        String url = CommonApplication.getInstance().ROOT_URL_RELEASE_IMAGE + mediafile.getExtension1() + mediafile.getGuid() + ".jpg";
//        Glide.with(context).asDrawable().load(url).override(100,100).skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.ALL).into(holder.iv_photo);
@@ -61,6 +67,7 @@
            Log.e("photolist",position+" no image found");
        }
    }
    }
    @Override
    public int getItemCount() {
app/src/main/java/cn/flightfeather/thirdapp/model/enumreation/MediaFileType.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package cn.flightfeather.thirdapp.model.enumreation
/**
 * @author riku
 * Date: 2020/10/19
 */
enum class MediaFileType(val value: Int, val des: String) {
    Problem(1, "问题"),
    TechnicalPrevention(2,"技防措施"),
    MonitorDevice(3, "监测设备"),
    ManageDevice(4, "治理设备"),
    RoutineRecord(5, "常规记录"),
    Signature(6, "签字"),
    Nameplate(7, "铭牌"),
    Others(99,"其他")
}
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt
@@ -684,10 +684,16 @@
    //开始导航
    private fun startNavi() {
        val sourceLatLng = LatLng(viewModel.scene.value?.getLatitude()!!, viewModel.scene.value?.getLongitude()!!)
        if (viewModel.scene.value != null) {
            val sourceLatLng = LatLng(
                    viewModel.scene.value!!.latitude,
                    viewModel.scene.value!!.longitude
            )
        val amapNavi = AmapNavi(this)
        amapNavi.startNavi(sourceLatLng.latitude, sourceLatLng.longitude)
        } else {
            toast("导航目前不可用,请稍后再试")
        }
    }
    override fun onClick(v: View?) {
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt
@@ -7,6 +7,7 @@
import android.os.Bundle
import android.os.Environment
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.RecyclerView
import android.view.View
import cn.flightfeather.thirdapp.R
import cn.flightfeather.thirdapp.activity.PhotoViewerActivity
@@ -16,7 +17,7 @@
import cn.flightfeather.thirdapp.bean.Mediafile
import cn.flightfeather.thirdapp.bean.Scense
import cn.flightfeather.thirdapp.bean.Subtask
import cn.flightfeather.thirdapp.fragment.InspectionFragment.intToByte
import cn.flightfeather.thirdapp.model.enumreation.MediaFileType
import cn.flightfeather.thirdapp.module.base.BaseActivity
import cn.flightfeather.thirdapp.module.base.BaseTakePicActivity
import cn.flightfeather.thirdapp.module.base.TAKE_PHOTO
@@ -31,12 +32,18 @@
import java.io.IOException
import java.io.Serializable
import java.util.*
import kotlin.collections.ArrayList
const val BUSINESS_TYPE_CAMERA = 5
class MenuCameraActivity : BaseActivity() {
    override fun getLayoutId(): Int = R.layout.dialog_camera
    //页面支持的拍摄图片类型
    private val typeList = listOf(MediaFileType.RoutineRecord, MediaFileType.Nameplate, MediaFileType.MonitorDevice)
    //当前选择的拍照类型
    private var currentType = MediaFileType.RoutineRecord
    lateinit var viewModel: MenuCameraViewModel
@@ -57,15 +64,7 @@
        lng = intent.getDoubleExtra("lng", 0.0)
        initUI()
        viewModel.mediaFileList.observe(this, Observer {
            it?.let {
                rv_photo_list.adapter?.notifyDataSetChanged()
                val t = "共${it.size}张照片"
                tv_count.text = t
            }
        })
        initObserver()
        inspection?.guid?.let { viewModel.getMediaFile(it) }
    }
@@ -88,45 +87,66 @@
                        }
                        try {
                            FileUtil.copyFile(oldFile, newFile)
                            putMediaFile(path, fileName, cal)
                            val mf = putMediaFile(path, fileName, cal)
                            addPhoto(mf)
                        } catch (e: IOException) {
                            e.printStackTrace()
                            application.toast("复制文件失败")
                        }
                    }
                }
                inspection?.guid?.let { viewModel.getMediaFile(it) }
            }
            VIEW_PHOTO -> {
                //查看临时拍摄图片可以删除
                data?.getIntExtra("position", -1)?.let {
                    viewModel.mediaFileList.value?.removeAt(it)
                    rv_photo_list.adapter?.run {
                        notifyDataSetChanged()
                    }
                    deletePhoto(it)
                }
            }
        }
    }
    private fun initUI() {
        rv_photo_list.run {
        typeList.forEach {
            getDataSet(it).run {
                initRecyclerView(first.value, second, it)
            }
        }
        fab_problem_list_close.setOnClickListener {
            finish()
        }
    }
    private fun initRecyclerView(dataList: MutableList<Mediafile>?, recyclerView: RecyclerView, type: MediaFileType) {
        if (dataList==null) return
        recyclerView.run {
            layoutManager = GridLayoutManager(this@MenuCameraActivity, 4)
            adapter = PhotoListAdapter(viewModel.mediaFileList.value, this@MenuCameraActivity)
            adapter = PhotoListAdapter(dataList, this@MenuCameraActivity)
            addOnItemTouchListener(RecyclerItemClickListener(this@MenuCameraActivity, this, object : RecyclerItemClickListener.OnItemClickListener {
                override fun onItemClick(view: View?, position: Int) {
                    currentType = type
                    //拍照
                    if (dataList[position].guid == null) {
                        PhotoUtil.pickPhoto2(this@MenuCameraActivity, TAKE_PHOTO, 9)
                    }
                    //查看图片
                    else {
                    val files = ArrayList<File>()
                    for (m in viewModel.mediaFileList.value!!) {
                        val medias = ArrayList<Mediafile>()
                        for (m in dataList) {
                            if (m.guid != null) {
                        val f = File(Environment.getExternalStorageDirectory(), m.path + m.description)
                        files.add(f)
                                medias.add(m)
                            }
                    }
                    val intent = Intent(this@MenuCameraActivity, PhotoViewerActivity::class.java)
                            .putExtra(PhotoViewerActivity.PARA_FILES, files as Serializable)
                            .putExtra("type", PhotoViewerActivity.CAMERA_PHOTO)
                            .putExtra("deletable", true)
                            .putExtra("position", position)
                            .putExtra(PhotoViewerActivity.PARA_MEDIAS, viewModel.mediaFileList.value as Serializable)
                                .putExtra("position", position - 1)
                                .putExtra(PhotoViewerActivity.PARA_MEDIAS, medias as Serializable)
                    startActivityForResult(intent, VIEW_PHOTO)
                    }
                }
                override fun onItemLongClick(view: View?, position: Int) {
@@ -134,17 +154,21 @@
            }))
        }
        iv_new_photo.setOnClickListener {
            PhotoUtil.pickPhoto2(this, TAKE_PHOTO, 9)
        }
        fab_problem_list_close.setOnClickListener {
            finish()
    private fun initObserver() {
        typeList.forEach {
            getDataSet(it).run {
                first.observe(this@MenuCameraActivity, Observer {list->
                    list?.let {
                        second.adapter?.notifyDataSetChanged()
                    }
                })
            }
        }
    }
    private fun putMediaFile(path: String, fileName: String, calendar: Calendar) {
    private fun putMediaFile(path: String, fileName: String, calendar: Calendar):Mediafile {
        val mediaFile = Mediafile()
        mediaFile.guid = UUIDGenerator.generate16ShortUUID()
        mediaFile.iguid = inspection?.guid
@@ -153,8 +177,8 @@
        mediaFile.address = "${scene?.cityname ?: ""} + ${scene?.districtname
                ?: ""} + ${scene?.townname ?: ""} + ${scene?.location ?: ""}"
        mediaFile.filetype = 1
        mediaFile.businesstype = "常规记录"
        mediaFile.businesstypeid = intToByte(5)
        mediaFile.businesstype = currentType.des
        mediaFile.businesstypeid = currentType.value.toByte()
        mediaFile.path = path
        mediaFile.description = fileName
        mediaFile.savetime = Date()
@@ -164,5 +188,32 @@
        mediaFile.remark = "未上传"
        viewModel.putMediaFile(mediaFile)
        return mediaFile
    }
    private fun addPhoto(mediaFile: Mediafile) {
        getDataSet(currentType).run {
            first.value?.add(mediaFile)
            second.adapter?.run {
                notifyDataSetChanged()
            }
        }
    }
    private fun deletePhoto(pos: Int) {
        getDataSet(currentType).run {
            first.value?.removeAt(pos + 1)//第一个数据为拍照按钮
            second.adapter?.run {
                notifyDataSetChanged()
            }
        }
    }
    private fun getDataSet(type: MediaFileType) = when (type) {
        MediaFileType.RoutineRecord -> Pair(viewModel.routineRecordList, rv_photo_list_1)
        MediaFileType.Nameplate -> Pair(viewModel.nameplateList, rv_photo_list_2)
        MediaFileType.MonitorDevice -> Pair(viewModel.monitorDeviceList, rv_photo_list_3)
        else -> Pair(viewModel.routineRecordList, rv_photo_list_1)
    }
}
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraViewModel.kt
@@ -3,6 +3,7 @@
import android.arch.lifecycle.MutableLiveData
import cn.flightfeather.thirdapp.bean.Mediafile
import cn.flightfeather.thirdapp.common.net.ResultCallBack
import cn.flightfeather.thirdapp.model.enumreation.MediaFileType
import cn.flightfeather.thirdapp.module.base.BaseViewModel
import cn.flightfeather.thirdapp.repository.InspectionRepository
import cn.flightfeather.thirdapp.repository.ProblemRepository
@@ -16,19 +17,33 @@
    private val inspectionRepository = InspectionRepository()
    private val problemRepository = ProblemRepository()
    val mediaFileList = MutableLiveData<ArrayList<Mediafile>>().apply { value = ArrayList() }
    //常规记录图片
    val routineRecordList = MutableLiveData<ArrayList<Mediafile>>().apply { value = ArrayList() }
    //铭牌图片
    val nameplateList = MutableLiveData<ArrayList<Mediafile>>().apply { value = ArrayList() }
    //监测设备图片
    val monitorDeviceList = MutableLiveData<ArrayList<Mediafile>>().apply { value = ArrayList() }
    private val dataSet = listOf(
            Pair(MediaFileType.RoutineRecord, routineRecordList),
            Pair(MediaFileType.Nameplate, nameplateList),
            Pair(MediaFileType.MonitorDevice, monitorDeviceList)
    )
    /**
     * èŽ·å–ä»»æ„æ‹ç…§å›¾ç‰‡
     */
    fun getMediaFile(inspectionId: String) {
        inspectionRepository.getMediaFile(inspectionId, BUSINESS_TYPE_CAMERA, object : ResultCallBack<ArrayList<Mediafile>> {
        dataSet.forEach {p ->
            inspectionRepository.getMediaFile(inspectionId, p.first.value, object : ResultCallBack<ArrayList<Mediafile>> {
            override fun onSuccess(result: ArrayList<Mediafile>?) {
                result?.let {
                    mediaFileList.value?.run {
                        p.second.value?.run {
                        clear()
                            add(0, Mediafile())//在列表头添加图片拍摄按钮
                        addAll(it)
                    }
                    mediaFileList.value = mediaFileList.value
                        p.second.value = p.second.value
                }
            }
@@ -38,6 +53,7 @@
        })
    }
    }
    /**
     * æ–°å¢žæœ¬åœ°å¤šåª’体文件记录
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuChangeActivity.kt
@@ -21,7 +21,6 @@
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        EventBus.getDefault().register(this)
        viewModel.problemList.observe(this, Observer {
            it?.let {
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuNewGitActivity.kt
@@ -27,6 +27,10 @@
import cn.flightfeather.thirdapp.util.file.FileUtil
import com.ping.greendao.gen.GittypeDao
import kotlinx.android.synthetic.main.dialog_camera.*
import kotlinx.android.synthetic.main.dialog_camera.fab_problem_list_close
import kotlinx.android.synthetic.main.dialog_camera.iv_new_photo
import kotlinx.android.synthetic.main.dialog_camera.tv_title
import kotlinx.android.synthetic.main.dialog_camera_2.*
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.Callback
@@ -42,7 +46,7 @@
    override fun getImageViews(): MutableList<ImageView> = mutableListOf()
    override fun getLayoutId(): Int = R.layout.dialog_camera
    override fun getLayoutId(): Int = R.layout.dialog_camera_2
    lateinit var viewModel: MenuNewGitViewModel
app/src/main/res/layout/dialog_camera.xml
@@ -10,10 +10,11 @@
        android:layout_height="match_parent"
        android:layout_marginTop="30dp"
        android:layout_marginLeft="12dp"
        android:layout_marginRight="14dp"
        android:layout_marginRight="12dp"
        android:layout_marginBottom="40dp"
        app:cardCornerRadius="6dp"
        app:cardElevation="7dp">
        <LinearLayout
            android:id="@+id/ll_dialog_problem_list_main"
            android:layout_width="match_parent"
@@ -31,22 +32,62 @@
                    android:textSize="18dp"
                    android:textColor="@color/primary_text"
                    android:text="照片列表"/>
            <android.support.v4.widget.NestedScrollView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="20dp">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">
                    <TextView
                        android:id="@+id/txt_title_1"
                        android:layout_marginTop="6dp"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="常规"/>
                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/rv_photo_list_1"
                        android:layout_marginTop="@dimen/dimen2"
                        android:paddingBottom="8dp"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">
                    </android.support.v7.widget.RecyclerView>
            <TextView
                android:id="@+id/tv_count"
                        android:id="@+id/txt_title_2"
                android:layout_marginTop="6dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
                        android:layout_height="wrap_content"
                        android:text="铭牌"/>
            <android.support.v7.widget.RecyclerView
                android:layout_marginTop="6dp"
                        android:id="@+id/rv_photo_list_2"
                        android:layout_marginTop="@dimen/dimen2"
                android:paddingBottom="8dp"
                android:id="@+id/rv_photo_list"
                android:layout_weight="1"
                android:layout_width="match_parent"
                android:layout_height="0dp">
                        android:layout_height="wrap_content">
            </android.support.v7.widget.RecyclerView>
                    <TextView
                        android:id="@+id/txt_title_3"
                        android:layout_marginTop="6dp"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="设备"/>
                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/rv_photo_list_3"
                        android:layout_marginTop="@dimen/dimen2"
                        android:paddingBottom="8dp"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">
                    </android.support.v7.widget.RecyclerView>
                </LinearLayout>
            </android.support.v4.widget.NestedScrollView>
            <ImageView
                android:id="@+id/iv_new_photo"
                android:visibility="gone"
                android:layout_gravity="center_horizontal"
                android:layout_width="60dp"
                android:layout_height="60dp"
app/src/main/res/layout/dialog_camera_2.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.v7.widget.CardView
        android:id="@+id/cv_dialog_problem_list_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="30dp"
        android:layout_marginLeft="12dp"
        android:layout_marginRight="12dp"
        android:layout_marginBottom="40dp"
        app:cardCornerRadius="6dp"
        app:cardElevation="7dp">
        <LinearLayout
            android:id="@+id/ll_dialog_problem_list_main"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingTop="12dp"
            android:paddingBottom="16dp"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:orientation="vertical">
            <TextView
                android:id="@+id/tv_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="18dp"
                android:textColor="@color/primary_text"
                android:text="照片列表"/>
            <TextView
                android:id="@+id/tv_count"
                android:layout_marginTop="6dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
            <android.support.v7.widget.RecyclerView
                android:layout_marginTop="6dp"
                android:paddingBottom="8dp"
                android:id="@+id/rv_photo_list"
                android:layout_weight="1"
                android:layout_width="match_parent"
                android:layout_height="0dp">
            </android.support.v7.widget.RecyclerView>
            <ImageView
                android:id="@+id/iv_new_photo"
                android:layout_gravity="center_horizontal"
                android:layout_width="60dp"
                android:layout_height="60dp"
                android:src="@drawable/icon_add_photo"
                android:layout_marginTop="12dp"
                android:layout_marginBottom="20dp"/>
        </LinearLayout>
    </android.support.v7.widget.CardView>
    <android.support.design.widget.FloatingActionButton
        android:src="@drawable/icon_close_white"
        android:id="@+id/fab_problem_list_close"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:fabSize="normal"
        app:elevation="8dp"
        app:layout_anchor="@id/cv_dialog_problem_list_main"
        app:layout_anchorGravity="bottom|center"
        />
</android.support.design.widget.CoordinatorLayout>