mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
add some views related to custom reminder interval
This commit is contained in:
@@ -9,7 +9,6 @@ import android.os.Bundle
|
|||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.WindowManager
|
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.AdapterView
|
import android.widget.AdapterView
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
@@ -99,7 +98,8 @@ class EventActivity : SimpleActivity(), DBHelper.EventsListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun hideKeyboard() {
|
private fun hideKeyboard() {
|
||||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
|
val inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
|
inputMethodManager.hideSoftInputFromWindow((currentFocus ?: View(this)).windowToken, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showKeyboard(et: EditText) {
|
private fun showKeyboard(et: EditText) {
|
||||||
@@ -113,7 +113,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventsListener {
|
|||||||
0 -> event_reminder.setSelection(1)
|
0 -> event_reminder.setSelection(1)
|
||||||
else -> {
|
else -> {
|
||||||
event_reminder.setSelection(2)
|
event_reminder.setSelection(2)
|
||||||
event_reminder_other.visibility = View.VISIBLE
|
toggleCustomReminderVisibility(true)
|
||||||
event_reminder_other.setText(mEvent.reminderMinutes.toString())
|
event_reminder_other.setText(mEvent.reminderMinutes.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,15 +146,21 @@ class EventActivity : SimpleActivity(), DBHelper.EventsListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event_reminder.selectedItemPosition == event_reminder.count - 1) {
|
if (event_reminder.selectedItemPosition == event_reminder.count - 1) {
|
||||||
event_reminder_other.visibility = View.VISIBLE
|
toggleCustomReminderVisibility(true)
|
||||||
event_reminder_other.requestFocus()
|
event_reminder_other.requestFocus()
|
||||||
showKeyboard(event_reminder_other)
|
showKeyboard(event_reminder_other)
|
||||||
} else {
|
} else {
|
||||||
event_reminder_other.visibility = View.GONE
|
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
|
toggleCustomReminderVisibility(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun toggleCustomReminderVisibility(show: Boolean) {
|
||||||
|
event_reminder_other_period.beVisibleIf(show)
|
||||||
|
event_reminder_other_val.beVisibleIf(show)
|
||||||
|
event_reminder_other.beVisibleIf(show)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
menuInflater.inflate(R.menu.menu_event, menu)
|
menuInflater.inflate(R.menu.menu_event, menu)
|
||||||
val item = menu.findItem(R.id.delete)
|
val item = menu.findItem(R.id.delete)
|
||||||
|
@@ -131,19 +131,42 @@
|
|||||||
android:id="@+id/event_reminder_other"
|
android:id="@+id/event_reminder_other"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/event_reminder_label"
|
android:layout_below="@+id/event_reminder"
|
||||||
android:layout_toRightOf="@+id/event_reminder"
|
android:layout_marginLeft="@dimen/activity_margin"
|
||||||
android:digits="0123456789"
|
android:digits="0123456789"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:minEms="5"
|
android:minEms="5"
|
||||||
android:textSize="@dimen/day_text_size"
|
android:textSize="@dimen/day_text_size"
|
||||||
android:visibility="invisible" />
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<android.support.v7.widget.AppCompatSpinner
|
||||||
|
android:id="@+id/event_reminder_other_period"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignBottom="@+id/event_reminder_other"
|
||||||
|
android:layout_alignTop="@+id/event_reminder_other"
|
||||||
|
android:layout_toRightOf="@+id/event_reminder_other"
|
||||||
|
android:entries="@array/custom_reminders"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingLeft="@dimen/activity_margin"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/event_reminder_other_val"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignBottom="@+id/event_reminder_other"
|
||||||
|
android:layout_alignTop="@+id/event_reminder_other"
|
||||||
|
android:layout_toRightOf="@+id/event_reminder_other_period"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:text="@string/before"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/event_repetition_label"
|
android:id="@+id/event_repetition_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/event_reminder"
|
android:layout_below="@+id/event_reminder_other"
|
||||||
android:layout_marginTop="@dimen/activity_margin"
|
android:layout_marginTop="@dimen/activity_margin"
|
||||||
android:text="@string/repetition"
|
android:text="@string/repetition"
|
||||||
android:textSize="@dimen/day_text_size"/>
|
android:textSize="@dimen/day_text_size"/>
|
||||||
|
Reference in New Issue
Block a user