.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,23 +42,30 @@ @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); File file = new File(Environment.getExternalStorageDirectory(),mediafile.getPath()+mediafile.getDescription()); if (file.exists()){ File file = new File(Environment.getExternalStorageDirectory(), mediafile.getPath() + mediafile.getDescription()); if (file.exists()) { // SetImageTask task = new SetImageTask(file,holder.iv_photo); // task.execute(); // String url = CommonApplication.getInstance().ROOT_URL_RELEASE_IMAGE + mediafile.getExtension1() + mediafile.getGuid() + ".jpg"; Glide.with(context) .load(file) .placeholder(R.drawable.icon_add_photo_waite) .override(100,100) .into(holder.iv_photo); }else { DownloadAndSetImageTask task = new DownloadAndSetImageTask(mediafile,holder.iv_photo,context); task.execute(); Log.e("photolist",position+" no image found"); Glide.with(context) .load(file) .placeholder(R.drawable.icon_add_photo_waite) .override(100, 100) .into(holder.iv_photo); } else { DownloadAndSetImageTask task = new DownloadAndSetImageTask(mediafile, holder.iv_photo, context); task.execute(); Log.e("photolist", position + " no image found"); } } } 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()!!) val amapNavi = AmapNavi(this) amapNavi.startNavi(sourceLatLng.latitude, sourceLatLng.longitude) 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) { val files = ArrayList<File>() for (m in viewModel.mediaFileList.value!!) { val f = File(Environment.getExternalStorageDirectory(), m.path + m.description) files.add(f) currentType = type //æç § if (dataList[position].guid == null) { PhotoUtil.pickPhoto2(this@MenuCameraActivity, TAKE_PHOTO, 9) } 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) startActivityForResult(intent, VIEW_PHOTO) //æ¥çå¾ç else { val files = ArrayList<File>() 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 - 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,27 +17,42 @@ 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>> { override fun onSuccess(result: ArrayList<Mediafile>?) { result?.let { mediaFileList.value?.run { clear() addAll(it) dataSet.forEach {p -> inspectionRepository.getMediaFile(inspectionId, p.first.value, object : ResultCallBack<ArrayList<Mediafile>> { override fun onSuccess(result: ArrayList<Mediafile>?) { result?.let { p.second.value?.run { clear() add(0, Mediafile())//å¨å表头添å å¾çæææé® addAll(it) } p.second.value = p.second.value } mediaFileList.value = mediaFileList.value } } override fun onFailure() { override fun onFailure() { } } }) }) } } /** 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" @@ -24,29 +25,69 @@ 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:id="@+id/tv_title" android:layout_width="wrap_content" android:layout_height="wrap_content" 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.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> 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/txt_title_2" 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_2" 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/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>