forked from yannecer/NCalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
401 additions
and
19 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
26 changes: 26 additions & 0 deletions
26
app/src/main/java/com/necer/ncalendar/activity/TestViewPagerActivity.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,26 @@ | ||
package com.necer.ncalendar.activity; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.view.ViewPager; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
import com.necer.ncalendar.R; | ||
import com.necer.ncalendar.adapter.ViewPagerAdapter; | ||
|
||
public class TestViewPagerActivity extends AppCompatActivity { | ||
|
||
|
||
private ViewPager viewPager; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_view_pager); | ||
|
||
viewPager = findViewById(R.id.view_pager); | ||
viewPager.setPageMargin(100); | ||
viewPager.setAdapter(new ViewPagerAdapter(this)); | ||
|
||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
app/src/main/java/com/necer/ncalendar/adapter/ViewPagerAdapter.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,49 @@ | ||
package com.necer.ncalendar.adapter; | ||
|
||
import android.content.Context; | ||
import android.support.annotation.NonNull; | ||
import android.support.v4.view.PagerAdapter; | ||
import android.support.v4.view.ViewPager; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import com.necer.ncalendar.R; | ||
|
||
public class ViewPagerAdapter extends PagerAdapter { | ||
|
||
|
||
private Context mContext; | ||
|
||
public ViewPagerAdapter(Context context) { | ||
this.mContext = context; | ||
} | ||
|
||
|
||
@Override | ||
public int getCount() { | ||
return 3; | ||
} | ||
|
||
@Override | ||
public boolean isViewFromObject(@NonNull View view, @NonNull Object object) { | ||
return view == object; | ||
} | ||
|
||
|
||
@Override | ||
public void destroyItem(ViewGroup container, int position, Object object) { | ||
container.removeView((View) object); | ||
} | ||
|
||
@Override | ||
public Object instantiateItem(ViewGroup container, int position) { | ||
View view = View.inflate(mContext, R.layout.item_view_pager, null); | ||
|
||
TextView textView = view.findViewById(R.id.tv); | ||
textView.setText(view + ""); | ||
container.addView(view); | ||
return view; | ||
} | ||
|
||
} |
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,25 @@ | ||
<?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.necer.view.WeekBar | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" /> | ||
|
||
<com.necer.calendar.Miui10Calendar | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:text="asdfasdf"/> | ||
|
||
</com.necer.calendar.Miui10Calendar> | ||
|
||
|
||
|
||
</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
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,29 @@ | ||
<?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:orientation="vertical"> | ||
|
||
|
||
<com.necer.view.WeekBar | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" /> | ||
|
||
|
||
<com.necer.calendar.Miui10Calendar | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
|
||
<android.support.v4.view.ViewPager | ||
android:id="@+id/view_pager" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:paddingRight="50dp" | ||
android:paddingLeft="50dp" | ||
android:clipToPadding="false"/> | ||
|
||
</com.necer.calendar.Miui10Calendar> | ||
|
||
|
||
</LinearLayout> |
Oops, something went wrong.