forked from prolificinteractive/material-calendarview
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix - Remove Restoration of XML parameters (prolificinteractive#838)
- Loading branch information
1 parent
bf1015c
commit 7a5a045
Showing
6 changed files
with
124 additions
and
46 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
47 changes: 47 additions & 0 deletions
47
...e/src/main/java/com/prolificinteractive/materialcalendarview/sample/RotationActivity.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,47 @@ | ||
package com.prolificinteractive.materialcalendarview.sample; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.NonNull; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.widget.Toast; | ||
import butterknife.BindView; | ||
import butterknife.ButterKnife; | ||
import com.prolificinteractive.materialcalendarview.CalendarDay; | ||
import com.prolificinteractive.materialcalendarview.MaterialCalendarView; | ||
import com.prolificinteractive.materialcalendarview.OnDateLongClickListener; | ||
import com.prolificinteractive.materialcalendarview.OnMonthChangedListener; | ||
import org.threeten.bp.format.DateTimeFormatter; | ||
|
||
/** | ||
* Shows off the most basic usage | ||
*/ | ||
public class RotationActivity extends AppCompatActivity | ||
implements OnMonthChangedListener, OnDateLongClickListener { | ||
|
||
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("EEE, d MMM yyyy"); | ||
|
||
@BindView(R.id.calendarView) | ||
MaterialCalendarView widget; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_rotation); | ||
ButterKnife.bind(this); | ||
|
||
widget.setOnDateLongClickListener(this); | ||
widget.setOnMonthChangedListener(this); | ||
} | ||
|
||
@Override | ||
public void onDateLongClick(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date) { | ||
final String text = String.format("%s is available", FORMATTER.format(date.getDate())); | ||
Toast.makeText(this, text, Toast.LENGTH_SHORT).show(); | ||
} | ||
|
||
@Override | ||
public void onMonthChanged(MaterialCalendarView widget, CalendarDay date) { | ||
//noinspection ConstantConditions | ||
getSupportActionBar().setTitle(FORMATTER.format(date.getDate())); | ||
} | ||
} |
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,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
android:paddingLeft="@dimen/activity_horizontal_margin" | ||
android:paddingRight="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin" | ||
tools:context=".BasicActivity" | ||
> | ||
|
||
<com.prolificinteractive.materialcalendarview.MaterialCalendarView | ||
android:id="@+id/calendarView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:mcv_calendarMode="week" | ||
app:mcv_dateTextAppearance="@style/CustomTextAppearance" | ||
app:mcv_firstDayOfWeek="sunday" | ||
app:mcv_headerTextAppearance="@style/CustomTextAppearance" | ||
app:mcv_showWeekDays="false" | ||
app:mcv_tileHeight="30dp" | ||
app:mcv_tileWidth="50dp" | ||
app:mcv_titleAnimationOrientation="horizontal" | ||
app:mcv_weekDayTextAppearance="@style/CustomTextAppearance" | ||
/> | ||
|
||
</LinearLayout> |
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,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
android:paddingLeft="@dimen/activity_horizontal_margin" | ||
android:paddingRight="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin" | ||
tools:context=".BasicActivity" | ||
> | ||
|
||
<com.prolificinteractive.materialcalendarview.MaterialCalendarView | ||
android:id="@+id/calendarView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:mcv_calendarMode="month" | ||
app:mcv_firstDayOfWeek="wednesday" | ||
app:mcv_showWeekDays="true" | ||
app:mcv_tileHeight="40dp" | ||
app:mcv_titleAnimationOrientation="vertical" | ||
app:mcv_tileWidth="30dp" | ||
/> | ||
|
||
</LinearLayout> |
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