mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Chnage backupprefs layout
This commit is contained in:
parent
c45957d813
commit
7aca0ee21b
7 changed files with 211 additions and 65 deletions
|
@ -87,7 +87,8 @@ public class CustomScannerActivity extends AppCompatActivity implements Decorate
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed(){
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
onCancel(this.getCurrentFocus());
|
||||
}
|
||||
|
||||
|
|
|
@ -310,8 +310,7 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
startActivity(new Intent(this, WelcomeActivity.class));
|
||||
return true;
|
||||
} else if (id == R.id.ImportExport) {
|
||||
//backupPrescriptions();
|
||||
// TODO: a changer ainsi que le menu.
|
||||
backupprefs();
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
@ -711,4 +710,33 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
}
|
||||
void backupprefs() {
|
||||
final Dialog dlg = new Dialog(this);
|
||||
dlg.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
Objects.requireNonNull(dlg.getWindow()).setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
||||
dlg.setContentView(R.layout.backupprefs);
|
||||
dlg.setCancelable(false);
|
||||
|
||||
Button btn_export = dlg.findViewById(R.id.switch_btn_export);
|
||||
Button btn_import = dlg.findViewById(R.id.switch_btn_import);
|
||||
Button btn_location = dlg.findViewById(R.id.btn_backup_location);
|
||||
Button btn_properties = dlg.findViewById(R.id.btn_properties);
|
||||
|
||||
btn_export.setEnabled(true);
|
||||
btn_import.setEnabled(false);
|
||||
|
||||
Button ok = dlg.findViewById(R.id.ok_btn);
|
||||
Button cancel = dlg.findViewById(R.id.cancel_btn);
|
||||
ok.setOnClickListener(v -> {
|
||||
dlg.cancel();
|
||||
//TODO: manage the options
|
||||
Log.i(TAG, "ok button");
|
||||
});
|
||||
|
||||
cancel.setOnClickListener(v -> {
|
||||
dlg.cancel();
|
||||
Log.i(TAG, "dismiss dialog");
|
||||
});
|
||||
dlg.show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,75 +1,148 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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/cl_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="16dp"
|
||||
tools:ignore="HardcodedText"
|
||||
tools:context=".DrugListActivity">
|
||||
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:id="@+id/materialCardView"
|
||||
android:layout_width="370dp"
|
||||
android:layout_height="319dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
app:cardCornerRadius="@dimen/btn_radius"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.35">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/btn_addFruit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="32dp"
|
||||
android:src="@drawable/ic_add"
|
||||
android:contentDescription="Add new Fruit" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_properties"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="160dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
app:layout_anchor="@+id/constraintLayout"
|
||||
app:layout_anchorGravity="center">
|
||||
|
||||
|
||||
|
||||
<include layout="@layout/custom_switch_btn"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/switch_btn_export"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:layout_marginEnd="68dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/selected_background"
|
||||
android:gravity="center"
|
||||
android:paddingStart="25dp"
|
||||
android:paddingEnd="25dp"
|
||||
android:text="@string/export_prescriptions"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/switch_btn_import"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/switch_btn_import" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_backup_location"
|
||||
style="@style/Widget.MaterialComponents.Button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded_btn"
|
||||
android:text="Backup Location"
|
||||
android:textAllCaps="false"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||
android:textColor="@android:color/white" />
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/switch_btn_import"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/unselected_background"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:paddingStart="25dp"
|
||||
android:paddingEnd="25dp"
|
||||
android:text="@string/import_prescriptions"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toStartOf="@+id/switch_btn_export"
|
||||
app:layout_constraintHorizontal_bias="0.99"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:layout_editor_absoluteY="93dp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/notagreed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@drawable/rounded_btn"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:paddingStart="25dp"
|
||||
android:paddingEnd="25dp"
|
||||
android:text="@string/button_cancel"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/agreed"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:ignore="HardcodedText,SpUsage" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_properties"
|
||||
style="@style/Widget.MaterialComponents.Button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/rounded_btn"
|
||||
android:text="Properties"
|
||||
android:textAllCaps="false"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||
android:textColor="@android:color/white" />
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_backup_location"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="76dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:background="@drawable/rounded_btn"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:paddingStart="25dp"
|
||||
android:paddingEnd="25dp"
|
||||
android:text="@string/location"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/btn_properties"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_properties"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/btn_properties"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_properties"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="68dp"
|
||||
android:background="@drawable/rounded_btn"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:paddingStart="25dp"
|
||||
android:paddingEnd="25dp"
|
||||
android:text="@string/properties"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:layout_editor_absoluteY="173dp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/agreed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/rounded_btn"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:paddingStart="25dp"
|
||||
android:paddingEnd="25dp"
|
||||
android:text="@string/button_ok"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/notagreed"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/notagreed"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
tools:ignore="HardcodedText,SpUsage" />
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/shapeableImageView"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@drawable/shadow_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:layout_conversion_absoluteHeight="61dp"
|
||||
tools:layout_conversion_absoluteWidth="61dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
40
app/src/main/res/layout/btn_okcancel.xml
Normal file
40
app/src/main/res/layout/btn_okcancel.xml
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?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/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Button
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:id="@+id/ok_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="178dp"
|
||||
android:text="@string/button_ok"
|
||||
android:textColor="@color/white"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
app:layout_constraintEnd_toStartOf="@+id/cancel_btn"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
|
||||
android:id="@+id/cancel_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/button_cancel"
|
||||
android:textColor="@color/white"
|
||||
android:backgroundTint="@color/material_on_surface_disabled"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/ok_btn"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
android:layout_height="237dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
app:cardCornerRadius="11dp"
|
||||
app:cardCornerRadius="@dimen/btn_radius"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
@ -74,4 +74,6 @@
|
|||
<string name="Undo">Annuler</string>
|
||||
<string name="trash_icon">Icône de poubelle</string>
|
||||
<string name="addInList">Ajouter à votre liste de médicament</string>
|
||||
<string name="location">Chemin</string>
|
||||
<string name="properties">Préférences</string>
|
||||
</resources>
|
||||
|
|
|
@ -79,4 +79,6 @@
|
|||
<string name="import_export" translatable="false">Import/Export</string>
|
||||
<string name="import_prescriptions" translatable="false">Import</string>
|
||||
<string name="export_prescriptions" translatable="false">Export</string>
|
||||
<string name="location">Location</string>
|
||||
<string name="properties">Properties</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue