Commit d60e67b2 authored by Robert Hitt's avatar Robert Hitt
Browse files

Added Notification dialog

- Doesn't actually do anything just yet
parent 5f7f2d35
......@@ -2,23 +2,27 @@ package srct.whatsopen.views.activities;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.NavUtils;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.TextView;
import java.util.Calendar;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.realm.Realm;
import srct.whatsopen.R;
import srct.whatsopen.model.Facility;
import srct.whatsopen.views.FacilityView;
import srct.whatsopen.presenters.FacilityPresenter;
import srct.whatsopen.views.fragments.NotificationDialogFragment;
public class DetailActivity extends AppCompatActivity implements FacilityView{
......@@ -27,6 +31,7 @@ public class DetailActivity extends AppCompatActivity implements FacilityView{
@BindView(R.id.open_duration) TextView openDurationTextView;
@BindView(R.id.location_text) TextView locationTextView;
@BindView(R.id.schedule_text) TextView scheduleTextView;
@BindView(R.id.notification_button) Button notificationButton;
MenuItem mFavoriteMenuItem;
......@@ -95,6 +100,14 @@ public class DetailActivity extends AppCompatActivity implements FacilityView{
mFavoriteMenuItem.setIcon(R.drawable.ic_fav_button_white_24dp);
}
@OnClick(R.id.notification_button)
public void showNotificationDialog() {
FragmentManager fm = getSupportFragmentManager();
NotificationDialogFragment notificationDialogFragment =
NotificationDialogFragment.newInstance("");
notificationDialogFragment.show(fm, "fragment_notification_dialog");
}
// Queries Realm for the facility matching the key
private void getFacility(String key) {
Realm realm = Realm.getDefaultInstance();
......
package srct.whatsopen.views.fragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import butterknife.BindView;
import butterknife.ButterKnife;
import srct.whatsopen.R;
public class NotificationDialogFragment extends DialogFragment {
@BindView(R.id.type_closing_check) CheckBox typeClosingCheckBox;
@BindView(R.id.type_opening_check) CheckBox typeOpeningCheckBox;
@BindView(R.id.interval_on_check) CheckBox intervalOnCheckBox;
@BindView(R.id.interval_15_check) CheckBox interval15CheckBox;
@BindView(R.id.interval_30_check) CheckBox interval30CheckBox;
@BindView(R.id.interval_hour_check) CheckBox intervalHourCheckBox;
@BindView(R.id.save_button) Button saveButton;
@BindView(R.id.cancel_button) Button cancelButton;
public NotificationDialogFragment() {
}
public static NotificationDialogFragment newInstance(String title) {
NotificationDialogFragment frag = new NotificationDialogFragment();
Bundle args = new Bundle();
args.putString("title", title);
frag.setArguments(args);
return frag;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_notification_dialog, container);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(view);
}
}
......@@ -15,6 +15,15 @@
android:layout_height="wrap_content"
android:layout_width="match_parent"/>
<Button
android:id="@+id/notification_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Set Notifications"
android:textColor="#FFFFFF"
android:background="@color/cardview_dark_background"
android:layout_margin="8dp"/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="1dp"
android:layout_margin="6dp">
<LinearLayout
android:orientation="vertical"
android:padding="8dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="Notification Type"
android:paddingStart="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingTop="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<CheckBox
android:id="@+id/type_opening_check"
android:text="Opening"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<CheckBox
android:id="@+id/type_closing_check"
android:text="Closing"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="1dp"
android:layout_margin="6dp">
<LinearLayout
android:orientation="vertical"
android:padding="8dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="Notification Interval"
android:paddingStart="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingTop="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<CheckBox
android:id="@+id/interval_on_check"
android:text="On opening/closing"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<CheckBox
android:id="@+id/interval_15_check"
android:text="15 minutes before"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<CheckBox
android:id="@+id/interval_30_check"
android:text="30 minutes before"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<CheckBox
android:id="@+id/interval_hour_check"
android:text="An hour before"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<LinearLayout
android:orientation="horizontal"
android:padding="4dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/save_button"
android:text="Save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/cancel_button"
android:text="Edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
......@@ -3,7 +3,7 @@
<color name="colorPrimary">#006633</color>
<color name="colorPrimaryLight">#008542</color>
<color name="colorPrimaryDark">#015429</color>
<color name="colorAccent">#FF4081</color>
<color name="colorAccent">#008542</color>
<color name="facilityText">#757575</color>
<color name="favoriteButtonOff">#757575</color>
<color name="favoriteButtonOn">#E8B827</color>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment