免检申请 增加时间过滤

master
hwf452 10 months ago
parent 1f59c77b7d
commit da450e5fa1

@ -125,10 +125,6 @@
android:name=".ui.activity.SisActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".base.MipcaActivityCapture"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activity.QrCodeActivity"
android:exported="false"
@ -257,6 +253,10 @@
android:name=".ui.activity.sbxdjgl.SQxgdlrfActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activity.sbxdjgl.MjApplyActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activity.sbxdjgl.QxgdListActivity"
android:exported="false"
@ -313,7 +313,7 @@
android:name=".ui.activity.KksSearchActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="false"
android:launchMode="singleInstance" />
android:screenOrientation="portrait" />
<activity
android:name=".ui.activity.YjyaActivity"
android:configChanges="orientation|keyboardHidden|screenSize"

@ -122,9 +122,9 @@ import com.rehome.dywoa.Listener.GlideEngine;
import com.rehome.dywoa.Listener.ImageLoaderUtils;
import com.rehome.dywoa.adapter.luck.GridImageAdapter;
import com.rehome.dywoa.base.BaseActivity2;
import com.rehome.dywoa.base.MipcaActivityCapture;
import com.rehome.dywoa.bean.UserInfoBean;
import com.rehome.dywoa.ui.activity.FaceRecognitionActivity;
import com.rehome.dywoa.ui.activity.QrCodeActivity;
import com.rehome.dywoa.utils.FullyGridLayoutManager;
import com.yalantis.ucrop.UCrop;
import com.yalantis.ucrop.UCropImageEngine;
@ -159,7 +159,7 @@ public class MainActivity extends BaseActivity2 {
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
private static final int CAMERA_REQUEST_CODE = 3;//人脸识别请求摄像头权限
private static final int QRCODE_SCAN_CAMERA_REQUEST_CODE = 4;//扫描二維码请求摄像头权限
// private static final int QRCODE_SCAN_CAMERA_REQUEST_CODE = 4;//扫描二維码请求摄像头权限
private LocalBroadcastManager localBroadcastManager;
private static final int STXC = 102;
private static final int STEND = 301;
@ -1466,27 +1466,26 @@ public class MainActivity extends BaseActivity2 {
public void onActivityResult(ActivityResult result) {
// 扫描二维码/条码回传
int resultCode = result.getResultCode();
Intent data = result.getData();
if (resultCode == RESULT_OK) {
Intent resultIntent = result.getData();
//返回的文本内容
String qrCodeStr = resultIntent.getStringExtra("result");
showLog(qrCodeStr);
myObject.setQRCodeStr(qrCodeStr);
Handler handler = new Handler();
handler.postDelayed(new Runnable(){
@Override
public void run() {
String call = "javascript:receiveQRCodeScanData()";
// 需要进行延时执行的操作
webview.loadUrl(call);
// 注入JavaScript代码
//webview.evaluateJavascript(call, null);
}
}, 1000);
if(data!=null){
String qrCodeStr = data.getStringExtra("code");
showLog(qrCodeStr);
myObject.setQRCodeStr(qrCodeStr);
Handler handler = new Handler();
handler.postDelayed(new Runnable(){
@Override
public void run() {
String call = "javascript:receiveQRCodeScanData()";
// 需要进行延时执行的操作
webview.loadUrl(call);
// 注入JavaScript代码
//webview.evaluateJavascript(call, null);
}
}, 1000);
}
}
}
});
@ -1829,17 +1828,6 @@ public class MainActivity extends BaseActivity2 {
Toast.makeText(this, "权限拒绝,无法打开摄像头,请手动设置开启APP访问摄像头权限", Toast.LENGTH_SHORT).show();
}
}
//扫描二维码
if (QRCODE_SCAN_CAMERA_REQUEST_CODE==requestCode){
if (grantResults.length>0&&grantResults[0]==PackageManager.PERMISSION_GRANTED) {
Intent intent = new Intent(MainActivity.this, MipcaActivityCapture.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent);
}else {
//权限拒绝
Toast.makeText(this, "权限拒绝,无法打开摄像头,请手动设置开启APP访问摄像头权限", Toast.LENGTH_SHORT).show();
}
}
}
/**
@ -1927,13 +1915,13 @@ public class MainActivity extends BaseActivity2 {
*
*/
private void goScan(){
//检查是否有相机权限
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
Intent intent = new Intent(MainActivity.this, MipcaActivityCapture.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent);
} else {
ActivityCompat.requestPermissions(this, permission, QRCODE_SCAN_CAMERA_REQUEST_CODE);
}
intentTOQRCode();
}
private void intentTOQRCode(){
Intent intent = new Intent(MainActivity.this, QrCodeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
//startActivity(intent);
launcherResultQRCode.launch(intent);
}
}

@ -1,273 +0,0 @@
package com.rehome.dywoa.base;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.graphics.Bitmap;
import android.hardware.Camera;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.os.Bundle;
import android.os.Handler;
import android.os.Vibrator;
import android.view.SurfaceHolder;
import android.view.SurfaceHolder.Callback;
import android.view.SurfaceView;
import android.view.View;
import android.widget.Button;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.Result;
import com.rehome.dywoa.R;
import com.rehome.dywoa.zxing.camera.CameraManager;
import com.rehome.dywoa.zxing.decoding.CaptureActivityHandler;
import com.rehome.dywoa.zxing.decoding.InactivityTimer;
import com.rehome.dywoa.zxing.view.ViewfinderView;
import java.io.IOException;
import java.util.Vector;
/**
*
*/
public class MipcaActivityCapture extends BaseActivity2 implements Callback {
Button flashlightButton;
private CaptureActivityHandler handler;
private ViewfinderView viewfinderView;
private boolean hasSurface;
private Vector<BarcodeFormat> decodeFormats;
private String characterSet;
private InactivityTimer inactivityTimer;
private MediaPlayer mediaPlayer;
private boolean playBeep;
private static final float BEEP_VOLUME = 0.10f;
private boolean vibrate;
private static Camera camera;
private Camera.Parameters params;
private boolean isOpen = true;
public static final int CAMERA_REQ_CODE = 111;
@Override
public int getContentViewID() {
return R.layout.activity_capture;
}
@Override
public void initView() {
CameraManager.init(getApplication());
viewfinderView = findViewById(R.id.viewfinder_view);
hasSurface = false;
inactivityTimer = new InactivityTimer(this);
title = findViewById(R.id.title_yx);
flashlightButton = findViewById(R.id.flashlightButton);
title.setText("二维码/条码扫描");
yxToolbar = findViewById(R.id.toolbar_yx);
setBack();
flashlightButton.setOnClickListener(openListener);
}
@Override
public void initData() {
}
private View.OnClickListener openListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
//获取到ZXing相机管理器创建的camera
camera = CameraManager.getCamera();
params = camera.getParameters();
if (params != null) {
if (isOpen) {
flashlightButton.setText("关闭闪光灯");
params.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
camera.setParameters(params);
isOpen = false;
} else { // 关灯
flashlightButton.setText("打开闪光灯");
params.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
camera.setParameters(params);
isOpen = true;
}
} else {
showToast("无法打开闪光灯新版本安卓系统API已调整请与管理员联系");
}
}
};
@Override
protected void onResume() {
super.onResume();
SurfaceView surfaceView = findViewById(R.id.preview_view);
SurfaceHolder surfaceHolder = surfaceView.getHolder();
if (hasSurface) {
initCamera(surfaceHolder);
} else {
surfaceHolder.addCallback(this);
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
decodeFormats = null;
characterSet = null;
playBeep = true;
AudioManager audioService = (AudioManager) getSystemService(AUDIO_SERVICE);
if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
playBeep = false;
}
initBeepSound();
vibrate = true;
}
@Override
protected void onPause() {
super.onPause();
if (handler != null) {
handler.quitSynchronously();
handler = null;
}
CameraManager.get().closeDriver();
}
@Override
protected void onDestroy() {
inactivityTimer.shutdown();
super.onDestroy();
}
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @param result
* @param barcode
*/
public void handleDecode(Result result, Bitmap barcode) {
inactivityTimer.onActivity();
playBeepSoundAndVibrate();
String[] b = result.getText().split("\\t");
String Result = b[0];
if (Result.equals("")) {
showToast("Scan failed!");
} else {
Intent resultIntent = new Intent();
Bundle bundle = new Bundle();
bundle.putString("result", Result);
resultIntent.putExtras(bundle);
setResult(RESULT_OK, resultIntent);
}
finish();
}
private void initCamera(SurfaceHolder surfaceHolder) {
try {
CameraManager.get().openDriver(surfaceHolder);
} catch (IOException ioe) {
return;
} catch (RuntimeException e) {
return;
}
if (handler == null) {
handler = new CaptureActivityHandler(this, decodeFormats, characterSet);
}
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
if (!hasSurface) {
hasSurface = true;
initCamera(holder);
}
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
hasSurface = false;
}
public ViewfinderView getViewfinderView() {
return viewfinderView;
}
public Handler getHandler() {
return handler;
}
public void drawViewfinder() {
viewfinderView.drawViewfinder();
}
private void initBeepSound() {
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it
// too loud,
// so we now play on the music stream.
setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setOnCompletionListener(beepListener);
AssetFileDescriptor file = getResources().openRawResourceFd(
R.raw.beep);
try {
mediaPlayer.setDataSource(file.getFileDescriptor(),
file.getStartOffset(), file.getLength());
file.close();
mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
mediaPlayer.prepare();
} catch (IOException e) {
mediaPlayer = null;
}
}
}
private static final long VIBRATE_DURATION = 200L;
private void playBeepSoundAndVibrate() {
if (playBeep && mediaPlayer != null) {
mediaPlayer.start();
}
if (vibrate) {
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
vibrator.vibrate(VIBRATE_DURATION);
}
}
/**
* When the beep has finished playing, rewind to queue up another one.
*/
private final OnCompletionListener beepListener = new OnCompletionListener() {
public void onCompletion(MediaPlayer mediaPlayer) {
mediaPlayer.seekTo(0);
}
};
}

@ -118,11 +118,9 @@ import com.rehome.dywoa.Contans;
import com.rehome.dywoa.CustomDialogActivity;
import com.rehome.dywoa.Listener.GlideEngine;
import com.rehome.dywoa.Listener.ImageLoaderUtils;
import com.rehome.dywoa.MyObject;
import com.rehome.dywoa.R;
import com.rehome.dywoa.adapter.luck.GridImageAdapter;
import com.rehome.dywoa.base.BaseAgentWebActivity;
import com.rehome.dywoa.base.MipcaActivityCapture;
import com.rehome.dywoa.bean.FwSingleLoginResult;
import com.rehome.dywoa.utils.FullyGridLayoutManager;
import com.rehome.dywoa.utils.GsonUtils;
@ -137,7 +135,6 @@ import com.yolanda.nohttp.NoHttp;
import com.yolanda.nohttp.RequestMethod;
import com.yolanda.nohttp.rest.Request;
import com.yolanda.nohttp.rest.Response;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;

@ -1,29 +1,20 @@
package com.rehome.dywoa.ui.activity
import android.Manifest
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Handler
import android.text.TextUtils
import android.view.View
import android.widget.Toast
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.rehome.dywoa.Contans
import com.rehome.dywoa.base.BaseActivityOaToolbarViewBinding
import com.rehome.dywoa.base.MipcaActivityCapture
import com.rehome.dywoa.bean.KksDataBean
import com.rehome.dywoa.databinding.ActivityKksSearchBinding
import com.rehome.dywoa.utils.GsonUtils
import com.rehome.dywoa.utils.HttpListener
import com.rehome.dywoa.utils.NohttpUtils
import com.rehome.dywoa.weiget.DatePickDialog
import com.yolanda.nohttp.NoHttp
import com.yolanda.nohttp.RequestMethod
import com.yolanda.nohttp.rest.Response
import java.util.Calendar
class KksSearchActivity : BaseActivityOaToolbarViewBinding<ActivityKksSearchBinding>() {

@ -4,6 +4,7 @@ package com.rehome.dywoa.ui.activity.sbxdjgl;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@ -350,7 +351,14 @@ public class DjdscFragment extends BaseFragment {
showLog(toJson());
}
});
builder.show();
AlertDialog dialog = builder.create();
dialog.show();
//确定按钮
Button btnPos = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
//取消按钮
Button btnNeg = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
btnPos.setTextColor(Color.BLACK);
btnNeg.setTextColor(Color.BLACK);
}
} else {
showToast("没有可上传计划");
@ -400,7 +408,14 @@ public class DjdscFragment extends BaseFragment {
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
}
});
builder.show();
AlertDialog dialog = builder.create();
dialog.show();
//确定按钮
Button btnPos = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
//取消按钮
Button btnNeg = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
btnPos.setTextColor(Color.BLACK);
btnNeg.setTextColor(Color.BLACK);
} else {
showToast("你还没有选择项目");
}

@ -0,0 +1,403 @@
package com.rehome.dywoa.ui.activity.sbxdjgl
import android.view.View
import com.rehome.dywoa.Contans
import com.rehome.dywoa.base.BaseActivityOaToolbarViewBinding
import com.rehome.dywoa.bean.KksDataBean
import com.rehome.dywoa.databinding.ActivityMjApplyBinding
import com.rehome.dywoa.utils.GsonUtils
import com.rehome.dywoa.utils.HttpListener
import com.rehome.dywoa.utils.NohttpUtils
import com.yolanda.nohttp.NoHttp
import com.yolanda.nohttp.RequestMethod
import com.yolanda.nohttp.rest.Response
import java.text.SimpleDateFormat
import java.util.Calendar
class MjApplyActivity : BaseActivityOaToolbarViewBinding<ActivityMjApplyBinding>() {
private var stime: String = ""
private var etime: String = ""
private lateinit var calendar:Calendar
private lateinit var calendarSunday:Calendar;
//格式化日期的对象(转化成习惯的时间格式)
private val sdFormat = SimpleDateFormat("yyyy-MM-dd")
override fun getViewBinding() = ActivityMjApplyBinding.inflate(layoutInflater)
override fun getToolbar() = binding.toolbarView.toolbar
override fun initView() {
initToolbar("免检申请", "") {
}
resetCurrentWeek()
// binding.tvSt.setOnClickListener(View.OnClickListener { view: View? ->
//
// val dialog = DatePickDialog(
// context, calendar
// ) { outPutDate: String?,calendarBack:Calendar? ->
// if (calendarBack != null) {
// if(calendarBack.after(calendarSunday)){
// showToast("开始时间不能在结束时间之后")
// }else{
// stime = binding.tvSt.getText().toString().trim { it <= ' ' }
// binding.tvSt.text = outPutDate
// calendar = calendarBack;
// }
// }
// //checkServerConnectStatus()
// }
// dialog.show()
// })
//
// binding.tvEt.setOnClickListener(View.OnClickListener { view: View? ->
//
// val dialog = DatePickDialog(
// context, calendarSunday
// ) { outPutDate: String?,calendarBack:Calendar? ->
// if (calendarBack != null) {
// if(calendarBack.before(calendar)){
// showToast("结束时间不能在开始时间之前")
// }else{
// etime = binding.tvEt.getText().toString().trim { it <= ' ' }
// binding.tvEt.text = outPutDate
// calendarSunday = calendarBack;
// }
// }
//
// //checkServerConnectStatus()
// }
// dialog.show()
// })
binding.tvLastMonth.setOnClickListener {
resetLastMonth()
getListData()
}
binding.tvCurrentMonth.setOnClickListener {
resetCurrentMonth()
getListData()
}
binding.tvLastWeek.setOnClickListener {
resetLastWeek()
getListData()
}
binding.tvCurrentWeek.setOnClickListener {
resetCurrentWeek()
getListData()
}
binding.tvLastDay.setOnClickListener {
resetYesterday()
getListData()
}
binding.tvCurrentQuarter.setOnClickListener {
resetCurrentQuarter()
getListData()
}
binding.tvLastQuarter.setOnClickListener {
resetLastQuarter()
getListData()
}
binding.tvCurrentYear.setOnClickListener {
resetCurrentYear()
getListData()
}
}
override fun initData() {
getListData()
}
private fun resetCurrentWeek(){
calendar = Calendar.getInstance()
val dayOfWeek: Int = calendar.get(Calendar.DAY_OF_WEEK) // 获取当前是周几1代表周日2代表周一依次类推
if (dayOfWeek == Calendar.SUNDAY) {
calendar.add(Calendar.DAY_OF_MONTH, -6) // 如果是周日向前推6天
} else {
calendar.add(
Calendar.DAY_OF_MONTH,
-dayOfWeek + 2
) // 向前推dayOfWeek-2天dayOfWeek减2代表前一周的周一
}
val startDateStr = sdFormat.format(calendar.time)
showLog("周一:")
showLog(startDateStr)
calendarSunday = Calendar.getInstance()
calendarSunday.time=calendar.time;
calendarSunday.add(Calendar.DAY_OF_MONTH, 6) // 如果是周日向前推6天
val sundayStr = sdFormat.format(calendarSunday.time)
showLog("本周日:")
showLog(sundayStr)
binding.tvSt.text = startDateStr
binding.tvEt.text = sundayStr
}
private fun resetLastWeek(){
calendar = Calendar.getInstance()
val dayOfWeek: Int = calendar.get(Calendar.DAY_OF_WEEK) // 获取当前是周几1代表周日2代表周一依次类推
if (dayOfWeek == Calendar.SUNDAY) {
calendar.add(Calendar.DAY_OF_MONTH, -6) // 如果是周日向前推6天
} else {
calendar.add(
Calendar.DAY_OF_MONTH,
-dayOfWeek + 2
) // 向前推dayOfWeek-2天dayOfWeek减2代表前一周的周一
}
calendar.add(Calendar.DAY_OF_MONTH, -7)
val startDateStr = sdFormat.format(calendar.time)
showLog("上周一:")
showLog(startDateStr)
calendarSunday = Calendar.getInstance()
calendarSunday.time=calendar.time;
calendarSunday.add(Calendar.DAY_OF_MONTH, 6) // 如果是周日向前推6天
val sundayStr = sdFormat.format(calendarSunday.time)
showLog("上周日:")
showLog(sundayStr)
binding.tvSt.text = startDateStr
binding.tvEt.text = sundayStr
}
private fun resetCurrentMonth(){
// 获取当前日期
calendar = Calendar.getInstance()
// 将日期设置为本月1号
calendar[Calendar.DAY_OF_MONTH] = 1
val startDateStr = sdFormat.format(calendar.time)
showLog("本月1号")
showLog(startDateStr)
// 获取当前日期
calendarSunday = Calendar.getInstance()
// 将日期设置为本月第一天
calendarSunday[Calendar.DAY_OF_MONTH] = 1
// 将日期向前推一天,即上个月的最后一天
calendarSunday.add(Calendar.MONTH, 1)
calendarSunday.add(Calendar.DAY_OF_MONTH, -1)
val sundayStr = sdFormat.format(calendarSunday.time)
showLog("本月最后一天:")
showLog(sundayStr)
binding.tvSt.text = startDateStr
binding.tvEt.text = sundayStr
}
private fun resetLastMonth(){
// 获取当前日期
calendar = Calendar.getInstance()
// 将日期设置为本月1号
calendar[Calendar.DAY_OF_MONTH] = 1
calendar.add(Calendar.MONTH, -1)
val startDateStr = sdFormat.format(calendar.time)
showLog("上月1号")
showLog(startDateStr)
// 获取当前日期
calendarSunday = Calendar.getInstance()
// 将日期设置为本月第一天
calendarSunday[Calendar.DAY_OF_MONTH] = 1
// 将日期向前推一天,即上个月的最后一天
calendarSunday.add(Calendar.DAY_OF_MONTH, -1)
val sundayStr = sdFormat.format(calendarSunday.time)
showLog("上月最后一天:")
showLog(sundayStr)
binding.tvSt.text = startDateStr
binding.tvEt.text = sundayStr
}
private fun resetYesterday(){
calendar = Calendar.getInstance()
calendar.add(Calendar.DAY_OF_MONTH, -1)
val startDateStr = sdFormat.format(calendar.time)
showLog("昨天:")
showLog(startDateStr)
calendarSunday = Calendar.getInstance()
calendarSunday.add(Calendar.DAY_OF_MONTH, -1)
val sundayStr = sdFormat.format(calendarSunday.time)
showLog("昨天:")
showLog(sundayStr)
binding.tvSt.text = startDateStr
binding.tvEt.text = sundayStr
}
private fun resetCurrentQuarter(){
// 获取当前日期
calendar = Calendar.getInstance()
// 获取当前月份
val month = calendar[Calendar.MONTH]
// 计算当前季度的第一个月
val firstMonthOfQuarter = (month / 3) * 3
// 设置日期为本季度的第一天
calendar[Calendar.MONTH] = firstMonthOfQuarter
calendar[Calendar.DAY_OF_MONTH] = 1
val startDateStr = sdFormat.format(calendar.time)
showLog("季度的第一天:")
showLog(startDateStr)
// 获取当前日期
calendarSunday = Calendar.getInstance()
// 获取当前月份
val monthEnd = calendarSunday[Calendar.MONTH]
// 计算当前季度的最后一个月
val lastMonthOfQuarter = ((monthEnd / 3) + 1) * 3 - 1
// 设置月份为当前季度的最后一个月
calendarSunday[Calendar.MONTH] = lastMonthOfQuarter
// 获取当前季度的最后一天
val lastDayOfQuarter = calendarSunday.getActualMaximum(Calendar.DAY_OF_MONTH)
// 设置日期为当前季度的最后一天
calendarSunday[Calendar.DAY_OF_MONTH] = lastDayOfQuarter
val sundayStr = sdFormat.format(calendarSunday.time)
showLog("当前季度的最后一天:")
showLog(sundayStr)
binding.tvSt.text = startDateStr
binding.tvEt.text = sundayStr
}
private fun resetLastQuarter(){
// 获取当前日期
calendar = Calendar.getInstance()
// 获取当前月份
val currentMonth = calendar[Calendar.MONTH]
// 计算上一季度的月份
var previousQuarterMonth = ((currentMonth / 3) * 3) - 3
if (previousQuarterMonth < 0) {
previousQuarterMonth += 12
calendar.add(Calendar.YEAR, -1) // 如果上一季度在上一年,年份减一
}
// 设置月份为上一季度的第一个月
calendar[Calendar.MONTH] = previousQuarterMonth
// 设置日期为1号
calendar[Calendar.DAY_OF_MONTH] = 1
val startDateStr = sdFormat.format(calendar.time)
showLog("上一季度的第一天:")
showLog(startDateStr)
// 获取当前日期
calendarSunday = Calendar.getInstance()
// 获取当前月份
val currentMonthEnd = calendarSunday[Calendar.MONTH]
// 计算上一季度的最后一个月
var lastQuarterEndMonth = ((currentMonthEnd / 3) * 3) - 1
// 如果上一季度的最后一个月是负数,说明当前季度是第一季度,上一季度就是去年的第四季度
if (lastQuarterEndMonth < 0) {
lastQuarterEndMonth = Calendar.DECEMBER // 12月
calendarSunday.add(Calendar.YEAR, -1) // 年份减一
}
// 设置月份为上一季度的最后一个月
calendarSunday[Calendar.MONTH] = lastQuarterEndMonth
// 获取上一季度的最后一天
val lastDayOfLastQuarter = calendarSunday.getActualMaximum(Calendar.DAY_OF_MONTH)
// 设置日期为上一季度的最后一天
calendarSunday[Calendar.DAY_OF_MONTH] = lastDayOfLastQuarter
val sundayStr = sdFormat.format(calendarSunday.time)
showLog("上一季度的最后一天:")
showLog(sundayStr)
binding.tvSt.text = startDateStr
binding.tvEt.text = sundayStr
}
private fun resetCurrentYear(){
// 获取当前日期实例
calendar = Calendar.getInstance()
// 将日期设置为今年的第一天
calendar[Calendar.DAY_OF_YEAR] = 1
val startDateStr = sdFormat.format(calendar.time)
showLog("今年的第一天:")
showLog(startDateStr)
// 获取当前日期
calendarSunday = Calendar.getInstance()
// 设置年份为当前年份月份为12月11表示12月因为月份从0开始日期为1日
calendarSunday[Calendar.YEAR] = calendarSunday[Calendar.YEAR]
calendarSunday[Calendar.MONTH] = Calendar.DECEMBER
calendarSunday[Calendar.DAY_OF_MONTH] = 1
// 获取今年最后一天
val lastDayOfYear = calendarSunday.getActualMaximum(Calendar.DAY_OF_YEAR)
// 设置日期为今年最后一天
calendarSunday[Calendar.DAY_OF_YEAR] = lastDayOfYear
val sundayStr = sdFormat.format(calendarSunday.time)
showLog("今年的最后一天:")
showLog(sundayStr)
binding.tvSt.text = startDateStr
binding.tvEt.text = sundayStr
}
private fun getListData() {
var param = HashMap<String,String>()
param["startDate"] = binding.tvSt.text.toString().trim();
param["endDate"] = binding.tvEt.text.toString().trim();
val json = GsonUtils.GsonString(param)
showLog(json)
val url: String = Contans.IP + Contans.GET_NEED_MJ_LIST
val request = NoHttp.createStringRequest(url, RequestMethod.POST)
request.setDefineRequestBodyForJson(json)
NohttpUtils.getInstance().add(this, 0, request, object : HttpListener<String> {
override fun onSucceed(what: Int, response: Response<String>?) {
if (response != null) {
val result = response.get()
showLog(result)
// val bean = GsonUtils.GsonToBean(result, KksDataBean::class.java)
// if (bean != null && bean.total != 0) {
// if (bean.rows != null && bean.rows.size>0) {
// binding.lv.visibility= View.VISIBLE
// binding.tvNodata.visibility= View.GONE
// val row: KksDataBean.Row = bean.rows[0]
//
//
// }else {
// binding.tvNodata.visibility= View.VISIBLE
// binding.lv.visibility= View.GONE
// }
// }
}
}
override fun onFailed(what: Int, response: Response<String>?) {
}
}, true, true, "正在加载数据...")
}
}

@ -113,17 +113,13 @@ import com.rehome.dywoa.DBModel.Xydj;
import com.rehome.dywoa.DBModel.Zy;
import com.rehome.dywoa.Listener.GlideEngine;
import com.rehome.dywoa.Listener.ImageLoaderUtils;
import com.rehome.dywoa.MainActivity;
import com.rehome.dywoa.R;
import com.rehome.dywoa.adapter.luck.GridImageAdapter;
import com.rehome.dywoa.base.BaseActivity;
import com.rehome.dywoa.adapter.SpinnerAdapter;
import com.rehome.dywoa.Contans;
import com.rehome.dywoa.base.MipcaActivityCapture;
import com.rehome.dywoa.entity.StatusInfo;
import com.rehome.dywoa.ui.activity.FaceRecognitionActivity;
import com.rehome.dywoa.utils.BitmapCompressUtils;
import com.rehome.dywoa.utils.BitmapUtil;
import com.rehome.dywoa.ui.activity.QrCodeActivity;
import com.rehome.dywoa.utils.FullyGridLayoutManager;
import com.rehome.dywoa.utils.GsonUtils;
import com.rehome.dywoa.utils.HttpListener;
@ -316,9 +312,6 @@ public class SQxgdlrfActivity extends BaseActivity {
tv_sysit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Intent intent = new Intent(SQxgdlrfActivity.this, MipcaActivityCapture.class);
// //startActivityForResult(intent, 1);
// launcherResultQRCode.launch(intent);
goScan();
}
});
@ -408,28 +401,25 @@ public class SQxgdlrfActivity extends BaseActivity {
}
}
/**
* ActivityResultLauncher
*
* @return
*/
private ActivityResultLauncher<Intent> createQRCodeActivityResultLauncher() {
return registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
new ActivityResultCallback<ActivityResult>() {
@Override
public void onActivityResult(ActivityResult result) {
int resultCode = result.getResultCode();
Intent data = result.getData();
if (resultCode == RESULT_OK) {
Intent resultIntent = result.getData();
//返回的文本内容
String qrCodeStr = resultIntent.getStringExtra("result");
showLog(qrCodeStr);
if(!TextUtils.isEmpty(qrCodeStr)){
if(qrCodeStr.startsWith("KK:")){
String qrCodeStrSub = qrCodeStr.replace("KK:","").trim();
et_kks.setText(qrCodeStrSub);
}else{
showToast("KKS码无法识别");
if(data!=null){
String qrCodeStr = data.getStringExtra("code");
showLog(qrCodeStr);
if(!TextUtils.isEmpty(qrCodeStr)){
if(qrCodeStr.startsWith("KK:")){
String qrCodeStrSub = qrCodeStr.replace("KK:","").trim();
et_kks.setText(qrCodeStrSub);
}else{
showToast("KKS码无法识别");
}
}
}
}
@ -867,41 +857,17 @@ public class SQxgdlrfActivity extends BaseActivity {
mAdapter.notifyDataSetChanged();
}
/**
*
*
* @param requestCode
* @param permissions
* @param grantResults
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
//扫描二维码
if (QRCODE_SCAN_CAMERA_REQUEST_CODE==requestCode){
if (grantResults.length>0&&grantResults[0]==PackageManager.PERMISSION_GRANTED) {
Intent intent = new Intent(SQxgdlrfActivity.this, MipcaActivityCapture.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent);
}else {
//权限拒绝
Toast.makeText(this, "权限拒绝,无法打开摄像头,请手动设置开启APP访问摄像头权限", Toast.LENGTH_SHORT).show();
}
}
}
/**
*
*/
private void goScan(){
//检查是否有相机权限
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
Intent intent = new Intent(SQxgdlrfActivity.this, MipcaActivityCapture.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent);
} else {
ActivityCompat.requestPermissions(this, permission, QRCODE_SCAN_CAMERA_REQUEST_CODE);
}
intentTOQRCodeOne();
}
private void intentTOQRCodeOne(){
Intent intent = new Intent(SQxgdlrfActivity.this, QrCodeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent);
}
private void initTakePhoto() {

@ -1,6 +1,8 @@
package com.rehome.dywoa.ui.activity.sbxdjgl;
import static android.app.Activity.RESULT_OK;
import android.content.ContentValues;
import android.content.Intent;
import android.os.Bundle;
@ -9,15 +11,22 @@ import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import com.rehome.dywoa.Contans;
import com.rehome.dywoa.DBModel.Ajhxzrwqy;
import com.rehome.dywoa.R;
import com.rehome.dywoa.adapter.CommonAdapter;
import com.rehome.dywoa.adapter.ViewHolder;
import com.rehome.dywoa.base.BaseFragment;
import com.rehome.dywoa.base.MipcaActivityCapture;
import com.rehome.dywoa.entity.DlbInfo;
import com.rehome.dywoa.entity.SbdjInfo;
import com.rehome.dywoa.ui.activity.QrCodeActivity;
import org.litepal.crud.DataSupport;
import java.util.ArrayList;
import java.util.List;
@ -32,6 +41,8 @@ public class Sajhlv2Fragment extends BaseFragment {
TextView tvNodata;
Button btnSys;
private ActivityResultLauncher<Intent> launcherResultQRCode;
private void findView() {
lv = view.findViewById(R.id.lv);
tvNodata = view.findViewById(R.id.tv_nodata);
@ -39,8 +50,7 @@ public class Sajhlv2Fragment extends BaseFragment {
btnSys.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), MipcaActivityCapture.class);
startActivityForResult(intent, 1);
intentTOQRCode();
}
});
}
@ -83,6 +93,9 @@ public class Sajhlv2Fragment extends BaseFragment {
@Override
protected void initView() {
findView();
launcherResultQRCode = createQRCodeActivityResultLauncher();
if (getArguments() != null) {
tag = getArguments().getString("tag");
}
@ -115,26 +128,54 @@ public class Sajhlv2Fragment extends BaseFragment {
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// switch (requestCode) {
// case 1:
// if (resultCode == Activity.RESULT_OK) {
// Bundle bundle = data.getExtras();
// ewm = bundle.getString("result");
// nfcorewm = true;
// getDataInSql();
// if (tag.equals("ajh")) {
// AjhAndSbjdActivity ajh = (AjhAndSbjdActivity) getActivity();
// ajh.setList(ewm);
// }
// }
// break;
// }
private void intentTOQRCode(){
Intent intent = new Intent(context, QrCodeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent);
}
private ActivityResultLauncher<Intent> createQRCodeActivityResultLauncher() {
return registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
new ActivityResultCallback<ActivityResult>() {
@Override
public void onActivityResult(ActivityResult result) {
int resultCode = result.getResultCode();
Intent data = result.getData();
if (resultCode == RESULT_OK) {
if(data!=null){
ewm = data.getStringExtra("code");
// nfcorewm = true;
// getDataInSql();
// if (tag.equals("ajh")) {
// AjhAndSbjdActivity ajh = (AjhAndSbjdActivity) getActivity();
// ajh.setList(ewm);
// }
}
}
}
});
}
// @Override
// public void onActivityResult(int requestCode, int resultCode, Intent data) {
// super.onActivityResult(requestCode, resultCode, data);
//
//// switch (requestCode) {
//// case 1:
//// if (resultCode == Activity.RESULT_OK) {
//// Bundle bundle = data.getExtras();
//// ewm = bundle.getString("result");
//// nfcorewm = true;
//// getDataInSql();
//// if (tag.equals("ajh")) {
//// AjhAndSbjdActivity ajh = (AjhAndSbjdActivity) getActivity();
//// ajh.setList(ewm);
//// }
//// }
//// break;
//// }
// }
private void getDataInSql() {
rwqys.clear();
infos.clear();

@ -43,8 +43,9 @@ import java.util.Map;
public class SbxdjglActivity extends BaseActivity2 {
GridView gv;
private final String[] str = {"任务", "工作", "统计", "读取NFC标签", "缺陷工单录入"};
private final int[] imageId = {R.drawable.icon3, R.drawable.icon6, R.drawable.icon_task_count, R.drawable.icon11, R.drawable.icon15};
private final String[] str = {"任务", "工作", "统计", "读取NFC标签", "缺陷工单录入", "免检申请"};
private final int[] imageId = {R.drawable.icon3, R.drawable.icon6, R.drawable.icon_task_count, R.drawable.icon11,
R.drawable.icon15, R.drawable.icon18};
private GridViewYXAdapter adapter;
@ -115,6 +116,11 @@ public class SbxdjglActivity extends BaseActivity2 {
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
break;
case 5:
intent = new Intent(SbxdjglActivity.this, MjApplyActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
break;
}
}
});

@ -12,6 +12,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Color;
import android.nfc.NfcAdapter;
import android.os.Bundle;
@ -43,8 +44,8 @@ import com.rehome.dywoa.R;
import com.rehome.dywoa.adapter.CommonAdapter;
import com.rehome.dywoa.adapter.ViewHolder;
import com.rehome.dywoa.base.BaseActivity;
import com.rehome.dywoa.base.MipcaActivityCapture;
import com.rehome.dywoa.entity.DjAjhGzInfo;
import com.rehome.dywoa.ui.activity.QrCodeActivity;
import com.rehome.dywoa.ui.activity.sbxj.SxgzActivity;
import com.rehome.dywoa.ui.activity.sbxj.XjYulActivity;
import com.rehome.dywoa.utils.GsonUtils;
@ -120,7 +121,6 @@ public class SdjgzActivity extends BaseActivity {
private String username;
private static final int CAMERA_REQUEST_CODE = 8;//请求码
private ActivityResultLauncher<Intent> launcherResultQRCode;
@ -155,13 +155,8 @@ public class SdjgzActivity extends BaseActivity {
initToolbar("点检工作(请使用NFC)", "扫描", new View.OnClickListener() {
@Override
public void onClick(View v) {
//动态权限申请
if (ContextCompat.checkSelfPermission(SdjgzActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(SdjgzActivity.this, new String[]{Manifest.permission.CAMERA}, CAMERA_REQUEST_CODE);
} else {
//扫码
goScan();
}
//扫码
goScan();
}
});
@ -183,60 +178,52 @@ public class SdjgzActivity extends BaseActivity {
public void onActivityResult(ActivityResult result) {
int resultCode = result.getResultCode();
Intent data = result.getData();
if (resultCode == RESULT_OK && data != null) {
Bundle bundle = data.getExtras();
ewm = bundle.getString("result");
showLog(ewm);
ArrayList<DjjhRwQy> rwqys = new ArrayList<>();
rwqys.addAll(DataSupport.where("txm = ? and username = ?", ewm,username).find(DjjhRwQy.class));
if(rwqys.size()>0){
DjjhRwQy djjhRwQy = rwqys.get(0);
if((!TextUtils.isEmpty(djjhRwQy.getTxmzt()))&&djjhRwQy.getTxmzt().equals("0")){
showToast("条形码点检方式未启用,不允许通过扫码条形码点检");
if (resultCode == RESULT_OK) {
if(data!=null){
ewm = data.getStringExtra("code");
showLog(ewm);
ArrayList<DjjhRwQy> rwqys = new ArrayList<>();
rwqys.addAll(DataSupport.where("txm = ? and username = ?", ewm,username).find(DjjhRwQy.class));
if(!rwqys.isEmpty()){
DjjhRwQy djjhRwQy = rwqys.get(0);
if((!TextUtils.isEmpty(djjhRwQy.getTxmzt()))&&djjhRwQy.getTxmzt().equals("0")){
showToast("条形码点检方式未启用,不允许通过扫码条形码点检");
return;
}
}else{
showToast("当前条形码对应的区域找不到点检数据");
return;
}
}else{
showToast("当前条形码对应的区域找不到点检数据");
return;
}
Intent intent = new Intent(SdjgzActivity.this, SdlbActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra(Contans.NFCOREWM, true);
intent.putExtra(Contans.KEY_BQBM, ewm);
intent.putExtra(Contans.KEY_FLAG, Contans.DLB);
Intent intent = new Intent(SdjgzActivity.this, SdlbActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra(Contans.NFCOREWM, true);
intent.putExtra(Contans.KEY_BQBM, ewm);
intent.putExtra(Contans.KEY_FLAG, Contans.DLB);
ContentValues values = new ContentValues();
values.put("second", "YES");
DataSupport.updateAll(DjjhRwQy.class, values, "txm = ? and username = ?", ewm,username);
ContentValues values = new ContentValues();
values.put("second", "YES");
DataSupport.updateAll(DjjhRwQy.class, values, "txm = ? and username = ?", ewm,username);
startActivity(intent);
startActivity(intent);
}
}
}
});
}
private void goScan() {
if (list.size() != 0) {
Intent intent = new Intent(SdjgzActivity.this, MipcaActivityCapture.class);
launcherResultQRCode.launch(intent);
if (!list.isEmpty()) {
intentTOQRCodeOne();
} else {
showToast("您还没有下载计划");
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (CAMERA_REQUEST_CODE == requestCode) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
//扫码
goScan();
} else {
//权限拒绝
Toast.makeText(this, "你拒绝了权限申请,无法打开相机扫码哟!", Toast.LENGTH_SHORT).show();
}
}
private void intentTOQRCodeOne(){
Intent intent = new Intent(SdjgzActivity.this, QrCodeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent);
}
//加载数据库中已经下载的计划
@ -372,7 +359,14 @@ public class SdjgzActivity extends BaseActivity {
dialogInterface.dismiss();
}
});
builder.show();
AlertDialog dialog = builder.create();
dialog.show();
//确定按钮
Button btnPos = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
//取消按钮
Button btnNeg = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
btnPos.setTextColor(Color.BLACK);
btnNeg.setTextColor(Color.BLACK);
}else{
if(djjhItem.isSMFX()){
Intent intent = new Intent(SdjgzActivity.this, SdlbActivity.class);

@ -7,6 +7,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@ -184,7 +185,14 @@ public class XzjhFragment extends BaseFragment {
adapter.notifyDataSetChanged();
}
});
builder.show();
AlertDialog dialog = builder.create();
dialog.show();
//确定按钮
Button btnPos = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
//取消按钮
Button btnNeg = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
btnPos.setTextColor(Color.BLACK);
btnNeg.setTextColor(Color.BLACK);
} else {
showToast("没有可删除计划");

@ -31,18 +31,15 @@ import com.rehome.dywoa.R;
import com.rehome.dywoa.adapter.CommonAdapter;
import com.rehome.dywoa.adapter.ViewHolder;
import com.rehome.dywoa.base.BaseActivity;
import com.rehome.dywoa.base.MipcaActivityCapture;
import com.rehome.dywoa.ui.activity.QrCodeActivity;
import com.rehome.dywoa.utils.GsonUtils;
import com.rehome.dywoa.utils.SPUtils;
import com.rehome.dywoa.weiget.ConfirmDialog;
import com.rehome.dywoa.weiget.JiZhuStatusDialog;
import com.rehome.dywoa.weiget.toastviewbymyself;
import org.litepal.crud.DataSupport;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -262,15 +259,19 @@ public class SxgzActivity extends BaseActivity {
}
private void goScan() {
if (xsjjhxzDataBeanList.size() != 0) {
Intent intent = new Intent(SxgzActivity.this, MipcaActivityCapture.class);
launcherResultQRCode.launch(intent);
//startActivityForResult(intent, 1);
if (!xsjjhxzDataBeanList.isEmpty()) {
intentTOQRCode();
} else {
showToast("您还没有下载计划");
}
}
private void intentTOQRCode(){
Intent intent = new Intent(SxgzActivity.this, QrCodeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent);
}
/**
*
*
@ -283,47 +284,45 @@ public class SxgzActivity extends BaseActivity {
public void onActivityResult(ActivityResult result) {
int resultCode = result.getResultCode();
Intent data = result.getData();
if (resultCode == RESULT_OK && data != null) {
Bundle bundle = data.getExtras();
txm = bundle.getString("result");
showLog(txm);
List<XSJJHXZDataBean> xSJJHXZDataBeans = where("username = ? and txm = ?", username,txm).find(XSJJHXZDataBean.class);
if(xSJJHXZDataBeans!=null&&xSJJHXZDataBeans.size()>0){
XSJJHXZDataBean xSJJHXZDataBean = xSJJHXZDataBeans.get(0);
if((!TextUtils.isEmpty(xSJJHXZDataBean.getTxmzt()))&&xSJJHXZDataBean.getTxmzt().equals("0")){
showToast("条形码巡检方式未启用,不允许通过扫码条形码巡检");
return;
if (resultCode == RESULT_OK) {
if(data!=null){
String txm = data.getStringExtra("code");
showLog(txm);
List<XSJJHXZDataBean> xSJJHXZDataBeans = where("username = ? and txm = ?", username,txm).find(XSJJHXZDataBean.class);
if(xSJJHXZDataBeans!=null&&xSJJHXZDataBeans.size()>0){
XSJJHXZDataBean xSJJHXZDataBean = xSJJHXZDataBeans.get(0);
if((!TextUtils.isEmpty(xSJJHXZDataBean.getTxmzt()))&&xSJJHXZDataBean.getTxmzt().equals("0")){
showToast("条形码巡检方式未启用,不允许通过扫码条形码巡检");
return;
}
}
List<XSJJHDataBean> xsjjhDataBeen = DataSupport.where("txm = ? and username = ?", txm,username).find(XSJJHDataBean.class);//txm是根据扫描得到的二维码结果来查询
xsjjhDataBeanArrayList.clear();
xsjjhDataBeanArrayList.addAll(xsjjhDataBeen);
if (xsjjhDataBeen.isEmpty()) {
toastviewbymyself.makeText(SxgzActivity.this, "此区域下无巡检数据,请确认!", Toast.LENGTH_SHORT).show();
} else {
Bundle bundle2 = new Bundle();
Intent intent = new Intent(SxgzActivity.this, XjYulActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
bundle2.putParcelableArrayList("xsjjhDataBeanArrayList", xsjjhDataBeanArrayList);
bundle2.putBoolean("edit", true);
bundle2.putInt(Contans.KEY_ITEM, 0);
bundle2.putInt("itemposition", 0);
bundle2.putString("LX", "QRcode");
bundle2.putString("LXResult", txm);
bundle2.putInt("from", 0);
intent.putExtras(bundle2);
ContentValues values = new ContentValues();
values.put("second", "YES");
values.put("smfs", "QRcode");
int i = DataSupport.updateAll(XSJJHDataBean.class, values, "txm = ? and username = ?", txm,username);
startActivity(intent);
}
}
List<XSJJHDataBean> xsjjhDataBeen = DataSupport.where("txm = ? and username = ?", txm,username).find(XSJJHDataBean.class);//txm是根据扫描得到的二维码结果来查询
xsjjhDataBeanArrayList.clear();
xsjjhDataBeanArrayList.addAll(xsjjhDataBeen);
if (xsjjhDataBeen.size() == 0) {
toastviewbymyself.makeText(SxgzActivity.this, "此区域下无巡检数据,请确认!", Toast.LENGTH_SHORT).show();
} else {
Bundle bundle2 = new Bundle();
Intent intent = new Intent(SxgzActivity.this, XjYulActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
bundle2.putParcelableArrayList("xsjjhDataBeanArrayList", xsjjhDataBeanArrayList);
bundle2.putBoolean("edit", true);
bundle2.putInt(Contans.KEY_ITEM, 0);
bundle2.putInt("itemposition", 0);
bundle2.putString("LX", "QRcode");
bundle2.putString("LXResult", txm);
bundle2.putInt("from", 0);
intent.putExtras(bundle2);
ContentValues values = new ContentValues();
values.put("second", "YES");
values.put("smfs", "QRcode");
int i = DataSupport.updateAll(XSJJHDataBean.class, values, "txm = ? and username = ?", txm,username);
startActivity(intent);
}
}
}

@ -7,6 +7,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
@ -184,7 +185,14 @@ public class XzxsjhFragment extends BaseFragment {
adapter.notifyDataSetChanged();
}
});
builder.show();
AlertDialog dialog = builder.create();
dialog.show();
//确定按钮
Button btnPos = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
//取消按钮
Button btnNeg = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
btnPos.setTextColor(Color.BLACK);
btnNeg.setTextColor(Color.BLACK);
} else {
showToast("没有可删除计划");

@ -31,7 +31,6 @@ import com.rehome.dywoa.MainActivity;
import com.rehome.dywoa.R;
import com.rehome.dywoa.adapter.GridViewAdapter;
import com.rehome.dywoa.base.BaseFragment;
import com.rehome.dywoa.base.MipcaActivityCapture;
import com.rehome.dywoa.bean.FaceRecognitionResult;
import com.rehome.dywoa.bean.FwSingleLoginResult;
import com.rehome.dywoa.bean.GridItem;
@ -281,6 +280,7 @@ public class HomeFragment extends BaseFragment {
startActivity(intentJiZhu);
break;
case 4:
//巡检
if((firstDeparment!=null&&firstDeparment.equals("运行部"))||(firstDeparment!=null&&firstDeparment.equals("承包商"))||(username!=null&&username.equals("371522"))||(username!=null&&username.equals("ceshi1"))||(username!=null&&username.equals("RH00001"))){
Intent intentXj= new Intent(mActivity, XscbglActivity.class);
intentXj.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
@ -290,11 +290,16 @@ public class HomeFragment extends BaseFragment {
}
break;
case 5:
Intent intentDj= new Intent(mActivity, SbxdjglActivity.class);
intentDj.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intentDj.putExtra("edit",false);
intentDj.putExtra("index",0);
startActivity(intentDj);
//点检
if((firstDeparment!=null&&firstDeparment.equals("设备部"))||(firstDeparment!=null&&firstDeparment.equals("承包商"))||(username!=null&&username.equals("371522"))||(username!=null&&username.equals("ceshi1"))||(username!=null&&username.equals("RH00001"))){
Intent intentDj= new Intent(mActivity, SbxdjglActivity.class);
intentDj.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intentDj.putExtra("edit",false);
intentDj.putExtra("index",0);
startActivity(intentDj);
}else{
showToast("点检功能只对设备部和承包商开放,当前用户无权限");
}
break;
// case 6:
// //运行日志

@ -1,32 +0,0 @@
package com.rehome.dywoa.zxing.camera;
import android.hardware.Camera;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
final class AutoFocusCallback implements Camera.AutoFocusCallback {
private static final String TAG = AutoFocusCallback.class.getSimpleName();
private static final long AUTOFOCUS_INTERVAL_MS = 1500L;
private Handler autoFocusHandler;
private int autoFocusMessage;
void setHandler(Handler autoFocusHandler, int autoFocusMessage) {
this.autoFocusHandler = autoFocusHandler;
this.autoFocusMessage = autoFocusMessage;
}
public void onAutoFocus(boolean success, Camera camera) {
if (autoFocusHandler != null) {
Message message = autoFocusHandler.obtainMessage(autoFocusMessage, success);
autoFocusHandler.sendMessageDelayed(message, AUTOFOCUS_INTERVAL_MS);
autoFocusHandler = null;
} else {
Log.d(TAG, "Got auto-focus callback, but no handler for it");
}
}
}

@ -1,267 +0,0 @@
package com.rehome.dywoa.zxing.camera;
import android.content.Context;
import android.graphics.Point;
import android.hardware.Camera;
import android.os.Build;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
import java.lang.reflect.Method;
import java.util.regex.Pattern;
final class CameraConfigurationManager {
private static final String TAG = CameraConfigurationManager.class.getSimpleName();
private static final int TEN_DESIRED_ZOOM = 27;
private static final int DESIRED_SHARPNESS = 30;
private static final Pattern COMMA_PATTERN = Pattern.compile(",");
private final Context context;
private Point screenResolution;
private Point cameraResolution;
private int previewFormat;
private String previewFormatString;
CameraConfigurationManager(Context context) {
this.context = context;
}
/**
* Reads, one time, values from the camera that are needed by the app.
*/
void initFromCameraParameters(Camera camera) {
Camera.Parameters parameters = camera.getParameters();
previewFormat = parameters.getPreviewFormat();
previewFormatString = parameters.get("preview-format");
Log.d(TAG, "Default preview format: " + previewFormat + '/' + previewFormatString);
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
screenResolution = new Point(display.getWidth(), display.getHeight());
Log.d(TAG, "Screen resolution: " + screenResolution);
cameraResolution = getCameraResolution(parameters, screenResolution);
Log.d(TAG, "Camera resolution: " + screenResolution);
}
/**
* Sets the camera up to take preview images which are used for both preview and decoding.
* We detect the preview format here so that buildLuminanceSource() can build an appropriate
* LuminanceSource subclass. In the future we may want to force YUV420SP as it's the smallest,
* and the planar Y can be used for barcode scanning without background copy in some cases.
*/
void setDesiredCameraParameters(Camera camera) {
Camera.Parameters parameters = camera.getParameters();
Log.d(TAG, "Setting preview size: " + cameraResolution);
parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
setFlash(parameters);
setZoom(parameters);
setDisplayOrientation(camera, 90);
camera.setParameters(parameters);
}
Point getCameraResolution() {
return cameraResolution;
}
Point getScreenResolution() {
return screenResolution;
}
int getPreviewFormat() {
return previewFormat;
}
String getPreviewFormatString() {
return previewFormatString;
}
private static Point getCameraResolution(Camera.Parameters parameters, Point screenResolution) {
String previewSizeValueString = parameters.get("preview-size-values");
// saw this on Xperia
if (previewSizeValueString == null) {
previewSizeValueString = parameters.get("preview-size-value");
}
Point cameraResolution = null;
if (previewSizeValueString != null) {
Log.d(TAG, "preview-size-values parameter: " + previewSizeValueString);
cameraResolution = findBestPreviewSizeValue(previewSizeValueString, screenResolution);
}
if (cameraResolution == null) {
// Ensure that the camera resolution is background multiple of 8, as the screen may not be.
cameraResolution = new Point(
(screenResolution.x >> 3) << 3,
(screenResolution.y >> 3) << 3);
}
return cameraResolution;
}
private static Point findBestPreviewSizeValue(CharSequence previewSizeValueString, Point screenResolution) {
int bestX = 0;
int bestY = 0;
int diff = Integer.MAX_VALUE;
for (String previewSize : COMMA_PATTERN.split(previewSizeValueString)) {
previewSize = previewSize.trim();
int dimPosition = previewSize.indexOf('x');
if (dimPosition < 0) {
Log.w(TAG, "Bad preview-size: " + previewSize);
continue;
}
int newX;
int newY;
try {
newX = Integer.parseInt(previewSize.substring(0, dimPosition));
newY = Integer.parseInt(previewSize.substring(dimPosition + 1));
} catch (NumberFormatException nfe) {
Log.w(TAG, "Bad preview-size: " + previewSize);
continue;
}
int newDiff = Math.abs(newX - screenResolution.x) + Math.abs(newY - screenResolution.y);
if (newDiff == 0) {
bestX = newX;
bestY = newY;
break;
} else if (newDiff < diff) {
bestX = newX;
bestY = newY;
diff = newDiff;
}
}
if (bestX > 0 && bestY > 0) {
return new Point(bestX, bestY);
}
return null;
}
private static int findBestMotZoomValue(CharSequence stringValues, int tenDesiredZoom) {
int tenBestValue = 0;
for (String stringValue : COMMA_PATTERN.split(stringValues)) {
stringValue = stringValue.trim();
double value;
try {
value = Double.parseDouble(stringValue);
} catch (NumberFormatException nfe) {
return tenDesiredZoom;
}
int tenValue = (int) (10.0 * value);
if (Math.abs(tenDesiredZoom - value) < Math.abs(tenDesiredZoom - tenBestValue)) {
tenBestValue = tenValue;
}
}
return tenBestValue;
}
private void setFlash(Camera.Parameters parameters) {
// FIXME: This is background hack to turn the flash off on the Samsung Galaxy.
// And this is background hack-hack to work around background different value on the Behold II
// Restrict Behold II check to Cupcake, per Samsung's advice
//if (Build.MODEL.contains("Behold II") &&
// CameraManager.SDK_INT == Build.VERSION_CODES.CUPCAKE) {
if (Build.MODEL.contains("Behold II") && CameraManager.SDK_INT == 3) { // icon3 = Cupcake
parameters.set("flash-value", 1);
} else {
parameters.set("flash-value", 2);
}
// This is the standard setting to turn the flash off that all devices should honor.
parameters.set("flash-mode", "off");
}
private void setZoom(Camera.Parameters parameters) {
String zoomSupportedString = parameters.get("zoom-supported");
if (zoomSupportedString != null && !Boolean.parseBoolean(zoomSupportedString)) {
return;
}
int tenDesiredZoom = TEN_DESIRED_ZOOM;
String maxZoomString = parameters.get("max-zoom");
if (maxZoomString != null) {
try {
int tenMaxZoom = (int) (10.0 * Double.parseDouble(maxZoomString));
if (tenDesiredZoom > tenMaxZoom) {
tenDesiredZoom = tenMaxZoom;
}
} catch (NumberFormatException nfe) {
Log.w(TAG, "Bad max-zoom: " + maxZoomString);
}
}
String takingPictureZoomMaxString = parameters.get("taking-picture-zoom-max");
if (takingPictureZoomMaxString != null) {
try {
int tenMaxZoom = Integer.parseInt(takingPictureZoomMaxString);
if (tenDesiredZoom > tenMaxZoom) {
tenDesiredZoom = tenMaxZoom;
}
} catch (NumberFormatException nfe) {
Log.w(TAG, "Bad taking-picture-zoom-max: " + takingPictureZoomMaxString);
}
}
String motZoomValuesString = parameters.get("mot-zoom-values");
if (motZoomValuesString != null) {
tenDesiredZoom = findBestMotZoomValue(motZoomValuesString, tenDesiredZoom);
}
String motZoomStepString = parameters.get("mot-zoom-step");
if (motZoomStepString != null) {
try {
double motZoomStep = Double.parseDouble(motZoomStepString.trim());
int tenZoomStep = (int) (10.0 * motZoomStep);
if (tenZoomStep > 1) {
tenDesiredZoom -= tenDesiredZoom % tenZoomStep;
}
} catch (NumberFormatException nfe) {
// continue
}
}
// Set zoom. This helps encourage the user to pull back.
// Some devices like the Behold have background zoom parameter
if (maxZoomString != null || motZoomValuesString != null) {
parameters.set("zoom", String.valueOf(tenDesiredZoom / 10.0));
}
// Most devices, like the Hero, appear to expose this zoom parameter.
// It takes on values like "27" which appears to mean icon2.7x zoom
if (takingPictureZoomMaxString != null) {
parameters.set("taking-picture-zoom", tenDesiredZoom);
}
}
public static int getDesiredSharpness() {
return DESIRED_SHARPNESS;
}
/**
* compatible icon1.icon6
* @param camera
* @param angle
*/
protected void setDisplayOrientation(Camera camera, int angle){
Method downPolymorphic;
try
{
downPolymorphic = camera.getClass().getMethod("setDisplayOrientation", int.class);
if (downPolymorphic != null)
downPolymorphic.invoke(camera, angle);
}
catch (Exception e1)
{
}
}
}

@ -1,312 +0,0 @@
package com.rehome.dywoa.zxing.camera;
import android.content.Context;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.Rect;
import android.hardware.Camera;
import android.os.Build;
import android.os.Handler;
import android.util.Log;
import android.view.SurfaceHolder;
import java.io.IOException;
/**
* This object wraps the Camera service object and expects to be the only one talking to it. The
* implementation encapsulates the steps needed to take preview-sized images, which are used for
* both preview and decoding.
*/
public final class CameraManager {
private static final String TAG = CameraManager.class.getSimpleName();
private static final int MIN_FRAME_WIDTH = 350;
private static final int MIN_FRAME_HEIGHT = 350;
private static final int MAX_FRAME_WIDTH = 700;
private static final int MAX_FRAME_HEIGHT
= 630;
private static CameraManager cameraManager;
static final int SDK_INT; // Later we can use Build.VERSION.SDK_INT
static {
int sdkInt;
try {
sdkInt = Integer.parseInt(Build.VERSION.SDK);
} catch (NumberFormatException nfe) {
// Just to be safe
sdkInt = 10000;
}
SDK_INT = sdkInt;
}
private final Context context;
private final CameraConfigurationManager configManager;
private static Camera camera;
private Rect framingRect;
private Rect framingRectInPreview;
private boolean initialized;
private boolean previewing;
private final boolean useOneShotPreviewCallback;
/**
* Preview frames are delivered here, which we pass on to the registered handler. Make sure to
* clear the handler so it will only receive one message.
*/
private final PreviewCallback previewCallback;
/**
* Autofocus callbacks arrive here, and are dispatched to the Handler which requested them.
*/
private final AutoFocusCallback autoFocusCallback;
/**
* Initializes this static object with the Context of the calling Activity.
*
* @param context The Activity which wants to use the camera.
*/
public static void init(Context context) {
if (cameraManager == null) {
cameraManager = new CameraManager(context);
}
}
/**
* Gets the CameraManager singleton instance.
*
* @return A reference to the CameraManager singleton.
*/
public static CameraManager get() {
return cameraManager;
}
public static Camera getCamera() {
return camera;
}
private CameraManager(Context context) {
this.context = context;
this.configManager = new CameraConfigurationManager(context);
// Camera.setOneShotPreviewCallback() has background race condition in Cupcake, so we use the older
// Camera.setPreviewCallback() on icon1.icon5 and earlier. For Donut and later, we need to use
// the more efficient one shot callback, as the older one can swamp the system and cause it
// to run out of memory. We can't use SDK_INT because it was introduced in the Donut SDK.
//useOneShotPreviewCallback = Integer.parseInt(Build.VERSION.SDK) > Build.VERSION_CODES.CUPCAKE;
useOneShotPreviewCallback = Integer.parseInt(Build.VERSION.SDK) > 3; // icon3 = Cupcake
previewCallback = new PreviewCallback(configManager, useOneShotPreviewCallback);
autoFocusCallback = new AutoFocusCallback();
}
/**
* Opens the camera driver and initializes the hardware parameters.
*
* @param holder The surface object which the camera will draw preview frames into.
* @throws IOException Indicates the camera driver failed to open.
*/
public void openDriver(SurfaceHolder holder) throws IOException {
if (camera == null) {
camera = Camera.open();
if (camera == null) {
throw new IOException();
}
camera.setPreviewDisplay(holder);
if (!initialized) {
initialized = true;
configManager.initFromCameraParameters(camera);
}
configManager.setDesiredCameraParameters(camera);
FlashlightManager.enableFlashlight();
}
}
/**
* Closes the camera driver if still in use.
*/
public void closeDriver() {
if (camera != null) {
FlashlightManager.disableFlashlight();
camera.release();
camera = null;
}
}
/**
* Asks the camera hardware to begin drawing preview frames to the screen.
*/
public void startPreview() {
if (camera != null && !previewing) {
camera.startPreview();
previewing = true;
}
}
/**
* Tells the camera to stop drawing preview frames.
*/
public void stopPreview() {
if (camera != null && previewing) {
if (!useOneShotPreviewCallback) {
camera.setPreviewCallback(null);
}
camera.stopPreview();
previewCallback.setHandler(null, 0);
autoFocusCallback.setHandler(null, 0);
previewing = false;
}
}
/**
* A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
* in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
* respectively.
*
* @param handler The handler to send the message to.
* @param message The what field of the message to be sent.
*/
public void requestPreviewFrame(Handler handler, int message) {
if (camera != null && previewing) {
previewCallback.setHandler(handler, message);
if (useOneShotPreviewCallback) {
camera.setOneShotPreviewCallback(previewCallback);
} else {
camera.setPreviewCallback(previewCallback);
}
}
}
/**
* Asks the camera hardware to perform an autofocus.
*
* @param handler The Handler to notify when the autofocus completes.
* @param message The message to deliver.
*/
public void requestAutoFocus(Handler handler, int message) {
if (camera != null && previewing) {
autoFocusCallback.setHandler(handler, message);
//Log.d(TAG, "Requesting auto-focus callback");
camera.autoFocus(autoFocusCallback);
}
}
/**
* Calculates the framing rect which the UI should draw to show the user where to place the
* barcode. This target helps with alignment as well as forces the user to hold the device
* far enough away to ensure the image will be in focus.
*
* @return The rectangle to draw on screen in window coordinates.
*/
public Rect getFramingRect() {
Point screenResolution = configManager.getScreenResolution();
if (framingRect == null) {
if (camera == null) {
return null;
}
int width = screenResolution.x * 3 / 4;
if (width < MIN_FRAME_WIDTH) {
width = MIN_FRAME_WIDTH;
} else if (width > MAX_FRAME_WIDTH) {
width = MAX_FRAME_WIDTH;
}
int height = screenResolution.y * 3 / 4;
if (height < MIN_FRAME_HEIGHT) {
height = MIN_FRAME_HEIGHT;
} else if (height > MAX_FRAME_HEIGHT) {
height = MAX_FRAME_HEIGHT;
}
int leftOffset = (screenResolution.x - width) / 2;
int topOffset = (screenResolution.y - height) / 2;
framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
Log.d(TAG, "Calculated framing rect: " + framingRect);
}
return framingRect;
}
/**
* Like {@link #getFramingRect} but coordinates are in terms of the preview frame,
* not UI / screen.
*/
public Rect getFramingRectInPreview() {
if (framingRectInPreview == null) {
Rect rect = new Rect(getFramingRect());
Point cameraResolution = configManager.getCameraResolution();
Point screenResolution = configManager.getScreenResolution();
//modify here
// rect.left = rect.left * cameraResolution.x / screenResolution.x;
// rect.right = rect.right * cameraResolution.x / screenResolution.x;
// rect.top = rect.top * cameraResolution.y / screenResolution.y;
// rect.bottom = rect.bottom * cameraResolution.y / screenResolution.y;
rect.left = rect.left * cameraResolution.y / screenResolution.x;
rect.right = rect.right * cameraResolution.y / screenResolution.x;
rect.top = rect.top * cameraResolution.x / screenResolution.y;
rect.bottom = rect.bottom * cameraResolution.x / screenResolution.y;
framingRectInPreview = rect;
}
return framingRectInPreview;
}
/**
* Converts the result points from still resolution coordinates to screen coordinates.
*
* @param points The points returned by the Reader subclass through Result.getResultPoints().
* @return An array of Points scaled to the size of the framing rect and offset appropriately
* so they can be drawn in screen coordinates.
*/
/*
public Point[] convertResultPoints(ResultPoint[] points) {
Rect frame = getFramingRectInPreview();
int count = points.length;
Point[] output = new Point[count];
for (int x = 0; x < count; x++) {
output[x] = new Point();
output[x].x = frame.left + (int) (points[x].getX() + 0.5f);
output[x].y = frame.top + (int) (points[x].getY() + 0.5f);
}
return output;
}
*/
/**
* A factory method to build the appropriate LuminanceSource object based on the format
* of the preview buffers, as described by Camera.Parameters.
*
* @param data A preview frame.
* @param width The width of the image.
* @param height The height of the image.
* @return A PlanarYUVLuminanceSource instance.
*/
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) {
Rect rect = getFramingRectInPreview();
int previewFormat = configManager.getPreviewFormat();
String previewFormatString = configManager.getPreviewFormatString();
switch (previewFormat) {
// This is the standard Android format which all devices are REQUIRED to support.
// In theory, it's the only one we should ever care about.
case PixelFormat.YCbCr_420_SP:
// This format has never been seen in the wild, but is compatible as we only care
// about the Y channel, so allow it.
case PixelFormat.YCbCr_422_SP:
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
rect.width(), rect.height());
default:
// The Samsung Moment incorrectly uses this variant instead of the 'sp' version.
// Fortunately, it too has all the Y data up front, so we can read it.
if ("yuv420p".equals(previewFormatString)) {
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
rect.width(), rect.height());
}
}
throw new IllegalArgumentException("Unsupported picture format: " +
previewFormat + '/' + previewFormatString);
}
public Context getContext() {
return context;
}
}

@ -1,132 +0,0 @@
package com.rehome.dywoa.zxing.camera;
import android.os.IBinder;
import android.util.Log;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* This class is used to activate the weak light on some camera phones (not flash)
* in order to illuminate surfaces for scanning. There is no official way to do this,
* but, classes which allow access to this function still exist on some devices.
* This therefore proceeds through background great deal of reflection.
*
* See <background href="http://almondmendoza.com/2009/01/05/changing-the-screen-brightness-programatically/">
* http://almondmendoza.com/2009/01/05/changing-the-screen-brightness-programatically/</background> and
* <background href="http://code.google.com/p/droidled/source/browse/trunk/src/com/droidled/demo/DroidLED.java">
* http://code.google.com/p/droidled/source/browse/trunk/src/com/droidled/demo/DroidLED.java</background>.
* Thanks to Ryan Alford for pointing out the availability of this class.
*/
final class FlashlightManager {
private static final String TAG = FlashlightManager.class.getSimpleName();
private static final Object iHardwareService;
private static final Method setFlashEnabledMethod;
static {
iHardwareService = getHardwareService();
setFlashEnabledMethod = getSetFlashEnabledMethod(iHardwareService);
if (iHardwareService == null) {
Log.v(TAG, "This device does supports control of background flashlight");
} else {
Log.v(TAG, "This device does not support control of background flashlight");
}
}
private FlashlightManager() {
}
//FIXME
static void enableFlashlight() {
setFlashlight(false);
}
static void disableFlashlight() {
setFlashlight(false);
}
private static Object getHardwareService() {
Class<?> serviceManagerClass = maybeForName("android.os.ServiceManager");
if (serviceManagerClass == null) {
return null;
}
Method getServiceMethod = maybeGetMethod(serviceManagerClass, "getService", String.class);
if (getServiceMethod == null) {
return null;
}
Object hardwareService = invoke(getServiceMethod, null, "hardware");
if (hardwareService == null) {
return null;
}
Class<?> iHardwareServiceStubClass = maybeForName("android.os.IHardwareService$Stub");
if (iHardwareServiceStubClass == null) {
return null;
}
Method asInterfaceMethod = maybeGetMethod(iHardwareServiceStubClass, "asInterface", IBinder.class);
if (asInterfaceMethod == null) {
return null;
}
return invoke(asInterfaceMethod, null, hardwareService);
}
private static Method getSetFlashEnabledMethod(Object iHardwareService) {
if (iHardwareService == null) {
return null;
}
Class<?> proxyClass = iHardwareService.getClass();
return maybeGetMethod(proxyClass, "setFlashlightEnabled", boolean.class);
}
private static Class<?> maybeForName(String name) {
try {
return Class.forName(name);
} catch (ClassNotFoundException cnfe) {
// OK
return null;
} catch (RuntimeException re) {
Log.w(TAG, "Unexpected error while finding class " + name, re);
return null;
}
}
private static Method maybeGetMethod(Class<?> clazz, String name, Class<?>... argClasses) {
try {
return clazz.getMethod(name, argClasses);
} catch (NoSuchMethodException nsme) {
// OK
return null;
} catch (RuntimeException re) {
Log.w(TAG, "Unexpected error while finding method " + name, re);
return null;
}
}
private static Object invoke(Method method, Object instance, Object... args) {
try {
return method.invoke(instance, args);
} catch (IllegalAccessException e) {
Log.w(TAG, "Unexpected error while invoking " + method, e);
return null;
} catch (InvocationTargetException e) {
Log.w(TAG, "Unexpected error while invoking " + method, e.getCause());
return null;
} catch (RuntimeException re) {
Log.w(TAG, "Unexpected error while invoking " + method, re);
return null;
}
}
private static void setFlashlight(boolean active) {
if (iHardwareService != null) {
invoke(setFlashEnabledMethod, iHardwareService, active);
}
}
}

@ -1,117 +0,0 @@
package com.rehome.dywoa.zxing.camera;
import android.graphics.Bitmap;
import com.google.zxing.LuminanceSource;
/**
* This object extends LuminanceSource around an array of YUV data returned from the camera driver,
* with the option to crop to background rectangle within the full data. This can be used to exclude
* superfluous pixels around the perimeter and speed up decoding.
*
* It works for any pixel format where the Y channel is planar and appears first, including
* YCbCr_420_SP and YCbCr_422_SP.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class PlanarYUVLuminanceSource extends LuminanceSource {
private final byte[] yuvData;
private final int dataWidth;
private final int dataHeight;
private final int left;
private final int top;
public PlanarYUVLuminanceSource(byte[] yuvData, int dataWidth, int dataHeight, int left, int top,
int width, int height) {
super(width, height);
if (left + width > dataWidth || top + height > dataHeight) {
throw new IllegalArgumentException("Crop rectangle does not fit within image data.");
}
this.yuvData = yuvData;
this.dataWidth = dataWidth;
this.dataHeight = dataHeight;
this.left = left;
this.top = top;
}
@Override
public byte[] getRow(int y, byte[] row) {
if (y < 0 || y >= getHeight()) {
throw new IllegalArgumentException("Requested row is outside the image: " + y);
}
int width = getWidth();
if (row == null || row.length < width) {
row = new byte[width];
}
int offset = (y + top) * dataWidth + left;
System.arraycopy(yuvData, offset, row, 0, width);
return row;
}
@Override
public byte[] getMatrix() {
int width = getWidth();
int height = getHeight();
// If the caller asks for the entire underlying image, save the copy and give them the
// original data. The docs specifically warn that result.length must be ignored.
if (width == dataWidth && height == dataHeight) {
return yuvData;
}
int area = width * height;
byte[] matrix = new byte[area];
int inputOffset = top * dataWidth + left;
// If the width matches the full width of the underlying data, perform background single copy.
if (width == dataWidth) {
System.arraycopy(yuvData, inputOffset, matrix, 0, area);
return matrix;
}
// Otherwise copy one cropped row at background time.
byte[] yuv = yuvData;
for (int y = 0; y < height; y++) {
int outputOffset = y * width;
System.arraycopy(yuv, inputOffset, matrix, outputOffset, width);
inputOffset += dataWidth;
}
return matrix;
}
@Override
public boolean isCropSupported() {
return true;
}
public int getDataWidth() {
return dataWidth;
}
public int getDataHeight() {
return dataHeight;
}
public Bitmap renderCroppedGreyscaleBitmap() {
int width = getWidth();
int height = getHeight();
int[] pixels = new int[width * height];
byte[] yuv = yuvData;
int inputOffset = top * dataWidth + left;
for (int y = 0; y < height; y++) {
int outputOffset = y * width;
for (int x = 0; x < width; x++) {
int grey = yuv[inputOffset + x] & 0xff;
pixels[outputOffset + x] = 0xFF000000 | (grey * 0x00010101);
}
inputOffset += dataWidth;
}
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
return bitmap;
}
}

@ -1,43 +0,0 @@
package com.rehome.dywoa.zxing.camera;
import android.graphics.Point;
import android.hardware.Camera;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
final class PreviewCallback implements Camera.PreviewCallback {
private static final String TAG = PreviewCallback.class.getSimpleName();
private final CameraConfigurationManager configManager;
private final boolean useOneShotPreviewCallback;
private Handler previewHandler;
private int previewMessage;
PreviewCallback(CameraConfigurationManager configManager, boolean useOneShotPreviewCallback) {
this.configManager = configManager;
this.useOneShotPreviewCallback = useOneShotPreviewCallback;
}
void setHandler(Handler previewHandler, int previewMessage) {
this.previewHandler = previewHandler;
this.previewMessage = previewMessage;
}
public void onPreviewFrame(byte[] data, Camera camera) {
Point cameraResolution = configManager.getCameraResolution();
if (!useOneShotPreviewCallback) {
camera.setPreviewCallback(null);
}
if (previewHandler != null) {
Message message = previewHandler.obtainMessage(previewMessage, cameraResolution.x,
cameraResolution.y, data);
message.sendToTarget();
previewHandler = null;
} else {
Log.d(TAG, "Got preview callback, but no handler for it");
}
}
}

@ -1,159 +0,0 @@
package com.rehome.dywoa.zxing.decoding;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.Result;
import com.rehome.dywoa.R;
import com.rehome.dywoa.base.MipcaActivityCapture;
import com.rehome.dywoa.zxing.camera.CameraManager;
import com.rehome.dywoa.zxing.view.ViewfinderResultPointCallback;
import java.util.Vector;
/**
* This class handles all the messaging which comprises the state machine for capture.
*/
public final class CaptureActivityHandler extends Handler {
private static final String TAG = CaptureActivityHandler.class.getSimpleName();
private final MipcaActivityCapture activity;
private final DecodeThread decodeThread;
private State state;
private enum State {
PREVIEW,
SUCCESS,
DONE
}
public CaptureActivityHandler(MipcaActivityCapture activity, Vector<BarcodeFormat> decodeFormats,
String characterSet) {
this.activity = activity;
decodeThread = new DecodeThread(activity, decodeFormats, characterSet,
new ViewfinderResultPointCallback(activity.getViewfinderView()));
decodeThread.start();
state = State.SUCCESS;
// Start ourselves capturing previews and decoding.
CameraManager.get().startPreview();
restartPreviewAndDecode();
}
@Override
public void handleMessage(Message message) {
if(message.what==R.id.auto_focus){
if (state == State.PREVIEW) {
CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
}
}
if(message.what==R.id.restart_preview){
Log.d(TAG, "Got restart preview message");
restartPreviewAndDecode();
}
if(message.what==R.id.decode_succeeded){
Log.d(TAG, "Got decode succeeded message");
state = State.SUCCESS;
Bundle bundle = message.getData();
/***********************************************************************/
Bitmap barcode = bundle == null ? null :
(Bitmap) bundle.getParcelable(DecodeThread.BARCODE_BITMAP);//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD>߳<EFBFBD>
activity.handleDecode((Result) message.obj, barcode);
/***********************************************************************/
}
if(message.what==R.id.decode_failed){
state = State.PREVIEW;
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
}
if(message.what==R.id.return_scan_result){
Log.d(TAG, "Got return scan result message");
activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
activity.finish();
}
if(message.what==R.id.launch_product_query){
Log.d(TAG, "Got product query message");
String url = (String) message.obj;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
activity.startActivity(intent);
}
// switch (message.what) {
// case R.id.auto_focus:
// //Log.d(TAG, "Got auto-focus message");
// // When one auto focus pass finishes, start another. This is the closest thing to
// // continuous AF. It does seem to hunt background bit, but I'm not sure what else to do.
// if (state == State.PREVIEW) {
// CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
// }
// break;
// case R.id.restart_preview:
// Log.d(TAG, "Got restart preview message");
// restartPreviewAndDecode();
// break;
// case R.id.decode_succeeded:
// Log.d(TAG, "Got decode succeeded message");
// state = State.SUCCESS;
// Bundle bundle = message.getData();
//
// /***********************************************************************/
// Bitmap barcode = bundle == null ? null :
// (Bitmap) bundle.getParcelable(DecodeThread.BARCODE_BITMAP);//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD>߳<EFBFBD>
//
// activity.handleDecode((Result) message.obj, barcode);//<2F><><EFBFBD>ؽ<EFBFBD><D8BD>? /***********************************************************************/
// break;
// case R.id.decode_failed:
// // We're decoding as fast as possible, so when one decode fails, start another.
// state = State.PREVIEW;
// CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
// break;
// case R.id.return_scan_result:
// Log.d(TAG, "Got return scan result message");
// activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
// activity.finish();
// break;
// case R.id.launch_product_query:
// Log.d(TAG, "Got product query message");
// String url = (String) message.obj;
// Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
// activity.startActivity(intent);
// break;
// }
}
public void quitSynchronously() {
state = State.DONE;
CameraManager.get().stopPreview();
Message quit = Message.obtain(decodeThread.getHandler(), R.id.quit);
quit.sendToTarget();
try {
decodeThread.join();
} catch (InterruptedException e) {
// continue
}
// Be absolutely sure we don't send any queued up messages
removeMessages(R.id.decode_succeeded);
removeMessages(R.id.decode_failed);
}
private void restartPreviewAndDecode() {
if (state == State.SUCCESS) {
state = State.PREVIEW;
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
activity.drawViewfinder();
}
}
}

@ -1,88 +0,0 @@
package com.rehome.dywoa.zxing.decoding;
import android.content.Intent;
import android.net.Uri;
import com.google.zxing.BarcodeFormat;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
import java.util.regex.Pattern;
final class DecodeFormatManager {
private static final Pattern COMMA_PATTERN = Pattern.compile(",");
static final Vector<BarcodeFormat> PRODUCT_FORMATS;
static final Vector<BarcodeFormat> ONE_D_FORMATS;
static final Vector<BarcodeFormat> QR_CODE_FORMATS;
static final Vector<BarcodeFormat> DATA_MATRIX_FORMATS;
static {
PRODUCT_FORMATS = new Vector<BarcodeFormat>(5);
PRODUCT_FORMATS.add(BarcodeFormat.UPC_A);
PRODUCT_FORMATS.add(BarcodeFormat.UPC_E);
PRODUCT_FORMATS.add(BarcodeFormat.EAN_13);
PRODUCT_FORMATS.add(BarcodeFormat.EAN_8);
ONE_D_FORMATS = new Vector<BarcodeFormat>(PRODUCT_FORMATS.size() + 4);
ONE_D_FORMATS.addAll(PRODUCT_FORMATS);
ONE_D_FORMATS.add(BarcodeFormat.CODE_39);
ONE_D_FORMATS.add(BarcodeFormat.CODE_93);
ONE_D_FORMATS.add(BarcodeFormat.CODE_128);
ONE_D_FORMATS.add(BarcodeFormat.ITF);
QR_CODE_FORMATS = new Vector<BarcodeFormat>(1);
QR_CODE_FORMATS.add(BarcodeFormat.QR_CODE);
DATA_MATRIX_FORMATS = new Vector<BarcodeFormat>(1);
DATA_MATRIX_FORMATS.add(BarcodeFormat.DATA_MATRIX);
}
private DecodeFormatManager() {}
static Vector<BarcodeFormat> parseDecodeFormats(Intent intent) {
List<String> scanFormats = null;
String scanFormatsString = intent.getStringExtra(Intents.Scan.SCAN_FORMATS);
if (scanFormatsString != null) {
scanFormats = Arrays.asList(COMMA_PATTERN.split(scanFormatsString));
}
return parseDecodeFormats(scanFormats, intent.getStringExtra(Intents.Scan.MODE));
}
static Vector<BarcodeFormat> parseDecodeFormats(Uri inputUri) {
List<String> formats = inputUri.getQueryParameters(Intents.Scan.SCAN_FORMATS);
if (formats != null && formats.size() == 1 && formats.get(0) != null){
formats = Arrays.asList(COMMA_PATTERN.split(formats.get(0)));
}
return parseDecodeFormats(formats, inputUri.getQueryParameter(Intents.Scan.MODE));
}
private static Vector<BarcodeFormat> parseDecodeFormats(Iterable<String> scanFormats,
String decodeMode) {
if (scanFormats != null) {
Vector<BarcodeFormat> formats = new Vector<BarcodeFormat>();
try {
for (String format : scanFormats) {
formats.add(BarcodeFormat.valueOf(format));
}
return formats;
} catch (IllegalArgumentException iae) {
// ignore it then
}
}
if (decodeMode != null) {
if (Intents.Scan.PRODUCT_MODE.equals(decodeMode)) {
return PRODUCT_FORMATS;
}
if (Intents.Scan.QR_CODE_MODE.equals(decodeMode)) {
return QR_CODE_FORMATS;
}
if (Intents.Scan.DATA_MATRIX_MODE.equals(decodeMode)) {
return DATA_MATRIX_FORMATS;
}
if (Intents.Scan.ONE_D_MODE.equals(decodeMode)) {
return ONE_D_FORMATS;
}
}
return null;
}
}

@ -1,101 +0,0 @@
package com.rehome.dywoa.zxing.decoding;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.ReaderException;
import com.google.zxing.Result;
import com.google.zxing.common.HybridBinarizer;
import com.rehome.dywoa.R;
import com.rehome.dywoa.base.MipcaActivityCapture;
import com.rehome.dywoa.zxing.camera.CameraManager;
import com.rehome.dywoa.zxing.camera.PlanarYUVLuminanceSource;
import java.util.Hashtable;
final class DecodeHandler extends Handler {
private static final String TAG = DecodeHandler.class.getSimpleName();
private final MipcaActivityCapture activity;
private final MultiFormatReader multiFormatReader;
DecodeHandler(MipcaActivityCapture activity, Hashtable<DecodeHintType, Object> hints) {
multiFormatReader = new MultiFormatReader();
multiFormatReader.setHints(hints);
this.activity = activity;
}
@Override
public void handleMessage(Message message) {
if(message.what==R.id.decode){
decode((byte[]) message.obj, message.arg1, message.arg2);
}
if(message.what==R.id.quit){
Looper.myLooper().quit();
}
// switch (message.what) {
// case R.id.decode:
// //Log.d(TAG, "Got decode message");
// decode((byte[]) message.obj, message.arg1, message.arg2);
// break;
// case R.id.quit:
// Looper.myLooper().quit();
// break;
// }
}
/**
* Decode the data within the viewfinder rectangle, and time how long it took. For efficiency,
* reuse the same reader objects from one decode to the next.
*
* @param data The YUV preview frame.
* @param width The width of the preview frame.
* @param height The height of the preview frame.
*/
private void decode(byte[] data, int width, int height) {
long start = System.currentTimeMillis();
Result rawResult = null;
//modify here
byte[] rotatedData = new byte[data.length];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++)
rotatedData[x * height + height - y - 1] = data[x + y * width];
}
int tmp = width; // Here we are swapping, that's the difference to #11
width = height;
height = tmp;
PlanarYUVLuminanceSource source = CameraManager.get().buildLuminanceSource(rotatedData, width, height);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
rawResult = multiFormatReader.decodeWithState(bitmap);
} catch (ReaderException re) {
// continue
} finally {
multiFormatReader.reset();
}
if (rawResult != null) {
long end = System.currentTimeMillis();
Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString());
Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult);
Bundle bundle = new Bundle();
bundle.putParcelable(DecodeThread.BARCODE_BITMAP, source.renderCroppedGreyscaleBitmap());
message.setData(bundle);
//Log.d(TAG, "Sending decode succeeded message...");
message.sendToTarget();
} else {
Message message = Message.obtain(activity.getHandler(), R.id.decode_failed);
message.sendToTarget();
}
}
}

@ -1,67 +0,0 @@
package com.rehome.dywoa.zxing.decoding;
import android.os.Handler;
import android.os.Looper;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.ResultPointCallback;
import com.rehome.dywoa.base.MipcaActivityCapture;
import java.util.Hashtable;
import java.util.Vector;
import java.util.concurrent.CountDownLatch;
final class DecodeThread extends Thread {
public static final String BARCODE_BITMAP = "barcode_bitmap";
private final MipcaActivityCapture activity;
private final Hashtable<DecodeHintType, Object> hints;
private Handler handler;
private final CountDownLatch handlerInitLatch;
DecodeThread(MipcaActivityCapture activity,
Vector<BarcodeFormat> decodeFormats,
String characterSet,
ResultPointCallback resultPointCallback) {
this.activity = activity;
handlerInitLatch = new CountDownLatch(1);
hints = new Hashtable<DecodeHintType, Object>(3);
if (decodeFormats == null || decodeFormats.isEmpty()) {
decodeFormats = new Vector<BarcodeFormat>();
decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
}
hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
if (characterSet != null) {
hints.put(DecodeHintType.CHARACTER_SET, characterSet);
}
hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
Handler getHandler() {
try {
handlerInitLatch.await();
} catch (InterruptedException ie) {
// continue?
}
return handler;
}
@Override
public void run() {
Looper.prepare();
handler = new DecodeHandler(activity, hints);
handlerInitLatch.countDown();
Looper.loop();
}
}

@ -1,31 +0,0 @@
package com.rehome.dywoa.zxing.decoding;
import android.app.Activity;
import android.content.DialogInterface;
/**
* Simple listener used to exit the app in background few cases.
*
*/
public final class FinishListener
implements DialogInterface.OnClickListener, DialogInterface.OnCancelListener, Runnable {
private final Activity activityToFinish;
public FinishListener(Activity activityToFinish) {
this.activityToFinish = activityToFinish;
}
public void onCancel(DialogInterface dialogInterface) {
run();
}
public void onClick(DialogInterface dialogInterface, int i) {
run();
}
public void run() {
activityToFinish.finish();
}
}

@ -1,55 +0,0 @@
package com.rehome.dywoa.zxing.decoding;
import android.app.Activity;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
/**
* Finishes an activity after background period of inactivity.
*/
public final class InactivityTimer {
private static final int INACTIVITY_DELAY_SECONDS = 5 * 60;
private final ScheduledExecutorService inactivityTimer =
Executors.newSingleThreadScheduledExecutor(new DaemonThreadFactory());
private final Activity activity;
private ScheduledFuture<?> inactivityFuture = null;
public InactivityTimer(Activity activity) {
this.activity = activity;
onActivity();
}
public void onActivity() {
cancel();
inactivityFuture = inactivityTimer.schedule(new FinishListener(activity),
INACTIVITY_DELAY_SECONDS,
TimeUnit.SECONDS);
}
private void cancel() {
if (inactivityFuture != null) {
inactivityFuture.cancel(true);
inactivityFuture = null;
}
}
public void shutdown() {
cancel();
inactivityTimer.shutdown();
}
private static final class DaemonThreadFactory implements ThreadFactory {
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable);
thread.setDaemon(true);
return thread;
}
}
}

