git-svn-id: http://192.168.1.226/svn/proxy@368 454eff88-639b-444f-9e54-f578c98de674
| | |
| | | }
|
| | | }
|
| | |
|
| | | public class AlphabeticalAdapter extends ArrayAdapter<String> implements SectionIndexer
|
| | | {
|
| | | private HashMap<String, Integer> alphaIndexer;
|
| | | private String[] sections;
|
| | |
|
| | | public AlphabeticalAdapter(Context c, int resource, List<String> data)
|
| | | {
|
| | | super(c, resource, data);
|
| | | alphaIndexer = new HashMap<String, Integer>();
|
| | | for (int i = 0; i < data.size(); i++)
|
| | | {
|
| | | String s = data.get(i).substring(0, 1).toUpperCase();
|
| | | if (!alphaIndexer.containsKey(s))
|
| | | alphaIndexer.put(s, i);
|
| | | }
|
| | |
|
| | | Set<String> sectionLetters = alphaIndexer.keySet();
|
| | | ArrayList<String> sectionList = new ArrayList<String>(sectionLetters);
|
| | | Collections.sort(sectionList);
|
| | | sections = new String[sectionList.size()];
|
| | | for (int i = 0; i < sectionList.size(); i++)
|
| | | sections[i] = sectionList.get(i);
|
| | | }
|
| | |
|
| | | public int getPositionForSection(int section)
|
| | | {
|
| | | return alphaIndexer.get(sections[section]);
|
| | | }
|
| | |
|
| | | public int getSectionForPosition(int position)
|
| | | {
|
| | | return 1;
|
| | | }
|
| | |
|
| | | public Object[] getSections()
|
| | | {
|
| | | return sections;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | myFragmentPagerAdapter.addFragment(PhoneCallFragment.getInstance(), tabNamesList.get(3),tabIcons[3]); |
| | | myFragmentPagerAdapter.addFragment(VisitFragment.getInstance(), tabNamesList.get(4),tabIcons[4]); |
| | | myFragmentPagerAdapter.addFragment(AttendanceFragment.getInstance(), tabNamesList.get(5),tabIcons[5]); |
| | | myFragmentPagerAdapter.addFragment(DeviceFragment.newInstance(), tabNamesList.get(6),tabIcons[6]); |
| | | myFragmentPagerAdapter.addFragment(DeviceFragment.getInstance(), tabNamesList.get(6),tabIcons[6]); |
| | | mViewPager.setAdapter(myFragmentPagerAdapter); |
| | | mViewPager.setOffscreenPageLimit(6);//viewpager缓存个数 |
| | | mTabLayout.setupWithViewPager(mViewPager); |
| | |
| | | import java.util.List;
|
| | |
|
| | | public class DeviceFragment extends LeftRightBaseFragment {
|
| | | private View mViewLeft,mViewRight;
|
| | | private RelativeLayout mLayoutWifi,mLayoutLandline,mLayoutSchool,mLayoutCamera1,mLayoutCamera2;
|
| | | private TextView mTvWifi,mTvLandline,mTvSchool,mTvCamera1,mTvCamera2;
|
| | | private CheckBox mCheckWifi,mCheckLandline,mCheckSchool,mCheckCamera1,mCheckCamera2;
|
| | | private List<CheckBox> listCheck = new ArrayList<>();
|
| | | public static DeviceFragment newInstance() {
|
| | | return new DeviceFragment();
|
| | |
|
| | | private static DeviceFragment instance = new DeviceFragment();
|
| | | public static DeviceFragment getInstance() {
|
| | | return instance;
|
| | | }
|
| | |
|
| | | public View addLeftLayout() {
|
| | | mViewLeft = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_left,null);
|
| | | ViewUtils.inject(this, mViewLeft);
|
| | | return mViewLeft;
|
| | | public int[] getLeftRightLayoutIds() {
|
| | | return new int[]{R.layout.fragment_device_left, R.layout.fragment_device_right};
|
| | | }
|
| | |
|
| | | public View addRightLayout() {
|
| | | mViewRight = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right,null);
|
| | | return mViewRight;
|
| | | }
|
| | |
|
| | |
|
| | | @OnClick(R.id.fragment_device_back)
|
| | | public void back(View view){
|