Skip to content

Commit

Permalink
calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
shanhong cheng committed Mar 24, 2017
1 parent cce7f26 commit 0563a43
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.loganfreeman.utahfishing.modules.main.ui;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.loganfreeman.utahfishing.R;
import com.loganfreeman.utahfishing.base.AbstractBaseFragment;
import com.prolificinteractive.materialcalendarview.CalendarDay;
import com.prolificinteractive.materialcalendarview.MaterialCalendarView;
import com.prolificinteractive.materialcalendarview.OnDateSelectedListener;
import com.prolificinteractive.materialcalendarview.OnMonthChangedListener;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
* Created by scheng on 3/23/17.
*/

public class CalendarFragment extends AbstractBaseFragment implements OnDateSelectedListener, OnMonthChangedListener {

@Bind(R.id.calendarView)
MaterialCalendarView widget;
private View view;

@Override
protected void lazyLoad() {

}

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
if (view == null) {
view = inflater.inflate(R.layout.fragment_fishing_calenar, container, false);
ButterKnife.bind(this, view);
}
return view;
}

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
safeSetTitle(getString(R.string.utah_fishing_calendar));
initView();
}

private void initView() {
widget.setOnDateChangedListener(this);
widget.setOnMonthChangedListener(this);

}

@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {

}

@Override
public void onMonthChanged(MaterialCalendarView widget, CalendarDay date) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ public void onTabSelected(@IdRes int tabId) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.contentContainer, new StockReportFragment()).commit();
break;
case R.id.tab_calendar:
getSupportFragmentManager().beginTransaction()
.replace(R.id.contentContainer, new CalendarFragment()).commit();
break;
default:
break;
}
Expand Down
Binary file added app/src/main/res/drawable-hdpi/ic_action_message.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/ic_action_message.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions app/src/main/res/layout/fragment_fishing_calenar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">

<com.prolificinteractive.materialcalendarview.MaterialCalendarView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:mcv_showOtherDates="all"
app:mcv_selectionColor="#00F"
/>

</LinearLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@
<string name="send_to">Share</string>
<string name="favorite">My favorite</string>
<string name="my_license">My license</string>
<string name="utah_fishing_calendar">Fishing Calendar</string>

</resources>
5 changes: 5 additions & 0 deletions app/src/main/res/xml/bottombar_tabs_three.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@
icon="@drawable/ic_favorites"
title="Stock" />

<tab
id="@+id/tab_calendar"
icon="@drawable/ic_action_message"
title="Calendar" />

</tabs>

0 comments on commit 0563a43

Please sign in to comment.