forked from Tibolte/AgendaCalendarView
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Tibolte#5 from FHellmann/master
Add possibility for custom event layouts
- Loading branch information
Showing
21 changed files
with
658 additions
and
418 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
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
1 change: 1 addition & 0 deletions
1
...darview/src/main/java/com/github/tibolte/agendacalendarview/CalendarPickerController.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
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
51 changes: 10 additions & 41 deletions
51
...endarview/src/main/java/com/github/tibolte/agendacalendarview/agenda/AgendaEventView.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 |
---|---|---|
@@ -1,69 +1,38 @@ | ||
package com.github.tibolte.agendacalendarview.agenda; | ||
|
||
import com.github.tibolte.agendacalendarview.R; | ||
import com.github.tibolte.agendacalendarview.models.CalendarEvent; | ||
|
||
import android.content.Context; | ||
import android.graphics.Typeface; | ||
import android.util.AttributeSet; | ||
import android.view.LayoutInflater; | ||
import android.view.ViewGroup; | ||
import android.widget.LinearLayout; | ||
import android.widget.TextView; | ||
|
||
/** | ||
* List item view for the StickyHeaderListView of the agenda view | ||
*/ | ||
public class AgendaEventView extends LinearLayout { | ||
public static AgendaEventView inflate(ViewGroup parent) { | ||
AgendaEventView agendaEventView = (AgendaEventView) LayoutInflater.from(parent.getContext()).inflate(R.layout.view_agenda_event, parent, false); | ||
return agendaEventView; | ||
return (AgendaEventView) LayoutInflater.from(parent.getContext()).inflate(R.layout.view_agenda_event, parent, false); | ||
} | ||
|
||
// region Constructors | ||
|
||
public AgendaEventView(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
public AgendaEventView(Context context) { | ||
this(context, null); | ||
} | ||
|
||
public AgendaEventView(Context context) { | ||
super(context); | ||
public AgendaEventView(Context context, AttributeSet attrs) { | ||
this(context, attrs, 0); | ||
} | ||
|
||
public AgendaEventView(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
setPadding(getResources().getDimensionPixelSize(R.dimen.agenda_event_view_padding_left), | ||
getResources().getDimensionPixelSize(R.dimen.agenda_event_view_padding_top), | ||
getResources().getDimensionPixelSize(R.dimen.agenda_event_view_padding_right), | ||
getResources().getDimensionPixelSize(R.dimen.agenda_event_view_padding_bottom)); | ||
} | ||
|
||
// endregion | ||
|
||
// region Public methods | ||
|
||
public void setEvent(CalendarEvent event) { | ||
TextView txtTitle = (TextView) findViewById(R.id.view_agenda_event_title); | ||
TextView txtLocation = (TextView) findViewById(R.id.view_agenda_event_location); | ||
LinearLayout descriptionContainer = (LinearLayout) findViewById(R.id.view_agenda_event_description_container); | ||
LinearLayout locationContainer = (LinearLayout) findViewById(R.id.view_agenda_event_location_container); | ||
|
||
descriptionContainer.setVisibility(VISIBLE); | ||
txtTitle.setTextColor(getResources().getColor(android.R.color.black)); | ||
|
||
txtTitle.setText(event.getTitle()); | ||
txtLocation.setText(event.getLocation()); | ||
if (event.getLocation().length() > 0) { | ||
locationContainer.setVisibility(VISIBLE); | ||
txtLocation.setText(event.getLocation()); | ||
} else { | ||
locationContainer.setVisibility(GONE); | ||
} | ||
|
||
if (event.getTitle().equals(getResources().getString(R.string.agenda_event_no_events))) { | ||
txtTitle.setTextColor(getResources().getColor(android.R.color.black)); | ||
} else { | ||
txtTitle.setTextColor(getResources().getColor(R.color.theme_text_icons)); | ||
} | ||
descriptionContainer.setBackgroundColor(event.getColor()); | ||
txtLocation.setTextColor(getResources().getColor(R.color.theme_text_icons)); | ||
} | ||
|
||
// endregion | ||
} | ||
} |
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
9 changes: 1 addition & 8 deletions
9
...lendarview/src/main/java/com/github/tibolte/agendacalendarview/agenda/AgendaListView.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
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
Oops, something went wrong.