diff --git a/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/AddAbstractProductActivity.kt b/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/AddAbstractProductActivity.kt index 961de15..88bbc50 100644 --- a/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/AddAbstractProductActivity.kt +++ b/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/AddAbstractProductActivity.kt @@ -1,8 +1,5 @@ package org.foxarmy.barcodescannerforemployees.activities -//import com.google.mlkit.vision.codescanner.GmsBarcodeScannerOptions -//import com.google.mlkit.vision.codescanner.GmsBarcodeScanning - import android.content.ContentValues import android.content.DialogInterface import android.content.Intent diff --git a/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/ExpiryCalendarActivity.kt b/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/ExpiryCalendarActivity.kt index 2dd2b72..7c009f6 100644 --- a/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/ExpiryCalendarActivity.kt +++ b/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/ExpiryCalendarActivity.kt @@ -1,10 +1,15 @@ package org.foxarmy.barcodescannerforemployees.activities +import android.content.Context import android.content.Intent import android.os.Bundle +import android.widget.LinearLayout import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat +import org.foxarmy.barcodescannerforemployees.DBStorageController +import org.foxarmy.barcodescannerforemployees.R import org.foxarmy.barcodescannerforemployees.databinding.ActivityExpiryCalendarBinding +import org.foxarmy.barcodescannerforemployees.views.ExpiryGroupView class ExpiryCalendarActivity : AppCompatActivity() { private lateinit var binding: ActivityExpiryCalendarBinding @@ -12,9 +17,9 @@ class ExpiryCalendarActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - binding = ActivityExpiryCalendarBinding.inflate(layoutInflater) - setContentView(binding.root) + setContentView(R.layout.fragment_expiry_dates) + fillUp() } fun displayDate(date:Long) { @@ -23,11 +28,16 @@ class ExpiryCalendarActivity : AppCompatActivity() { extras.putLong("date", date) expiryCalendarGroupActivityIntent.putExtras(extras) ContextCompat.startActivity(this, expiryCalendarGroupActivityIntent, extras) + } -// val shelfFragment = ShelfFragment.newInstance(date) -// val ft = supportFragmentManager.beginTransaction() -// ft.replace(R.id.include_content, shelfFragment) -// ft.commit() -// ft.addToBackStack(null) + private fun fillUp() { + val dates = DBStorageController(this).findAllExpiryDates(DBStorageController(this).readableDatabase) + + val container = findViewById(R.id.datesLinearLayout) + + dates.forEach { date -> + val newDate = ExpiryGroupView(this, this as Context, date) + container.addView(newDate) + } } } \ No newline at end of file diff --git a/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/ExpiryCalendarGroupActivity.kt b/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/ExpiryCalendarGroupActivity.kt index 6d18b4d..f5749ba 100644 --- a/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/ExpiryCalendarGroupActivity.kt +++ b/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/ExpiryCalendarGroupActivity.kt @@ -16,7 +16,6 @@ class ExpiryCalendarGroupActivity : AppCompatActivity() { val date = intent.extras!!.getLong("date") -// binding.root.addView(ShelfFragment.newInstance(date).view!!.rootView) val ft = supportFragmentManager.beginTransaction() ft.replace(R.id.content, ShelfFragment.newInstance(date)) ft.commit() diff --git a/app/src/main/java/org/foxarmy/barcodescannerforemployees/fragments/ExpiryDatesFragment.kt b/app/src/main/java/org/foxarmy/barcodescannerforemployees/fragments/ExpiryDatesFragment.kt index 1e07125..a48f907 100644 --- a/app/src/main/java/org/foxarmy/barcodescannerforemployees/fragments/ExpiryDatesFragment.kt +++ b/app/src/main/java/org/foxarmy/barcodescannerforemployees/fragments/ExpiryDatesFragment.kt @@ -5,9 +5,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment -import org.foxarmy.barcodescannerforemployees.DBStorageController import org.foxarmy.barcodescannerforemployees.databinding.FragmentExpiryDatesBinding -import org.foxarmy.barcodescannerforemployees.views.ExpiryGroupView class ExpiryDatesFragment : Fragment() { private lateinit var binding: FragmentExpiryDatesBinding @@ -18,20 +16,6 @@ class ExpiryDatesFragment : Fragment() { ): View { binding = FragmentExpiryDatesBinding.inflate(layoutInflater) - fillUp() - return binding.root } - - - private fun fillUp() { - val dates = DBStorageController(requireContext()).findAllExpiryDates(DBStorageController(requireContext()).readableDatabase) - - val container = binding.datesLinearLayout - - dates.forEach { date -> - val newDate = ExpiryGroupView(requireActivity(), requireContext(), date) - container.addView(newDate) - } - } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_add_abstract_product.xml b/app/src/main/res/layout/activity_add_abstract_product.xml index 45e349a..2cf30f4 100644 --- a/app/src/main/res/layout/activity_add_abstract_product.xml +++ b/app/src/main/res/layout/activity_add_abstract_product.xml @@ -6,5 +6,5 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".fragments.AddAbstractProductFragment"> - + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_add_product.xml b/app/src/main/res/layout/activity_add_product.xml index b500a44..9e3440f 100644 --- a/app/src/main/res/layout/activity_add_product.xml +++ b/app/src/main/res/layout/activity_add_product.xml @@ -1,10 +1,9 @@ - + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_expiry_calendar.xml b/app/src/main/res/layout/activity_expiry_calendar.xml index 2f37de1..9986adc 100644 --- a/app/src/main/res/layout/activity_expiry_calendar.xml +++ b/app/src/main/res/layout/activity_expiry_calendar.xml @@ -5,5 +5,5 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".fragments.ExpiryDatesFragment"> - + \ No newline at end of file diff --git a/app/src/main/res/layout/content_add_abstract_product.xml b/app/src/main/res/layout/content_add_abstract_product.xml deleted file mode 100644 index 15293d8..0000000 --- a/app/src/main/res/layout/content_add_abstract_product.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/content_add_product.xml b/app/src/main/res/layout/content_add_product.xml deleted file mode 100644 index 9168c2b..0000000 --- a/app/src/main/res/layout/content_add_product.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/content_expiry_calendar.xml b/app/src/main/res/layout/content_expiry_calendar.xml deleted file mode 100644 index 3744aa7..0000000 --- a/app/src/main/res/layout/content_expiry_calendar.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/navigation/nav_graph_add_abstract_product.xml b/app/src/main/res/navigation/nav_graph_add_abstract_product.xml deleted file mode 100644 index 22b9cab..0000000 --- a/app/src/main/res/navigation/nav_graph_add_abstract_product.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/navigation/nav_graph_add_product.xml b/app/src/main/res/navigation/nav_graph_add_product.xml deleted file mode 100644 index 61db858..0000000 --- a/app/src/main/res/navigation/nav_graph_add_product.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/navigation/nav_graph_expiry_calendar.xml b/app/src/main/res/navigation/nav_graph_expiry_calendar.xml deleted file mode 100644 index 3190512..0000000 --- a/app/src/main/res/navigation/nav_graph_expiry_calendar.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file