From 7633249fe619fb658881485780cf1a6d44eca7fc Mon Sep 17 00:00:00 2001 From: s22thong <sylvain.thong@gmail.com> Date: Tue, 18 Mar 2025 11:28:29 +0100 Subject: [PATCH] ft(UI): menu in EditUserFragment --- app/src/main/AndroidManifest.xml | 7 - .../myfirstapplication/DatePicker.java | 51 ------ .../DatePickerActivity.java | 99 ---------- .../DisplayUserActivity.java | 163 ----------------- .../DisplayUserFragment.java | 3 +- .../myfirstapplication/EditUserFragment.java | 6 + .../myfirstapplication/MainActivity.java | 6 + app/src/main/res/layout/activity_date.xml | 56 ------ .../main/res/layout/activity_display_user.xml | 172 ------------------ .../main/res/layout/fragment_display_user.xml | 17 +- .../main/res/layout/fragment_edit_user.xml | 24 ++- .../main/res/layout/phone_number_input.xml | 3 +- .../main/res/layout/phone_number_print.xml | 5 +- app/src/main/res/values/themes.xml | 2 +- 14 files changed, 49 insertions(+), 565 deletions(-) delete mode 100644 app/src/main/java/fr/imt_atlantique/myfirstapplication/DatePicker.java delete mode 100644 app/src/main/java/fr/imt_atlantique/myfirstapplication/DatePickerActivity.java delete mode 100644 app/src/main/java/fr/imt_atlantique/myfirstapplication/DisplayUserActivity.java delete mode 100644 app/src/main/res/layout/activity_date.xml delete mode 100644 app/src/main/res/layout/activity_display_user.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2429999..8a14c49 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -27,13 +27,6 @@ <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> - <activity android:name=".DisplayUserActivity" android:exported="true" /> - <activity android:name=".DatePickerActivity" android:exported="true"> - <intent-filter> - <action android:name="fr.imt_atlantique.myfirstapplication.ACTION_PICK_DATE" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> - </activity> </application> <queries> diff --git a/app/src/main/java/fr/imt_atlantique/myfirstapplication/DatePicker.java b/app/src/main/java/fr/imt_atlantique/myfirstapplication/DatePicker.java deleted file mode 100644 index 4047982..0000000 --- a/app/src/main/java/fr/imt_atlantique/myfirstapplication/DatePicker.java +++ /dev/null @@ -1,51 +0,0 @@ -package fr.imt_atlantique.myfirstapplication; - -import android.os.Build; -import android.os.Parcel; -import android.os.Parcelable; - -import androidx.annotation.NonNull; - -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; - -public class DatePicker implements Parcelable { - private LocalDate date; - - public DatePicker(LocalDate birthDate) { - this.date = birthDate; - } - - protected DatePicker(Parcel in) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-M-d"); - date = LocalDate.parse(in.readString(), formatter); - } - } - - public static final Creator<DatePicker> CREATOR = new Creator<DatePicker>() { - @Override - public DatePicker createFromParcel(Parcel in) { - return new DatePicker(in); - } - - @Override - public DatePicker[] newArray(int size) { - return new DatePicker[size]; - } - }; - - @Override - public void writeToParcel(@NonNull Parcel parcel, int i) { - parcel.writeString(this.date.toString()); - } - - @Override - public int describeContents() { - return 0; - } - - public LocalDate getDate() { - return date; - } -} diff --git a/app/src/main/java/fr/imt_atlantique/myfirstapplication/DatePickerActivity.java b/app/src/main/java/fr/imt_atlantique/myfirstapplication/DatePickerActivity.java deleted file mode 100644 index b081b46..0000000 --- a/app/src/main/java/fr/imt_atlantique/myfirstapplication/DatePickerActivity.java +++ /dev/null @@ -1,99 +0,0 @@ -package fr.imt_atlantique.myfirstapplication; - -import android.content.Intent; -import android.os.Build; -import android.os.Bundle; -import android.util.Log; -import android.widget.Button; -import android.widget.DatePicker; - -import androidx.activity.EdgeToEdge; -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.graphics.Insets; -import androidx.core.view.ViewCompat; -import androidx.core.view.WindowInsetsCompat; - -import java.time.LocalDate; - -public class DatePickerActivity extends AppCompatActivity { - - LocalDate date; - - DatePicker datePicker; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - Log.i("Lifecycle", "onCreate method"); - EdgeToEdge.enable(this); - setContentView(R.layout.activity_date); - ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.date), (v, insets) -> { - Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); - v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); - return insets; - }); - datePicker = findViewById(R.id.datePicker); - - getValues(); - - Button validateButton = findViewById(R.id.validateDateButton); - validateButton.setOnClickListener(view -> { - int day = datePicker.getDayOfMonth(); - int month = datePicker.getMonth() + 1; - int year = datePicker.getYear(); - - Intent resultIntent = new Intent(); - resultIntent.putExtra("day", day); - resultIntent.putExtra("month", month); - resultIntent.putExtra("year", year); - - setResult(RESULT_OK, resultIntent); - finish(); - }); - - Button cancelButton = findViewById(R.id.cancel_button); - cancelButton.setOnClickListener(view -> { - setResult(RESULT_CANCELED); - finish(); - }); - - - } - - private void getValues() { - Intent intent = getIntent(); - if (intent != null) { - int day = intent.getIntExtra("day", -1); - int month = intent.getIntExtra("month", -1); - int year = intent.getIntExtra("year", -1); - - if (day != -1 && month != -1 && year != -1) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - date = LocalDate.of(year, month, day); - datePicker.updateDate(year, month - 1, day); - } - } - } - } - - - @Override - protected void onStart() { - super.onStart(); - Log.i("Lifecycle", "onStart method"); - } - - @Override - protected void onRestart() { - super.onRestart(); - Log.i("Lifecycle", "onRestart method"); - } - - @Override - protected void onResume() { - super.onResume(); - Log.i("Lifecycle", "onResume method"); - } - - -} diff --git a/app/src/main/java/fr/imt_atlantique/myfirstapplication/DisplayUserActivity.java b/app/src/main/java/fr/imt_atlantique/myfirstapplication/DisplayUserActivity.java deleted file mode 100644 index ab9ca62..0000000 --- a/app/src/main/java/fr/imt_atlantique/myfirstapplication/DisplayUserActivity.java +++ /dev/null @@ -1,163 +0,0 @@ -package fr.imt_atlantique.myfirstapplication; - -import android.app.AlertDialog; -import android.content.pm.PackageManager; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.util.Log; -import android.content.Intent; -import android.Manifest; - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.LinearLayout; -import android.widget.TextView; -import android.widget.Toast; - -import androidx.activity.EdgeToEdge; -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.app.ActivityCompat; -import androidx.core.graphics.Insets; -import androidx.core.view.ViewCompat; -import androidx.core.view.WindowInsetsCompat; - -import com.google.android.material.snackbar.Snackbar; - -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.Arrays; - -public class DisplayUserActivity extends AppCompatActivity { - - String firstName, lastName, birthCity, birthDept, birthDate = ""; - ArrayList<String> phoneNumbersList = new ArrayList<>(); - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - Log.i("Lifecycle", "onCreate method"); - EdgeToEdge.enable(this); - setContentView(R.layout.activity_display_user); - ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.displayUserActivity), (v, insets) -> { - Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); - v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); - return insets; - }); - getValues(); - } - - private void getValues() { - Intent intent = getIntent(); - if (intent != null){ - User user = intent.getParcelableExtra("user"); - if (user != null){ - firstName = user.getFirstName(); - lastName = user.getLastName(); - birthCity = user.getBirthCity(); - birthDept = user.getBirthDept(); - DateTimeFormatter formatter; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - formatter = DateTimeFormatter.ofPattern("d/M/yyyy"); - birthDate = user.getBirthDate().format(formatter); - } - phoneNumbersList = new ArrayList<>(Arrays.asList(user.getPhoneNumbers())); - - } - } - } - - private void restoreValues() { - TextView secondFirstNameEditText = findViewById(R.id.displayFirstNameTextView); - TextView secondLastNameEditText = findViewById(R.id.displayLastNameTextView); - TextView secondBirthCityEditText = findViewById(R.id.displayBirthDateTextView); - TextView secondBirthDeptSpinner = findViewById(R.id.displayBirthDeptTextView); - TextView secondBirthDateEditText = findViewById(R.id.displayBirthCityTextView); - LinearLayout secondPhonesLayout = findViewById(R.id.displayPhonesLayout); - - secondFirstNameEditText.setText(firstName); - secondLastNameEditText.setText(lastName); - secondBirthCityEditText.setText(birthCity); - secondBirthDeptSpinner.setText(birthDept); - secondBirthDateEditText.setText(birthDate); - - while (secondPhonesLayout.getChildCount() > 1) { - secondPhonesLayout.removeViewAt(1); - } - for (String phoneNumber : phoneNumbersList) { - addPhoneNumberToLayout(secondPhonesLayout, phoneNumber); - } - } - - @Override - protected void onStart() { - super.onStart(); - Log.i("Lifecycle", "onStart method"); - } - - @Override - protected void onRestart() { - super.onRestart(); - Log.i("Lifecycle", "onRestart method"); - } - - @Override - protected void onResume() { - super.onResume(); - Log.i("Lifecycle", "onResume method"); - this.restoreValues(); - } - - private void addPhoneNumberToLayout(ViewGroup viewGroup, String phoneNumber) { - LayoutInflater inflater = LayoutInflater.from(this); - - View phoneView = inflater.inflate(R.layout.phone_number_print, viewGroup, false); - - TextView phoneEditText = phoneView.findViewById(R.id.secondPhoneNumberTextView); - phoneEditText.setText(phoneNumber); - - viewGroup.addView(phoneView); - } - - public void callPhoneNumber(View v) { - ViewGroup phoneRow = (ViewGroup) v.getParent(); - TextView phoneTextView = phoneRow.findViewById(R.id.secondPhoneNumberTextView); - String phoneNumber = phoneTextView.getText().toString(); - - if (phoneNumber.trim().isEmpty()) { - Snackbar.make(findViewById(R.id.mainContent), getString(R.string.invalid_phone_number), Snackbar.LENGTH_LONG).show(); - return; - } - - // We check for the application "Call permission" - if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { - grantPermissionAlertDialog(); - return; - } - - // Just in case, we try/catch possible security exceptions - try { - Intent callIntent = new Intent(Intent.ACTION_CALL); - callIntent.setData(Uri.parse("tel:" + phoneNumber)); - startActivity(callIntent); - } catch (SecurityException e) { - Snackbar.make(v, getString(R.string.call_attempt_error) + e, Snackbar.LENGTH_SHORT).show(); - } - } - - - private void grantPermissionAlertDialog() { - new AlertDialog.Builder(this) - .setTitle(getString(R.string.call_permission_title)) - .setMessage(getString(R.string.call_permission_message)) - .setNegativeButton(getString(R.string.cancel), (dialog, which) -> Toast.makeText(DisplayUserActivity.this, getString(R.string.permission_denied), Toast.LENGTH_SHORT) - .show()) - .setPositiveButton("Ok", (dialog, which) -> ActivityCompat.requestPermissions(DisplayUserActivity.this, new String[]{Manifest.permission.CALL_PHONE}, 3)) - .create() - .show(); - } - - - -} diff --git a/app/src/main/java/fr/imt_atlantique/myfirstapplication/DisplayUserFragment.java b/app/src/main/java/fr/imt_atlantique/myfirstapplication/DisplayUserFragment.java index 633859d..1f48279 100644 --- a/app/src/main/java/fr/imt_atlantique/myfirstapplication/DisplayUserFragment.java +++ b/app/src/main/java/fr/imt_atlantique/myfirstapplication/DisplayUserFragment.java @@ -7,6 +7,8 @@ import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; @@ -101,7 +103,6 @@ public class DisplayUserFragment extends Fragment { phoneView.findViewById(R.id.callAPhoneNumberButton).setOnClickListener(v -> callPhoneNumber(v)); } - rootView = view; return view; } diff --git a/app/src/main/java/fr/imt_atlantique/myfirstapplication/EditUserFragment.java b/app/src/main/java/fr/imt_atlantique/myfirstapplication/EditUserFragment.java index 249e9a0..dfffe75 100644 --- a/app/src/main/java/fr/imt_atlantique/myfirstapplication/EditUserFragment.java +++ b/app/src/main/java/fr/imt_atlantique/myfirstapplication/EditUserFragment.java @@ -5,6 +5,8 @@ import android.content.SharedPreferences; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; @@ -39,6 +41,7 @@ public class EditUserFragment extends Fragment { private Spinner birthDeptSpinner; private Button birthDateButton, validateButton, addPhoneButton; private LinearLayout phonesLayout; + private Toolbar toolbar; private OnUserInfoSubmittedListener callback; @@ -104,6 +107,9 @@ public class EditUserFragment extends Fragment { validateButton = view.findViewById(R.id.validateButton); addPhoneButton = view.findViewById(R.id.addAPhoneNumberButton); phonesLayout = view.findViewById(R.id.phonesLayout); + toolbar = view.findViewById(R.id.mainToolbar); + + toolbar.inflateMenu(R.menu.menu_main); if (savedInstanceState != null) { firstNameEditText.setText(savedInstanceState.getString(ARG_FIRSTNAME, "")); diff --git a/app/src/main/java/fr/imt_atlantique/myfirstapplication/MainActivity.java b/app/src/main/java/fr/imt_atlantique/myfirstapplication/MainActivity.java index fd567eb..45f8589 100644 --- a/app/src/main/java/fr/imt_atlantique/myfirstapplication/MainActivity.java +++ b/app/src/main/java/fr/imt_atlantique/myfirstapplication/MainActivity.java @@ -2,8 +2,11 @@ package fr.imt_atlantique.myfirstapplication; import android.content.SharedPreferences; import android.os.Bundle; +import android.view.MenuItem; + import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; @@ -90,4 +93,7 @@ public class MainActivity extends AppCompatActivity implements EditUserFragment. editor.putStringSet(ARG_PHONES, new HashSet<>(phoneNumbersList)); editor.apply(); } + + public void resetAction(MenuItem item) { + } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_date.xml b/app/src/main/res/layout/activity_date.xml deleted file mode 100644 index 240fe6d..0000000 --- a/app/src/main/res/layout/activity_date.xml +++ /dev/null @@ -1,56 +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" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/date" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginStart="10dp" - android:layout_marginTop="100dp" - android:layout_marginEnd="10dp" - android:layout_marginBottom="100dp" - android:orientation="vertical" - android:background="@drawable/rounded_card" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent"> - - <DatePicker - android:id="@+id/datePicker" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:layout_marginBottom="16dp"/> - - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="horizontal"> - - <Button - android:id="@+id/validateDateButton" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="1" - android:background="@color/green" - android:textColor="@color/white" - android:text="@string/validate" /> - - <Button - android:id="@+id/cancel_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="1" - android:background="@color/red" - android:textColor="@color/white" - android:text="@string/cancel" /> - </LinearLayout> - - </LinearLayout> -</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_display_user.xml b/app/src/main/res/layout/activity_display_user.xml deleted file mode 100644 index 5045b28..0000000 --- a/app/src/main/res/layout/activity_display_user.xml +++ /dev/null @@ -1,172 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.coordinatorlayout.widget.CoordinatorLayout - 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/displayUserActivity" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fitsSystemWindows="true"> - - <ScrollView - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <LinearLayout - android:id="@+id/mainContent" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:padding="16dp"> - - <TextView - android:id="@+id/displayFirstNameTextViewLabel" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/first_name_label" /> - - <TextView - android:id="@+id/displayFirstNameTextView" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="2" - android:autofillHints="" - android:background="@drawable/rounded_edittext" - android:ems="10" - android:gravity="center" - android:hint="@string/first_name_placeholder" - android:inputType="text" - android:minHeight="48dp" - android:text="@string/first_name_label" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:padding="16dp"> - - <TextView - android:id="@+id/displayLastNameTextViewLabel" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/last_name_label" /> - - <TextView - android:id="@+id/displayLastNameTextView" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="2" - android:autofillHints="" - android:background="@drawable/rounded_edittext" - android:ems="10" - android:gravity="center" - android:hint="@string/last_name_placeholder" - android:minHeight="48dp" - android:text="@string/last_name_label" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:padding="16dp"> - - <TextView - android:id="@+id/displayBirthDateTextViewLabel" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/birth_date_label" /> - - <TextView - android:id="@+id/displayBirthDateTextView" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="2" - android:autofillHints="" - android:background="@drawable/rounded_edittext" - android:ems="10" - android:gravity="center" - android:minHeight="48dp" /> - - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:padding="16dp"> - - <TextView - android:id="@+id/displayBirthDeptTextViewLabel" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/birth_dept_label" /> - - <TextView - android:id="@+id/displayBirthDeptTextView" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="2" - android:autofillHints="" - android:background="@drawable/rounded_edittext" - android:ems="10" - android:gravity="center" - android:entries="@array/departments" - android:minHeight="48dp"/> - - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:padding="16dp"> - - <TextView - android:id="@+id/displayBirthCityTextViewLabel" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/birth_city_label" /> - - <TextView - android:id="@+id/displayBirthCityTextView" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="2" - android:autofillHints="" - android:background="@drawable/rounded_edittext" - android:ems="10" - android:gravity="center" - android:hint="@string/birth_city_placeholder" - android:minHeight="48dp" - android:text="@string/birth_city_placeholder" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/displayPhonesLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="16dp"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:padding="16dp"> - </LinearLayout> - </LinearLayout> - </LinearLayout> - </ScrollView> -</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout/fragment_display_user.xml b/app/src/main/res/layout/fragment_display_user.xml index 41af476..a964441 100644 --- a/app/src/main/res/layout/fragment_display_user.xml +++ b/app/src/main/res/layout/fragment_display_user.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.coordinatorlayout.widget.CoordinatorLayout 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/displayUserFragment" android:layout_width="match_parent" android:layout_height="match_parent" + android:fitsSystemWindows="true" tools:context=".DisplayUserFragment"> <ScrollView @@ -93,7 +96,6 @@ android:ems="10" android:gravity="center" android:minHeight="48dp" /> - </LinearLayout> <LinearLayout @@ -117,10 +119,9 @@ android:autofillHints="" android:background="@drawable/rounded_edittext" android:ems="10" - android:gravity="center" android:entries="@array/departments" - android:minHeight="48dp"/> - + android:gravity="center" + android:minHeight="48dp" /> </LinearLayout> <LinearLayout @@ -161,10 +162,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:padding="16dp"> - </LinearLayout> + android:padding="16dp" /> </LinearLayout> </LinearLayout> </ScrollView> - -</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file +</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout/fragment_edit_user.xml b/app/src/main/res/layout/fragment_edit_user.xml index c1815f1..c309c2a 100644 --- a/app/src/main/res/layout/fragment_edit_user.xml +++ b/app/src/main/res/layout/fragment_edit_user.xml @@ -9,9 +9,27 @@ android:fitsSystemWindows="true" tools:context=".EditUserFragment"> - <ScrollView + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appBarLayout" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="wrap_content" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + android:background="@color/black"> + + <androidx.appcompat.widget.Toolbar + android:id="@+id/mainToolbar" + android:layout_width="match_parent" + android:layout_height="50dp" + app:title="@string/app_name" + app:titleTextColor="@color/white" /> + </com.google.android.material.appbar.AppBarLayout> + + + + <androidx.core.widget.NestedScrollView + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior"> <LinearLayout android:id="@+id/mainContent" @@ -185,5 +203,5 @@ android:text="@string/validate" android:textColor="#FFFFFF"/> </LinearLayout> - </ScrollView> + </androidx.core.widget.NestedScrollView> </androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/phone_number_input.xml b/app/src/main/res/layout/phone_number_input.xml index 2ee5407..578d144 100644 --- a/app/src/main/res/layout/phone_number_input.xml +++ b/app/src/main/res/layout/phone_number_input.xml @@ -5,7 +5,8 @@ android:id="@+id/main_phones" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center"> + android:layout_gravity="center" + android:layout_marginBottom="8dp"> <TextView android:id="@+id/phoneNumberTextView" diff --git a/app/src/main/res/layout/phone_number_print.xml b/app/src/main/res/layout/phone_number_print.xml index 222d4d9..070d27e 100644 --- a/app/src/main/res/layout/phone_number_print.xml +++ b/app/src/main/res/layout/phone_number_print.xml @@ -5,7 +5,8 @@ android:id="@+id/main_phones" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center"> + android:layout_gravity="center" + android:layout_marginBottom="8dp"> <TextView android:id="@+id/phoneNumberTextView" @@ -36,7 +37,7 @@ app:layout_constraintStart_toEndOf="@+id/phoneNumberTextView" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.068" - app:layout_constraintWidth_percent="0.5" /> + app:layout_constraintWidth_percent="0.4" /> <Button android:id="@+id/callAPhoneNumberButton" diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index c447aa7..2376f79 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,6 +1,6 @@ <resources xmlns:tools="http://schemas.android.com/tools"> <!-- Base application theme. --> - <style name="Base.Theme.MyFirstApplication" parent="Theme.AppCompat.Light.DarkActionBar"> + <style name="Base.Theme.MyFirstApplication" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your light theme here. --> <!-- <item name="colorPrimary">@color/my_light_primary</item> --> </style> -- GitLab