Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
eshza committed Nov 13, 2017
2 parents a58d3e4 + 6440892 commit a6f10f9
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
ViewHabitEventActivity.class);
intent5.putExtra("userName", userName);
intent5.putExtra("userIndex", userIndex);
intent5.putExtra("habitIndex", position);
intent5.putExtra("habitEventIndex", position);
startActivity(intent5);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;
Expand All @@ -27,8 +29,15 @@
//TODO: get the habit list in spinner dropdown
public class ViewHabitEventActivity extends Activity {

ArrayList<HabitEvent> habitEvents;

private TextView headingTextView;
private TextView habitTitleTextView;
private TextView habitDateBoxTextView;
private TextView habitCommentTextView;
private String userName;
private int userIndex;
//private int habitIndex;
private int habitEventIndex;
private Habit habit;
/**
* Launches Interface displaying the habit events and their
* basic details.
Expand All @@ -39,51 +48,24 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_habit_event);

FloatingActionButton newActivity = (FloatingActionButton) findViewById(R.id.eventAdder);
newActivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View view = LayoutInflater.from(ViewHabitEventActivity.this).inflate(R.layout.activity_new_habit_event, null);

final EditText editComment = (EditText) view.findViewById(R.id.edit_comment);

// Create dialog to add counter
AlertDialog.Builder builder = new AlertDialog.Builder(ViewHabitEventActivity.this);
builder.setMessage("Add Habit Event");
builder.setView(view);
builder.setPositiveButton("Add", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final Intent intent = getIntent();
this.userName = intent.getStringExtra("userName");
this.userIndex = intent.getIntExtra("userIndex", 0);
this.habitEventIndex = intent.getIntExtra("habitEventIndex", 0);

// Check if counter Title and Reason are valid entires
if (!(editComment.getText().toString().equals("")) ) {
String comment = editComment.getText().toString();
//Habit habit = new Habit("ok","ok",new Date()); //remove this; testing

SaveFileController saveFileController = new SaveFileController();
ArrayList<HabitEvent> allEvents = saveFileController.getAllHabitEvents(getApplicationContext(),
this.userIndex);
HabitEvent habitEvent = allEvents.get(this.habitEventIndex);
headingTextView = (TextView) findViewById(R.id.habitEventDetailHeadingTextView);
habitTitleTextView = (TextView)
}

//HabitEvent myObject = new HabitEvent(habit, comment);
//habitEvents.add(myObject);
dialog.dismiss();
}

// Show error toast on invalid entry
else {
Toast.makeText(getApplicationContext(), "Make sure Habit and Comment are not blank", Toast.LENGTH_SHORT).show();
}

}
});
builder.setNegativeButton("Cancel", null);
builder.setCancelable(false);

AlertDialog alert = builder.create();

alert.show();
}
});

}


//public void deleteEventButton(View view){}
}
31 changes: 16 additions & 15 deletions app/src/main/res/layout/activity_habit_time_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,14 @@
android:layout_height="65dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:textAlignment="center"
android:padding="4dp"
android:background="@drawable/check_box_dimens"
android:padding="4dp"
android:textAlignment="center"
app:layout_constraintHorizontal_bias="0.484"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>

<ListView
android:id="@+id/timeLineListView"
android:layout_width="365dp"
android:layout_height="370dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/SelfProfileHeadingTextView"
app:layout_constraintVertical_bias="0.071"/>


<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation_today"
Expand All @@ -48,4 +35,18 @@
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/menu"/>

<ListView
android:id="@+id/timeLineListView"
android:layout_width="359dp"
android:layout_height="444dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="76dp"
app:layout_constraintBottom_toBottomOf="@+id/bottom_navigation_today"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/timelineHeadingTextView"
app:layout_constraintVertical_bias="0.04"/>

</android.support.constraint.ConstraintLayout>
80 changes: 69 additions & 11 deletions app/src/main/res/layout/activity_view_habit_event.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,77 @@
android:layout_height="match_parent"
tools:context="com.cmput301f17t11.cupofjava.ViewHabitEventActivity">

<android.support.design.widget.FloatingActionButton
android:id="@+id/eventAdder"
android:layout_width="wrap_content"
<TextView
android:id="@+id/habitEventDetailHeadingTextView"
android:layout_width="362dp"
android:layout_height="65dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="@drawable/check_box_dimens"
android:padding="4dp"
android:textAlignment="center"
app:layout_constraintHorizontal_bias="0.484"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>

<TextView
android:id="@+id/HabitEventTextView2"
android:layout_width="362dp"
android:layout_height="65dp"
android:layout_marginTop="32dp"
android:background="@drawable/check_box_dimens"
android:padding="4dp"
android:textAlignment="center"
app:layout_constraintHorizontal_bias="0.489"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/habitEventDetailHeadingTextView"/>

<TextView
android:id="@+id/habitEventTextView3"
android:layout_width="362dp"
android:layout_height="65dp"
android:layout_marginTop="32dp"
android:background="@drawable/check_box_dimens"
android:padding="4dp"
android:textAlignment="center"
app:layout_constraintHorizontal_bias="0.489"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/HabitEventTextView2"/>

<TextView
android:id="@+id/habitEventTextView4"
android:layout_width="362dp"
android:layout_height="65dp"
android:layout_marginTop="32dp"
android:background="@drawable/check_box_dimens"
android:padding="4dp"
android:textAlignment="center"
app:layout_constraintHorizontal_bias="0.489"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/habitEventTextView3"/>
<!--
<Button
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="76dp"
app:backgroundTint="@android:color/background_dark"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="56dp"
android:background="@drawable/delete_button"
android:fontFamily="sans-serif-medium"
android:onClick="deleteEventButton"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:text="Delete"
android:textColor="#000000"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.915"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:srcCompat="@android:drawable/ic_input_add"></android.support.design.widget.FloatingActionButton>
app:layout_constraintRight_toRightOf="parent"/>
-->


</android.support.constraint.ConstraintLayout>

0 comments on commit a6f10f9

Please sign in to comment.