diff --git a/app/src/main/java/in/tosc/studddin/fragments/NotesFragment.java b/app/src/main/java/in/tosc/studddin/fragments/NotesFragment.java index 86269d7..33bb03d 100644 --- a/app/src/main/java/in/tosc/studddin/fragments/NotesFragment.java +++ b/app/src/main/java/in/tosc/studddin/fragments/NotesFragment.java @@ -32,7 +32,6 @@ public class NotesFragment extends Fragment { FragmentStatePagerAdapter fragmentPagerAdapter; int p,s; NotesUploadFragment notesUploadFragment; - ViewPagerAdapter adapter; SlidingTabLayout tabs; @@ -54,7 +53,18 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, s = getActivity().getResources().getColor(R.color.colorPrimaryDark); ApplicationWrapper.setCustomTheme((ActionBarActivity) getActivity(),p,s); -/* fragmentPagerAdapter = new FragmentStatePagerAdapter(getChildFragmentManager()) { + fragmentPagerAdapter = new FragmentStatePagerAdapter(getChildFragmentManager()) { + + String[] fragmentTitles = new String[] { + getResources().getString(R.string.notes_fragment_title_search), + getResources().getString(R.string.notes_fragment_title_upload) + }; + + @Override + public CharSequence getPageTitle(int position) { + return fragmentTitles[position]; + } + @Override public Fragment getItem(int position) { switch (position) { @@ -72,11 +82,10 @@ public int getCount() { return 2; } - };*/ + }; notesPager = (ViewPager) rootView.findViewById(R.id.notes_pager); - adapter = new ViewPagerAdapter(getActivity().getSupportFragmentManager()); - notesPager.setAdapter(adapter); + notesPager.setAdapter(fragmentPagerAdapter); tabs = (SlidingTabLayout) rootView.findViewById(R.id.tabs); tabs.setDistributeEvenly(true); tabs.setCustomTabColorizer(new SlidingTabLayout.TabColorizer() { @@ -110,39 +119,5 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { notesUploadFragment.setImagePaths(paths, true); } - - public class ViewPagerAdapter extends FragmentStatePagerAdapter { - - CharSequence TAB_TITLES[]={"Notes","Upload Notes"}; - int NUM_TAB =2; - - public ViewPagerAdapter(FragmentManager fm) { - super(fm); - } - - @Override - public Fragment getItem(int position) { - - - if(position == 0) - { - return (new NotesSearchFragment()); - } - else { - return (new NotesUploadFragment()); - } - - } - - @Override - public CharSequence getPageTitle(int position) { - return TAB_TITLES[position]; - } - - @Override - public int getCount() { - return NUM_TAB; - } - } } diff --git a/app/src/main/java/in/tosc/studddin/fragments/notes/NotesCustomGridViewAdapter.java b/app/src/main/java/in/tosc/studddin/fragments/notes/NotesCustomGridViewAdapter.java index 0836c88..fa96561 100644 --- a/app/src/main/java/in/tosc/studddin/fragments/notes/NotesCustomGridViewAdapter.java +++ b/app/src/main/java/in/tosc/studddin/fragments/notes/NotesCustomGridViewAdapter.java @@ -68,7 +68,7 @@ public void done(byte[] bytes, ParseException e) { public void onClick(View v) { NotesCustomDialog notesCustomDialog = new NotesCustomDialog(mContext, notesCollegeName, notesBranchName, notesTopicName, notesSubjectName, position, uploadedBy); - notesCustomDialog.setTitle(mContext.getString(R.string.notes_details)); + notesCustomDialog.setTitle(mContext.getString(R.string.listings_details)); notesCustomDialog.show(); } }); diff --git a/app/src/main/java/in/tosc/studddin/fragments/notes/NotesSearchFragment.java b/app/src/main/java/in/tosc/studddin/fragments/notes/NotesSearchFragment.java index 5386e42..93d5b0e 100644 --- a/app/src/main/java/in/tosc/studddin/fragments/notes/NotesSearchFragment.java +++ b/app/src/main/java/in/tosc/studddin/fragments/notes/NotesSearchFragment.java @@ -8,6 +8,7 @@ import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; +import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -28,6 +29,7 @@ import java.util.ArrayList; import java.util.List; +import in.tosc.studddin.ApplicationWrapper; import in.tosc.studddin.R; import in.tosc.studddin.fragments.NotesFragment; import in.tosc.studddin.ui.FloatingActionButton; @@ -41,6 +43,8 @@ */ public class NotesSearchFragment extends Fragment { + public static final String TAG = "NotesSearch"; + // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; @@ -177,6 +181,7 @@ public void onClick(View v) { public void goToUploadFragment() { + if (ApplicationWrapper.LOG_DEBUG) Log.d(TAG, "goToUploadFragment called"); NotesFragment notesFragment = (NotesFragment) getParentFragment(); if (notesFragment != null) { notesFragment.goToOtherFragment(1); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 50ec02f..deac91b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -94,11 +94,15 @@ Upload complete - Uploading - Downloading... - Details: + Uploading + Downloading... + Details: Download Start You haven\'t posted an item to sell yet! lets get going + + Get Notes + Upload Notes +