Browse Source

Finished the App. Finally!

master
Yiğit Çolakoğlu 7 years ago
parent
commit
b9179c11b9
7 changed files with 529 additions and 3 deletions
  1. BIN
      FoodCloud/.idea/caches/build_file_checksums.ser
  2. +5
    -1
      FoodCloud/app/src/main/AndroidManifest.xml
  3. +8
    -0
      FoodCloud/app/src/main/java/gq/yigit/foodcloud/LearnMore.java
  4. +67
    -1
      FoodCloud/app/src/main/java/gq/yigit/foodcloud/PopTrans1.java
  5. +79
    -0
      FoodCloud/app/src/main/java/gq/yigit/foodcloud/PopTrans2.java
  6. +180
    -1
      FoodCloud/app/src/main/res/layout/activity_pop_trans1.xml
  7. +190
    -0
      FoodCloud/app/src/main/res/layout/activity_pop_trans2.xml

BIN
FoodCloud/.idea/caches/build_file_checksums.ser View File


+ 5
- 1
FoodCloud/app/src/main/AndroidManifest.xml View File

@ -36,7 +36,11 @@
<activity
android:name=".PackagePop"
android:theme="@style/AppTheme.Popup" />
<activity android:name=".PopTrans1" android:theme="@style/AppTheme.Popup"/>
<activity
android:name=".PopTrans1"
android:theme="@style/AppTheme.Popup" />
<activity android:name=".PopTrans2"
android:theme="@style/AppTheme.Popup"/>
</application>
</manifest>

+ 8
- 0
FoodCloud/app/src/main/java/gq/yigit/foodcloud/LearnMore.java View File

@ -96,6 +96,14 @@ public class LearnMore extends AppCompatActivity implements View.OnClickListener
Intent i = new Intent(LearnMore.this, PackagePop.class);
i.putExtra("key", process.get("Packaging").toString());
startActivity(i);
} else if (v.getId() == R.id.trans1) {
Intent i = new Intent(LearnMore.this, PopTrans1.class);
i.putExtra("key", process.get("Transport1").toString());
startActivity(i);
} else if (v.getId() == R.id.trans2) {
Intent i = new Intent(LearnMore.this, PopTrans2.class);
i.putExtra("key", process.get("Transport2").toString());
startActivity(i);
}
}catch(JSONException e){
Log.d(TAG,"An error occured with json");


+ 67
- 1
FoodCloud/app/src/main/java/gq/yigit/foodcloud/PopTrans1.java View File

@ -1,13 +1,79 @@
package gq.yigit.foodcloud;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
public class PopTrans1 extends AppCompatActivity {
import org.json.JSONException;
import org.json.JSONObject;
import static android.support.constraint.Constraints.TAG;
public class PopTrans1 extends Activity {
public TextView duration;
public TextView from;
public TextView to;
public TextView stop;
public TextView cond;
public TextView safe_txt;
public ImageView safe_img;
public boolean safe;
public boolean stop_cond;
public boolean cond_cond;
public JSONObject json_trans1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pop_trans1);
duration = (TextView)findViewById(R.id.duration);
from = (TextView)findViewById(R.id.from);
safe_txt = (TextView)findViewById(R.id.safe_txt);
to = (TextView)findViewById(R.id.to);
stop = (TextView)findViewById(R.id.stop);
cond = (TextView)findViewById(R.id.cond);
safe_img = (ImageView) findViewById(R.id.safe_img);
Bundle extras = getIntent().getExtras();
if (extras != null) {
try {
json_trans1 = new JSONObject(extras.getString("key"));
duration.setText(json_trans1.get("Duration").toString() + " hours");
safe = (boolean)json_trans1.get("Problematic");
to.setText(json_trans1.get("Moved to,from").toString().split("-")[1]);
from.setText(json_trans1.get("Moved to,from").toString().split("-")[0]);
stop_cond = (boolean)json_trans1.get("Stopped");
cond_cond = (boolean)json_trans1.get("Condition");
}catch(JSONException e){
Log.d(TAG,"An error occured with json!");
}
}
if(safe){
safe_img.setImageResource(R.mipmap.warning);
safe_txt.setText("Warning, there was an error in the harvestment of this product. We recommend that you don't consume it!");
}else{
safe_img.setImageResource(R.mipmap.check);
safe_txt.setText("This product did not have any problems during harvesting. It is safe to consume!");
}
if(stop_cond){
stop.setText("Yes");
}else{
stop.setText("No");
}
if(cond_cond){
cond.setText("Yes");
}else{
cond.setText("No");
}
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = dm.widthPixels;
int height = dm.heightPixels;
getWindow().setLayout((int)(width*0.8), (int)(height*0.72));
}
}

+ 79
- 0
FoodCloud/app/src/main/java/gq/yigit/foodcloud/PopTrans2.java View File

@ -0,0 +1,79 @@
package gq.yigit.foodcloud;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
import org.json.JSONException;
import org.json.JSONObject;
import static android.support.constraint.Constraints.TAG;
public class PopTrans2 extends Activity {
public TextView duration;
public TextView from;
public TextView to;
public TextView stop;
public TextView cond;
public TextView safe_txt;
public ImageView safe_img;
public boolean safe;
public boolean stop_cond;
public boolean cond_cond;
public JSONObject json_trans2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pop_trans2);
duration = (TextView)findViewById(R.id.duration);
from = (TextView)findViewById(R.id.from);
safe_txt = (TextView)findViewById(R.id.safe_txt);
to = (TextView)findViewById(R.id.to);
stop = (TextView)findViewById(R.id.stop);
cond = (TextView)findViewById(R.id.cond);
safe_img = (ImageView) findViewById(R.id.safe_img);
Bundle extras = getIntent().getExtras();
if (extras != null) {
try {
json_trans2 = new JSONObject(extras.getString("key"));
duration.setText(json_trans2.get("Duration").toString() + " hours");
safe = (boolean)json_trans2.get("Problematic");
to.setText(json_trans2.get("Moved to,from").toString().split("-")[1]);
from.setText(json_trans2.get("Moved to,from").toString().split("-")[0]);
stop_cond = (boolean)json_trans2.get("Stopped");
cond_cond = (boolean)json_trans2.get("Condition");
}catch(JSONException e){
Log.d(TAG,"An error occured with json!");
}
}
if(safe){
safe_img.setImageResource(R.mipmap.warning);
safe_txt.setText("Warning, there was an error in the harvestment of this product. We recommend that you don't consume it!");
}else{
safe_img.setImageResource(R.mipmap.check);
safe_txt.setText("This product did not have any problems during harvesting. It is safe to consume!");
}
if(stop_cond){
stop.setText("Yes");
}else{
stop.setText("No");
}
if(cond_cond){
cond.setText("Yes");
}else{
cond.setText("No");
}
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = dm.widthPixels;
int height = dm.heightPixels;
getWindow().setLayout((int)(width*0.8), (int)(height*0.72));
}
}

+ 180
- 1
FoodCloud/app/src/main/res/layout/activity_pop_trans1.xml View File

@ -5,6 +5,185 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PopTrans1"
android:background="@drawable/process_bg">
android:background="@drawable/process_bg">
<TextView
android:id="@+id/duration_const"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="504dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="40dp"
android:layout_marginTop="86dp"
android:text="Duration:"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold|italic"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="44dp"
android:layout_marginTop="12dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="@+id/duration_const"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/duration_const"
app:layout_constraintTop_toBottomOf="@+id/duration_const" />
<TextView
android:id="@+id/from_const"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
android:text="Moved From:"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold|italic"
app:layout_constraintEnd_toEndOf="@+id/duration"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/duration"
app:layout_constraintTop_toBottomOf="@+id/duration" />
<TextView
android:id="@+id/from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="@+id/from_const"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/from_const"
app:layout_constraintTop_toBottomOf="@+id/from_const" />
<TextView
android:id="@+id/to_const"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
android:text="Moved To:"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold|italic"
app:layout_constraintEnd_toEndOf="@+id/from"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/from"
app:layout_constraintTop_toBottomOf="@+id/from" />
<TextView
android:id="@+id/to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="@+id/to_const"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/to_const"
app:layout_constraintTop_toBottomOf="@+id/to_const" />
<TextView
android:id="@+id/stop_const"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="12dp"
android:text="Did the Vehicle Stop:"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold|italic"
app:layout_constraintEnd_toEndOf="@+id/to"
app:layout_constraintHorizontal_bias="0.062"
app:layout_constraintStart_toStartOf="@+id/to"
app:layout_constraintTop_toBottomOf="@+id/to" />
<TextView
android:id="@+id/stop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="@+id/stop_const"
app:layout_constraintHorizontal_bias="0.175"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/stop_const" />
<TextView
android:id="@+id/cond_const"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="Were the Conditions Right:"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold|italic"
app:layout_constraintEnd_toEndOf="@+id/stop"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/stop"
app:layout_constraintTop_toBottomOf="@+id/stop" />
<TextView
android:id="@+id/cond"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="@+id/cond_const"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/cond_const"
app:layout_constraintTop_toBottomOf="@+id/cond_const" />
<ImageView
android:id="@+id/safe_img"
android:layout_width="64dp"
android:layout_height="60dp"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
app:layout_constraintEnd_toEndOf="@+id/cond"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/cond"
app:layout_constraintTop_toBottomOf="@+id/cond"
app:srcCompat="@mipmap/check" />
<TextView
android:id="@+id/safe_txt"
android:layout_width="193dp"
android:layout_height="79dp"
android:layout_marginStart="4dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintBottom_toBottomOf="@+id/safe_img"
app:layout_constraintStart_toEndOf="@+id/safe_img"
app:layout_constraintTop_toTopOf="@+id/safe_img"
app:layout_constraintVertical_bias="0.0" />
</android.support.constraint.ConstraintLayout>

+ 190
- 0
FoodCloud/app/src/main/res/layout/activity_pop_trans2.xml View File

@ -0,0 +1,190 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PopTrans2"
android:background="@drawable/process_bg">
<TextView
android:id="@+id/duration_const"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="504dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="40dp"
android:layout_marginTop="86dp"
android:text="Duration:"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold|italic"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="44dp"
android:layout_marginTop="12dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="@+id/duration_const"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/duration_const"
app:layout_constraintTop_toBottomOf="@+id/duration_const" />
<TextView
android:id="@+id/from_const"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
android:text="Moved From:"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold|italic"
app:layout_constraintEnd_toEndOf="@+id/duration"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/duration"
app:layout_constraintTop_toBottomOf="@+id/duration" />
<TextView
android:id="@+id/from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="@+id/from_const"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/from_const"
app:layout_constraintTop_toBottomOf="@+id/from_const" />
<TextView
android:id="@+id/to_const"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
android:text="Moved To:"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold|italic"
app:layout_constraintEnd_toEndOf="@+id/from"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/from"
app:layout_constraintTop_toBottomOf="@+id/from" />
<TextView
android:id="@+id/to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="@+id/to_const"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/to_const"
app:layout_constraintTop_toBottomOf="@+id/to_const" />
<TextView
android:id="@+id/stop_const"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="12dp"
android:text="Did the Vehicle Stop:"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold|italic"
app:layout_constraintEnd_toEndOf="@+id/to"
app:layout_constraintHorizontal_bias="0.062"
app:layout_constraintStart_toStartOf="@+id/to"
app:layout_constraintTop_toBottomOf="@+id/to" />
<TextView
android:id="@+id/stop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="@+id/stop_const"
app:layout_constraintHorizontal_bias="0.175"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/stop_const" />
<TextView
android:id="@+id/cond_const"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="Were the Conditions Right:"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold|italic"
app:layout_constraintEnd_toEndOf="@+id/stop"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/stop"
app:layout_constraintTop_toBottomOf="@+id/stop" />
<TextView
android:id="@+id/cond"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="@+id/cond_const"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/cond_const"
app:layout_constraintTop_toBottomOf="@+id/cond_const" />
<ImageView
android:id="@+id/safe_img"
android:layout_width="64dp"
android:layout_height="60dp"
android:layout_marginEnd="8dp"
android:layout_marginTop="12dp"
app:layout_constraintEnd_toEndOf="@+id/cond"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/cond"
app:layout_constraintTop_toBottomOf="@+id/cond"
app:srcCompat="@mipmap/check" />
<TextView
android:id="@+id/safe_txt"
android:layout_width="193dp"
android:layout_height="79dp"
android:layout_marginStart="4dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintBottom_toBottomOf="@+id/safe_img"
app:layout_constraintStart_toEndOf="@+id/safe_img"
app:layout_constraintTop_toTopOf="@+id/safe_img"
app:layout_constraintVertical_bias="0.0" />
</android.support.constraint.ConstraintLayout>

Loading…
Cancel
Save