-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added info dialog for calendar entries
- Loading branch information
Showing
7 changed files
with
102 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...c/main/java/prototype/xd/scheduler/fragments/dialogs/CalendarEventInfoDialogFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package prototype.xd.scheduler.fragments.dialogs; | ||
|
||
import static prototype.xd.scheduler.utilities.DateManager.currentlySelectedDayUTC; | ||
|
||
import android.view.LayoutInflater; | ||
import android.view.ViewGroup; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.appcompat.app.AlertDialog; | ||
|
||
import prototype.xd.scheduler.R; | ||
import prototype.xd.scheduler.databinding.CalendarEntryInfoBinding; | ||
import prototype.xd.scheduler.entities.TodoEntry; | ||
import prototype.xd.scheduler.utilities.misc.ContextWrapper; | ||
|
||
public class CalendarEventInfoDialogFragment extends BaseCachedDialogFragment<CalendarEntryInfoBinding, AlertDialog> { // NOSONAR This is a fragment | ||
|
||
private TodoEntry entry; | ||
|
||
public void show(@Nullable TodoEntry entry, | ||
@NonNull ContextWrapper wrapper) { | ||
this.entry = entry; | ||
show(wrapper.fragmentManager, entry + " info"); | ||
} | ||
|
||
@Override | ||
protected void buildDialogStatic(@NonNull CalendarEntryInfoBinding binding, @NonNull AlertDialog dialog) { | ||
dialog.setIcon(R.drawable.ic_info_24); | ||
} | ||
|
||
@Override | ||
protected void buildDialogDynamic(@NonNull CalendarEntryInfoBinding binding, @NonNull AlertDialog dialog) { | ||
dialog.setTitle(entry.event.data.title); | ||
String desc = entry.event.data.description; | ||
dialog.setMessage(desc.isEmpty() ? wrapper.getString(R.string.no_description) : desc); | ||
binding.date.setText(entry.getCalendarEntryTimeSpan(wrapper.context, currentlySelectedDayUTC)); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
protected CalendarEntryInfoBinding inflate(@NonNull LayoutInflater inflater, @Nullable ViewGroup container) { | ||
return CalendarEntryInfoBinding.inflate(inflater, container, false); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
protected AlertDialog buildDialog() { | ||
return getAlertDialog(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/src/main/res/layouts/dialogs/layout/calendar_entry_info.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<TextView | ||
android:id="@+id/date" | ||
style="@style/LargeHeadingSubtext" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="12dp" | ||
android:text="TextView" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="@id/divider2" /> | ||
|
||
<com.google.android.material.divider.MaterialDivider | ||
android:id="@+id/divider2" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters