add the spinner for choosing event reminder

This commit is contained in:
tibbi 2016-07-06 16:19:57 +02:00
parent e129b756c1
commit ad7a08eaeb
6 changed files with 62 additions and 10 deletions

View File

@ -5,6 +5,7 @@ import android.app.TimePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.AppCompatSpinner;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@ -29,6 +30,7 @@ import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnItemSelected;
public class EventActivity extends AppCompatActivity implements DBHelper.DBOperationsListener {
@BindView(R.id.event_start_date) TextView mStartDate;
@ -37,6 +39,7 @@ public class EventActivity extends AppCompatActivity implements DBHelper.DBOpera
@BindView(R.id.event_end_time) TextView mEndTime;
@BindView(R.id.event_title) EditText mTitleET;
@BindView(R.id.event_description) EditText mDescriptionET;
@BindView(R.id.event_reminder) AppCompatSpinner mReminder;
private static DateTime mEventStartDateTime;
private static DateTime mEventEndDateTime;
@ -90,6 +93,11 @@ public class EventActivity extends AppCompatActivity implements DBHelper.DBOpera
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
}
@OnItemSelected(R.id.event_reminder)
public void handleReminder() {
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_event, menu);

View File

@ -30,11 +30,30 @@
android:textSize="@dimen/day_text_size"/>
<TextView
android:id="@+id/event_start_label"
android:id="@+id/event_description_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_title"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/description"
android:textSize="@dimen/day_text_size"/>
<EditText
android:id="@+id/event_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_description_label"
android:gravity="top"
android:inputType="textCapSentences|textMultiLine"
android:minEms="20"
android:textSize="@dimen/day_text_size"/>
<TextView
android:id="@+id/event_start_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_description"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/start"
android:textSize="@dimen/day_text_size"/>
@ -86,23 +105,21 @@
android:textSize="@dimen/day_text_size"/>
<TextView
android:id="@+id/event_description_label"
android:id="@+id/event_reminder_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_end_time"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/description"
android:text="@string/reminder"
android:textSize="@dimen/day_text_size"/>
<EditText
android:id="@+id/event_description"
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/event_reminder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_description_label"
android:gravity="top"
android:inputType="textCapSentences|textMultiLine"
android:minEms="20"
android:textSize="@dimen/day_text_size"/>
android:layout_below="@+id/event_reminder_label"
android:entries="@array/reminders"
android:padding="@dimen/activity_margin"/>
</RelativeLayout>
</ScrollView>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="reminders">
<item>@string/off</item>
<item>@string/at_start</item>
<item>@string/ten_mins</item>
<item>@string/thirty_mins</item>
</string-array>
</resources>

View File

@ -4,6 +4,7 @@
<dimen name="social_logo">40dp</dimen>
<dimen name="event_padding">8dp</dimen>
<dimen name="top_padding">8dp</dimen>
<dimen name="settings_padding">8dp</dimen>
<dimen name="min_widget_width">250dp</dimen>
<dimen name="min_widget_height">250dp</dimen>

View File

@ -12,6 +12,11 @@
<string name="end_before_start">The event cannot end earlier than it starts</string>
<string name="event_added">Event added successfully</string>
<string name="event_updated">Event updated successfully</string>
<string name="reminder">Reminder</string>
<string name="off">Off</string>
<string name="at_start">At start</string>
<string name="ten_mins">10 mins before</string>
<string name="thirty_mins">30 mins before</string>
<!-- Day details -->
<string name="details">Details</string>

View File

@ -8,6 +8,9 @@
<item name="android:buttonStyle">@style/MyButton</item>
<item name="actionBarStyle">@style/AppTheme.ActionBarStyle</item>
<item name="android:textSize">@dimen/normal_text_size</item>
<item name="android:spinnerItemStyle">@style/SpinnerItem</item>
<item name="spinnerDropDownItemStyle">@style/SpinnerItem.DropDownItem</item>
<item name="android:spinnerDropDownItemStyle">@style/SpinnerItem.DropDownItem</item>
</style>
<style name="DayView">
@ -46,4 +49,13 @@
<item name="android:fontFamily">sans-serif</item>
<item name="android:textSize">20sp</item>
</style>
<style name="SpinnerItem" parent="@android:style/Widget.TextView">
<item name="android:paddingRight">@dimen/activity_margin</item>
</style>
<style name="SpinnerItem.DropDownItem" parent="@android:style/Widget.TextView">
<item name="android:gravity">center_vertical</item>
<item name="android:padding">@dimen/settings_padding</item>
</style>
</resources>