Skip to content

Commit

Permalink
测试
Browse files Browse the repository at this point in the history
  • Loading branch information
yannecer committed May 9, 2018
1 parent 3828663 commit 5f84482
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
23 changes: 19 additions & 4 deletions app/src/main/java/necer/ncalendardemo/fragment/TestFragment2.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,56 @@
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.necer.ncalendar.calendar.MonthCalendar;
import com.necer.ncalendar.calendar.NCalendar;
import com.necer.ncalendar.listener.OnMonthCalendarChangedListener;
import com.necer.ncalendar.utils.MyLog;

import org.joda.time.DateTime;
import org.joda.time.LocalDate;

import necer.ncalendardemo.R;
import necer.ncalendardemo.adapter.AAAdapter;

/**
* Created by necer on 2018/2/5.
*/

public class TestFragment2 extends Fragment {

MonthCalendar monthCalendar;
// MonthCalendar monthCalendar;


private NCalendar ncalendar;
private RecyclerView recyclerView;


@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

View inflate = inflater.inflate(R.layout.fragment_2, null);
monthCalendar = (MonthCalendar) inflate.findViewById(R.id.monthcalendar);
/* monthCalendar = (MonthCalendar) inflate.findViewById(R.id.monthcalendar);
monthCalendar.setOnMonthCalendarChangedListener(new OnMonthCalendarChangedListener() {
@Override
public void onMonthCalendarChanged(LocalDate dateTime) {
MyLog.d("TestFragment2::;"+dateTime.toString());
}
});
});*/

ncalendar = (NCalendar) inflate.findViewById(R.id.ncalendarrrr);
recyclerView = (RecyclerView) inflate.findViewById(R.id.recyclerView);

recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
AAAdapter aaAdapter = new AAAdapter(getContext());
recyclerView.setAdapter(aaAdapter);

return inflate;

Expand All @@ -49,7 +64,7 @@ public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);

if (!hidden) {
monthCalendar.toToday();
ncalendar.toToday();
}
}
}
21 changes: 17 additions & 4 deletions app/src/main/res/layout/fragment_2.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">


Expand All @@ -11,9 +13,20 @@
android:background="#aa4081"
android:gravity="center"/>

<com.necer.ncalendar.calendar.MonthCalendar
android:id="@+id/monthcalendar"
<com.necer.ncalendar.calendar.NCalendar
android:id="@+id/ncalendarrrr"
android:layout_width="match_parent"
android:layout_height="300dp"/>
android:layout_height="match_parent"
app:firstDayOfWeek="Sunday"
>

<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"/>

</com.necer.ncalendar.calendar.NCalendar>


</LinearLayout>

0 comments on commit 5f84482

Please sign in to comment.