DB Helper 사용으로 변경, 폴더 위치 변경
This commit is contained in:
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="C:\Users\lee\.android\avd\Nexus_5_Edited_API_29.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2022-09-05T11:22:38.238761700Z" />
|
||||
</component>
|
||||
</project>
|
||||
9
.idea/misc.xml
generated
9
.idea/misc.xml
generated
@@ -101,6 +101,15 @@
|
||||
<entry key="..\:/QTagger/a/QTagger_Android5/app/src/main/res/layout/fragment_weight2.xml" value="0.3848958333333333" />
|
||||
<entry key="..\:/QTagger/a/QTagger_Android5/app/src/main/res/layout/item_slider.xml" value="0.44166666666666665" />
|
||||
<entry key="..\:/QTagger/a/QTagger_Android5/app/src/main/res/xml/file_paths.xml" value="0.3963541666666667" />
|
||||
<entry key="..\:/QTagger/a/QTagger_Android6/app/src/main/res/layout/activity_search.xml" value="0.3088768115942029" />
|
||||
<entry key="..\:/QTagger/a/QTagger_Android6/app/src/main/res/layout/fragment_capture.xml" value="0.4427083333333333" />
|
||||
<entry key="..\:/QTagger/a/QTagger_Android6/app/src/main/res/layout/fragment_photograph.xml" value="0.4427083333333333" />
|
||||
<entry key="..\:/QTagger/a/QTagger_Android6/app/src/main/res/layout/fragment_weight2.xml" value="0.4427083333333333" />
|
||||
<entry key="..\:/QTagger/a/QTagger_Android7/app/src/main/res/layout/activity_account_add.xml" value="0.39739583333333334" />
|
||||
<entry key="..\:/QTagger/a/QTagger_Android7/app/src/main/res/layout/activity_account_modify.xml" value="0.39739583333333334" />
|
||||
<entry key="..\:/QTagger/a/QTagger_Android7/app/src/main/res/layout/activity_main.xml" value="0.39739583333333334" />
|
||||
<entry key="..\:/QTagger/a/QTagger_Android7/app/src/main/res/layout/activity_search.xml" value="0.8869323447636701" />
|
||||
<entry key="..\:/QTagger/a/QTagger_Android7/app/src/main/res/layout/activity_test_select.xml" value="0.4427083333333333" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application
|
||||
|
||||
android:allowBackup="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
@@ -31,6 +32,7 @@
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:largeHeap="true"
|
||||
android:theme="@style/Theme.QTagger"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:targetApi="31">
|
||||
|
||||
3
app/src/main/java/Info.txt
Normal file
3
app/src/main/java/Info.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
기본 설명
|
||||
- DB 저장 공간 :
|
||||
-
|
||||
@@ -9,13 +9,14 @@ import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.qtagger.Database.Account;
|
||||
import com.qtagger.Database.AppDatabase;
|
||||
import com.qtagger.Database.AccountData;
|
||||
import com.qtagger.R;
|
||||
import com.qtagger.util.DataManager;
|
||||
|
||||
public class AccountAdd extends AppCompatActivity {
|
||||
private EditText editAccountId, editAccountName, editAccountDapt;
|
||||
private ImageFilterButton backBtn;
|
||||
DataManager dataManager = DataManager.getInstance();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -27,7 +28,6 @@ public class AccountAdd extends AppCompatActivity {
|
||||
editAccountDapt = (EditText) findViewById(R.id.textView_AccountDapt);
|
||||
backBtn = (ImageFilterButton) findViewById(R.id.imageFilterButton_Back);
|
||||
|
||||
AppDatabase db = Room.databaseBuilder(this,AppDatabase.class,"AccountDB").allowMainThreadQueries().build();
|
||||
|
||||
|
||||
findViewById(R.id.button_save).setOnClickListener(new View.OnClickListener() {
|
||||
@@ -45,8 +45,7 @@ public class AccountAdd extends AppCompatActivity {
|
||||
|
||||
|
||||
//DB에 저장
|
||||
db.accountDao().insert(new Account(acId,acName,acDapt));
|
||||
|
||||
dataManager.dbHelper.insertAccount(new AccountData(acId,acName,acDapt));
|
||||
Toast.makeText(AccountAdd.this, "계정 생성 성공", Toast.LENGTH_SHORT).show();
|
||||
|
||||
finish();
|
||||
|
||||
@@ -11,23 +11,22 @@ import android.os.Bundle;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TableRow;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.qtagger.Database.Account;
|
||||
import com.qtagger.Database.AppDatabase;
|
||||
import com.qtagger.Database.AccountData;
|
||||
import com.qtagger.R;
|
||||
import com.qtagger.util.DataManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AccountList extends AppCompatActivity {
|
||||
ScrollView scrollView;
|
||||
LinearLayout linearLayout;
|
||||
AppDatabase db;
|
||||
DataManager dataManager = DataManager.getInstance();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -37,7 +36,6 @@ public class AccountList extends AppCompatActivity {
|
||||
scrollView = (ScrollView)findViewById(R.id.scrollview_AccountList);
|
||||
linearLayout = (LinearLayout)findViewById(R.id.linearList);
|
||||
|
||||
db = Room.databaseBuilder(this,AppDatabase.class,"AccountDB").allowMainThreadQueries().build();
|
||||
|
||||
findViewById(R.id.imageFilterButton_Back).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -54,15 +52,15 @@ public class AccountList extends AppCompatActivity {
|
||||
linearLayout.removeAllViewsInLayout();
|
||||
|
||||
//초기 데이터 세팅
|
||||
List<Account> accountList = db.accountDao().getAll();
|
||||
for (Account ac: accountList) {
|
||||
List<AccountData> accountList = dataManager.dbHelper.getAllAccount();
|
||||
for (AccountData ac: accountList) {
|
||||
//계정 개수만큼 추가
|
||||
addAccountView(ac);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addAccountView(Account account)
|
||||
private void addAccountView(AccountData account)
|
||||
{
|
||||
TableLayout tableLayout = new TableLayout(this);
|
||||
TableLayout.LayoutParams params = new TableLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,inttodp(150));
|
||||
@@ -108,8 +106,7 @@ public class AccountList extends AppCompatActivity {
|
||||
btnRemove.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
db.accountDao().delete(account);
|
||||
dataManager.dbHelper.deleteAccount(account);
|
||||
linearLayout.removeView(tableLayout);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,17 +5,16 @@ import androidx.room.Room;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.qtagger.Database.Account;
|
||||
import com.qtagger.Database.AppDatabase;
|
||||
import com.qtagger.Database.AccountData;
|
||||
import com.qtagger.R;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
import com.qtagger.util.DataManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,8 +22,8 @@ public class AccountModify extends AppCompatActivity {
|
||||
TextView textAccountId;
|
||||
EditText editAccountName, editAccountDapt;
|
||||
Button btnModify;
|
||||
Account findAccount = null;
|
||||
AppDatabase db;
|
||||
AccountData findAccount = null;
|
||||
private DataManager dataManager = DataManager.getInstance();
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -45,9 +44,8 @@ Button btnModify;
|
||||
|
||||
if(id != -1)
|
||||
{
|
||||
db = Room.databaseBuilder(this, AppDatabase.class, "AccountDB").allowMainThreadQueries().build();
|
||||
List<Account> accountList = db.accountDao().getAll();
|
||||
for (Account ac: accountList) {
|
||||
List<AccountData> accountList = dataManager.dbHelper.getAllAccount();
|
||||
for (AccountData ac: accountList) {
|
||||
if(ac.getId() == id)
|
||||
{
|
||||
findAccount = ac;
|
||||
@@ -83,7 +81,7 @@ Button btnModify;
|
||||
findAccount.setAccountDapt(acDapt);
|
||||
|
||||
//DB에 저장
|
||||
db.accountDao().update(findAccount);
|
||||
dataManager.dbHelper.updateAccount(findAccount);
|
||||
|
||||
Toast.makeText(AccountModify.this, "계정 수정 성공", Toast.LENGTH_SHORT).show();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.qtagger.Activity.Search.BarcodeFragment;
|
||||
@@ -58,6 +59,14 @@ public class SearchActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.imageFilterButton_Back).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void callTestActivity(){
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.qtagger.Database;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface AccountDao {
|
||||
@Query("SELECT * FROM Account")
|
||||
List<Account> getAll();
|
||||
|
||||
@Insert
|
||||
void insert(Account account);
|
||||
|
||||
@Update
|
||||
void update(Account account);
|
||||
|
||||
@Delete
|
||||
void delete(Account account);
|
||||
|
||||
}
|
||||
@@ -1,15 +1,19 @@
|
||||
package com.qtagger.Database;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
@Entity
|
||||
public class Account {
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
|
||||
public class AccountData {
|
||||
private int id;
|
||||
private String accountId;
|
||||
private String accountName;
|
||||
private String accountDapt;
|
||||
|
||||
public Account(String accountId, String accountName, String accountDapt) {
|
||||
public AccountData(String accountId, String accountName, String accountDapt) {
|
||||
this.accountId = accountId;
|
||||
this.accountName = accountName;
|
||||
this.accountDapt = accountDapt;
|
||||
}
|
||||
|
||||
public AccountData(int id,String accountId, String accountName, String accountDapt) {
|
||||
this.id = id;
|
||||
this.accountId = accountId;
|
||||
this.accountName = accountName;
|
||||
this.accountDapt = accountDapt;
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.qtagger.Database;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
@Database(entities = {Account.class}, version = 1)
|
||||
public abstract class AppDatabase extends RoomDatabase{
|
||||
public abstract AccountDao accountDao();
|
||||
|
||||
}
|
||||
@@ -1,23 +1,62 @@
|
||||
package com.qtagger.Database;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
import com.qtagger.util.CommonHelper;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DBHelper extends SQLiteOpenHelper {
|
||||
public SQLiteDatabase db;
|
||||
public DBHelper(Context context) {
|
||||
super(context, "groupDB", null, 1);
|
||||
super(context, CommonHelper.DefaultDBFolderPath+ CommonHelper.DBName, null, 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
db.execSQL("CREATE TABLE groupTBL ( gName CHAR(20) PRIMARY KEY,gNumber INTEGER);");
|
||||
db.execSQL("CREATE TABLE Account ( id integer PRIMARY KEY AUTOINCREMENT, accountId TEXT, accountName TEXT, accountDapt TEXT);");
|
||||
db.execSQL("CREATE TABLE File ( path text, FileName text);");
|
||||
db.execSQL("CREATE TABLE PKG ( PKG_Type text, PKG_NO text);");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
db.execSQL("DROP TABLE IF EXISTS groupTBL");
|
||||
onCreate(db);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public List<AccountData> getAllAccount(){
|
||||
List<AccountData> resultData = new ArrayList<AccountData>();
|
||||
db = getWritableDatabase();
|
||||
Cursor cs = db.rawQuery("Select * From Account ",null);
|
||||
while (cs.moveToNext()){
|
||||
resultData.add(new AccountData(cs.getInt(0),cs.getString(1),cs.getString(2),cs.getString(3) ));
|
||||
}
|
||||
db.close();
|
||||
return resultData;
|
||||
}
|
||||
|
||||
public void insertAccount(AccountData ac){
|
||||
db = getWritableDatabase();
|
||||
db.execSQL("INSERT INTO Account (accountId,accountName,accountDapt) VALUES('"+ac.getAccountId()+"','"+ac.getAccountName()+"','"+ac.getAccountDapt()+"')");
|
||||
db.close();
|
||||
}
|
||||
|
||||
public void updateAccount(AccountData ac){
|
||||
db.execSQL("Update Account set accountId ='"+ac.getAccountId()+"'"
|
||||
+", accountName = '"+ac.getAccountName()+"'"
|
||||
+", accountDapt = '"+ac.getAccountDapt()+"'"
|
||||
+" where id = '"+ac.getId()+"';");
|
||||
}
|
||||
|
||||
public void deleteAccount(AccountData ac){
|
||||
db.execSQL("Delete from Account where id = '"+ac.getId()+"'");
|
||||
}
|
||||
}
|
||||
33
app/src/main/java/com/qtagger/Database/DBInfo.txt
Normal file
33
app/src/main/java/com/qtagger/Database/DBInfo.txt
Normal file
@@ -0,0 +1,33 @@
|
||||
DB 정보
|
||||
|
||||
- Account
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
int id;
|
||||
String accountId;
|
||||
String accountName;
|
||||
String accountDapt;
|
||||
|
||||
- File
|
||||
String path //임시 번호 저장 경로
|
||||
String FileName // 실제 파일 이름
|
||||
|
||||
- PKG//방폐물
|
||||
String PKG_Type //발생지특성, 예비, 인수, 처분
|
||||
String PKG_NO
|
||||
|
||||
|
||||
- 발생지특성
|
||||
기본정보
|
||||
방사선적특성
|
||||
검사확인
|
||||
- 예비
|
||||
기본정보(전수검사,판정내역)
|
||||
표본검사 (핵종정보)
|
||||
|
||||
- 인수
|
||||
기본정보(전수검사, 판정내역)
|
||||
표본검사(핵종정보)
|
||||
|
||||
- 처분
|
||||
기본정보(핵종분석, 처분검사 판정내역)
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.qtagger;
|
||||
|
||||
import static android.os.Environment.DIRECTORY_DCIM;
|
||||
import static android.os.Environment.DIRECTORY_DOWNLOADS;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
@@ -19,14 +16,13 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.room.Room;
|
||||
|
||||
import com.qtagger.Activity.AccountAdd;
|
||||
import com.qtagger.Activity.AccountList;
|
||||
import com.qtagger.Activity.NavigationActivity;
|
||||
import com.qtagger.Activity.TestSelectActivity;
|
||||
import com.qtagger.Database.Account;
|
||||
import com.qtagger.Database.AppDatabase;
|
||||
import com.qtagger.Database.AccountData;
|
||||
import com.qtagger.Database.DBHelper;
|
||||
import com.qtagger.util.CommonHelper;
|
||||
import com.qtagger.util.DataManager;
|
||||
|
||||
@@ -38,8 +34,8 @@ import java.util.List;
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
private Spinner mSpinner;
|
||||
private Button btnLogin;
|
||||
private DataManager dataManager;
|
||||
private List<Account> accountList;
|
||||
private DataManager dataManager= DataManager.getInstance();
|
||||
private List<AccountData> accountList;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public static void copy(File origin, File dest) throws IOException {
|
||||
@@ -51,11 +47,23 @@ public class MainActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
mSpinner = findViewById(R.id.spinner_account);
|
||||
dataManager = DataManager.getInstance();
|
||||
CommonHelper.CheckCameraPermission(this);
|
||||
CommonHelper.FolderClear();
|
||||
dataManager.dbHelper = new DBHelper(getApplicationContext());
|
||||
|
||||
dataManager.dbHelper.getAllAccount();
|
||||
|
||||
|
||||
/*
|
||||
SQLiteDatabase sqLiteOpenHelper = dbHelper.getWritableDatabase();
|
||||
|
||||
sqLiteOpenHelper.execSQL("INSERT INTO Account (accountId,accountName,accountDapt) VALUES('"+"gg"+"','"+"gg"+"','"+"gg"+"')");
|
||||
sqLiteOpenHelper.close();*/
|
||||
//db.execSQL("INSERT INTO Account (accountId,accountName,accountDapt) VALUES('"+ac.getAccountId()+"','"+ac.getAccountName()+"','"+ac.getAccountDapt()+"')");
|
||||
|
||||
|
||||
/*
|
||||
File path22 = getDatabasePath("groupDB");
|
||||
try {
|
||||
copy(path22,new File(Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS).getPath()+"/groupDB"));
|
||||
@@ -69,34 +77,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
/*
|
||||
File path = Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS);
|
||||
File[] files = path.listFiles();
|
||||
files = getFilesDir().listFiles();
|
||||
File path22 = getDatabasePath("AccountDB");
|
||||
try {
|
||||
copy(path22,new File(path.getPath()+"/Account"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Uri uri = Uri.fromParts("package",this.getPackageName(),null);
|
||||
//String path123 = uri.getPath();
|
||||
|
||||
|
||||
|
||||
files = (new File(uri.getPath())).listFiles();
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//테스트용도 나중에 삭제
|
||||
findViewById(R.id.imageView).setOnClickListener(v -> {
|
||||
Intent intent = new Intent(getApplicationContext(), test.class);
|
||||
startActivity(intent);
|
||||
//Intent intent = new Intent(getApplicationContext(), TestSelectActivity.class);
|
||||
//Intent intent = new Intent(getApplicationContext(), test.class);
|
||||
//startActivity(intent);
|
||||
Intent intent = new Intent(getApplicationContext(), TestSelectActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
//로그인
|
||||
@@ -155,12 +144,12 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
ArrayAdapter<String> aa_items = new ArrayAdapter<String>(this, androidx.appcompat.R.layout.support_simple_spinner_dropdown_item);
|
||||
aa_items.add("사용자를 선택해주세요");
|
||||
AppDatabase db = Room.databaseBuilder(this,AppDatabase.class,"AccountDB").allowMainThreadQueries().build();
|
||||
|
||||
|
||||
//초기 데이터 세팅
|
||||
accountList = db.accountDao().getAll();
|
||||
for (Account ac: accountList) {
|
||||
//accountList = db.accountDao().getAll();
|
||||
accountList = dataManager.dbHelper.getAllAccount();
|
||||
for (AccountData ac: accountList) {
|
||||
aa_items.add(ac.getAccountId());
|
||||
}
|
||||
|
||||
@@ -177,4 +166,9 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
return (networkInfo != null && networkInfo.isConnectedOrConnecting());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,8 @@ import static android.content.ContentValues.TAG;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.room.Room;
|
||||
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
@@ -19,50 +15,26 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.qtagger.Database.Account;
|
||||
import com.qtagger.Database.AppDatabase;
|
||||
import com.qtagger.Database.DBHelper;
|
||||
import com.qtagger.util.DataManager;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.ConnectException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class test extends AppCompatActivity {
|
||||
ListView list1;
|
||||
private DataManager dataManager;
|
||||
DBHelper dbHelper;
|
||||
SQLiteDatabase sqlDB;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_test);
|
||||
dataManager = DataManager.getInstance();
|
||||
list1 = findViewById(R.id.list_test);
|
||||
dbHelper = new DBHelper(this);
|
||||
|
||||
sqlDB = dbHelper.getWritableDatabase();
|
||||
dbHelper.onUpgrade(sqlDB,1,2);
|
||||
sqlDB.close();
|
||||
|
||||
|
||||
sqlDB = dbHelper.getWritableDatabase();
|
||||
//sqlDB.execSQL("INSERT INTO groupTBL VALUES ( aaa,bbb);");
|
||||
String temp1 = "aaa";
|
||||
String temp2 = "1";
|
||||
|
||||
sqlDB.execSQL("INSERT INTO groupTBL VALUES ( '" + temp1 + "' , "+temp2 +");");
|
||||
sqlDB.close();
|
||||
|
||||
|
||||
String testString[] = {"A","B","C"};//,"D","E","A","B","C","D","E"};
|
||||
|
||||
@@ -85,7 +57,6 @@ public class test extends AppCompatActivity {
|
||||
list1.setAdapter(aa_items);
|
||||
|
||||
|
||||
AppDatabase db = Room.databaseBuilder(this,AppDatabase.class,"AccountDB").allowMainThreadQueries().build();
|
||||
|
||||
findViewById(R.id.button3).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -18,8 +18,15 @@ import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class CommonHelper {
|
||||
|
||||
public static String DefaultPath = "/storage/emulated/0/Android/data/QTagger/";
|
||||
public static String DefaultDBFolderPath = DefaultPath+"DB/";
|
||||
public static String DefaultImageFolderPath = DefaultPath+ "Image/";
|
||||
public static String DBName = "QTagger.db";
|
||||
|
||||
public static Bitmap CameraResult(ActivityResult result){
|
||||
if( result.getResultCode() == RESULT_OK && result.getData() != null){
|
||||
|
||||
@@ -54,6 +61,33 @@ public class CommonHelper {
|
||||
activityResultPicture.launch(cameraIntent);
|
||||
}
|
||||
}
|
||||
public static void FolderClear(){
|
||||
File f = new File(DefaultDBFolderPath+ DBName);
|
||||
if(!f.exists())
|
||||
{
|
||||
File dbFolder = new File(DefaultDBFolderPath);
|
||||
if(dbFolder.exists())
|
||||
{
|
||||
dbFolder.delete();
|
||||
}
|
||||
dbFolder.mkdirs();
|
||||
}
|
||||
|
||||
File imageFolder = new File(DefaultImageFolderPath);
|
||||
if(!imageFolder.exists())
|
||||
imageFolder.mkdirs();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static File getSaveFolder(){
|
||||
File dir = new File(DefaultPath);
|
||||
if(!dir.exists()){
|
||||
dir.mkdirs();
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +1,26 @@
|
||||
package com.qtagger.util;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
import static com.qtagger.util.CommonHelper.CheckCameraPermission;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.provider.MediaStore;
|
||||
|
||||
import androidx.activity.result.ActivityResult;
|
||||
import androidx.activity.result.ActivityResultCallback;
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.qtagger.Data.TestEnum;
|
||||
import com.qtagger.Database.Account;
|
||||
import com.qtagger.Database.AccountData;
|
||||
import com.qtagger.Database.DBHelper;
|
||||
|
||||
public class DataManager {
|
||||
private DataManager(){}
|
||||
|
||||
public Account loginAccount;
|
||||
public AccountData loginAccount;
|
||||
public FragmentManager fragmentManager;
|
||||
public DBHelper dbHelper;
|
||||
public static TestEnum testEnum = TestEnum.선택안함;
|
||||
public static Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
public static final int CAMERA_PERMISSIONS_REQUEST_CODE = 100;
|
||||
|
||||
|
||||
|
||||
private static class DataManagerHolder{
|
||||
public static final DataManager INSTANCE = new DataManager();
|
||||
}
|
||||
|
||||
BIN
app/src/main/res/drawable/logo.png
Normal file
BIN
app/src/main/res/drawable/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
@@ -44,6 +44,7 @@
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="64dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:singleLine="true"
|
||||
android:hint="아이디를 입력해주세요"
|
||||
android:minHeight="48dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -58,6 +59,7 @@
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="132dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:singleLine="true"
|
||||
android:hint="이름을 입력해주세요"
|
||||
android:minHeight="48dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -72,6 +74,7 @@
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="200dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:singleLine="true"
|
||||
android:hint="소속을 입력해주세요"
|
||||
android:minHeight="48dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="132dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:singleLine="true"
|
||||
android:hint="이름을 입력해주세요"
|
||||
android:minHeight="48dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -75,6 +76,7 @@
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="200dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:singleLine="true"
|
||||
android:hint="소속을 입력해주세요"
|
||||
android:minHeight="48dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@android:drawable/ic_delete" />
|
||||
app:srcCompat="@drawable/logo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewTitle"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="조회"
|
||||
android:text="방폐물 선택"
|
||||
android:textAlignment="center"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="검사"
|
||||
android:text="검사 단계 선택"
|
||||
android:textAlignment="center"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -298,7 +298,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="중단"
|
||||
android:text="하단"
|
||||
android:textSize="24sp">
|
||||
|
||||
</TextView>
|
||||
|
||||
Reference in New Issue
Block a user