@ -1,174 +0,0 @@
package com.rehome.dywoa.zxing.decoding;
/**
* This class provides the constants to use when sending an Intent to Barcode Scanner.
* These strings are effectively API and cannot be changed.
*/
public final class Intents {
private Intents() {
}
public static final class Scan {
/**
* Send this intent to open the Barcodes app in scanning mode, find background barcode, and return
* the results.
*/
public static final String ACTION = "com.google.zxing.client.android.SCAN";
/**
* By default, sending Scan.ACTION will decode all barcodes that we understand. However it
* may be useful to limit scanning to certain formats. Use Intent.putExtra(MODE, value) with
* one of the values below ({@link #PRODUCT_MODE}, {@link #ONE_D_MODE}, {@link #QR_CODE_MODE}).
* Optional.
*
* Setting this is effectively shorthnad for setting explicit formats with {@link #SCAN_FORMATS}.
* It is overridden by that setting.
*/
public static final String MODE = "SCAN_MODE";
/**
* Comma-separated list of formats to scan for. The values must match the names of
* {@link com.google.zxing.BarcodeFormat}s, such as {@link com.google.zxing.BarcodeFormat#EAN_13}.
* Example: "EAN_13,EAN_8,QR_CODE"
*
* This overrides {@link #MODE}.
*/
public static final String SCAN_FORMATS = "SCAN_FORMATS";
/**
* @see com.google.zxing.DecodeHintType#CHARACTER_SET
*/
public static final String CHARACTER_SET = "CHARACTER_SET";
/**
* Decode only UPC and EAN barcodes. This is the right choice for shopping apps which get
* prices, reviews, etc. for products.
*/
public static final String PRODUCT_MODE = "PRODUCT_MODE";
/**
* Decode only 1D barcodes (currently UPC, EAN, Code 39, and Code 128).
*/
public static final String ONE_D_MODE = "ONE_D_MODE";
/**
* Decode only QR codes.
*/
public static final String QR_CODE_MODE = "QR_CODE_MODE";
/**
* Decode only Data Matrix codes.
*/
public static final String DATA_MATRIX_MODE = "DATA_MATRIX_MODE";
/**
* If background barcode is found, Barcodes returns RESULT_OK to onActivityResult() of the app which
* requested the scan via startSubActivity(). The barcodes contents can be retrieved with
* intent.getStringExtra(RESULT). If the user presses Back, the result code will be
* RESULT_CANCELED.
*/
public static final String RESULT = "SCAN_RESULT";
/**
* Call intent.getStringExtra(RESULT_FORMAT) to determine which barcode format was found.
* See Contents.Format for possible values.
*/
public static final String RESULT_FORMAT = "SCAN_RESULT_FORMAT";
/**
* Setting this to false will not save scanned codes in the history.
*/
public static final String SAVE_HISTORY = "SAVE_HISTORY";
private Scan() {
}
}
public static final class Encode {
/**
* Send this intent to encode background piece of data as background QR code and display it full screen, so
* that another person can scan the barcode from your screen.
*/
public static final String ACTION = "com.google.zxing.client.android.ENCODE";
/**
* The data to encode. Use Intent.putExtra(DATA, data) where data is either background String or background
* Bundle, depending on the type and format specified. Non-QR Code formats should
* just use background String here. For QR Code, see Contents for details.
*/
public static final String DATA = "ENCODE_DATA";
/**
* The type of data being supplied if the format is QR Code. Use
* Intent.putExtra(TYPE, type) with one of Contents.Type.
*/
public static final String TYPE = "ENCODE_TYPE";
/**
* The barcode format to be displayed. If this isn't specified or is blank,
* it defaults to QR Code. Use Intent.putExtra(FORMAT, format), where
* format is one of Contents.Format.
*/
public static final String FORMAT = "ENCODE_FORMAT";
private Encode() {
}
}
public static final class SearchBookContents {
/**
* Use Google Book Search to search the contents of the book provided.
*/
public static final String ACTION = "com.google.zxing.client.android.SEARCH_BOOK_CONTENTS";
/**
* The book to search, identified by ISBN number.
*/
public static final String ISBN = "ISBN";
/**
* An optional field which is the text to search for.
*/
public static final String QUERY = "QUERY";
private SearchBookContents() {
}
}
public static final class WifiConnect {
/**
* Internal intent used to trigger connection to background wi-fi network.
*/
public static final String ACTION = "com.google.zxing.client.android.WIFI_CONNECT";
/**
* The network to connect to, all the configuration provided here.
*/
public static final String SSID = "SSID";
/**
* The network to connect to, all the configuration provided here.
*/
public static final String TYPE = "TYPE";
/**
* The network to connect to, all the configuration provided here.
*/
public static final String PASSWORD = "PASSWORD";
private WifiConnect() {
}
}
public static final class Share {
/**
* Give the user background choice of items to encode as background barcode, then render it as background QR Code and
* display onscreen for background friend to scan with their phone.
*/
public static final String ACTION = "com.google.zxing.client.android.SHARE";
private Share() {
}
}
}

