-
Notifications
You must be signed in to change notification settings - Fork 38
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 #1 from MOLO17/develop
First usable implementation
- Loading branch information
Showing
49 changed files
with
2,419 additions
and
1 deletion.
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
app/src/main/java/com/francesco/furlan/customizablecalendar/CalendarViewInteractor.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,119 @@ | ||
package com.francesco.furlan.customizablecalendar; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.RelativeLayout; | ||
import android.widget.TextView; | ||
|
||
import com.francesco.furlan.customizablecalendar.library.adapter.WeekDaysViewAdapter; | ||
import com.francesco.furlan.customizablecalendar.library.interactors.ViewInteractor; | ||
import com.francesco.furlan.customizablecalendar.library.model.Calendar; | ||
import com.francesco.furlan.customizablecalendar.library.model.CalendarItem; | ||
|
||
import org.joda.time.DateTime; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by francescofurlan on 03/07/17. | ||
*/ | ||
|
||
public class CalendarViewInteractor implements ViewInteractor { | ||
private Context context; | ||
private Calendar calendar; | ||
private TextView firstDaySelectedTxt; | ||
private TextView lastDaySelectedTxt; | ||
|
||
CalendarViewInteractor(Context context) { | ||
this.context = context; | ||
} | ||
|
||
@Override | ||
public void onCustomizableCalendarBindView(View view) { | ||
|
||
} | ||
|
||
@Override | ||
public void onHeaderBindView(ViewGroup view) { | ||
RelativeLayout layout = (RelativeLayout) LayoutInflater.from(context).inflate(R.layout.calendar_header, view); | ||
firstDaySelectedTxt = (TextView) layout.findViewById(R.id.first_day_selected); | ||
lastDaySelectedTxt = (TextView) layout.findViewById(R.id.last_day_selected); | ||
updateCalendar(calendar); | ||
} | ||
|
||
@Override | ||
public void onWeekDaysBindView(View view) { | ||
|
||
} | ||
|
||
@Override | ||
public void onWeekDayBindView(WeekDaysViewAdapter.WeekDayVH holder, String weekDay) { | ||
|
||
} | ||
|
||
@Override | ||
public void onSubViewBindView(View view, String month) { | ||
|
||
} | ||
|
||
@Override | ||
public void onCalendarBindView(View view) { | ||
|
||
} | ||
|
||
@Override | ||
public void onMonthBindView(View view) { | ||
|
||
} | ||
|
||
@Override | ||
public View onMonthCellBindView(View view, CalendarItem currentItem) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean hasImplementedDayCalculation() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public List<CalendarItem> calculateDays(int year, int month, int firstDayOfMonth, int lastDayOfMonth) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean hasImplementedSelection() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public int setSelected(boolean multipleSelection, DateTime dateSelected) { | ||
return -1; | ||
} | ||
|
||
@Override | ||
public boolean hasImplementedMonthCellBinding() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public View getMonthGridView(View rootView) { | ||
return null; | ||
} | ||
|
||
void updateCalendar(Calendar calendar) { | ||
this.calendar = calendar; | ||
if (firstDaySelectedTxt != null && lastDaySelectedTxt != null) { | ||
DateTime firstDate = calendar.getFirstSelectedDay(); | ||
DateTime lastDate = calendar.getLastSelectedDay(); | ||
if (firstDate != null) { | ||
firstDaySelectedTxt.setText(firstDate.toString("dd MMMMM yyyy")); | ||
} | ||
if (lastDate != null) { | ||
lastDaySelectedTxt.setText(lastDate.toString("dd MMMMM yyyy")); | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:background="@android:color/white" | ||
android:orientation="vertical"> | ||
|
||
<com.francesco.furlan.customizablecalendar.library.components.CustomizableCalendar | ||
android:id="@+id/view_month" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:layout="@layout/c_calendar" /> | ||
|
||
</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,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_marginEnd="30dp" | ||
android:layout_marginStart="30dp" | ||
android:orientation="vertical"> | ||
|
||
<com.francesco.furlan.customizablecalendar.library.components.HeaderView | ||
android:id="@android:id/primary" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" /> | ||
|
||
<com.francesco.furlan.customizablecalendar.library.components.SubView | ||
android:id="@android:id/text2" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="30dp" /> | ||
|
||
<com.francesco.furlan.customizablecalendar.library.components.WeekDaysView | ||
android:id="@android:id/text1" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center_horizontal" | ||
android:layout_marginTop="30dp" /> | ||
|
||
<com.francesco.furlan.customizablecalendar.library.components.CalendarRecyclerView | ||
android:id="@android:id/content" | ||
android:layout_width="match_parent" | ||
android:layout_height="@dimen/customizable_calendar_height" | ||
android:layout_marginTop="15dp" /> | ||
|
||
</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,80 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginBottom="10dp" | ||
android:layout_marginTop="10dp"> | ||
|
||
<LinearLayout | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentStart="true" | ||
android:gravity="center" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:id="@+id/firstDay" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="6dp" | ||
android:ellipsize="end" | ||
android:gravity="center" | ||
android:maxLines="1" | ||
android:maxWidth="250dp" | ||
android:singleLine="true" | ||
android:text="@string/first_day_selected" | ||
android:textColor="@android:color/black" | ||
android:textSize="18sp" /> | ||
|
||
<TextView | ||
android:id="@+id/first_day_selected" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="4dp" | ||
android:ellipsize="end" | ||
android:gravity="center" | ||
android:maxLines="1" | ||
android:maxWidth="250dp" | ||
android:singleLine="true" | ||
android:text="@string/day_month_year" | ||
android:textColor="@android:color/black" | ||
android:textSize="20sp" /> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentEnd="true" | ||
android:gravity="center" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="end" | ||
android:layout_marginTop="6dp" | ||
android:ellipsize="end" | ||
android:gravity="center" | ||
android:maxLines="1" | ||
android:maxWidth="250dp" | ||
android:singleLine="true" | ||
android:text="@string/last_day_selected" | ||
android:textColor="@android:color/black" | ||
android:textSize="18sp" /> | ||
|
||
<TextView | ||
android:id="@+id/last_day_selected" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="4dp" | ||
android:ellipsize="end" | ||
android:gravity="center" | ||
android:maxLines="1" | ||
android:maxWidth="250dp" | ||
android:singleLine="true" | ||
android:text="@string/day_month_year" | ||
android:textColor="@android:color/black" | ||
android:textSize="20sp" /> | ||
</LinearLayout> | ||
</RelativeLayout> |
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,3 +1,6 @@ | ||
<resources> | ||
<string name="app_name">CustomizableCalendar</string> | ||
<string name="day_month_year">day month year</string> | ||
<string name="first_day_selected">First day selected</string> | ||
<string name="last_day_selected">Last day selected</string> | ||
</resources> |
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,11 @@ | ||
<resources> | ||
|
||
<!-- Base application theme. --> | ||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | ||
<!-- Customize your theme here. --> | ||
<item name="colorPrimary">@color/colorPrimary</item> | ||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | ||
<item name="colorAccent">@color/colorAccent</item> | ||
</style> | ||
|
||
</resources> |
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 @@ | ||
/build |
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.