정보뷰

This commit is contained in:
DESKTOP-1A3P75F\lee
2022-09-16 15:22:37 +09:00
parent 0ea76c6ce9
commit bbb509ab64
297 changed files with 1175 additions and 499 deletions

View File

@@ -5,9 +5,9 @@
cmake_minimum_required(VERSION 3.4.1)
set(pathPROJECT D:/QTagger/a/QTagger_Android8)
set(pathOPENCV D:/QTagger/a/QTagger_Android8/OpenCV)
set(pathLIBOPENCV_JAVA D:/QTagger/a/QTagger_Android8/OpenCV/native/libs/${ANDROID_ABI}/libopencv_java4.so)
set(pathPROJECT D:/QTagger/a/QTagger_Android9)
set(pathOPENCV D:/QTagger/a/QTagger_Android9/OpenCV)
set(pathLIBOPENCV_JAVA D:/QTagger/a/QTagger_Android9/OpenCV/native/libs/${ANDROID_ABI}/libopencv_java4.so)
set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")

View File

@@ -141,6 +141,5 @@ public class AccountList extends AppCompatActivity {
private int inttodp(int dp)
{
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,dp,getResources().getDisplayMetrics());
}
}

View File

@@ -5,6 +5,7 @@ import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@@ -17,6 +18,8 @@ import android.graphics.drawable.BitmapDrawable;
import android.hardware.Camera;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
@@ -25,9 +28,11 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.googlecode.tesseract.android.TessBaseAPI;
import com.qtagger.CustomPalette.CameraSurfaceView;
import com.qtagger.Data.TestEnum;
import com.qtagger.Database.ImageFile;
import com.qtagger.Database.TestType;
import com.qtagger.R;
import com.qtagger.util.CommonHelper;
import com.qtagger.util.DataManager;
@@ -36,6 +41,8 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -55,17 +62,23 @@ public class CameraActivity extends AppCompatActivity {
DataManager dataManager = DataManager.getInstance();
Bitmap resultBitmap;
String filename, time,pkgData;
boolean octChecker;
TessBaseAPI tessBaseAPI;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camera);
Intent intent = getIntent();
dbTestType = intent.getStringExtra("TestType");
pkgData = intent.getStringExtra("PkgData");
if(dbTestType == null)
{
dbTestType ="";
}
pkgData = "";
if(pkgData == null)
pkgData = "";
octChecker = dbTestType.compareTo(TestType.Weight.name()) == 0;
tessBaseAPI = new TessBaseAPI();
imageView = findViewById(R.id.imageView);
surfaceView = findViewById(R.id.surfaceView);
@@ -104,6 +117,12 @@ public class CameraActivity extends AppCompatActivity {
else if(dbTestType.contains("M1")){
FileName += "1m방사선량" + dbTestType.replace("M1","");
}
else if(dbTestType.compareTo(TestType.Weight.name()) == 0){
FileName += "무게 측정";
}
else if(dbTestType.compareTo(TestType.Filling.name()) == 0){
FileName += "채움률";
}
else
{
FileName += "일반사진";
@@ -152,6 +171,10 @@ public class CameraActivity extends AppCompatActivity {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onPictureTaken(byte[] data, Camera camera) {
String pkgNo = "K042022B000009";
if(dataManager.selPkg != null)
pkgNo = dataManager.selPkg.getPKG_NO();
//bytearray 형식으로 전달
//이걸이용해서 이미지뷰로 보여주거나 파일로 저장
BitmapFactory.Options options = new BitmapFactory.Options();
@@ -177,6 +200,23 @@ public class CameraActivity extends AppCompatActivity {
Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0,0,width,height,matrix,true);
if(octChecker){
String dir = getFilesDir() + "/tesseract";
if(checkLanguageFile(dir+"/tessdata","d05"))
{
tessBaseAPI.init(dir, "d05");
tessBaseAPI.setPageSegMode(TessBaseAPI.PageSegMode.PSM_SINGLE_LINE);
tessBaseAPI.setVariable(TessBaseAPI.VAR_CHAR_BLACKLIST, ",!?@#$%&amp;*()<>_-+=/:;'\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
tessBaseAPI.setVariable(TessBaseAPI.VAR_CHAR_WHITELIST, "1234567890.");
tessBaseAPI.setVariable("classify_bln_numeric_mode", "1");
tessBaseAPI.setImage(resizedBitmap);
String resultText = tessBaseAPI.getUTF8Text();
Log.i("Tess",resultText);
}
}
Canvas cs = new Canvas(resizedBitmap);
Paint tPaint = new Paint();
@@ -186,7 +226,7 @@ public class CameraActivity extends AppCompatActivity {
tPaint.setStyle(Paint.Style.FILL);
cs.drawText(dbTestType,10f,20f,tPaint);
cs.drawText(time,10f,20+20f,tPaint);
cs.drawText("K042022B000009",10f,40+20f,tPaint);
cs.drawText(pkgNo,10f,40+20f,tPaint);
//CommonHelper.DefaultImageFolderPath
@@ -227,5 +267,47 @@ public class CameraActivity extends AppCompatActivity {
}
boolean checkLanguageFile(String dir, String ocrname)
{
File file = new File(dir);
if(!file.exists() && file.mkdirs())
createFiles(dir, ocrname);
else if(file.exists()){
String filePath = dir + "/" + ocrname + ".traineddata";
File langDataFile = new File(filePath);
if(!langDataFile.exists())
createFiles(dir, ocrname);
}
return true;
}
private void createFiles(String dir, String ocrname)
{
AssetManager assetMgr = this.getAssets();
InputStream inputStream = null;
OutputStream outputStream = null;
try {
inputStream = assetMgr.open(ocrname+".traineddata");
String destFile = dir + "/" + ocrname + ".traineddata";
Log.i("ocr", destFile+"");
outputStream = new FileOutputStream(destFile);
byte[] buffer = new byte[1024];
int read;
while ((read = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, read);
}
inputStream.close();
outputStream.flush();
outputStream.close();
}catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -6,11 +6,14 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.RequiresApi;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
@@ -170,6 +173,7 @@ public class CaptureFragment extends Fragment {
@Override
public void onStart() {
super.onStart();
resetButton();
List<ImageFile> files = dataManager.dbHelper.selectFiles(dataManager.selPkg.getPKG_NO(),dataManager.testEnum.label());
for(ImageFile file : files)
@@ -188,6 +192,39 @@ public class CaptureFragment extends Fragment {
}
}
@RequiresApi(api = Build.VERSION_CODES.M)
public void resetButton(){
int defaultColor = Color.parseColor("#C8C8C8");
Drawable defaultDrawable = ContextCompat.getDrawable(context,R.drawable.add_picture_32);
btnTopFront.setBackgroundColor(defaultColor);
btnTopFront.setForeground(defaultDrawable);
btnTopBack.setBackgroundColor(defaultColor);
btnTopBack.setForeground(defaultDrawable);
btnTopLeft.setBackgroundColor(defaultColor);
btnTopLeft.setForeground(defaultDrawable);
btnTopRight.setBackgroundColor(defaultColor);
btnTopRight.setForeground(defaultDrawable);
btnMiddleFront.setBackgroundColor(defaultColor);
btnMiddleFront.setForeground(defaultDrawable);
btnMiddleBack.setBackgroundColor(defaultColor);
btnMiddleBack.setForeground(defaultDrawable);
btnMiddleLeft.setBackgroundColor(defaultColor);
btnMiddleLeft.setForeground(defaultDrawable);
btnMiddleRight.setBackgroundColor(defaultColor);
btnMiddleRight.setForeground(defaultDrawable);
btnBottomFront.setBackgroundColor(defaultColor);
btnBottomFront.setForeground(defaultDrawable);
btnBottomBack.setBackgroundColor(defaultColor);
btnBottomBack.setForeground(defaultDrawable);
btnBottomLeft.setBackgroundColor(defaultColor);
btnBottomLeft.setForeground(defaultDrawable);
btnBottomRight.setBackgroundColor(defaultColor);
btnBottomRight.setForeground(defaultDrawable);
}
public Button getTestTypeButton(TestType type){
switch (type)
{

View File

@@ -1,10 +1,17 @@
package com.qtagger.Activity.Test;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.RequiresApi;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
@@ -19,9 +26,16 @@ import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import com.qtagger.Activity.CameraActivity;
import com.qtagger.Data.CaptureFragmentEnum;
import com.qtagger.Database.ImageFile;
import com.qtagger.Database.TestType;
import com.qtagger.R;
import com.qtagger.util.DataManager;
import com.ramotion.foldingcell.FoldingCell;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
* Use the {@link FillFragment#newInstance} factory method to
@@ -34,10 +48,13 @@ public class FillFragment extends Fragment {
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
private int FillValue = -1;
Button foldingButton;
Button foldingButton, btnFilling;
RadioGroup radioGroup;
EditText editText;
RadioButton radioInput;
ImageFile fillingFile = null;
DataManager dataManager = DataManager.getInstance();
private Context context;
// TODO: Rename and change types of parameters
@@ -79,13 +96,15 @@ public class FillFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_fill, container, false);
context = container.getContext();
editText = view.findViewById(R.id.editInput);
foldingButton = view.findViewById(R.id.folding_button);
radioGroup = view.findViewById(R.id.radio_fill_value);
radioInput = view.findViewById(R.id.fillInput);
btnFilling = view.findViewById(R.id.fill_Picture);
view.findViewById(R.id.fill_Picture).setOnClickListener(new View.OnClickListener() {
btnFilling.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(FillValue == -1)
@@ -99,13 +118,16 @@ public class FillFragment extends Fragment {
}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
//카메라 실행후 저장되면 이미지 출력
else
{
Intent cameraIntent = new Intent(getActivity().getApplicationContext(), CameraActivity.class);
cameraIntent.putExtra("TestType",TestType.Filling.name());
cameraIntent.putExtra("PkgData",Integer.toString(FillValue));
startActivity(cameraIntent);
}
}
});
view.findViewById(R.id.fill_OK).setOnClickListener(new View.OnClickListener() {
@@ -202,8 +224,12 @@ public class FillFragment extends Fragment {
return view;
}
public void toggleLayout(){
if(radioGroup.getVisibility() == View.GONE) {
private void toggleLayout(){
changeLayout(radioGroup.getVisibility() == View.GONE);
}
private void changeLayout(boolean change){
if(change) {
foldingButton.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(getActivity(), R.drawable.arrows_left_48), null);
radioGroup.setVisibility(View.VISIBLE);
if(radioGroup.getCheckedRadioButtonId() == R.id.fillInput)
@@ -211,11 +237,79 @@ public class FillFragment extends Fragment {
editText.setVisibility(View.VISIBLE);
}
}
else if(radioGroup.getVisibility() == View.VISIBLE) {
else {
foldingButton.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(getActivity(), R.drawable.arrows_down_48), null);
radioGroup.setVisibility(View.GONE);
editText.setVisibility(View.GONE);
}
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onStart() {
super.onStart();
int defaultColor = Color.parseColor("#C8C8C8");
Drawable defaultDrawable = ContextCompat.getDrawable(context,R.drawable.add_picture_32);
btnFilling.setBackgroundColor(defaultColor);
btnFilling.setForeground(defaultDrawable);
List<ImageFile> files = dataManager.dbHelper.selectFiles(dataManager.selPkg.getPKG_NO(),dataManager.testEnum.label());
ImageFile fillFile = null;
changeLayout(true);
for(ImageFile file : files)
{
if(file.getType().contains(TestType.Filling.name()))
{
fillFile = file;
}
}
if(fillFile != null)
{
btnFilling.setBackground(new BitmapDrawable(BitmapFactory.decodeFile(fillFile.getFilePath())));
btnFilling.setForeground(null);
FillValue = Integer.parseInt(fillFile.getPkgData());
foldingButton.setText("채움률 : " + String.valueOf(FillValue) + "%");
radioGroup.clearCheck();
setFillingRate();
changeLayout(false);
fillingFile = fillFile;
}
}
public void setFillingRate(){
if(!(FillValue<0 || FillValue>100))
{
if(FillValue == 100)
{
radioGroup.check(radioGroup.getChildAt(0).getId());
}
else if(FillValue == 75)
{
radioGroup.check(radioGroup.getChildAt(1).getId());
}
else if(FillValue == 50)
{
radioGroup.check(radioGroup.getChildAt(2).getId());
}
else if(FillValue == 25)
{
radioGroup.check(radioGroup.getChildAt(3).getId());
}
else if(FillValue == 0)
{
radioGroup.check(radioGroup.getChildAt(4).getId());
}
else
{
editText.setText(String.valueOf(FillValue));
radioGroup.check(radioGroup.getChildAt(5).getId());
}
}
}
}

View File

@@ -1,28 +1,41 @@
package com.qtagger.Activity.Test;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.RequiresApi;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.viewpager2.widget.ViewPager2;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.qtagger.Data.TestEnum;
import com.qtagger.Database.ACCEPT_TEST;
import com.qtagger.Database.DISPOSAL_TEST;
import com.qtagger.Database.ImageFile;
import com.qtagger.Database.ORIGIN_CHRCT;
import com.qtagger.Database.PREPAR_TEST;
import com.qtagger.R;
import com.qtagger.util.DataManager;
import com.qtagger.util.ImageSliderAdapter;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* A simple {@link Fragment} subclass.
@@ -34,9 +47,13 @@ public class InfoFragment extends Fragment {
DataManager dataManager = DataManager.getInstance();
private ViewPager2 sliderViewPager;
private ImageSliderAdapter imageSliderAdapter;
private LinearLayout layoutIndicator;
private LinearLayout layoutIndicator,defaultInfo,addInfo,nuclideInfo;
private TextView textPictureInfo;
ImageView[] indicators = null;
List<ImageFile> filePaths = null;
Map<String,TextView> connectViewMap = new HashMap<>();
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
@@ -88,24 +105,212 @@ public class InfoFragment extends Fragment {
sliderViewPager = view.findViewById(R.id.sliderViewPager);
layoutIndicator = view.findViewById(R.id.layoutIndicators);
textPictureInfo= view.findViewById(R.id.text_picture_info);
defaultInfo = view.findViewById(R.id.layout_defaultInfo);
nuclideInfo = view.findViewById(R.id.layout_nuclideInfo);
addInfo = view.findViewById(R.id.layout_addInfo);
createInfoView();
return view;
}
private void createInfoView(){
if(dataManager.testEnum == TestEnum.발생지특성검사){
createInfoTitle(defaultInfo,"기본 정보");
connectViewMap.put("포장물번호",createInfoTextView(defaultInfo,"포장물번호"));
connectViewMap.put("포장일자",createInfoTextView(defaultInfo,"포장일자"));
connectViewMap.put("발생기관",createInfoTextView(defaultInfo,"발생기관"));
connectViewMap.put("발생지점",createInfoTextView(defaultInfo,"발생지점"));
connectViewMap.put("발생시점",createInfoTextView(defaultInfo,"발생시점"));
connectViewMap.put("폐기물내용물",createInfoTextView(defaultInfo,"폐기물내용물"));
connectViewMap.put("포장물 크기",createInfoTextView(defaultInfo,"포장물 크기"));
connectViewMap.put("용기 종류",createInfoTextView(defaultInfo,"용기 종류"));
connectViewMap.put("폐기물종류",createInfoTextView(defaultInfo,"폐기물종류"));
connectViewMap.put("처리 방법",createInfoTextView(defaultInfo,"처리 방법"));
connectViewMap.put("총 중량(kg)",createInfoTextView(defaultInfo,"총 중량(kg)"));
connectViewMap.put("내용물 중량(kg)",createInfoTextView(defaultInfo,"내용물 중량(kg)"));
createInfoTitle(defaultInfo,"포장물 검사 확인");
connectViewMap.put("판정",createInfoTextView(defaultInfo,"판정"));
connectViewMap.put("특기사항",createInfoTextView(defaultInfo,"특기사항"));
connectViewMap.put("자체검사일자",createInfoTextView(defaultInfo,"자체검사일자"));
connectViewMap.put("검사자",createInfoTextView(defaultInfo,"검사자"));
connectViewMap.put("확인자",createInfoTextView(defaultInfo,"확인자"));
connectViewMap.put("취금",createInfoTextView(defaultInfo,"유의사항"));
connectViewMap.put("인도희망일자",createInfoTextView(defaultInfo,"인도희망일자"));
//createInfoTitle(defaultInfo,"핵종 정보");
//addInfo
connectViewMap.put("임계안전",createInfoTextView(addInfo,"임계안전"));
connectViewMap.put("표면오염도",createInfoTextView(addInfo,"표면오염도(㏃/c㎡)"));
connectViewMap.put("표면오염도 측정일자",createInfoTextView(addInfo,"표면오염도 측정일자"));
connectViewMap.put("표면오염도 측정자",createInfoTextView(addInfo,"표면오염도 측정자"));
connectViewMap.put("표면방사선량률",createInfoTextView(addInfo,"표면방사선량률"));
connectViewMap.put("표면선량률 측정일자",createInfoTextView(addInfo,"표면선량률 측정일자"));
connectViewMap.put("표면선량률 측정자",createInfoTextView(addInfo,"표면선량률 측정자"));
connectViewMap.put("총방사능량",createInfoTextView(addInfo,"총방사능량(㏃)"));
connectViewMap.put("핵종측정일",createInfoTextView(addInfo,"핵종측정일"));
connectViewMap.put("핵종측정자",createInfoTextView(addInfo,"핵종측정자"));
connectViewMap.put("핵종평가일",createInfoTextView(addInfo,"핵종평가일"));
connectViewMap.put("핵종평가자",createInfoTextView(addInfo,"핵종평가자"));
}
else if(dataManager.testEnum == TestEnum.인수검사){
}
else if(dataManager.testEnum == TestEnum.처분검사){
}
else if(dataManager.testEnum == TestEnum.예비검사){
}
}
private void updateView(){
if(dataManager.testEnum == TestEnum.발생지특성검사) {
ORIGIN_CHRCT selPkg = (ORIGIN_CHRCT) dataManager.selPkg;
//기본정보
connectViewMap.get("포장물번호").setText(selPkg.getPKG_NO());
connectViewMap.get("포장일자").setText(selPkg.getORIGIN_CHRCT_PKG_PKG_DATE());
connectViewMap.get("발생기관").setText(selPkg.getORIGIN_CHRCT_PGK_AGENCY());
connectViewMap.get("발생지점").setText(selPkg.getORIGIN_CHRCT_OCRD());
connectViewMap.get("발생시점").setText(selPkg.getORIGIN_CHRCT_OCRNC_TIME());
connectViewMap.get("폐기물내용물").setText(selPkg.getORIGIN_WASTE());
connectViewMap.get("포장물 크기").setText(selPkg.getORIGIN_PACK_FORM());
connectViewMap.get("용기 종류").setText(selPkg.getORIGIN_CONTAINER_TYPE());
connectViewMap.get("폐기물종류").setText(selPkg.getORIGIN_WASTE_TYPE());
connectViewMap.get("처리 방법").setText(selPkg.getORIGIN_PKG_PRCSN_MTHD());
connectViewMap.get("총 중량(kg)").setText(selPkg.getORIGIN_TOTAL_WEIGHT());
connectViewMap.get("내용물 중량(kg)").setText(selPkg.getORIGIN_PKG_IN_WT());
//포장물검사확인
connectViewMap.get("판정").setText(selPkg.getORIGIN_PKG_JUDGMENT());
connectViewMap.get("특기사항").setText(selPkg.getORIGIN_PKG_SPCL_NOTE());
connectViewMap.get("자체검사일자").setText(selPkg.getORIGIN_PKG_SLFINDATE());
connectViewMap.get("검사자").setText(selPkg.getORIGIN_PKG_INSPECTOR());
connectViewMap.get("확인자").setText(selPkg.getORIGIN_CHRCT_PKG_CHECKER());
connectViewMap.get("취금").setText(selPkg.getORIGIN_CHRCT_PKG_NOTE());
connectViewMap.get("인도희망일자").setText(selPkg.getORIGIN_PKG_DELIVERYDATE());
//방사선적 특성
connectViewMap.get("임계안전").setText(selPkg.getORIGIN_PKG_CRTCL_SFTY());
connectViewMap.get("표면오염도").setText(selPkg.getORIGIN_PKG_SRFC_PLTN());
connectViewMap.get("표면오염도 측정일자").setText(selPkg.getORIGIN_PKG_SRFC_PLTN_DATE());
connectViewMap.get("표면오염도 측정자").setText(selPkg.getORIGIN_PKG_SRFC_PLTN_MSRRS());
connectViewMap.get("표면방사선량률").setText(selPkg.getORIGIN_PKG_SURFC_RD());
connectViewMap.get("표면선량률 측정일자").setText(selPkg.getORIGIN_SURFC_RD_MSRMN_DATE());
connectViewMap.get("표면선량률 측정자").setText(selPkg.getORIGIN_PKG_SURFC_RD_MSRRS());
connectViewMap.get("총방사능량").setText(selPkg.getORIGIN_PKG_TOTAL_RDCTV_Bq());
connectViewMap.get("핵종측정일").setText(selPkg.getORIGIN_PKG_NCLD_MSRMN_DATE());
connectViewMap.get("핵종측정자").setText(selPkg.getORIGIN_PKG_NCLD_MSRRS());
connectViewMap.get("핵종평가일").setText(selPkg.getORIGIN_PKG_NCLD_EVLTN_DATE());
connectViewMap.get("핵종평가자").setText(selPkg.getORIGIN_PKG_NCLD_EVLTR());
}
else if(dataManager.testEnum == TestEnum.인수검사){
ACCEPT_TEST selPkg = (ACCEPT_TEST) dataManager.selPkg;
}
else if(dataManager.testEnum == TestEnum.처분검사){
DISPOSAL_TEST selPkg = (DISPOSAL_TEST) dataManager.selPkg;
}
else if(dataManager.testEnum == TestEnum.예비검사){
PREPAR_TEST selPkg = (PREPAR_TEST) dataManager.selPkg;
}
}
public void createInfoTitle(LinearLayout linearLayout,String title)
{
LinearLayout.LayoutParams titleParam = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
titleParam.leftMargin = inttodp(10);
int dp = inttodp(10);
titleParam.setMargins(dp,dp,dp,dp);
TextView editText = new TextView(context);
editText.setText(title);
editText.setGravity(Gravity.LEFT);
editText.setTextColor(Color.BLACK);
editText.setTextSize(TypedValue.COMPLEX_UNIT_SP,24);
editText.setLayoutParams(titleParam);
linearLayout.addView(editText);
}
public TextView createInfoTextView(LinearLayout linearLayout, String title){
LinearLayout t1 = new LinearLayout(context);
t1.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams mParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
t1.setLayoutParams(mParams);
LinearLayout.LayoutParams titleParam = new LinearLayout.LayoutParams(
0,
LinearLayout.LayoutParams.WRAP_CONTENT);
titleParam.weight = 0.8f;
TextView editText = new TextView(context);
editText.setText(" "+title);
editText.setGravity(Gravity.LEFT);
editText.setPadding(10,0,0,0);
editText.setTextSize(TypedValue.COMPLEX_UNIT_SP,16);
editText.setLayoutParams(titleParam);
LinearLayout.LayoutParams infoTextParam = new LinearLayout.LayoutParams(
0,
LinearLayout.LayoutParams.WRAP_CONTENT);
infoTextParam.weight = 1;
TextView infoText = new TextView(context);
infoText.setText(dataManager.selPkg.getPKG_NO());
infoText.setGravity(Gravity.LEFT);
infoText.setTextSize(TypedValue.COMPLEX_UNIT_SP,16);
infoText.setLayoutParams(infoTextParam);
t1.addView(editText);
t1.addView(infoText);
linearLayout.addView(t1);
return infoText;
}
@Override
public void onStart() {
super.onStart();
updateView();
imageSliderAdapter = new ImageSliderAdapter(context, null);
sliderViewPager.setOffscreenPageLimit(1);
sliderViewPager.setAdapter(imageSliderAdapter);
// Inflate the layout for this fragment
return view;
}
@Override
public void onStart() {
super.onStart();
textPictureInfo.setText("");
imageSliderAdapter.clear();
sliderViewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
setCurrentIndicator(position);
if(filePaths != null) {
textPictureInfo.setText(filePaths.get(position).getFileName());
}
else
{
textPictureInfo.setText("");
}
}
});
List<ImageFile> files = dataManager.dbHelper.selectFiles(dataManager.selPkg.getPKG_NO(),dataManager.testEnum.label());
List<ImageFile> filePaths = new ArrayList<>();
filePaths = new ArrayList<>();
for(ImageFile file : files)
{
if(file.getFilePath() != null)
@@ -118,19 +323,7 @@ public class InfoFragment extends Fragment {
}
}
}
sliderViewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
setCurrentIndicator(position);
textPictureInfo.setText(filePaths.get(position).getFileName());
}
});
setupIndicators(imageSliderAdapter.getItemCount());
}
private void setupIndicators(int count) {
@@ -141,6 +334,18 @@ public class InfoFragment extends Fragment {
layoutIndicator.removeView(indicators[i]);
}
}
if(count == 0)
{
sliderViewPager.setVisibility(View.INVISIBLE);
textPictureInfo.setVisibility(View.INVISIBLE);
}
else
{
sliderViewPager.setVisibility(View.VISIBLE);
textPictureInfo.setVisibility(View.VISIBLE);
}
indicators = new ImageView[count];
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
@@ -174,4 +379,14 @@ public class InfoFragment extends Fragment {
}
}
}
private int inttodp(int dp)
{
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,dp,getResources().getDisplayMetrics());
}
private int inttosp(int sp)
{
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,sp,getResources().getDisplayMetrics());
}
}

View File

@@ -1,14 +1,30 @@
package com.qtagger.Activity.Test;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.RequiresApi;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.qtagger.Activity.CameraActivity;
import com.qtagger.Database.ImageFile;
import com.qtagger.Database.TestType;
import com.qtagger.R;
import com.qtagger.util.DataManager;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
@@ -17,6 +33,9 @@ import com.qtagger.R;
*/
public class WeightFragment extends Fragment {
DataManager dataManager = DataManager.getInstance();
Button weightButton;
private Context context;
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
@@ -61,14 +80,46 @@ public class WeightFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_weight2, container, false);
view.findViewById(R.id.weight_Picture).setOnClickListener(new View.OnClickListener() {
context = container.getContext();
weightButton =view.findViewById(R.id.weight_Picture);
weightButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent cameraIntent = new Intent(getActivity().getApplicationContext(), CameraActivity.class);
cameraIntent.putExtra("TestType",TestType.Weight.name());
startActivity(cameraIntent);
}
});
//weight_Picture
// Inflate the layout for this fragment
return view;
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onStart() {
super.onStart();
int defaultColor = Color.parseColor("#C8C8C8");
Drawable defaultDrawable = ContextCompat.getDrawable(context,R.drawable.add_picture_32);
weightButton.setBackgroundColor(defaultColor);
weightButton.setForeground(defaultDrawable);
List<ImageFile> files = dataManager.dbHelper.selectFiles(dataManager.selPkg.getPKG_NO(),dataManager.testEnum.label());
ImageFile fillFile = null;
for(ImageFile file : files)
{
if(file.getType().contains(TestType.Weight.name()))
{
fillFile = file;
}
}
if(fillFile != null)
{
weightButton.setBackground(new BitmapDrawable(BitmapFactory.decodeFile(fillFile.getFilePath())));
weightButton.setForeground(null);
}
}
}

