-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
168 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,47 @@ | ||
package com.trolle.trolleapp | ||
|
||
import android.app.AlertDialog | ||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.Toast | ||
import androidx.navigation.Navigation | ||
import com.trolle.trolleapp.databinding.FragmentHomeBinding | ||
|
||
// TODO: Rename parameter arguments, choose names that match | ||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER | ||
private const val ARG_PARAM1 = "param1" | ||
private const val ARG_PARAM2 = "param2" | ||
|
||
/** | ||
* A simple [Fragment] subclass. | ||
* Use the [HomeFragment.newInstance] factory method to | ||
* create an instance of this fragment. | ||
*/ | ||
class HomeFragment : Fragment() { | ||
// TODO: Rename and change types of parameters | ||
private var param1: String? = null | ||
private var param2: String? = null | ||
|
||
private var _binding: FragmentHomeBinding? = null | ||
private val binding get() = _binding!! | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
arguments?.let { | ||
param1 = it.getString(ARG_PARAM1) | ||
param2 = it.getString(ARG_PARAM2) | ||
} | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
// Inflate the layout for this fragment | ||
return inflater.inflate(R.layout.fragment_home, container, false) | ||
_binding = FragmentHomeBinding.inflate(inflater, container, false) | ||
return binding.root | ||
} | ||
|
||
companion object { | ||
/** | ||
* Use this factory method to create a new instance of | ||
* this fragment using the provided parameters. | ||
* | ||
* @param param1 Parameter 1. | ||
* @param param2 Parameter 2. | ||
* @return A new instance of fragment HomeFragment. | ||
*/ | ||
// TODO: Rename and change types and number of parameters | ||
@JvmStatic | ||
fun newInstance(param1: String, param2: String) = | ||
HomeFragment().apply { | ||
arguments = Bundle().apply { | ||
putString(ARG_PARAM1, param1) | ||
putString(ARG_PARAM2, param2) | ||
} | ||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
binding.imageViewBarcode.setOnClickListener{ | ||
|
||
val alertDialog = AlertDialog.Builder(requireContext()) | ||
alertDialog.apply { | ||
setTitle("Success!") | ||
setMessage("Your smartphone has successfully connected with Trolley ID = (ID). " + | ||
" Happy Shopping!") | ||
setPositiveButton("OK") { _, _ -> | ||
//Toast.makeText(requireContext(), "yes", Toast.LENGTH_SHORT).show() | ||
Navigation.findNavController(view).navigate(R.id.payFragment) | ||
}.create().show() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24" | ||
android:tint="?attr/colorControlNormal"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/> | ||
</vector> |
10 changes: 10 additions & 0 deletions
10
app/src/main/res/drawable/ic_baseline_qr_code_scanner_24.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24" | ||
android:tint="?attr/colorControlNormal"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M9.5,6.5v3h-3v-3H9.5M11,5H5v6h6V5L11,5zM9.5,14.5v3h-3v-3H9.5M11,13H5v6h6V13L11,13zM17.5,6.5v3h-3v-3H17.5M19,5h-6v6h6V5L19,5zM13,13h1.5v1.5H13V13zM14.5,14.5H16V16h-1.5V14.5zM16,13h1.5v1.5H16V13zM13,16h1.5v1.5H13V16zM14.5,17.5H16V19h-1.5V17.5zM16,16h1.5v1.5H16V16zM17.5,14.5H19V16h-1.5V14.5zM17.5,17.5H19V19h-1.5V17.5zM22,7h-2V4h-3V2h5V7zM22,22v-5h-2v3h-3v2H22zM2,22h5v-2H4v-3H2V22zM2,2v5h2V4h3V2H2z"/> | ||
</vector> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> | ||
<solid android:color="@color/pink"/> <!-- this one is ths color of the Rounded Button --> | ||
<corners | ||
android:bottomRightRadius="10dp" | ||
android:bottomLeftRadius="10dp" | ||
android:topLeftRadius="10dp" | ||
android:topRightRadius="10dp"/> | ||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,74 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".HomeFragment"> | ||
|
||
<!-- TODO: Update blank fragment layout --> | ||
<TextView | ||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:gravity="center" | ||
android:text='ini fragment home' /> | ||
android:orientation="vertical" | ||
android:background="@color/bgc"> | ||
|
||
<TextView | ||
android:id="@+id/text_view_welcome" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Welcome to Troll-E!" | ||
android:textAlignment="center" | ||
android:textSize="28sp" | ||
android:textStyle="bold" | ||
android:textColor="@color/pink" | ||
android:layout_marginBottom="20dp" | ||
/> | ||
|
||
<TextView | ||
android:id="@+id/text_view_title" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/connect_to_trolley" | ||
android:textAlignment="center" | ||
android:justificationMode="inter_word" | ||
android:textSize="18sp" | ||
android:textColor="@color/pink" | ||
android:padding="20dp" | ||
/> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:layout_marginTop="20dp" | ||
android:id="@+id/image_view_barcode" | ||
android:layout_width="250dp" | ||
android:layout_height="wrap_content" | ||
android:text="Scan QR Code" | ||
style="@style/Widget.MaterialComponents.Button.TextButton" | ||
app:icon="@drawable/ic_baseline_qr_code_scanner_24" | ||
android:backgroundTint="@color/white" | ||
app:cornerRadius="15dp" | ||
/> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="OR" | ||
android:textAlignment="center" | ||
android:textSize="15sp" | ||
android:textColor="@color/grey" | ||
android:padding="10dp" | ||
/> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:layout_width="250dp" | ||
android:layout_height="wrap_content" | ||
android:text="Manually input the ID" | ||
style="@style/Widget.MaterialComponents.Button.TextButton" | ||
app:icon="@drawable/ic_baseline_edit_24" | ||
android:backgroundTint="@color/white" | ||
app:cornerRadius="15dp" | ||
/> | ||
|
||
</LinearLayout> | ||
|
||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters