Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# build-gigapet-AND
# build-gigapet-AND

## App that allows parents to encourage their children to live a healthier live by associating the foods they eat with the effects on a digital pet that they're resposible of taking care of.


### App is stable, but Not all MVP features are currently working, I'll continue to work on this project over the upcoming months to get it to a market ready product.
1 change: 1 addition & 0 deletions app/debug/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-debug.apk","fullName":"debug","baseName":"debug"},"path":"app-debug.apk","properties":{}}]
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<application
android:usesCleartextTraffic="true"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/ic_launcher_blob"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_launcher_blob_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<activity
android:name=".LoginActivity"
android:label="@string/title_activity_login"
android:label="Gigapet"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Binary file added app/src/main/ic_launcher_blob-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 81 additions & 0 deletions app/src/main/java/com/example/gigapet/AddFoodListAdapter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package com.example.gigapet;

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.ArrayList;

public class AddFoodListAdapter extends RecyclerView.Adapter<AddFoodListAdapter.ViewHolder> {

public AddFoodListAdapter() {
}

class ViewHolder extends RecyclerView.ViewHolder {
Context context;
ImageView ivMinusButton;
ImageView ivPlusButton;
ImageView ivFoodImage;
ImageView ivFoodBackground;
TextView tvFoodAmount;
View vParentView;

public ViewHolder(@NonNull View itemView) {
super(itemView);
ivFoodBackground = itemView.findViewById(R.id.iv_food);
ivFoodImage = itemView.findViewById(R.id.iv_food_icon);
tvFoodAmount = itemView.findViewById(R.id.tv_num);
ivMinusButton = itemView.findViewById(R.id.iv_button_food_minus);
ivPlusButton = itemView.findViewById(R.id.iv_button_food_plus);
vParentView = itemView.findViewById(R.id.recycler_view_item_add_food);
}
}

@NonNull
@Override
public AddFoodListAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.food_add_item_layout, parent, false);
return new ViewHolder(v);
}

@Override
public void onBindViewHolder(@NonNull final AddFoodListAdapter.ViewHolder viewHolder, int i) {
viewHolder.tvFoodAmount.setText(String.valueOf(Constants.ADD_FOOD_ARRAY[i]));
viewHolder.ivFoodImage.setImageResource(DrawableResolver.getDrawableImageIcon(i));
viewHolder.ivFoodBackground.setImageResource(DrawableResolver.getDrawableIcon(i));
final int position = i;
viewHolder.ivMinusButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Constants.ADD_FOOD_ARRAY[position] > 0) {
Constants.ADD_FOOD_ARRAY[position]--;
viewHolder.tvFoodAmount.setText(String.valueOf(Constants.ADD_FOOD_ARRAY[position]));
}
notifyDataSetChanged();
}
});
viewHolder.ivPlusButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Constants.ADD_FOOD_ARRAY[position]++;
viewHolder.tvFoodAmount.setText(String.valueOf(Constants.ADD_FOOD_ARRAY[position]));
notifyDataSetChanged();
}
});

}

@Override
public int getItemCount() {
return 6;
}
}
20 changes: 20 additions & 0 deletions app/src/main/java/com/example/gigapet/Animations.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.example.gigapet;

import android.app.Activity;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

public class Animations {
Activity activity;

public Animations(Activity activity){
this.activity = activity;
}

public void ItemTap(View v){
Animation anim = AnimationUtils.loadAnimation(activity, R.anim.item_anim_slide_up);
anim.setDuration(200);
v.startAnimation(anim);
}
}
14 changes: 13 additions & 1 deletion app/src/main/java/com/example/gigapet/Child.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,22 @@ public Child(String name, int id) {
}

public Child(String name, int id, Gigapet gigapet) {

//TODO: save food int array in shared prefs to load
this.name = name;
this.id = id;
this.gigapet = gigapet;
foodIntArr = new int[6];
foodIntArr = new int[]{0,0,0,0,0,0};
getFoodFromDb();
}

public void getFoodFromDb(){
new Thread(new Runnable() {
@Override
public void run() {
// ChildDao.LoadFoodEntries();
}
}).start();
}

public void setGigapet(Gigapet gigapet) {
Expand Down
Loading