mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-18 02:51:38 +01:00
Put Schoumi chqnges; remove dead import; clean part of code
This commit is contained in:
parent
9a1e25a356
commit
1a7e6c063a
3 changed files with 36 additions and 27 deletions
|
@ -22,21 +22,21 @@ public class MedicamentDetailActivity extends AppCompatActivity {
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_medicament_detail);
|
setContentView(R.layout.activity_medicament_detail);
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.detail_toolbar);
|
Toolbar toolbar = findViewById(R.id.detail_toolbar);
|
||||||
|
|
||||||
if (toolbar != null) {
|
if (toolbar != null) {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
toolbar.setTitle(getTitle());
|
toolbar.setTitle(getTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
FloatingActionButton fab = findViewById(R.id.fab);
|
||||||
fab.setOnClickListener(new View.OnClickListener() {
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Snackbar.make(view, "Will be use to save changes in a drug", Snackbar.LENGTH_LONG)
|
Snackbar.make(view, "Will be use to save changes in a drug", Snackbar.LENGTH_LONG)
|
||||||
.setAction("Action", null).show();
|
.setAction("Action", null).show();
|
||||||
setResult(1);
|
setResult(1);
|
||||||
return;
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.foucry.pilldroid;
|
package net.foucry.pilldroid;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.support.design.widget.CollapsingToolbarLayout;
|
import android.support.design.widget.CollapsingToolbarLayout;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
@ -8,6 +9,7 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A fragment representing a single Medicament detail screen.
|
* A fragment representing a single Medicament detail screen.
|
||||||
|
@ -68,32 +70,32 @@ public class MedicamentDetailFragment extends Fragment {
|
||||||
if (medicament != null) {
|
if (medicament != null) {
|
||||||
// Find each conponment of rootView
|
// Find each conponment of rootView
|
||||||
nameView = detailView.findViewById(R.id.name_cell);
|
nameView = detailView.findViewById(R.id.name_cell);
|
||||||
TextView nameLabel = (TextView) nameView.findViewById(R.id.label);
|
TextView nameLabel = nameView.findViewById(R.id.label);
|
||||||
TextView nameValeur = (TextView) nameView.findViewById(R.id.valeur);
|
TextView nameValeur = nameView.findViewById(R.id.valeur);
|
||||||
nameLabel.setText("Nom");
|
nameLabel.setText("Nom");
|
||||||
nameValeur.setText(medicament.getNom());
|
nameValeur.setText(medicament.getNom());
|
||||||
|
|
||||||
presentationView = detailView.findViewById(R.id.presentation_cell);
|
presentationView = detailView.findViewById(R.id.presentation_cell);
|
||||||
TextView presentationLabel = (TextView) presentationView.findViewById(R.id.label);
|
TextView presentationLabel = presentationView.findViewById(R.id.label);
|
||||||
TextView presentationValeur = (TextView) presentationView.findViewById(R.id.valeur);
|
TextView presentationValeur = presentationView.findViewById(R.id.valeur);
|
||||||
presentationLabel.setText("Presentation");
|
presentationLabel.setText("Presentation");
|
||||||
presentationValeur.setText(medicament.getPresentation());
|
presentationValeur.setText(medicament.getPresentation());
|
||||||
|
|
||||||
adminModeView = detailView.findViewById(R.id.administration_cell);
|
adminModeView = detailView.findViewById(R.id.administration_cell);
|
||||||
TextView adminModeLabel = (TextView) adminModeView.findViewById(R.id.label);
|
TextView adminModeLabel = adminModeView.findViewById(R.id.label);
|
||||||
TextView adminModeValeur = (TextView) adminModeView.findViewById(R.id.valeur);
|
TextView adminModeValeur = adminModeView.findViewById(R.id.valeur);
|
||||||
adminModeLabel.setText("Mode d'administration");
|
adminModeLabel.setText("Mode d'administration");
|
||||||
adminModeValeur.setText(medicament.getMode_administration());
|
adminModeValeur.setText(medicament.getMode_administration());
|
||||||
|
|
||||||
stockView = detailView.findViewById(R.id.stock_cell);
|
stockView = detailView.findViewById(R.id.stock_cell);
|
||||||
TextView stockLibelle = (TextView) stockView.findViewById(R.id.libelle);
|
TextView stockLibelle = (stockView.findViewById(R.id.libelle));
|
||||||
TextView stockValue = (TextView) stockView.findViewById(R.id.valeur);
|
TextView stockValue = stockView.findViewById(R.id.valeur);
|
||||||
stockLibelle.setText("Stock courant");
|
stockLibelle.setText("Stock courant");
|
||||||
stockValue.setText(Double.toString(medicament.getStock()));
|
stockValue.setText(Double.toString(medicament.getStock()));
|
||||||
|
|
||||||
priseView = detailView.findViewById(R.id.prise_cell);
|
priseView = detailView.findViewById(R.id.prise_cell);
|
||||||
TextView priseLibelle = (TextView) priseView.findViewById(R.id.libelle);
|
TextView priseLibelle = priseView.findViewById(R.id.libelle);
|
||||||
TextView priseValue = (TextView) priseView.findViewById(R.id.valeur);
|
TextView priseValue = (priseView.findViewById(R.id.valeur));
|
||||||
priseLibelle.setText("Prise");
|
priseLibelle.setText("Prise");
|
||||||
priseValue.setText(Double.toString(medicament.getPrise()));
|
priseValue.setText(Double.toString(medicament.getPrise()));
|
||||||
|
|
||||||
|
@ -104,12 +106,19 @@ public class MedicamentDetailFragment extends Fragment {
|
||||||
warningValue.setText(Integer.toString(medicament.getWarnThreshold()));
|
warningValue.setText(Integer.toString(medicament.getWarnThreshold()));
|
||||||
|
|
||||||
alertView = detailView.findViewById(R.id.alert_cell);
|
alertView = detailView.findViewById(R.id.alert_cell);
|
||||||
TextView alertLibelle = (TextView) alertView.findViewById(R.id.libelle);
|
TextView alertLibelle = alertView.findViewById(R.id.libelle);
|
||||||
TextView alertValue = (TextView) alertView.findViewById(R.id.valeur);
|
TextView alertValue = alertView.findViewById(R.id.valeur);
|
||||||
alertLibelle.setText("Seuil critique");
|
alertLibelle.setText("Seuil critique");
|
||||||
alertValue.setText(Integer.toString(medicament.getAlertThreshold()));
|
alertValue.setText(Integer.toString(medicament.getAlertThreshold()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return detailView;
|
return detailView;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void onStop()
|
||||||
|
{
|
||||||
|
Context context = getContext();
|
||||||
|
Toast.makeText(context, "***PROUT***", Toast.LENGTH_SHORT).show();
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
@ -107,7 +106,7 @@ public class MedicamentListActivity extends AppCompatActivity {
|
||||||
dbHelper = new DBHelper(this);
|
dbHelper = new DBHelper(this);
|
||||||
dbMedoc = new DBMedoc(this);
|
dbMedoc = new DBMedoc(this);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
|
||||||
if (toolbar != null) {
|
if (toolbar != null) {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
@ -319,10 +318,11 @@ public class MedicamentListActivity extends AppCompatActivity {
|
||||||
// Handle cancel
|
// Handle cancel
|
||||||
Toast.makeText(context, "Scan annulé", Toast.LENGTH_LONG).show();
|
Toast.makeText(context, "Scan annulé", Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
Toast.makeText(context, "back from detail", Toast.LENGTH_SHORT).show();
|
else if (requestCode == 1) {
|
||||||
}
|
// TODO : Si requestCode=1 -> Sauvegarde du medoc dans la base et raffraichissement de la base.
|
||||||
} // TODO : Si requestCode=1 -> Sauvegarde du medoc dans la base et raffraichissement de la base.
|
Toast.makeText(context, "back from detail == "+requestCode, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupRecyclerView(@NonNull RecyclerView recyclerView) {
|
private void setupRecyclerView(@NonNull RecyclerView recyclerView) {
|
||||||
|
@ -442,8 +442,8 @@ public class MedicamentListActivity extends AppCompatActivity {
|
||||||
Context context = v.getContext();
|
Context context = v.getContext();
|
||||||
Intent intent = new Intent(context, MedicamentDetailActivity.class);
|
Intent intent = new Intent(context, MedicamentDetailActivity.class);
|
||||||
intent.putExtra("medicament", medicamentCourant);
|
intent.putExtra("medicament", medicamentCourant);
|
||||||
|
int requestCode = 1;
|
||||||
context.startActivity(intent);
|
startActivityForResult(intent, requestCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -466,10 +466,10 @@ public class MedicamentListActivity extends AppCompatActivity {
|
||||||
ViewHolder(View view) {
|
ViewHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
mView = view;
|
mView = view;
|
||||||
mIDView = (TextView) view.findViewById(R.id.cip13);
|
mIDView = view.findViewById(R.id.cip13);
|
||||||
mContentView = (TextView) view.findViewById(R.id.valeur);
|
mContentView = view.findViewById(R.id.valeur);
|
||||||
mEndOfStock = (TextView) view.findViewById(R.id.endOfStock);
|
mEndOfStock = view.findViewById(R.id.endOfStock);
|
||||||
mIconView = (ImageView) view.findViewById(R.id.list_image);
|
mIconView = view.findViewById(R.id.list_image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue