diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6e197c4..a429f80 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -49,6 +49,8 @@ dependencies { androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) + implementation("com.google.android.material:1.2.0") + // Barcode scanning API implementation (libs.barcode.scanning) // CameraX library diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ec11dbb..698c541 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -37,7 +37,7 @@ diff --git a/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/StorageActivity.kt b/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/MainActivity.kt similarity index 98% rename from app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/StorageActivity.kt rename to app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/MainActivity.kt index 738fdee..0a670a3 100644 --- a/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/StorageActivity.kt +++ b/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/MainActivity.kt @@ -19,7 +19,7 @@ import org.foxarmy.barcodescannerforemployees.databinding.ActivityStorageBinding import org.foxarmy.barcodescannerforemployees.fragments.StorageFragment import org.foxarmy.barcodescannerforemployees.views.AbstractProductView -class StorageActivity : AppCompatActivity() { +class MainActivity : AppCompatActivity() { private lateinit var appBarConfiguration: AppBarConfiguration private lateinit var binding: ActivityStorageBinding diff --git a/app/src/main/java/org/foxarmy/barcodescannerforemployees/fragments/CategoriesFragment.kt b/app/src/main/java/org/foxarmy/barcodescannerforemployees/fragments/CategoriesFragment.kt new file mode 100644 index 0000000..494b9a5 --- /dev/null +++ b/app/src/main/java/org/foxarmy/barcodescannerforemployees/fragments/CategoriesFragment.kt @@ -0,0 +1,70 @@ +package org.foxarmy.barcodescannerforemployees.fragments + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import org.foxarmy.barcodescannerforemployees.R + +class CategoriesFragment : Fragment() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_categories, container, false) + } + + override fun onResume() { + super.onResume() + +// updateContent() + } + +// public fun updateContent() { +// +// val grv = getView()?.findViewById(R.id.contentGridLayout) +// grv?.removeAllViews() +// +// val db = DBStorageController(requireContext()).readableDatabase +// val projection = arrayOf( +// BaseColumns._ID, +// ProductContract.ProductEntry.PRODUCT_NAME, +// ProductContract.ProductEntry.PRODUCT_NET_WEIGHT, +// ProductContract.ProductEntry.IMAGE_FILENAME +// ) +// +// val cursor = db.query(ProductContract.ProductEntry.TABLE_NAME, projection, null, null, null, null, null) +// +// with (cursor) { +// while(moveToNext()) { +// val productId = getInt(getColumnIndexOrThrow(BaseColumns._ID)) +// val productName = getString(getColumnIndexOrThrow(ProductContract.ProductEntry.PRODUCT_NAME)) +// val netWeight = getDouble(getColumnIndexOrThrow(ProductContract.ProductEntry.PRODUCT_NET_WEIGHT)) +// val productImageHash = getString(getColumnIndexOrThrow(ProductContract.ProductEntry.IMAGE_FILENAME)) +// +// val product = AbstractProduct(productId, productName, netWeight, productImageHash, 1) +// +// generateThumbnailForImage(context!!, productImageHash) +// +// val abstractProduct = AbstractProductView( +// requireActivity(), +// requireContext(), +// product +// ) +// grv?.addView(abstractProduct) +// } +// } +// } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + +// updateContent() + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_storage.xml b/app/src/main/res/layout/activity_main.xml similarity index 93% rename from app/src/main/res/layout/activity_storage.xml rename to app/src/main/res/layout/activity_main.xml index 971de78..3d96d00 100644 --- a/app/src/main/res/layout/activity_storage.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" - tools:context=".activities.StorageActivity"> + tools:context=".activities.MainActivity"> + app:navGraph="@navigation/nav_graph_main"/> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_categories.xml b/app/src/main/res/layout/fragment_categories.xml new file mode 100644 index 0000000..6f5f4dd --- /dev/null +++ b/app/src/main/res/layout/fragment_categories.xml @@ -0,0 +1,13 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 538a82a..9c3bffd 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -1,7 +1,7 @@ + tools:context="org.foxarmy.barcodescannerforemployees.activities.MainActivity">