cleanup
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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<LinearLayout>(R.id.datesLinearLayout)
 | 
			
		||||
 | 
			
		||||
        dates.forEach { date ->
 | 
			
		||||
            val newDate = ExpiryGroupView(this, this as Context, date)
 | 
			
		||||
            container.addView(newDate)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -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()
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -6,5 +6,5 @@
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="match_parent"
 | 
			
		||||
        tools:context=".fragments.AddAbstractProductFragment">
 | 
			
		||||
    <include layout="@layout/content_add_abstract_product" android:id="@+id/include_content"/>
 | 
			
		||||
    <include layout="@layout/fragment_add_abstract_product" android:id="@+id/include_content"/>
 | 
			
		||||
</androidx.core.widget.NestedScrollView>
 | 
			
		||||
@@ -1,10 +1,9 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<androidx.core.widget.NestedScrollView
 | 
			
		||||
        xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
        xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
        xmlns:tools="http://schemas.android.com/tools"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="match_parent"
 | 
			
		||||
        tools:context=".fragments.AddProductFragment">
 | 
			
		||||
    <include layout="@layout/content_add_product" android:id="@+id/include_content"/>
 | 
			
		||||
    <include layout="@layout/fragment_add_product" android:id="@+id/include_content"/>
 | 
			
		||||
</androidx.core.widget.NestedScrollView>
 | 
			
		||||
@@ -5,5 +5,5 @@
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="match_parent"
 | 
			
		||||
        tools:context=".fragments.ExpiryDatesFragment">
 | 
			
		||||
    <include layout="@layout/content_expiry_calendar" android:id="@+id/include_content"/>
 | 
			
		||||
    <include layout="@layout/fragment_expiry_dates" android:id="@+id/include_content"/>
 | 
			
		||||
</androidx.core.widget.NestedScrollView>
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<androidx.constraintlayout.widget.ConstraintLayout
 | 
			
		||||
        xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
        xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="match_parent"
 | 
			
		||||
        app:layout_behavior="@string/appbar_scrolling_view_behavior" android:id="@+id/addAbstractProductLayout">
 | 
			
		||||
 | 
			
		||||
        <androidx.fragment.app.FragmentContainerView
 | 
			
		||||
                android:name="androidx.navigation.fragment.NavHostFragment"
 | 
			
		||||
                android:layout_width="match_parent"
 | 
			
		||||
                android:layout_height="match_parent" app:navGraph="@navigation/nav_graph_add_abstract_product"
 | 
			
		||||
                app:defaultNavHost="true" android:id="@+id/fragmentContainerView"/>
 | 
			
		||||
</androidx.constraintlayout.widget.ConstraintLayout>
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<androidx.constraintlayout.widget.ConstraintLayout
 | 
			
		||||
        xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
        xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="match_parent"
 | 
			
		||||
        app:layout_behavior="@string/appbar_scrolling_view_behavior" android:id="@+id/addProductLayout">
 | 
			
		||||
 | 
			
		||||
        <androidx.fragment.app.FragmentContainerView
 | 
			
		||||
                android:name="androidx.navigation.fragment.NavHostFragment"
 | 
			
		||||
                android:layout_width="match_parent"
 | 
			
		||||
                android:layout_height="match_parent" app:navGraph="@navigation/nav_graph_add_product"
 | 
			
		||||
                app:defaultNavHost="true" android:id="@+id/fragmentContainerView"/>
 | 
			
		||||
</androidx.constraintlayout.widget.ConstraintLayout>
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<androidx.constraintlayout.widget.ConstraintLayout
 | 
			
		||||
        xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
        xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="match_parent"
 | 
			
		||||
        app:layout_behavior="@string/appbar_scrolling_view_behavior" android:id="@+id/expiryCalendarContent">
 | 
			
		||||
 | 
			
		||||
    <androidx.fragment.app.FragmentContainerView
 | 
			
		||||
            android:name="androidx.navigation.fragment.NavHostFragment"
 | 
			
		||||
            android:layout_width="match_parent"
 | 
			
		||||
            android:layout_height="match_parent" app:navGraph="@navigation/nav_graph_expiry_calendar"
 | 
			
		||||
            app:defaultNavHost="true" android:id="@+id/fragmentContainerView"/>
 | 
			
		||||
</androidx.constraintlayout.widget.ConstraintLayout>
 | 
			
		||||
@@ -1,11 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
            xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
            xmlns:tools="http://schemas.android.com/tools"
 | 
			
		||||
            android:id="@+id/nav_graph_add_abstract_product"
 | 
			
		||||
            app:startDestination="@id/addAbstractProductFragment">
 | 
			
		||||
 | 
			
		||||
    <fragment android:id="@+id/addAbstractProductFragment"
 | 
			
		||||
              android:name="org.foxarmy.barcodescannerforemployees.fragments.AddAbstractProductFragment"
 | 
			
		||||
              android:label="activity_add_abstract_product" tools:layout="@layout/fragment_add_abstract_product"/>
 | 
			
		||||
</navigation>
 | 
			
		||||
@@ -1,11 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
            xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
            xmlns:tools="http://schemas.android.com/tools"
 | 
			
		||||
            android:id="@+id/nav_graph_add_product"
 | 
			
		||||
            app:startDestination="@id/addProductFragment">
 | 
			
		||||
 | 
			
		||||
    <fragment android:id="@+id/addProductFragment"
 | 
			
		||||
              android:name="org.foxarmy.barcodescannerforemployees.fragments.AddProductFragment"
 | 
			
		||||
              android:label="activity_add_product" tools:layout="@layout/fragment_add_product"/>
 | 
			
		||||
</navigation>
 | 
			
		||||
@@ -1,11 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
            xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
            xmlns:tools="http://schemas.android.com/tools"
 | 
			
		||||
            android:id="@+id/navigation_graph_expiry_calendar"
 | 
			
		||||
            app:startDestination="@id/expiryDatesFragment">
 | 
			
		||||
 | 
			
		||||
    <fragment android:id="@+id/expiryDatesFragment"
 | 
			
		||||
              android:name="org.foxarmy.barcodescannerforemployees.fragments.ExpiryDatesFragment"
 | 
			
		||||
              android:label="expiry dates" tools:layout="@layout/fragment_expiry_dates"/>
 | 
			
		||||
</navigation>
 | 
			
		||||
		Reference in New Issue
	
	Block a user