@ -1,18 +0,0 @@
package com.rehome.dywoa.zxing.view;
import com.google.zxing.ResultPoint;
import com.google.zxing.ResultPointCallback;
public final class ViewfinderResultPointCallback implements ResultPointCallback {
private final ViewfinderView viewfinderView;
public ViewfinderResultPointCallback(ViewfinderView viewfinderView) {
this.viewfinderView = viewfinderView;
}
public void foundPossibleResultPoint(ResultPoint point) {
viewfinderView.addPossibleResultPoint(point);
}
}

@ -1,255 +0,0 @@
/*
* Copyright (C) 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rehome.dywoa.zxing.view;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.View;
import com.google.zxing.ResultPoint;
import com.rehome.dywoa.R;
import com.rehome.dywoa.zxing.camera.CameraManager;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
/**
* This view is overlaid on top of the camera preview. It adds the viewfinder
* rectangle and partial transparency outside it, as well as the laser scanner
* animation and result points.
*
*/
public final class ViewfinderView extends View {
private static final String TAG = "log";
/**
* ˢ<EFBFBD>½<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
*/
private static final long ANIMATION_DELAY = 10L;
private static final int OPAQUE = 0xFF;
/**
* <EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD>߽Ƕ<EFBFBD>Ӧ<EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>
*/
private int ScreenRate;
/**
* <EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD>߽Ƕ<EFBFBD>Ӧ<EFBFBD>Ŀ<EFBFBD><EFBFBD>
*/
private static final int CORNER_WIDTH = 10;
/**
* ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>м<EFBFBD><EFBFBD>ߵĿ<EFBFBD><EFBFBD>
*/
private static final int MIDDLE_LINE_WIDTH = 6;
/**
* ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>м<EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵļ<EFBFBD>϶
*/
private static final int MIDDLE_LINE_PADDING = 5;
/**
* <EFBFBD>м<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD>
*/
private static final int SPEEN_DISTANCE = 5;
/**
* <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>ܶ<EFBFBD>
*/
private static float density;
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
*/
private static final int TEXT_SIZE = 16;
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD>
*/
private static final int TEXT_PADDING_TOP = 30;
/**
* <EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
private Paint paint;
/**
* <EFBFBD>м<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
*/
private int slideTop;
/**
* <EFBFBD>м<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD>׶<EFBFBD>λ<EFBFBD><EFBFBD>
*/
private int slideBottom;
/**
* <EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD>Ķ<EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
private Bitmap resultBitmap;
private final int maskColor;
private final int resultColor;
private final int resultPointColor;
private Collection<ResultPoint> possibleResultPoints;
private Collection<ResultPoint> lastPossibleResultPoints;
boolean isFirst;
public ViewfinderView(Context context, AttributeSet attrs) {
super(context, attrs);
density = context.getResources().getDisplayMetrics().density;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>dp
ScreenRate = (int)(20 * density);
paint = new Paint();
Resources resources = getResources();
maskColor = resources.getColor(R.color.viewfinder_mask);
resultColor = resources.getColor(R.color.result_view);
resultPointColor = resources.getColor(R.color.possible_result_points);
possibleResultPoints = new HashSet<ResultPoint>(5);
}
@Override
public synchronized void onDraw(Canvas canvas) {
Rect frame = CameraManager.get().getFramingRect();
if (frame == null) {
return;
}
//<2F><>ʼ<EFBFBD><CABC><EFBFBD>м<EFBFBD><D0BC>߻<EFBFBD><DFBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϱߺ<CFB1><DFBA><EFBFBD><EFBFBD>±<EFBFBD>
if(!isFirst){
isFirst = true;
slideTop = frame.top;
slideBottom = frame.bottom;
}
int width = canvas.getWidth();
int height = canvas.getHeight();
paint.setColor(resultBitmap != null ? resultColor : maskColor);
canvas.drawRect(0, 0, width, frame.top, paint);
canvas.drawRect(0, frame.top, frame.left, frame.bottom + 1, paint);
canvas.drawRect(frame.right + 1, frame.top, width, frame.bottom + 1,
paint);
canvas.drawRect(0, frame.bottom + 1, width, height, paint);
if (resultBitmap != null) {
// Draw the opaque result bitmap over the scanning rectangle
paint.setAlpha(OPAQUE);
canvas.drawBitmap(resultBitmap, frame.left, frame.top, paint);
} else {
paint.setColor(Color.GREEN);
canvas.drawRect(frame.left, frame.top, frame.left + ScreenRate,
frame.top + CORNER_WIDTH, paint);
canvas.drawRect(frame.left, frame.top, frame.left + CORNER_WIDTH, frame.top
+ ScreenRate, paint);
canvas.drawRect(frame.right - ScreenRate, frame.top, frame.right,
frame.top + CORNER_WIDTH, paint);
canvas.drawRect(frame.right - CORNER_WIDTH, frame.top, frame.right, frame.top
+ ScreenRate, paint);
canvas.drawRect(frame.left, frame.bottom - CORNER_WIDTH, frame.left
+ ScreenRate, frame.bottom, paint);
canvas.drawRect(frame.left, frame.bottom - ScreenRate,
frame.left + CORNER_WIDTH, frame.bottom, paint);
canvas.drawRect(frame.right - ScreenRate, frame.bottom - CORNER_WIDTH,
frame.right, frame.bottom, paint);
canvas.drawRect(frame.right - CORNER_WIDTH, frame.bottom - ScreenRate,
frame.right, frame.bottom, paint);
slideTop += SPEEN_DISTANCE;
if(slideTop >= frame.bottom){
slideTop = frame.top;
}
canvas.drawRect(frame.left + MIDDLE_LINE_PADDING, slideTop - MIDDLE_LINE_WIDTH/2, frame.right - MIDDLE_LINE_PADDING,slideTop + MIDDLE_LINE_WIDTH/2, paint);
//<2F><>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
paint.setColor(Color.WHITE);
paint.setTextSize(TEXT_SIZE * density);
paint.setAlpha(0x40);
paint.setTypeface(Typeface.create("System", Typeface.BOLD));
canvas.drawText("将二维码/条码放入框内即可扫描", frame.left, frame.bottom + (float)TEXT_PADDING_TOP *density, paint);
Collection<ResultPoint> currentPossible = possibleResultPoints;
Collection<ResultPoint> currentLast = lastPossibleResultPoints;
if (currentPossible.isEmpty()) {
lastPossibleResultPoints = null;
} else {
//possibleResultPoints = new HashSet<ResultPoint>(5);
possibleResultPoints = Collections.synchronizedSet(new HashSet<ResultPoint>(5));
lastPossibleResultPoints = currentPossible;
paint.setAlpha(OPAQUE);
paint.setColor(resultPointColor);
for (ResultPoint point : currentPossible) {
canvas.drawCircle(frame.left + point.getX(), frame.top
+ point.getY(), 6.0f, paint);
}
}
if (currentLast != null) {
paint.setAlpha(OPAQUE / 2);
paint.setColor(resultPointColor);
for (ResultPoint point : currentLast) {
canvas.drawCircle(frame.left + point.getX(), frame.top
+ point.getY(), 3.0f, paint);
}
}
//ֻˢ<D6BB><CBA2>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>ˢ<EFBFBD><CBA2>
postInvalidateDelayed(ANIMATION_DELAY, frame.left, frame.top,
frame.right, frame.bottom);
}
}
public void drawViewfinder() {
resultBitmap = null;
invalidate();
}
/**
* Draw background bitmap with the result points highlighted instead of the live
* scanning display.
*
* @param barcode
* An image of the decoded barcode.
*/
public void drawResultBitmap(Bitmap barcode) {
resultBitmap = barcode;
invalidate();
}
public void addPossibleResultPoint(ResultPoint point) {
possibleResultPoints.add(point);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 正常状态 -->
<item android:drawable="@drawable/btn_normal" android:state_pressed="false"/>
<!-- 按下状态 -->
<item android:drawable="@drawable/btn_pressed" android:state_pressed="true"/>
</selector>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#fff" />
<solid android:color="#4fa5d5" />
<stroke
android:width="1dip"
android:color="#4fa5d5" />

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffff00" />
<solid android:color="#cccccc" />
<stroke
android:width="1dip"
android:color="#4fa5d5" />

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<SurfaceView
android:id="@+id/preview_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"/>
<com.rehome.dywoa.zxing.view.ViewfinderView
android:id="@+id/viewfinder_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<include layout="@layout/toolbar_yx" />
<Button
android:id="@+id/flashlightButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@android:color/transparent"
android:text="打开闪光灯"
android:textColor="@color/white"/>
</RelativeLayout>
</FrameLayout>

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -8,9 +7,9 @@
android:background="#ffffff"
tools:context=".ui.activity.KksSearchActivity">
<include
android:id="@+id/toolbarView"
android:visibility="visible"
layout="@layout/layout_base" />

@ -0,0 +1,209 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ui.activity.sbxdjgl.MjApplyActivity">
<include
android:id="@+id/toolbarView"
layout="@layout/layout_base" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#dddddd"
android:padding="5dp"
android:minHeight="30px">
<TextView
android:id="@+id/tv_zxsj"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:gravity="center"
android:minHeight="50px"
android:text="执行时间:"
android:textSize="24px" />
<TextView
android:id="@+id/tv_st"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:layout_weight="1"
android:gravity="center"
android:minHeight="50px"
android:text="开始时间"
android:textSize="24px" />
<TextView
android:id="@+id/tv_to"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:layout_weight="0.2"
android:gravity="center"
android:minHeight="50px"
android:text="至"
android:textSize="24px" />
<TextView
android:id="@+id/tv_et"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:layout_weight="1"
android:gravity="center"
android:minHeight="50px"
android:text="结束时间"
android:textSize="24px" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#dddddd"
android:orientation="horizontal"
android:padding="5dp"
android:minHeight="30px">
<Button
android:id="@+id/tv_last_month"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:gravity="center"
android:minHeight="50px"
android:background="@drawable/btn_selector"
android:textColor="#ffffff"
android:text="上一月"
android:textSize="24px" />
<Button
android:id="@+id/tv_current_month"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:gravity="center"
android:minHeight="50px"
android:background="@drawable/btn_selector"
android:textColor="#ffffff"
android:text="本月"
android:textSize="24px" />
<Button
android:id="@+id/tv_last_week"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:layout_weight="1"
android:gravity="center"
android:minHeight="50px"
android:background="@drawable/btn_selector"
android:textColor="#ffffff"
android:text="上一周"
android:textSize="24px" />
<Button
android:id="@+id/tv_current_week"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:layout_weight="1"
android:gravity="center"
android:minHeight="50px"
android:background="@drawable/btn_selector"
android:textColor="#ffffff"
android:text="本周"
android:textSize="24px" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#dddddd"
android:orientation="horizontal"
android:padding="5dp"
android:minHeight="30px">
<Button
android:id="@+id/tv_last_day"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:gravity="center"
android:minHeight="50px"
android:background="@drawable/btn_selector"
android:textColor="#ffffff"
android:text="昨天"
android:textSize="24px" />
<Button
android:id="@+id/tv_current_quarter"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:gravity="center"
android:minHeight="50px"
android:background="@drawable/btn_selector"
android:textColor="#ffffff"
android:text="本季"
android:textSize="24px" />
<Button
android:id="@+id/tv_last_quarter"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:layout_weight="1"
android:gravity="center"
android:minHeight="50px"
android:background="@drawable/btn_selector"
android:textColor="#ffffff"
android:text="上一季"
android:textSize="24px" />
<Button
android:id="@+id/tv_current_year"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:layout_weight="1"
android:gravity="center"
android:minHeight="50px"
android:background="@drawable/btn_selector"
android:textColor="#ffffff"
android:text="今年"
android:textSize="24px" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="5dp"
android:layout_weight="1">
<ListView
android:id="@+id/lv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#00000000"
android:dividerHeight="0px"/>
<TextView
android:id="@+id/tv_nodata"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="@color/viewfinder_mask"
android:gravity="center"
android:text="暂无数据"/>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/colorPrimary"
android:orientation="vertical">
<TextView
android:id="@+id/tv_report"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="@color/white"
android:gravity="center"
android:textSize="18sp"
android:text="@string/tv_mj_apply_manage"/>
</LinearLayout>
</LinearLayout>

@ -88,7 +88,8 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingStart="5dp"
android:paddingRight="5dp"
android:paddingEnd="5dp"
android:background="#00000000"
android:textColor="#777777"
android:textSize="14sp"
android:text="提交缺陷" />

@ -105,4 +105,5 @@
<string name="scan_text">将二维码/条码放入框内即可扫描</string>
<string name="shanke_sign">签到</string>
<string name="shan_please_sign">请扫描二维码进行签到</string>
<string name="tv_mj_apply_manage">免检申请管理</string>
</resources>
Loading…
Cancel
Save