View File

@@ -38,6 +38,13 @@ public class TestActivity extends AppCompatActivity {
infoFragment = new InfoFragment();
textViewRadiation = findViewById(R.id.textViewRadiation);
findViewById(R.id.imageFilterButton_Back).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
textViewRadiation.setOnClickListener(new View.OnClickListener() {

View File

@@ -80,9 +80,12 @@ public class MainActivity extends AppCompatActivity {
//테스트용도 나중에 삭제
findViewById(R.id.imageView).setOnClickListener(v -> {
Intent intent = new Intent(getApplicationContext(), CameraActivity.class);
Intent intent = new Intent(getApplicationContext(), test.class);
startActivity(intent);
//Intent intent = new Intent(getApplicationContext(), CameraActivity.class);
//startActivity(intent);
});
//로그인

View File

@@ -80,9 +80,9 @@ public class test extends AppCompatActivity {
tessBaseAPI = new TessBaseAPI();
String dir = getFilesDir() + "/tesseract";
if(checkLanguageFile(dir+"/tessdata"))
if(checkLanguageFile(dir+"/tessdata","d05"))
{
tessBaseAPI.init(dir, "eng");
tessBaseAPI.init(dir, "d05");
tessBaseAPI.setPageSegMode(TessBaseAPI.PageSegMode.PSM_SINGLE_LINE);
tessBaseAPI.setVariable(TessBaseAPI.VAR_CHAR_BLACKLIST, ",!?@#$%&amp;*()<>_-+=/:;'\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
@@ -90,7 +90,7 @@ public class test extends AppCompatActivity {
tessBaseAPI.setVariable("classify_bln_numeric_mode", "1");
String testImage = "IMG_20220913_060413.jpg";
testImage = "weight_test_image.png";
testImage = "tesseractTest2.png";
//testImage = "tesseractTest2.png";
String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) +"/Camera/"+ testImage;
File file = new File(path);
Bitmap myBitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
@@ -220,21 +220,22 @@ public class test extends AppCompatActivity {
}
}
boolean checkLanguageFile(String dir)
boolean checkLanguageFile(String dir, String ocrname)
{
File file = new File(dir);
if(!file.exists() && file.mkdirs())
createFiles(dir);
createFiles(dir, ocrname);
else if(file.exists()){
String filePath = dir + "/eng.traineddata";
String filePath = dir + "/" + ocrname + ".traineddata";
File langDataFile = new File(filePath);
if(!langDataFile.exists())
createFiles(dir);
createFiles(dir, ocrname);
}
return true;
}
private void createFiles(String dir)
private void createFiles(String dir, String ocrname)
{
AssetManager assetMgr = this.getAssets();
@@ -242,10 +243,10 @@ public class test extends AppCompatActivity {
OutputStream outputStream = null;
try {
inputStream = assetMgr.open("eng.traineddata");
String destFile = dir + "/eng.traineddata";
inputStream = assetMgr.open(ocrname+".traineddata");
String destFile = dir + "/" + ocrname + ".traineddata";
Log.i("ocr", destFile+"");
outputStream = new FileOutputStream(destFile);
byte[] buffer = new byte[1024];

View File

@@ -19,7 +19,7 @@ import java.util.List;
public class ImageSliderAdapter extends RecyclerView.Adapter<ImageSliderAdapter.MyViewHolder> {
private Context context;
private List<String> sliderImage;
private MyViewHolder holder;
public MyViewHolder holder;
public ImageSliderAdapter(Context context, List<String> sliderImage) {
this.context = context;
@@ -34,8 +34,10 @@ public class ImageSliderAdapter extends RecyclerView.Adapter<ImageSliderAdapter.
public void clear(){
sliderImage.clear();
if(holder != null)
holder.clear();
if(holder != null) {
}
}
public void addItem(String item){
@@ -79,7 +81,8 @@ public class ImageSliderAdapter extends RecyclerView.Adapter<ImageSliderAdapter.
}
public void clear(){
mImageView.setImageBitmap(null);
//mImageView.setImageBitmap(null);
}
}
}

View File

@@ -3,5 +3,4 @@
android:shape="rectangle">
</shape>

View File

@@ -55,6 +55,7 @@
android:layout_marginBottom="2dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:background="#C8C8C8"
android:foreground="@drawable/add_picture_32"
android:foregroundGravity="center_vertical|center_horizontal" />

View File

@@ -20,235 +20,33 @@
android:orientation="vertical">
<LinearLayout
android:id="@+id/layout_defaultInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/default_fragment_background"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="일반 요건"
android:textColor="@color/black"
android:textSize="24sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="포장물 번호"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="AR0000B000000"
android:textSize="16sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="포장 일자"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="2014-01-01"
android:textSize="16sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="발생기관"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="한국원자력연구원"
android:textSize="16sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="폐기물내용물"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="비닐류"
android:textSize="16sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="총중량(kg)"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="100"
android:textSize="16sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="내용물 중량(kg)"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="80.4"
android:textSize="16sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="포장물 크기"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="일반잡고체(200L)"
android:textSize="16sp">
</TextView>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_nuclideInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/default_fragment_background"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:id="@+id/layout_addInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/default_fragment_background"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
@@ -263,196 +61,6 @@
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="표면방사선량률"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="AR0000B000000"
android:textSize="16sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="중방사능량"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="2014-01-01"
android:textSize="16sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="G-Alpha"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="한국원자력연구원"
android:textSize="16sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="폐기물내용물"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="비닐류"
android:textSize="16sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="총중량(kg)"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="100"
android:textSize="16sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="내용물 중량(kg)"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="80.4"
android:textSize="16sp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:gravity="left"
android:paddingLeft="10dp"
android:text="포장물 크기"
android:textSize="16sp">
</TextView>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text="일반잡고체(200L)"
android:textSize="16sp">
</TextView>
</LinearLayout>
</LinearLayout>
@@ -514,10 +122,12 @@
<TextView
android:id="@+id/text_picture_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:textAlignment="center"
android:text="사진"
android:layout_weight="1"
android:text=" "
android:textColor="@color/black"
android:textSize="18sp">