app/build.gradle
@@ -13,8 +13,8 @@ applicationId "cn.flightfeather.thirdapp" minSdkVersion 19 targetSdkVersion 28 versionCode 21 versionName "1.1.14.04" versionCode 23 versionName "1.1.14.06" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" renderscriptTargetApi 25 renderscriptSupportModeEnabled true app/src/main/java/cn/flightfeather/thirdapp/activity/GitDetailActivity.java
@@ -117,7 +117,7 @@ Mediafile mediaFile = mediafileList.get(i); File file =getFileFromMediaFile(mediaFile); if (file.exists()){ SetImageTask task1 = new SetImageTask(file, ivPhotoList.get(i)); SetImageTask task1 = new SetImageTask(file, ivPhotoList.get(i), this); task1.execute(); }else { DownloadAndSetImageTask task = new DownloadAndSetImageTask(mediaFile,ivPhotoList.get(i),this); @@ -150,7 +150,7 @@ } for (int i = 0;i<mediaFileList.size();i++){ if (resetImage){ SetImageTask task1 = new SetImageTask(getFileFromMediaFile(mediaFileList.get(i)), ivPhotoList.get(i)); SetImageTask task1 = new SetImageTask(getFileFromMediaFile(mediaFileList.get(i)), ivPhotoList.get(i), this); task1.execute(); } ivPhotoList.get(i).setOnClickListener(showPhotoClicker(getFilesFromMediaFile(mediaFileList),i,mediaFileList)); app/src/main/java/cn/flightfeather/thirdapp/activity/PhotoViewerActivity.java
@@ -131,7 +131,7 @@ type = intent.getIntExtra("type",0); deletable = intent.getBooleanExtra("deletable",false); mediafiles = (List<Mediafile>) intent.getSerializableExtra(PARA_MEDIAS); position = intent.getIntExtra("position",-1); position = intent.getIntExtra("position",0); iv_share.setOnClickListener(this); app/src/main/java/cn/flightfeather/thirdapp/activity/ProblemDetailActivity.java
@@ -598,7 +598,7 @@ //å·²æ´æ¹çå¾ç File file = getFileFromMediaFile(mediaFile); if (file.exists()){ SetImageTask task1 = new SetImageTask(file, imageViewChangeList.get(changeMediaFileList.size())); SetImageTask task1 = new SetImageTask(file, imageViewChangeList.get(changeMediaFileList.size()), this); task1.execute(); }else { DownloadAndSetImageTask task = new DownloadAndSetImageTask(mediaFile,imageViewChangeList.get(changeMediaFileList.size()),this); @@ -610,7 +610,7 @@ File file = getFileFromMediaFile(mediaFile); if (file.exists()){ //æä»¶æ¬å°åå¨ç´æ¥è¯»åæ¾ç¤º SetImageTask task1 = new SetImageTask(file, imageViewProblemList.get(problemMediaFileList.size())); SetImageTask task1 = new SetImageTask(file, imageViewProblemList.get(problemMediaFileList.size()), this); task1.execute(); }else { DownloadAndSetImageTask task = new DownloadAndSetImageTask(mediaFile, imageViewProblemList.get(problemMediaFileList.size()),this); @@ -655,14 +655,14 @@ private void refreshPhotoAndClicker(boolean resetImage) { for (int i = 0; i < problemMediaFileList.size(); i++) { if (resetImage){ SetImageTask task1 = new SetImageTask(getFileFromMediaFile(problemMediaFileList.get(i)), imageViewProblemList.get(i)); SetImageTask task1 = new SetImageTask(getFileFromMediaFile(problemMediaFileList.get(i)), imageViewProblemList.get(i), this); task1.execute(); } imageViewProblemList.get(i).setOnClickListener(showPhotoClicker(getFilesFromMediaFiles(problemMediaFileList),i,problemMediaFileList,VIEW_PROBLEM_PHOTO)); } for (int i = 0; i < changeMediaFileList.size(); i++) { if (resetImage){ SetImageTask task1 = new SetImageTask(getFileFromMediaFile(changeMediaFileList.get(i)), imageViewChangeList.get(i)); SetImageTask task1 = new SetImageTask(getFileFromMediaFile(changeMediaFileList.get(i)), imageViewChangeList.get(i), this); task1.execute(); } imageViewChangeList.get(i).setOnClickListener(showPhotoClicker(getFilesFromMediaFiles(changeMediaFileList),i,changeMediaFileList,VIEW_CHANGE_PHOTO)); app/src/main/java/cn/flightfeather/thirdapp/activity/UploadMediaFilesActivity.java
@@ -122,10 +122,11 @@ pb_uploading.setMax(photoTotal); pb_uploading.setProgress(photoUploaded); tv_status.setText("å缩ä¸..."); uploadingDialog2 = uploadingDialog.show(); if (uploadingDialog2 != null && !uploadingDialog2.isShowing()) { uploadingDialog2.show(); } else { uploadingDialog2 = uploadingDialog.show(); } } //å¼å§ä¸ä¼ public void startUplaod(List<File> outputFileList){ app/src/main/java/cn/flightfeather/thirdapp/adapter/CommonPagerAdapter.java
@@ -1,20 +1,16 @@ package cn.flightfeather.thirdapp.adapter; import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.support.v4.view.PagerAdapter; import android.view.View; import android.view.ViewGroup; import com.bm.library.PhotoView; import com.bumptech.glide.Glide; import java.io.File; import java.util.ArrayList; import java.util.List; import cn.flightfeather.thirdapp.util.ScreenUtils; import cn.flightfeather.thirdapp.util.photo.PhotoUtil; /** * Created by hyhb01 on 2018/3/26. @@ -57,9 +53,12 @@ @Override public Object instantiateItem(ViewGroup container, int position) { Bitmap bm = PhotoUtil.decodeSampledBitmapFromResource(fileList.get(position).getAbsolutePath(), ScreenUtils.getScreenWidth(context), ScreenUtils.getScreenHeight(context)); viewList.get(position).setImageBitmap(bm); // Bitmap bm = PhotoUtil.decodeSampledBitmapFromResource(fileList.get(position).getAbsolutePath(), ScreenUtils.getScreenWidth(context), ScreenUtils.getScreenHeight(context)); // viewList.get(position).setImageBitmap(bm); Glide.with(container) .load(fileList.get(position)) .into(viewList.get(position)); container.addView(viewList.get(position)); return viewList.get(position); @@ -67,15 +66,15 @@ @Override public void destroyItem(ViewGroup container, int position, Object object) { BitmapDrawable bitmapDrawable = (BitmapDrawable) viewList.get(position).getDrawable(); viewList.get(position).setImageDrawable(null); if (bitmapDrawable != null) { Bitmap bitmap = bitmapDrawable.getBitmap(); if (bitmap != null) { bitmap.recycle(); System.gc(); } } // BitmapDrawable bitmapDrawable = (BitmapDrawable) viewList.get(position).getDrawable(); // viewList.get(position).setImageDrawable(null); // if (bitmapDrawable != null) { // Bitmap bitmap = bitmapDrawable.getBitmap(); // if (bitmap != null) { // bitmap.recycle(); // System.gc(); // } // } container.removeView(viewList.get(position)); } app/src/main/java/cn/flightfeather/thirdapp/adapter/PhotoListAdapter.java
@@ -1,6 +1,6 @@ package cn.flightfeather.thirdapp.adapter; import android.content.Context; import android.app.Activity; import android.os.Environment; import android.support.v7.widget.RecyclerView; import android.util.Log; @@ -24,13 +24,13 @@ public class PhotoListAdapter extends RecyclerView.Adapter<PhotoListAdapter.PhotoListHolder> { private List<Mediafile> mediafileList; private Context context; private Activity activity; private LayoutInflater layoutInflater; public PhotoListAdapter(List<Mediafile> mediafileList, Context context) { public PhotoListAdapter(List<Mediafile> mediafileList, Activity activity) { this.mediafileList = mediafileList; this.context = context; layoutInflater = LayoutInflater.from(context); this.activity = activity; layoutInflater = LayoutInflater.from(activity); } @Override @@ -44,7 +44,7 @@ Mediafile mediafile = mediafileList.get(position); if (mediafile.getGuid() == null) { Glide.with(context) Glide.with(activity) .load(R.drawable.icon_add_photo) .into(holder.iv_photo); } else { @@ -56,13 +56,13 @@ // 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) Glide.with(activity) .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); DownloadAndSetImageTask task = new DownloadAndSetImageTask(mediafile, holder.iv_photo, activity); task.execute(); Log.e("photolist", position + " no image found"); } app/src/main/java/cn/flightfeather/thirdapp/adapter/ProblemPromiseListAdapter.java
@@ -1,7 +1,7 @@ package cn.flightfeather.thirdapp.adapter; import android.app.Activity; import android.app.DatePickerDialog; import android.content.Context; import android.content.Intent; import android.os.Environment; import android.support.v7.widget.RecyclerView; @@ -46,7 +46,7 @@ public class ProblemPromiseListAdapter extends RecyclerView.Adapter<ProblemPromiseListAdapter.ProblemPromiseListHolder>{ private List<ProblemlistVo> problemlistVoList; private Context context; private Activity activity; private LayoutInflater layoutInflater; private ProblemlistVo problemlistVoCurrent; private MediafileDao mediafileDao; @@ -61,10 +61,10 @@ private AllBoolean allBoolean; public ProblemPromiseListAdapter(List<ProblemlistVo> problemlistVoList, Context context, CommonApplication application,PromiseActivity promiseActivity,List<Mediafile> signMediaFileList, AllBoolean allBoolean) { public ProblemPromiseListAdapter(List<ProblemlistVo> problemlistVoList, Activity activity, CommonApplication application, PromiseActivity promiseActivity, List<Mediafile> signMediaFileList, AllBoolean allBoolean) { this.problemlistVoList = problemlistVoList; this.context = context; layoutInflater = LayoutInflater.from(context); this.activity = activity; layoutInflater = LayoutInflater.from(activity); mediafileDao = application.getDaoSession().getMediafileDao(); this.application =application; this.promiseActivity = promiseActivity; @@ -175,10 +175,10 @@ private void setImage(Mediafile mediafile,ImageView imageView){ File file = new File(Environment.getExternalStorageDirectory(), (mediafile.getPath() + mediafile.getDescription())); if (file.exists()){ SetImageTask task1 = new SetImageTask(file,imageView); SetImageTask task1 = new SetImageTask(file, imageView, activity); task1.execute(); }else { DownloadAndSetImageTask task2 = new DownloadAndSetImageTask(mediafile,imageView,context); DownloadAndSetImageTask task2 = new DownloadAndSetImageTask(mediafile,imageView, activity); task2.execute(); } } app/src/main/java/cn/flightfeather/thirdapp/fragment/HomeFragment.java
@@ -671,6 +671,7 @@ } void initView() { if (subtask == null) return; tv_info.setText(subtask.getName()); tv_address.setText(subtask.getScenseaddress()); try { app/src/main/java/cn/flightfeather/thirdapp/fragment/InspectionFragment.java
ÎļþÒÑɾ³ý app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseActivity.kt
@@ -12,6 +12,8 @@ import android.support.v7.widget.Toolbar import android.view.MenuItem import android.view.ViewGroup import com.bumptech.glide.Glide import com.bumptech.glide.util.Util import io.reactivex.disposables.Disposable import org.greenrobot.eventbus.EventBus @@ -48,6 +50,7 @@ it.dispose() } } Glide.with(applicationContext).pauseRequests() super.onDestroy() } app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt
@@ -12,6 +12,7 @@ import cn.flightfeather.thirdapp.util.UUIDGenerator import cn.flightfeather.thirdapp.util.file.FileUtil import cn.flightfeather.thirdapp.util.photo.PhotoUtil import com.bumptech.glide.Glide import com.lcw.library.imagepicker.ImagePicker import org.jetbrains.anko.toast import java.io.File @@ -91,9 +92,11 @@ when { i < picSize -> { imageViewList[i].setOnClickListener(viewPhotoClickListener(i)) // fixme: 2019/8/2 æ¤å¤ç»imageVIew设置å¾çå¨å代ç 䏿¯èªå®ä¹äºä¸ä¸ªAsyncTaskï¼ä¹åå¯ä»¥ç¨Glideçç¬¬ä¸æ¹æ¡æ¶æ¿ä»£ imageViewList[i].scaleType = ImageView.ScaleType.CENTER_CROP SetImageTask(pathTempList[i].first, imageViewList[i]).execute() Glide.with(this) .load(pathTempList[i].first) .placeholder(R.drawable.icon_add_photo_waite) .into(imageViewList[i]) } i == picSize -> imageViewList[i].run { setOnClickListener(takePhotoClickListener(i)) app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt
@@ -174,8 +174,7 @@ mediaFile.iguid = inspection?.guid mediaFile.longitude = lng mediaFile.latitude = lat mediaFile.address = "${scene?.cityname ?: ""} + ${scene?.districtname ?: ""} + ${scene?.townname ?: ""} + ${scene?.location ?: ""}" mediaFile.address = "${scene?.cityname ?: ""}${scene?.districtname ?: ""}${scene?.townname ?: ""}${scene?.location ?: ""}" mediaFile.filetype = 1 mediaFile.businesstype = currentType.des mediaFile.businesstypeid = currentType.value.toByte() app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuChangeActivity.kt
@@ -3,7 +3,6 @@ import android.arch.lifecycle.Observer import android.os.Bundle import cn.flightfeather.thirdapp.adapter.ProblemListAdapter import cn.flightfeather.thirdapp.fragment.InspectionFragment import cn.flightfeather.thirdapp.model.event.InspectionEvent import cn.flightfeather.thirdapp.model.event.ProblemEvent import kotlinx.android.synthetic.main.dialog_problem_list.* app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceActivity.kt
@@ -158,7 +158,7 @@ toast("å½åå·¡æ¥ç¶æéè¯¯ï¼æ æ³ä¸ä¼ é®é¢ï¼è¯·å°è¯éæ°å¯å¨") } val problemType = sp_take_evidence_select_problem_type.selectedItem.toString() val problemType = sp_take_evidence_select_problem_type.selectedItem?.toString() val pro = Problemlist().apply { guid = UUIDGenerator.generate16ShortUUID() @@ -171,26 +171,26 @@ val p = sp_take_evidence_select_problem.selectedItem if (p is Problemtype) { ptguid = p.guid var problemDes = et_take_evidence_problem_des.text.toString() var problemDes = et_take_evidence_problem_des?.text.toString() if (problemDes.isNotEmpty()) { problemDes = "($problemDes)" } problemname = p.name + problemDes } var adviceDes = et_take_evidence_suggestion.text.toString() var adviceDes = et_take_evidence_suggestion?.text.toString() if (adviceDes.isNotEmpty()) { adviceDes = "($adviceDes)" } advise = sp_take_evidence_select_suggestion.selectedItem.toString() + adviceDes advise = sp_take_evidence_select_suggestion.selectedItem?.toString() + adviceDes latitude = lat longitude = lng val l = sp_take_evidence_select_location.selectedItem if (l is Domainitem) { if (problemType != "æåº¦") { var locationRemark = et_take_evidence_location.text.toString() if (locationRemark.isNotEmpty()) { var locationRemark = et_take_evidence_location.text?.toString() if (locationRemark?.isNotEmpty() == true) { locationRemark = "($locationRemark)" } locationid = l.index.toByte() app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemUpdateActivity.kt
@@ -63,10 +63,13 @@ VIEW_PHOTO -> { //æ¥çä¸´æ¶ææå¾çå¯ä»¥å é¤ data?.getIntExtra("position", -1)?.let { if (it > -1) { viewModel.mediaFileList.value?.get(it)?.let {m -> val size = viewModel.mediaFileList.value?.size ?: 0 if (it > -1 && it < size) { viewModel.mediaFileList.value?.get(it)?.let { m -> deleteMediaFileList.add(m) } } else { toast("è¦å é¤çå¾çä¸åå¨") } } } app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuRecheckActivity.kt
@@ -4,7 +4,6 @@ import android.os.Bundle import cn.flightfeather.thirdapp.adapter.ProblemListAdapter import cn.flightfeather.thirdapp.bean.vo.ProblemlistVo import cn.flightfeather.thirdapp.fragment.InspectionFragment import cn.flightfeather.thirdapp.model.event.InspectionEvent import cn.flightfeather.thirdapp.model.event.ProblemEvent import cn.flightfeather.thirdapp.util.Constant app/src/main/java/cn/flightfeather/thirdapp/module/inspectioninfo/InspectionInfoFragment.java
@@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; import butterknife.BindView; import butterknife.ButterKnife; @@ -38,6 +39,7 @@ import cn.flightfeather.thirdapp.util.CommonUtils; import cn.flightfeather.thirdapp.util.Constant; import cn.flightfeather.thirdapp.util.DateFormatter; import cn.flightfeather.thirdapp.util.Domain; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -268,7 +270,7 @@ p.setTotalCount(p.getTotalCount() + 1 ); this.total_problems++; //å·²æ´æ¹é®é¢æ°ç´¯å if (problemlistVo.getIschanged()){ if (problemlistVo.getIschanged() && Objects.equals(problemlistVo.getExtension3(), Domain.CHANGE_CHECK_PASS)) { p.setIsRectifiedCount(p.getIsRectifiedCount() + 1); this.changed_problems++; } app/src/main/java/cn/flightfeather/thirdapp/module/inspectioninfo/ProblemChangeActivity.java
@@ -157,10 +157,12 @@ for (int i = 0; i < problemlistVos.size(); i++) { ProblemlistVo problemlistVoTemp = problemlistVos.get(i); if (problemlistVoTemp.getIschanged()) { this.changedProblems.add(problemlistVoTemp); } else { if (!problemlistVoTemp.getIschanged()) { this.unChangedProblems.add(problemlistVoTemp); } else if (!Objects.equals(problemlistVoTemp.getExtension3(), Domain.CHANGE_CHECK_PASS)) { this.unChangedProblems.add(problemlistVoTemp); } else { this.changedProblems.add(problemlistVoTemp); } } tabIndicators = new ArrayList<>(); app/src/main/java/cn/flightfeather/thirdapp/module/inspectioninfo/ProblemChangeDetailActivity.java
@@ -184,7 +184,12 @@ if (data!=null){ int position = data.getIntExtra("position",-1); if (position>-1){ mediafileDao.deleteByKey(mediafileListChange.get(position).getGuid()); this.mediafileListChange.remove(position); //fixme 2020/11/12 ç±äºå é¤åå¼ å¾çæ¯ç´æ¥èç½å°æå¡å¨æ°æ®ä¸å¹¶å é¤ï¼å æ¤å½å¾çå ¨é¨å é¤åï¼ç«å³æ´æ°é®é¢ä¸ºæªæ´æ¹ç¶æ if (mediafileListChange.isEmpty()) { uploadProblem(); } this.isEdited = !mediafileListChange.isEmpty(); initChangingPhoto(this.mediafileListChange, this.imageViewChangeList); if (this.problemlistVo.getIschanged()) { @@ -511,31 +516,39 @@ //<editor-fold desc="ç¹å»äºä»¶"> private void refreshProblemStatus() { this.problemlistVo.setIschanged(true);//è®¾ç½®ä¸ºå·²æ´æ¹ this.problemlistVo.setExtension3(Domain.CHANGE_UNCHECKED);//è®¾ç½®ä¸ºæ´æ¹å¾ å®¡æ ¸ this.problemlistVo.setChangedtime(new Date());//è®¾ç½®æ´æ¹æ¶é´ä¸ºå½åæ¶é´ this.problemlistVo.getMediafileList().clear(); this.problemlistVo.getMediafileList().addAll(this.mediafileListProblem); this.problemlistVo.getMediafileList().addAll(this.mediafileListChange);//å°æ°å¢çå¾çæ·»å è¿åªä½æä»¶å表ï¼ç¨äºappæ°æ®å·æ° //æ´æ¹å¾çå ¨å é¤åï¼é®é¢éåæªæ´æ¹å®¡æ ¸éè¿ç¶æ if (mediafileListChange.isEmpty()) { this.problemlistVo.setIschanged(false);//è®¾ç½®ä¸ºæªæ´æ¹ this.problemlistVo.setExtension3(Domain.PROBLEM_CHECK_PASS); this.problemlistVo.setChangedtime(null); this.problemlistVo.setChangecatalog(null); } else { this.problemlistVo.setIschanged(true);//è®¾ç½®ä¸ºå·²æ´æ¹ this.problemlistVo.setExtension3(Domain.CHANGE_UNCHECKED);//è®¾ç½®ä¸ºæ´æ¹å¾ å®¡æ ¸ this.problemlistVo.setChangedtime(new Date());//è®¾ç½®æ´æ¹æ¶é´ä¸ºå½åæ¶é´ this.problemlistVo.getMediafileList().clear(); this.problemlistVo.getMediafileList().addAll(this.mediafileListProblem); this.problemlistVo.getMediafileList().addAll(this.mediafileListChange);//å°æ°å¢çå¾çæ·»å è¿åªä½æä»¶å表ï¼ç¨äºappæ°æ®å·æ° Calendar calendar = Calendar.getInstance(); int today = calendar.get(Calendar.DAY_OF_YEAR); calendar.setTime(this.problemlistVo.getTime()); int problemDay = calendar.get(Calendar.DAY_OF_YEAR); //ææ¿è¯ºæ´æ¹çæ¥æ if (this.problemlistVo.getExtension1() != null){ //æ´æ¹æ¶é´å·²è¶ è¿ç管å½å¤©ç24ç¹ï¼åè®¤ä¸ºæ¯æ¿è¯ºæ´æ¹ if (today > problemDay) { this.problemlistVo.setChangecatalog(Domain.PROMISE_CHANGE); Calendar calendar = Calendar.getInstance(); int today = calendar.get(Calendar.DAY_OF_YEAR); calendar.setTime(this.problemlistVo.getTime()); int problemDay = calendar.get(Calendar.DAY_OF_YEAR); //ææ¿è¯ºæ´æ¹çæ¥æ if (this.problemlistVo.getExtension1() != null) { //æ´æ¹æ¶é´å·²è¶ è¿ç管å½å¤©ç24ç¹ï¼åè®¤ä¸ºæ¯æ¿è¯ºæ´æ¹ if (today > problemDay) { this.problemlistVo.setChangecatalog(Domain.PROMISE_CHANGE); } //å¦åæ¯ç°åºå½å¤©æ´æ¹ else { this.problemlistVo.setChangecatalog(Domain.LOACAL_CHANGE); } } //å¦åæ¯ç°åºå½å¤©æ´æ¹ //æ²¡ææ¿è¯ºæ´æ¹çæ¥ææ¯æªæ¿è¯ºæ´æ¹ else { this.problemlistVo.setChangecatalog(Domain.LOACAL_CHANGE); this.problemlistVo.setChangecatalog(Domain.UNPROMISE_CHANGE); } } //æ²¡ææ¿è¯ºæ´æ¹çæ¥ææ¯æªæ¿è¯ºæ´æ¹ else { this.problemlistVo.setChangecatalog(Domain.UNPROMISE_CHANGE); } } @@ -547,29 +560,8 @@ // return; // } if (this.isEdited){ loadingDialog = DialogUtil.createLoadingDialog(this, ""); refreshProblemStatus(); Call<ResponseBody> updateProblemList = application.getRetrofit().create(ProblemListService.class).updateProblemList(this.problemlistVo); updateProblemList.enqueue(new Callback<ResponseBody>() { @Override public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { if (response.body()!=null){ Toast.makeText(application, R.string.submit_success, Toast.LENGTH_LONG).show(); //ä¸ä¼ é®é¢æååï¼å¼å§ä¸ä¼ 对åºçæ´æ¹å¾ç upLoadPic(); }else if (response.errorBody()!=null){ Toast.makeText(application, R.string.submit_unsuccess, Toast.LENGTH_LONG).show(); loadingDialog.dismiss(); } } @Override public void onFailure(Call<ResponseBody> call, Throwable t) { Toast.makeText(application, R.string.network_error, Toast.LENGTH_LONG).show(); loadingDialog.dismiss(); } }); loadingDialog = DialogUtil.createLoadingDialog(this, ""); upLoadPic(); }else { Toast.makeText(application, R.string.take_one_change_photo_at_least, Toast.LENGTH_SHORT).show(); } @@ -603,6 +595,45 @@ } } private void uploadProblem() { refreshProblemStatus(); Call<ResponseBody> updateProblemList = application.getRetrofit().create(ProblemListService.class).updateProblemList(this.problemlistVo); updateProblemList.enqueue(new Callback<ResponseBody>() { @Override public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { if (response.body()!=null){ Toast.makeText(application, R.string.submit_success, Toast.LENGTH_LONG).show(); if (loadingDialog != null && loadingDialog.isShowing()) { loadingDialog.dismiss(); } //è¿årequestCode Intent intent = new Intent(); intent.putExtra(ARG_PROBLEM, problemlistVo); setResult(RESULT_OK, intent); //åéæ°æ®æ´æ°å¹¿æ Intent intent1 = new Intent("cn.flightfeather.thirdapp.broadcasereceiver.MainReceiver"); intent1.setAction(Constant.REFRESH_DATA); intent1.putExtra(ARG_PROBLEM, problemlistVo); sendBroadcast(intent1); finish(); }else if (response.errorBody()!=null){ Toast.makeText(application, R.string.submit_unsuccess, Toast.LENGTH_LONG).show(); loadingDialog.dismiss(); } } @Override public void onFailure(Call<ResponseBody> call, Throwable t) { Toast.makeText(application, R.string.network_error, Toast.LENGTH_LONG).show(); loadingDialog.dismiss(); } }); } private void upLoadPic() { @@ -617,37 +648,22 @@ PhotoUtil photoUtil = new PhotoUtil(mediafiles.size(), application, new OnUpLoadListener() { @Override public void onSuccess() { Toast.makeText(application, "ä¸ä¼ æå", Toast.LENGTH_SHORT).show(); if (loadingDialog != null && loadingDialog.isShowing()) { loadingDialog.dismiss(); } //è¿årequestCode Intent intent = new Intent(); intent.putExtra(ARG_PROBLEM, problemlistVo); setResult(RESULT_OK, intent); //åéæ°æ®æ´æ°å¹¿æ Intent intent1 = new Intent("cn.flightfeather.thirdapp.broadcasereceiver.MainReceiver"); intent1.setAction(Constant.REFRESH_DATA); intent1.putExtra(ARG_PROBLEM, problemlistVo); sendBroadcast(intent1); finish(); uploadProblem(); } @Override public void onFail() { Toast.makeText(application, "ä¸ä¼ 失败", Toast.LENGTH_SHORT).show(); Toast.makeText(application, "ä¸ä¼ 失败ï¼è¯·éè¯", Toast.LENGTH_SHORT).show(); loadingDialog.dismiss(); AlertDialog.Builder dialog = new AlertDialog.Builder(application); dialog.setMessage("å¾çä¸ä¼ 失败ï¼è¯·æå¨ä¸ä¼ æèç³»æå¸ï¼"); dialog.setPositiveButton("ç¡®å®", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { finish(); } }); dialog.show(); // AlertDialog.Builder dialog = new AlertDialog.Builder(application); // dialog.setMessage("å¾çä¸ä¼ 失败ï¼è¯·éè¯"); // dialog.setPositiveButton("ç¡®å®", new DialogInterface.OnClickListener() { // @Override // public void onClick(DialogInterface dialogInterface, int i) { // finish(); // } // }); // dialog.show(); } }); app/src/main/java/cn/flightfeather/thirdapp/repository/SceneRepository.kt
@@ -103,6 +103,7 @@ * æ°å¢åºæ¯ä¿¡æ¯ */ fun putScene(scene: Scense, resultCallBack: ResultCallBack<ResponseBody>) { sceneDao.insert(scene) retrofit.create(ScenseService::class.java).putScense(scene) .enqueue(ResponseBodyCallBack(resultCallBack)) } @@ -111,6 +112,7 @@ * æ´æ°åºæ¯ä¿¡æ¯ */ fun updateScene(scene: Scense, resultCallBack: ResultCallBack<ResponseBody>) { sceneDao.update(scene) retrofit.create(ScenseService::class.java).updateScense(scene) .enqueue(ResponseBodyCallBack(resultCallBack)) } @@ -119,6 +121,9 @@ * æ¹éæ´æ°åºæ¯ä¿¡æ¯ */ fun updateSceneList(sceneList: ArrayList<Scense>, resultCallBack: ResultCallBack<ResponseBody>) { sceneList.forEach { sceneDao.update(it) } retrofit.create(ScenseService::class.java).updateSceneList(sceneList) .enqueue(ResponseBodyCallBack(resultCallBack)) } app/src/main/java/cn/flightfeather/thirdapp/repository/dao/SceneDao.kt
@@ -12,6 +12,10 @@ */ class SceneDao { fun insert(scene: Scense) { DbFactory.getInstance().scenseDao.insert(scene) } /** * æ´æ°åºæ¯ä¿¡æ¯ */ app/src/main/java/cn/flightfeather/thirdapp/task/DownloadAndSetImageTask.java
@@ -1,7 +1,6 @@ package cn.flightfeather.thirdapp.task; import android.app.Activity; import android.content.Context; import android.os.Environment; import android.util.Log; import android.widget.ImageView; @@ -36,17 +35,18 @@ private Activity activity; //ä¸è½½å¹¶æ¾ç¤ºå¾ç public DownloadAndSetImageTask(Mediafile mediafile, ImageView imageView, Context context) { public DownloadAndSetImageTask(Mediafile mediafile, ImageView imageView, Activity activity) { this.mediafile = mediafile; this.imageView = imageView; application = (CommonApplication) context.getApplicationContext(); this.activity = activity; application = (CommonApplication) activity.getApplicationContext(); } //åªä¸è½½ public DownloadAndSetImageTask(Mediafile mediafile, Context context) { public DownloadAndSetImageTask(Mediafile mediafile, Activity activity) { this.mediafile = mediafile; application = (CommonApplication) context.getApplicationContext(); application = (CommonApplication) activity.getApplicationContext(); try { activity = (Activity) context; this.activity = (Activity) activity; } catch (Exception e) { e.printStackTrace(); } app/src/main/java/cn/flightfeather/thirdapp/task/SetImageTask.java
@@ -1,98 +1,41 @@ package cn.flightfeather.thirdapp.task; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.os.AsyncTask; import android.os.Build; import android.support.annotation.RequiresApi; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.bumptech.glide.util.Util; import java.io.File; import cn.flightfeather.thirdapp.R; import cn.flightfeather.thirdapp.module.inspectioninfo.ProblemChangeDetailActivity; /** * Created by note_ff_1602 on 2017/10/26. * 设置å¾ççtask * */ public class SetImageTask extends AsyncTask { // FIXME: 2020/11/12 忥çå®ç°æ¹å¼å¯è½ä¼å¯¼è´oomï¼å æ¤ä¿®æ¹ä¸ºä½¿ç¨Glideæ¥å®ç°å¾ççæ¾ç¤ºã public class SetImageTask { private File file; private ImageView miv_photo; private ProblemChangeDetailActivity activity; private Activity activity; public SetImageTask(File file, ImageView miv_photo, Activity activity) { super(); this.file = file; this.miv_photo = miv_photo; try { this.activity = (ProblemChangeDetailActivity) activity; } catch (Exception e) { e.printStackTrace(); } } public SetImageTask(File file, ImageView miv_photo) { super(); this.file = file; this.miv_photo = miv_photo; } //å缩åå æå¾ç设置为çå¾ @Override protected void onPreExecute() { super.onPreExecute(); miv_photo.setImageResource(R.drawable.icon_add_photo_waite); } //åå°å缩å¾ç @Override protected Object doInBackground(Object[] params) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.RGB_565; Bitmap bm = BitmapFactory.decodeFile(file.getAbsolutePath(), options); if (bm == null) return null; //å缩缩ç¥å¾ Matrix matrix = new Matrix(); matrix.setScale(0.12f, 0.12f); //å缩缩ç¥å¾ Bitmap bmSmall = null; int normalSize = 100; int width,height =0; if (bm.getWidth()>=bm.getHeight()){ width = normalSize; height = normalSize*bm.getHeight()/bm.getWidth(); }else { height =normalSize; width = normalSize*bm.getWidth()/bm.getHeight(); } if (bm!=null){ bmSmall= Bitmap.createScaledBitmap(bm,width,height,true); // bmSmall= Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true); } return bmSmall; this.activity = activity; } @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override protected void onPostExecute(Object o) { super.onPostExecute(o); Bitmap bmSmall = (Bitmap) o; if (bmSmall!=null){ miv_photo.setImageBitmap(bmSmall); // if (activity != null) { // activity.postponeEnterTransition(); // } public void execute() { if (Util.isOnMainThread() && activity != null && !activity.isDestroyed()) { Glide.with(miv_photo) .load(file) .placeholder(R.drawable.icon_add_photo_waite) .into(miv_photo); } } app/src/main/java/cn/flightfeather/thirdapp/util/photo/PhotoUtil.java
@@ -1,7 +1,6 @@ package cn.flightfeather.thirdapp.util.photo; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -65,21 +64,21 @@ * ç»å®ImageViewåå¾çï¼æ¬å°å è½½æèç½å è½½æ¾ç¤º(é对åºå®æ°éçImageView) * @param mediaFiles * @param imageViews * @param context * @param activity * @return å®é å è½½çå¾çä¸ªæ° */ public static int loadImage(List<Mediafile> mediaFiles, List<ImageView> imageViews, Context context){ public static int loadImage(List<Mediafile> mediaFiles, List<ImageView> imageViews, Activity activity){ if (mediaFiles!=null){ int count = mediaFiles.size() >= imageViews.size() ? imageViews.size() : mediaFiles.size(); int count = Math.min(mediaFiles.size(), imageViews.size()); for (int i = 0; i < count; i++) { Mediafile mediaFileTmp = mediaFiles.get(i); File file = FileUtil.getFileFromMediaFile(mediaFileTmp); if (file.exists()) { SetImageTask task1 = new SetImageTask(file, imageViews.get(i), (Activity) context); SetImageTask task1 = new SetImageTask(file, imageViews.get(i), (Activity) activity); task1.execute(); } else { DownloadAndSetImageTask task = new DownloadAndSetImageTask(mediaFileTmp, imageViews.get(i), context); DownloadAndSetImageTask task = new DownloadAndSetImageTask(mediaFileTmp, imageViews.get(i), activity); task.execute(); } } app/src/main/res/layout/activity_upload_media_files.xml
@@ -14,12 +14,12 @@ android:layout_height="50dp" android:textColor="@color/white" android:text="ä¸ä¼ "/> <android.support.v7.widget.RecyclerView android:layout_above="@id/tv_upload" android:id="@+id/rv_main" android:layout_width="match_parent" android:layout_height="match_parent" ></android.support.v7.widget.RecyclerView> android:layout_height="match_parent" /> <android.support.v7.widget.CardView android:id="@+id/cv_wait" android:layout_width="70dp" app/src/main/res/layout/fragment_inspection.xml
ÎļþÒÑɾ³ý