From c6fa7ad6d1eb2985246a6491b8c384c6bc5525a5 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1A3P75F\\lee" Date: Wed, 31 Aug 2022 18:59:10 +0900 Subject: [PATCH] =?UTF-8?q?=E3=85=88=E3=84=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 6 + app/build.gradle | 2 + app/src/main/AndroidManifest.xml | 1 + .../qtagger/Activity/Test/InfoFragment.java | 81 ++- .../CustomPalette/SquareConstLayout.java | 32 +- .../java/com/qtagger/Database/DBHelper.java | 25 +- .../main/java/com/qtagger/MainActivity.java | 83 ++- app/src/main/java/com/qtagger/test.java | 24 +- .../com/qtagger/util/ImageSliderAdapter.java | 58 +- .../main/res/drawable/bg_indicator_active.xml | 14 +- .../res/drawable/bg_indicator_inactive.xml | 12 +- app/src/main/res/layout/fragment_info.xml | 525 +++++++++++++++++- .../main/res/layout/fragment_photograph.xml | 1 + app/src/main/res/layout/item_slider.xml | 11 +- gradle.properties | 1 + 15 files changed, 830 insertions(+), 46 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 500af69..ba86fd6 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -83,17 +83,23 @@ + + + + + + diff --git a/app/build.gradle b/app/build.gradle index ee7f1ba..8a58846 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -39,9 +39,11 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.room:room-common:2.4.3' implementation 'androidx.room:room-runtime:2.4.3' + implementation 'com.github.bumptech.glide:glide:4.9.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' annotationProcessor 'androidx.room:room-compiler:2.4.3' implementation fileTree(dir: 'C:\\lib\\libs-wsmr', include: ['*.aar', '*.jar'], exclude: []) } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 590e687..a754313 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,6 +23,7 @@ accountList; - ActivityResultLauncher activityResultPicture = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() { - @Override - public void onActivityResult(ActivityResult result) { - CommonHelper.CameraResult(result); + @RequiresApi(api = Build.VERSION_CODES.O) + public static void copy(File origin, File dest) throws IOException { + Files.copy(origin.toPath(), dest.toPath()); + } - } - }); - - @RequiresApi(api = Build.VERSION_CODES.M) + @RequiresApi(api = Build.VERSION_CODES.O) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -60,16 +56,47 @@ public class MainActivity extends AppCompatActivity { dataManager = DataManager.getInstance(); CommonHelper.CheckCameraPermission(this); - //테스트용도 나중에 삭제 - findViewById(R.id.imageView).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { + File path22 = getDatabasePath("groupDB"); + try { + copy(path22,new File(Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS).getPath()+"/groupDB")); + } catch (IOException e) { + e.printStackTrace(); + } - //Intent intent = new Intent(getApplicationContext(), test.class); - //startActivity(intent); - Intent intent = new Intent(getApplicationContext(), TestSelectActivity.class); - startActivity(intent); - } + File path2 = getDatabasePath("AccountDB"); + try { + copy(path2,new File(Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS).getPath()+"/AccountDB2")); + } 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); + //startActivity(intent); }); //로그인 @@ -86,8 +113,7 @@ public class MainActivity extends AppCompatActivity { } else { - Account selectAcc = accountList.get(selId-1); - dataManager.loginAccount = selectAcc; + dataManager.loginAccount = accountList.get(selId-1); Intent intent2 = new Intent(getApplicationContext(), NavigationActivity.class); startActivity(intent2); } @@ -131,6 +157,7 @@ public class MainActivity extends AppCompatActivity { aa_items.add("사용자를 선택해주세요"); AppDatabase db = Room.databaseBuilder(this,AppDatabase.class,"AccountDB").allowMainThreadQueries().build(); + //초기 데이터 세팅 accountList = db.accountDao().getAll(); for (Account ac: accountList) { diff --git a/app/src/main/java/com/qtagger/test.java b/app/src/main/java/com/qtagger/test.java index 485f3b7..2b5656d 100644 --- a/app/src/main/java/com/qtagger/test.java +++ b/app/src/main/java/com/qtagger/test.java @@ -8,6 +8,7 @@ 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; @@ -22,6 +23,7 @@ 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; @@ -38,12 +40,28 @@ 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"}; @@ -66,13 +84,17 @@ 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 public void onClick(View v) { - HttpGet(); + + + + //HttpGet(); //http://1.245.98.188:9085/api/cmmn/getNotPassTypeCombo //URL url = new URL("http://1.245.98.188:9097/api/cmmn/getNotPassTypeCombo"); diff --git a/app/src/main/java/com/qtagger/util/ImageSliderAdapter.java b/app/src/main/java/com/qtagger/util/ImageSliderAdapter.java index 5a57331..84bd71a 100644 --- a/app/src/main/java/com/qtagger/util/ImageSliderAdapter.java +++ b/app/src/main/java/com/qtagger/util/ImageSliderAdapter.java @@ -1,2 +1,58 @@ -package com.qtagger.util;public class ImageSliderAdapter { +package com.qtagger.util; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.bumptech.glide.Glide; +import com.qtagger.R; + +public class ImageSliderAdapter extends RecyclerView.Adapter { + private Context context; + private String[] sliderImage; + + public ImageSliderAdapter(Context context, String[] sliderImage) { + this.context = context; + this.sliderImage = sliderImage; + } + + @NonNull + @Override + public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.item_slider, parent, false); + + return new MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { + holder.bindSliderImage(sliderImage[position]); + } + + @Override + public int getItemCount() { + return sliderImage.length; + } + + public class MyViewHolder extends RecyclerView.ViewHolder { + + private ImageView mImageView; + + public MyViewHolder(@NonNull View itemView) { + super(itemView); + mImageView = itemView.findViewById(R.id.imageSlider); + } + + public void bindSliderImage(String imageURL) { + Glide.with(context) + .load(imageURL) + .into(mImageView); + } + } } diff --git a/app/src/main/res/drawable/bg_indicator_active.xml b/app/src/main/res/drawable/bg_indicator_active.xml index 3ef8998..a02ce15 100644 --- a/app/src/main/res/drawable/bg_indicator_active.xml +++ b/app/src/main/res/drawable/bg_indicator_active.xml @@ -1,4 +1,12 @@ - - - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_indicator_inactive.xml b/app/src/main/res/drawable/bg_indicator_inactive.xml index a8b409b..02b3601 100644 --- a/app/src/main/res/drawable/bg_indicator_inactive.xml +++ b/app/src/main/res/drawable/bg_indicator_inactive.xml @@ -1,4 +1,12 @@ - + - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_info.xml b/app/src/main/res/layout/fragment_info.xml index 738ec96..5a6574d 100644 --- a/app/src/main/res/layout/fragment_info.xml +++ b/app/src/main/res/layout/fragment_info.xml @@ -3,12 +3,533 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto" tools:context=".Activity.Test.InfoFragment"> - + android:scrollbars="none"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_photograph.xml b/app/src/main/res/layout/fragment_photograph.xml index 5adea26..eb86904 100644 --- a/app/src/main/res/layout/fragment_photograph.xml +++ b/app/src/main/res/layout/fragment_photograph.xml @@ -18,6 +18,7 @@ diff --git a/app/src/main/res/layout/item_slider.xml b/app/src/main/res/layout/item_slider.xml index cdc89f2..607dd64 100644 --- a/app/src/main/res/layout/item_slider.xml +++ b/app/src/main/res/layout/item_slider.xml @@ -1,6 +1,7 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index dab7c28..1d77e86 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,6 +15,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # Android operating system, and which are packaged with your app"s APK # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true +android.enableJetifier=true # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library