Skip to content

Commit

Permalink
Add calendar listview demo.
Browse files Browse the repository at this point in the history
  • Loading branch information
SpecialCyCi committed May 29, 2014
1 parent f8f2643 commit a586191
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This copy is the demo.

## Version Migration

#### Upgrading to `1.4` from `1.3`, `1.2`, `1.1`, `1.0`
#### Upgrading to `v1.4` from `v1.3`, `v1.2`, `v1.1`, `v1.0`

Duplicate the followed code in dispatchTouchEvent() of Activity, replace the old `dispatchTouchEvent()` code.

Expand Down
4 changes: 2 additions & 2 deletions ResideMenu/src/com/special/ResideMenu/ResideMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public void onClick(View view) {
private Animator.AnimatorListener animationListener = new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
if (isOpened){
if (isOpened()){
scrollViewMenu.setVisibility(VISIBLE);
if (menuListener != null)
menuListener.openMenu();
Expand All @@ -341,7 +341,7 @@ public void onAnimationStart(Animator animation) {
@Override
public void onAnimationEnd(Animator animation) {
// reset the view;
if(isOpened){
if(isOpened()){
viewActivity.setTouchDisable(true);
viewActivity.setOnClickListener(viewActivityOnClickListener);
}else{
Expand Down
2 changes: 1 addition & 1 deletion ResideMenuDemo/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
android:targetSdkVersion="17"/>
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:name="MenuActivity"
android:theme="@android:style/Theme.NoTitleBar"
android:theme="@android:style/Theme.Light.NoTitleBar"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand Down
13 changes: 4 additions & 9 deletions ResideMenuDemo/res/layout/calendar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Calendar"
style="@style/fragment_text"
android:layout_gravity="center"
android:id="@+id/textView"/>

<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import java.util.ArrayList;
import java.util.List;

/**
* User: special
Expand All @@ -14,9 +20,45 @@
*/
public class CalendarFragment extends Fragment {

private View parentView;
private ListView listView;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.calendar, container, false);
parentView = inflater.inflate(R.layout.calendar, container, false);
listView = (ListView) parentView.findViewById(R.id.listView);
initView();
return parentView;
}

private void initView(){
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(
getActivity(),
android.R.layout.simple_list_item_1,
getCalendarData());
listView.setAdapter(arrayAdapter);
}

private ArrayList<String> getCalendarData(){
ArrayList<String> calendarList = new ArrayList<String>();
calendarList.add("New Year's Day");
calendarList.add("St. Valentine's Day");
calendarList.add("Easter Day");
calendarList.add("April Fool's Day");
calendarList.add("Mother's Day");
calendarList.add("Memorial Day");
calendarList.add("National Flag Day");
calendarList.add("Father's Day");
calendarList.add("Independence Day");
calendarList.add("Labor Day");
calendarList.add("Columbus Day");
calendarList.add("Halloween");
calendarList.add("All Soul's Day");
calendarList.add("Veterans Day");
calendarList.add("Thanksgiving Day");
calendarList.add("Election Day");
calendarList.add("Forefather's Day");
calendarList.add("Christmas Day");
return calendarList;
}
}

0 comments on commit a586191

Please sign in to comment.