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
27 changed files
with
486 additions
and
359 deletions.
There are no files selected for viewing
Binary file not shown.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
16 changes: 16 additions & 0 deletions
16
app/src/main/java/com/necer/ncalendar/activity/TestGeneralActivity.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,16 @@ | ||
package com.necer.ncalendar.activity; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
import com.necer.ncalendar.R; | ||
|
||
public class TestGeneralActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_general); | ||
} | ||
} |
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
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
48 changes: 17 additions & 31 deletions
48
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 |
---|---|---|
@@ -1,49 +1,35 @@ | ||
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 android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentManager; | ||
import android.support.v4.app.FragmentPagerAdapter; | ||
|
||
import com.necer.ncalendar.R; | ||
import java.util.List; | ||
|
||
public class ViewPagerAdapter extends PagerAdapter { | ||
public class ViewPagerAdapter extends FragmentPagerAdapter { | ||
|
||
|
||
private Context mContext; | ||
private List<Fragment> fragmentList; | ||
private List<String> titleList; | ||
|
||
public ViewPagerAdapter(Context context) { | ||
this.mContext = context; | ||
public ViewPagerAdapter(FragmentManager fm, List<Fragment> fragmentList, List<String> titleList) { | ||
super(fm); | ||
this.fragmentList = fragmentList; | ||
this.titleList = titleList; | ||
} | ||
|
||
|
||
@Override | ||
public int getCount() { | ||
return 3; | ||
public Fragment getItem(int position) { | ||
return fragmentList.get(position); | ||
} | ||
|
||
@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); | ||
public int getCount() { | ||
return fragmentList.size(); | ||
} | ||
|
||
@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; | ||
public CharSequence getPageTitle(int position) { | ||
return titleList.get(position); | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
app/src/main/java/com/necer/ncalendar/fragment/Fragment1.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,41 @@ | ||
package com.necer.ncalendar.fragment; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.NonNull; | ||
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.R; | ||
import com.necer.ncalendar.adapter.RecyclerViewAdapter; | ||
|
||
public class Fragment1 extends Fragment { | ||
|
||
|
||
private RecyclerView recyclerView; | ||
|
||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
|
||
View view = inflater.inflate(R.layout.fragment1, container, false); | ||
recyclerView = view.findViewById(R.id.recyclerView); | ||
|
||
return view; | ||
} | ||
|
||
@Override | ||
public void onActivityCreated(@Nullable Bundle savedInstanceState) { | ||
super.onActivityCreated(savedInstanceState); | ||
|
||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); | ||
RecyclerViewAdapter recyclerViewAdapter = new RecyclerViewAdapter(getContext()); | ||
recyclerView.setAdapter(recyclerViewAdapter); | ||
|
||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/necer/ncalendar/fragment/Fragment2.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,21 @@ | ||
package com.necer.ncalendar.fragment; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import com.necer.ncalendar.R; | ||
|
||
public class Fragment2 extends Fragment { | ||
|
||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
return inflater.inflate(R.layout.fragment2, container, false); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
app/src/main/java/com/necer/ncalendar/fragment/Fragment3.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,42 @@ | ||
package com.necer.ncalendar.fragment; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.NonNull; | ||
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 android.widget.TextView; | ||
|
||
import com.necer.ncalendar.R; | ||
import com.necer.ncalendar.adapter.RecyclerViewAdapter; | ||
|
||
public class Fragment3 extends Fragment { | ||
|
||
private RecyclerView recyclerView; | ||
private TextView tv_no_data; | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
|
||
View view = inflater.inflate(R.layout.fragment3, container, false); | ||
recyclerView = view.findViewById(R.id.recyclerView); | ||
tv_no_data = view.findViewById(R.id.tv_no_data); | ||
return view; | ||
} | ||
|
||
@Override | ||
public void onActivityCreated(@Nullable Bundle savedInstanceState) { | ||
super.onActivityCreated(savedInstanceState); | ||
|
||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); | ||
RecyclerViewAdapter recyclerViewAdapter = new RecyclerViewAdapter(getContext()); | ||
recyclerView.setAdapter(recyclerViewAdapter); | ||
recyclerView.setVisibility(View.GONE); | ||
tv_no_data.setVisibility(View.VISIBLE); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.