Compare commits

...

3 commits

Author SHA1 Message Date
jacques
940aad20d4 WIP. add database import/export 2024-07-15 21:13:22 +02:00
jacques
94378ec2c2 Add color, chnage backupprefs, DrugDetailActivity. 2024-07-15 21:12:47 +02:00
jacques
b7e55fad28 Some tweak in backupprefs
Fix issue in DrugListActivity
The backupprefs dialog is displayed but the button are not usable, except cancel
2024-07-12 09:52:22 +02:00
4 changed files with 22 additions and 3 deletions

View file

@ -10,8 +10,10 @@ import android.widget.TextView;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
import net.foucry.pilldroid.dao.PrescriptionsDAO;
import net.foucry.pilldroid.databases.PrescriptionDatabase;
import net.foucry.pilldroid.models.Prescription;

View file

@ -42,6 +42,7 @@ import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
@ -711,6 +712,8 @@ public class DrugListActivity extends AppCompatActivity {
}
}
void backupprefs() {
Log.i(TAG, "backupprefs");
final Dialog dlg = new Dialog(this);
dlg.requestWindowFeature(Window.FEATURE_NO_TITLE);
Objects.requireNonNull(dlg.getWindow()).setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
@ -725,12 +728,15 @@ public class DrugListActivity extends AppCompatActivity {
btn_export.setEnabled(true);
btn_import.setEnabled(false);
Button ok = dlg.findViewById(R.id.ok_btn);
Button cancel = dlg.findViewById(R.id.cancel_btn);
Button ok = dlg.findViewById(R.id.agreed);
Button cancel = dlg.findViewById(R.id.notagreed);
PrescriptionDatabase prescriptions = PrescriptionDatabase.getInstanceDatabase(this);
ok.setOnClickListener(v -> {
dlg.cancel();
//TODO: manage the options
Log.i(TAG, "ok button");
});
cancel.setOnClickListener(v -> {
@ -738,5 +744,14 @@ public class DrugListActivity extends AppCompatActivity {
Log.i(TAG, "dismiss dialog");
});
dlg.show();
Log.i(TAG, "ok button");
if ( btn_export.isEnabled() {
// TODO: call `make backup
prescriptions.backup();
} else {
// TODO: call restore backup
}
}
}

View file

@ -12,6 +12,7 @@
android:layout_height="319dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@color/lightgrey"
app:cardCornerRadius="@dimen/btn_radius"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View file

@ -20,4 +20,5 @@
<color name="grey">#777</color>
<color name="unselected_background">#777777</color>
<color name="selected_background">#4f91ff</color>
<color name="lightgrey">#ACABAC</color>
</resources>