mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-14 01:21:35 +01:00
Compare commits
3 commits
51d36dc297
...
940aad20d4
Author | SHA1 | Date | |
---|---|---|---|
|
940aad20d4 | ||
|
94378ec2c2 | ||
|
b7e55fad28 |
4 changed files with 22 additions and 3 deletions
|
@ -10,8 +10,10 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.google.android.material.appbar.MaterialToolbar;
|
import com.google.android.material.appbar.MaterialToolbar;
|
||||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||||
|
|
||||||
import net.foucry.pilldroid.dao.PrescriptionsDAO;
|
import net.foucry.pilldroid.dao.PrescriptionsDAO;
|
||||||
import net.foucry.pilldroid.databases.PrescriptionDatabase;
|
import net.foucry.pilldroid.databases.PrescriptionDatabase;
|
||||||
import net.foucry.pilldroid.models.Prescription;
|
import net.foucry.pilldroid.models.Prescription;
|
||||||
|
|
|
@ -42,6 +42,7 @@ import androidx.core.content.ContextCompat;
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.room.Room;
|
import androidx.room.Room;
|
||||||
|
import androidx.room.RoomDatabase;
|
||||||
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
@ -711,6 +712,8 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void backupprefs() {
|
void backupprefs() {
|
||||||
|
Log.i(TAG, "backupprefs");
|
||||||
|
|
||||||
final Dialog dlg = new Dialog(this);
|
final Dialog dlg = new Dialog(this);
|
||||||
dlg.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
dlg.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
Objects.requireNonNull(dlg.getWindow()).setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
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_export.setEnabled(true);
|
||||||
btn_import.setEnabled(false);
|
btn_import.setEnabled(false);
|
||||||
|
|
||||||
Button ok = dlg.findViewById(R.id.ok_btn);
|
Button ok = dlg.findViewById(R.id.agreed);
|
||||||
Button cancel = dlg.findViewById(R.id.cancel_btn);
|
Button cancel = dlg.findViewById(R.id.notagreed);
|
||||||
|
|
||||||
|
PrescriptionDatabase prescriptions = PrescriptionDatabase.getInstanceDatabase(this);
|
||||||
|
|
||||||
|
|
||||||
ok.setOnClickListener(v -> {
|
ok.setOnClickListener(v -> {
|
||||||
dlg.cancel();
|
dlg.cancel();
|
||||||
//TODO: manage the options
|
//TODO: manage the options
|
||||||
Log.i(TAG, "ok button");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cancel.setOnClickListener(v -> {
|
cancel.setOnClickListener(v -> {
|
||||||
|
@ -738,5 +744,14 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
Log.i(TAG, "dismiss dialog");
|
Log.i(TAG, "dismiss dialog");
|
||||||
});
|
});
|
||||||
dlg.show();
|
dlg.show();
|
||||||
|
|
||||||
|
Log.i(TAG, "ok button");
|
||||||
|
if ( btn_export.isEnabled() {
|
||||||
|
// TODO: call `make backup
|
||||||
|
prescriptions.backup();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// TODO: call restore backup
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
android:layout_height="319dp"
|
android:layout_height="319dp"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
|
android:background="@color/lightgrey"
|
||||||
app:cardCornerRadius="@dimen/btn_radius"
|
app:cardCornerRadius="@dimen/btn_radius"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|
|
@ -20,4 +20,5 @@
|
||||||
<color name="grey">#777</color>
|
<color name="grey">#777</color>
|
||||||
<color name="unselected_background">#777777</color>
|
<color name="unselected_background">#777777</color>
|
||||||
<color name="selected_background">#4f91ff</color>
|
<color name="selected_background">#4f91ff</color>
|
||||||
|
<color name="lightgrey">#ACABAC</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue