feat: added
This commit is contained in:
parent
fc86c76656
commit
e9d0beaa1e
@ -2,6 +2,8 @@ package ru.myitschool.work.ui.screens;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -9,58 +11,31 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import ru.myitschool.work.R;
|
import ru.myitschool.work.R;
|
||||||
|
import ru.myitschool.work.databinding.FragmentQrBinding;
|
||||||
|
|
||||||
/**
|
|
||||||
* A simple {@link Fragment} subclass.
|
|
||||||
* Use the {@link QrFragment#newInstance} factory method to
|
|
||||||
* create an instance of this fragment.
|
|
||||||
*/
|
|
||||||
public class QrFragment extends Fragment {
|
public class QrFragment extends Fragment {
|
||||||
|
private FragmentQrBinding binding;
|
||||||
|
|
||||||
// TODO: Rename parameter arguments, choose names that match
|
public QrFragment() { super(R.layout.fragment_qr); }
|
||||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
|
||||||
private static final String ARG_PARAM1 = "param1";
|
|
||||||
private static final String ARG_PARAM2 = "param2";
|
|
||||||
|
|
||||||
// TODO: Rename and change types of parameters
|
@Override
|
||||||
private String mParam1;
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
private String mParam2;
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
public QrFragment() {
|
binding = FragmentQrBinding.bind(view);
|
||||||
// Required empty public constructor
|
|
||||||
|
binding.qrButton.setOnClickListener(this::qrScanListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void qrScanListener(View view) {
|
||||||
* Use this factory method to create a new instance of
|
this.requireActivity().getSupportFragmentManager().beginTransaction()
|
||||||
* this fragment using the provided parameters.
|
.replace(R.id.fragment_container_view, QrScanFragment.class, null)
|
||||||
*
|
.addToBackStack("").commit();
|
||||||
* @param param1 Parameter 1.
|
|
||||||
* @param param2 Parameter 2.
|
|
||||||
* @return A new instance of fragment QrFragment.
|
|
||||||
*/
|
|
||||||
// TODO: Rename and change types and number of parameters
|
|
||||||
public static QrFragment newInstance(String param1, String param2) {
|
|
||||||
QrFragment fragment = new QrFragment();
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putString(ARG_PARAM1, param1);
|
|
||||||
args.putString(ARG_PARAM2, param2);
|
|
||||||
fragment.setArguments(args);
|
|
||||||
return fragment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onDestroyView() {
|
||||||
super.onCreate(savedInstanceState);
|
binding = null;
|
||||||
if (getArguments() != null) {
|
super.onDestroyView();
|
||||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
|
||||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState) {
|
|
||||||
// Inflate the layout for this fragment
|
|
||||||
return inflater.inflate(R.layout.fragment_qr, container, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package ru.myitschool.work.ui.screens;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import ru.myitschool.work.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple {@link Fragment} subclass.
|
||||||
|
* Use the {@link QrScanFragment#newInstance} factory method to
|
||||||
|
* create an instance of this fragment.
|
||||||
|
*/
|
||||||
|
public class QrScanFragment extends Fragment {
|
||||||
|
|
||||||
|
// TODO: Rename parameter arguments, choose names that match
|
||||||
|
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||||
|
private static final String ARG_PARAM1 = "param1";
|
||||||
|
private static final String ARG_PARAM2 = "param2";
|
||||||
|
|
||||||
|
// TODO: Rename and change types of parameters
|
||||||
|
private String mParam1;
|
||||||
|
private String mParam2;
|
||||||
|
|
||||||
|
public QrScanFragment() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 QrScanFragment.
|
||||||
|
*/
|
||||||
|
// TODO: Rename and change types and number of parameters
|
||||||
|
public static QrScanFragment newInstance(String param1, String param2) {
|
||||||
|
QrScanFragment fragment = new QrScanFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString(ARG_PARAM1, param1);
|
||||||
|
args.putString(ARG_PARAM2, param2);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
if (getArguments() != null) {
|
||||||
|
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||||
|
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
return inflater.inflate(R.layout.fragment_qr_scan, container, false);
|
||||||
|
}
|
||||||
|
}
|
BIN
app/src/main/res/drawable/background_qr_fragment.png
Normal file
BIN
app/src/main/res/drawable/background_qr_fragment.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
BIN
app/src/main/res/drawable/qr_code.png
Normal file
BIN
app/src/main/res/drawable/qr_code.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.0 KiB |
@ -3,12 +3,48 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".ui.screens.QrFragment">
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
tools:context=".ui.screens.QrFragment"
|
||||||
|
android:background="@drawable/background_qr_fragment">
|
||||||
|
|
||||||
<!-- TODO: Update blank fragment layout -->
|
<RelativeLayout
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:text="@string/hello_blank_fragment" />
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/session_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_marginTop="50dp"
|
||||||
|
android:text="@string/session_30_days"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="24sp" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/session_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_marginTop="90dp"
|
||||||
|
android:text="@string/hours_500"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="22sp" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/qr_button"
|
||||||
|
android:layout_width="180dp"
|
||||||
|
android:layout_height="180dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginBottom="176dp"
|
||||||
|
android:contentDescription="@string/qr_code"
|
||||||
|
android:src="@drawable/qr_code"
|
||||||
|
android:background="#1E1F5C"/>
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
22
app/src/main/res/layout/fragment_qr_scan.xml
Normal file
22
app/src/main/res/layout/fragment_qr_scan.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.screens.QrScanFragment">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:text="Сканирование qr кода"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="30sp" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
</FrameLayout>
|
@ -42,4 +42,7 @@
|
|||||||
<string name="login">Войти</string>
|
<string name="login">Войти</string>
|
||||||
<string name="password">Пароль</string>
|
<string name="password">Пароль</string>
|
||||||
<string name="login_text">Вход</string>
|
<string name="login_text">Вход</string>
|
||||||
|
<string name="qr_code">qr_code</string>
|
||||||
|
<string name="hours_500">500 часов</string>
|
||||||
|
<string name="session_30_days">Сессии за последние 30 дней:</string>
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user