コード例 #1
0
ファイル: EventDetailActivity.java プロジェクト: MrClan/ntf1
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    /*getSupportActionBar().setTitle("Event Details");
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);*/
    setContentView(R.layout.event_detail_view);

    ButterKnife.bind(this);

    Bundle b = this.getIntent().getExtras();
    Event event = (Event) b.getSerializable("curItem");

    lblTitle.setText(event.getTitle());
    lblEventDetail.setText(
        "From " + event.getStartdate() + " till " + event.getEnddate() + " at " + event.getCity());
    U.LoadImage(this, iv, event.getImgName());

    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    viewPager.setAdapter(new SampleFragmentPagerAdapter(getSupportFragmentManager(), event));

    PagerSlidingTabStrip tabsStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    tabsStrip.setShouldExpand(true);
    tabsStrip.setViewPager(viewPager);
    tabsStrip.setShouldExpand(false);

    final Toolbar advToolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
    advToolbar.setTitle("Event Detail");
    advToolbar.setTitleTextColor(R.color.colorPrimaryDark);
    advToolbar.inflateMenu(R.menu.advance_search);
  }
コード例 #2
0
ファイル: BbsFragmentSuper.java プロジェクト: unix8net/vanda
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_child_layout, null);
    mViewPager = (ViewPager) view.findViewById(R.id.content_pager);
    mMyPagerAdapter = new BbsPageAdapter(context, getFragmentManager());
    mFragment = mMyPagerAdapter.getItem(0);
    mViewPager.setAdapter(mMyPagerAdapter);
    mViewPager.setPageTransformer(true, new ZoomOutPageTransformer());
    mPagerSlidingTabStrip = (PagerSlidingTabStrip) view.findViewById(R.id.tabs);

    mViewPager.setOnPageChangeListener(
        new OnPageChangeListener() {

          @Override
          public void onPageSelected(int arg0) {
            mFragment = mMyPagerAdapter.getItem(arg0);
          }

          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {}

          @Override
          public void onPageScrollStateChanged(int arg0) {}
        });
    mPagerSlidingTabStrip.setViewPager(mViewPager);
    // mPagerSlidingTabStrip.setTextColor(Color.parseColor("#fe4200"));
    mPagerSlidingTabStrip.setTextSize(26);
    mPagerSlidingTabStrip.setSelectTabTextSize(28);
    return view;
  }
コード例 #3
0
  // region Lifecycle Methods
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quick_return_twitter);
    ButterKnife.inject(this);

    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager.setAdapter(mSectionsPagerAdapter);

    mTabs.setAllCaps(false);
    mTabs.setShouldExpand(true);
    mTabs.setTextSize(QuickReturnUtils.dp2px(this, 16));
    mTabs.setTabBackground(R.drawable.selector_bg_tab);
    mTabs.setIndicatorColorResource(R.color.steel_blue);
    mTabs.setIndicatorHeight(QuickReturnUtils.dp2px(this, 5));
    mTabs.setOnPageChangeListener(mTabsOnPageChangeListener);
    mTabs.setViewPager(mViewPager);

    // Set first tab selected
    mTabsLinearLayout = ((LinearLayout) mTabs.getChildAt(0));

    for (int i = 0; i < mTabsLinearLayout.getChildCount(); i++) {
      TextView tv = (TextView) mTabsLinearLayout.getChildAt(i);

      if (i == 0) {
        tv.setTextColor(getResources().getColor(R.color.steel_blue));
        tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Medium.ttf"));
      } else {
        tv.setTextColor(getResources().getColor(R.color.steel_blue));
        tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"));
      }
    }
  }
コード例 #4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    //        fab.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View view) {
    //                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
    //                        .setAction("Action", null).show();
    //            }
    //        });
    pagerTab = (PagerSlidingTabStrip) findViewById(R.id.pager_tabs);
    viewPager = (ViewPager) findViewById(R.id.view_pager);
    viewPager.setOffscreenPageLimit(3);
    viewPager.setAdapter(new PagerAdapter(getSupportFragmentManager()));
    pagerTab.setViewPager(viewPager);
    pagerTab.setOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {
          @Override
          public void onPageScrolled(
              int position, float positionOffset, int positionOffsetPixels) {}

          @Override
          public void onPageSelected(int position) {
            if (position == 0) {}
          }

          @Override
          public void onPageScrollStateChanged(int state) {}
        });
  }
コード例 #5
0
  // region Lifecycle Methods
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quick_return_facebook);
    ButterKnife.inject(this);

    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager.setAdapter(mSectionsPagerAdapter);

    mTabs.setAllCaps(false);
    mTabs.setShouldExpand(true);
    //        mTabs.setTextSize(QuickReturnUtils.dp2px(this, 16));
    //        mTabs.setTabBackground(R.drawable.selector_bg_tab);
    mTabs.setIndicatorColorResource(R.color.steel_blue);
    mTabs.setIndicatorHeight(QuickReturnUtils.dp2px(this, 5));
    mTabs.setDividerColor(getResources().getColor(android.R.color.transparent));
    //        mTabs.setBackgroundColor(getResources().getColor(R.color.indigo));

    mTabs.setOnPageChangeListener(mTabsOnPageChangeListener);

    mTabs.setViewPager(mViewPager);

    // Set first tab selected
    mTabsLinearLayout = ((LinearLayout) mTabs.getChildAt(0));
    ImageButton ib = (ImageButton) mTabsLinearLayout.getChildAt(0);
    ib.setImageResource(R.drawable.ic_action_event_highlighted);
  }
コード例 #6
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root =
        (ViewGroup) inflater.inflate(R.layout.fragment_default_view_pager, container, false);
    ButterKnife.inject(this, root);

    Bundle tvArgs = new Bundle(), radioArgs = new Bundle();
    if (getArguments() != null) {
      tvArgs.putAll(getArguments());
      radioArgs.putAll(getArguments());
    }
    tvArgs.putInt(PVR_LIST_TYPE_KEY, LIST_TV_CHANNELS);
    radioArgs.putInt(PVR_LIST_TYPE_KEY, LIST_RADIO_CHANNELS);

    tabsAdapter =
        new TabsAdapter(getActivity(), getChildFragmentManager())
            .addTab(PVRChannelsListFragment.class, tvArgs, R.string.tv_channels, 1)
            .addTab(PVRChannelsListFragment.class, radioArgs, R.string.radio_channels, 2)
            .addTab(PVRRecordingsListFragment.class, getArguments(), R.string.recordings, 3);

    viewPager.setAdapter(tabsAdapter);
    pagerTabStrip.setViewPager(viewPager);

    return root;
  }
コード例 #7
0
  // Activity Callbacks __________________________________________________________________________
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);
    this.getSupportActionBar().setElevation(0);

    getWindow().setSharedElementExitTransition(new Slide());
    getWindow().setSharedElementEnterTransition(new Slide());

    tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPagerAdapter = new ContactsAdapter(this.getSupportFragmentManager(), this);

    viewPager.setAdapter(viewPagerAdapter);

    tabs.setShouldExpand(true);
    tabs.setTextColor(getResources().getColor(R.color.text_primary));
    tabs.setDividerColor(getResources().getColor(R.color.primary));
    tabs.setIndicatorColorResource(R.color.text_primary);
    tabs.setIndicatorHeight(7);

    // Bind the tabs to the ViewPager
    tabs.setViewPager(viewPager);

    // Start in Contacts Fragment
    viewPager.setCurrentItem(1);

    // Listener for slide animation on searchable selected
    setOnSearchableListener();

    // Configure custom-searchable UI
    // CustomSearchableInfo.setTransparencyColor(Color.parseColor("#0288D1"));
  }
コード例 #8
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final SharedPreferences sp =
        this.getActivity().getSharedPreferences("linefriend", Context.MODE_APPEND);

    View rootView = inflater.inflate(R.layout.fragment_category_all, container, false);

    tabs = (PagerSlidingTabStrip) rootView.findViewById(R.id.tabs);
    pager = (ViewPager) rootView.findViewById(R.id.pager);
    adapter = new MyPagerAdapter(this.getChildFragmentManager());

    pager.setAdapter(adapter);

    final int pageMargin =
        (int)
            TypedValue.applyDimension(
                TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics());
    pager.setPageMargin(pageMargin);

    tabs.setTextSize(DisplayUtil.sp2px(this.getActivity(), 15));
    //		tabs.setTextColor(Color.parseColor("#828181"));
    tabs.setViewPager(pager);

    return rootView;
  }
コード例 #9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
    viewPager.setAdapter(new TabsAdapter(getSupportFragmentManager()));
    PagerSlidingTabStrip pagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    pagerSlidingTabStrip.setViewPager(viewPager);
  }
コード例 #10
0
  private void setupSlidingTabs(ViewPager vpPager) {
    tabs = (PagerSlidingTabStrip) findViewById(R.id.slidingTabStrip);
    tabs.setViewPager(vpPager);
    tabs.setTextColor(getResources().getColor(R.color.TwitterBlue));

    tabs.setIndicatorColor(getResources().getColor(R.color.TwitterBlue));
    tabs.setDividerColor(getResources().getColor(android.R.color.white));
    tabs.setShouldExpand(true);
    tabs.setAllCaps(true);
  }
コード例 #11
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    mVPager = (ViewPager) mFragmentView.findViewById(R.id.viewpager2);
    mUserProfilePagerAdapter = new UserProfilePagerAdapter(getChildFragmentManager());
    mVPager.setAdapter(mUserProfilePagerAdapter);
    mTabStrip = (PagerSlidingTabStrip) mFragmentView.findViewById(R.id.tabs2);
    mTabStrip.setViewPager(mVPager);
    mUserProfilePagerAdapter.notifyDataSetChanged();
  }
コード例 #12
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_fragment_cut_pager_sliding_tab_strip);
   pagerSlidingTabStrip =
       (PagerSlidingTabStrip) findViewById(R.id.activity_fragnent_cut_pager_sliding_tab_strip);
   viewpager =
       (ViewPager) findViewById(R.id.activity_fragnent_cut_pager_sliding_tab_strip_viewpager);
   viewpager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager()));
   pagerSlidingTabStrip.setViewPager(viewpager);
 }
コード例 #13
0
ファイル: BlogFragment.java プロジェクト: treejames/Fishing-1
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   View rootView = inflater.inflate(R.layout.blog_fragment_main, container, false);
   ButterKnife.inject(this, rootView);
   vpDate.setAdapter(new BlogFragmentListAdapter(getChildFragmentManager()));
   tabs.setViewPager(vpDate);
   tabs.setTextColor(Color.WHITE);
   tabs.setBackgroundColor(getResources().getColor(R.color.blue));
   write.setOnClickListener(v -> startActivity(new Intent(getActivity(), WriteActivity.class)));
   return rootView;
 }
コード例 #14
0
ファイル: ChartFragment.java プロジェクト: hungapp/chart
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_chart, container, false);
    tabs = (PagerSlidingTabStrip) rootView.findViewById(R.id.tabs);
    pager = (ViewPager) rootView.findViewById(R.id.pager);
    adapter =
        new MyPagerAdapter(getActivity().getSupportFragmentManager(), arrayTabs, arrayChartUrl);
    pager.setAdapter(adapter);
    tabs.setShouldExpand(true);
    tabs.setViewPager(pager);
    return rootView;
  }
コード例 #15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_friends);

    This = this;
    Log.d(TAG, "Info oncreate");
    ButterKnife.bind(this);
    parseUser = ParseUser.getCurrentUser();

    alertD = new Alert(this);

    isLoadData = false;

    final ViewPager vpPager = (ViewPager) findViewById(R.id.vpPager);
    adapterViewPager = new MyPagerAdapter(getSupportFragmentManager());
    vpPager.setAdapter(adapterViewPager);

    // Check data extra
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {
      String jsonData = extras.getString("com.parse.Data");
      JSONObject json = null;
      try {
        json = new JSONObject(jsonData);
        String action = json.getString("action");

        switch (action) {
          case "friends_invite":
            vpPager.setCurrentItem(2);
            break;
          case "friends_search":
            vpPager.setCurrentItem(1);
            break;
          default:
            vpPager.setCurrentItem(0);
        }

      } catch (JSONException e) {
        e.printStackTrace();
      }
    }

    PagerSlidingTabStrip tabsStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    LinearLayout view = (LinearLayout) tabsStrip.getChildAt(0);
    tabsStrip.setViewPager(vpPager);

    loadData();
  }
コード例 #16
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    // 头部图片集
    ViewPager vpImage = (ViewPager) findViewById(R.id.imagepager);
    vpImage.setAdapter(new MyHeadPicAdapter(this));

    // ScrollableLayout
    mScrollLayout = (ScrollableLayout) findViewById(R.id.scrollableLayout);
    // 扩展点击头部滑动范围
    //        int headHeight = getResources().getDimensionPixelSize(R.dimen.head_height);
    //        int tabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
    //        mScrollLayout.setClickHeadExpand(headHeight + tabHeight);
    mFragmentList = new ArrayList<>();
    mFragmentList.add(ListFragment.newInstance(0));
    mFragmentList.add(ScrollViewFragment.newInstance(1));
    mFragmentList.add(ListFragment.newInstance(2));

    List<String> titleList = new ArrayList<>();
    titleList.add("tab0");
    titleList.add("tab1");
    titleList.add("tab2");
    viewPager.setAdapter(
        new MyFragmentPagerAdapter(getSupportFragmentManager(), mFragmentList, titleList));
    mScrollLayout.getHelper().setCurrentScrollableContainer(mFragmentList.get(0));
    PagerSlidingTabStrip pagerSlidingTabStrip =
        (PagerSlidingTabStrip) findViewById(R.id.pagerStrip);
    pagerSlidingTabStrip.setViewPager(viewPager);
    pagerSlidingTabStrip.setOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {
          @Override
          public void onPageScrolled(int i, float v, int i2) {}

          @Override
          public void onPageSelected(int i) {
            Log.e("onPageSelected", "page:" + i);
            mScrollLayout.getHelper().setCurrentScrollableContainer(mFragmentList.get(i));
          }

          @Override
          public void onPageScrollStateChanged(int i) {}
        });
    viewPager.setCurrentItem(0);
  }
コード例 #17
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    mPagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    mPagerSlidingTabStrip.setViewPager(mViewPager);
  }
コード例 #18
0
  private void setupViews() {
    mListsAdapter = new ListsPagerAdapter(getSupportFragmentManager(), this);

    mPager = (ViewPager) findViewById(R.id.pagerLists);
    mPager.setAdapter(mListsAdapter);

    mTabs = (PagerSlidingTabStrip) findViewById(R.id.tabsLists);
    mTabs.setViewPager(mPager);
    mTabs.setOnTabClickListener(
        new OnTabClickListener() {
          @Override
          public void onTabClick(int position) {
            if (mPager.getCurrentItem() == position) {
              String listId = mListsAdapter.getListId(position);
              ListManageDialogFragment.showListManageDialog(listId, getSupportFragmentManager());
            }
          }
        });
  }
コード例 #19
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View v = inflater.inflate(R.layout.swipe, container, false);
    // TextView textV = (TextView) v.findViewById(R.id.drawer_itemName);
    // ImageView view = (ImageView) v.findViewById(R.id.drawer_icon);
    // view.setImageResource(R.drawable.ic_drawer);
    // textV.setText("skask");
    // Get the ViewPager and set it's PagerAdapter so that it can display items
    ViewPager viewPager = (ViewPager) v.findViewById(R.id.viewpager);
    viewPager.setAdapter(new SampleFragmentPagerAdapter(getFragmentManager()));

    // Give the PagerSlidingTabStrip the ViewPager

    PagerSlidingTabStrip tabsStrip = (PagerSlidingTabStrip) v.findViewById(R.id.tabs);
    // Attach the view pager to the tab strip
    tabsStrip.setViewPager(viewPager);
    return v;
  }
コード例 #20
0
ファイル: MainActivity.java プロジェクト: westPagoda/FuLiApp
  @TargetApi(Build.VERSION_CODES.M)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    UmengUpdateAgent.update(this);

    mainViewPager = (ViewPager) findViewById(R.id.main_viewPager);
    // mainViewPager.setOffscreenPageLimit(1);
    mainViewPager.setAdapter(new SampleFragmentPagerAdapter(getSupportFragmentManager()));
    pagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tab_indicator);
    pagerSlidingTabStrip.setViewPager(mainViewPager);

    // 指示条颜色
    pagerSlidingTabStrip.setIndicatorColor(R.color.blue_500);
    // 指示条高度
    pagerSlidingTabStrip.setIndicatorHeight(
        (int)
            TypedValue.applyDimension(
                TypedValue.COMPLEX_UNIT_DIP, 3, getResources().getDisplayMetrics()));
  }
コード例 #21
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    if (getDialog() != null) {
      getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
      getDialog().getWindow().setBackgroundDrawableResource(android.R.color.transparent);
    }

    View root = inflater.inflate(R.layout.fragment_quick_contact, container, false);

    tabs = (PagerSlidingTabStrip) root.findViewById(R.id.tabs);
    pager = (ViewPager) root.findViewById(R.id.pager);
    adapter = new ContactPagerAdapter();

    pager.setAdapter(adapter);

    tabs.setViewPager(pager);

    return root;
  }
コード例 #22
0
ファイル: HomeFragment2.java プロジェクト: hughesrl/0f0s00
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    myFragmentView = inflater.inflate(R.layout.fragment_home, container, false);

    tabs = (PagerSlidingTabStrip) myFragmentView.findViewById(R.id.tabs);
    pager = (ViewPager) myFragmentView.findViewById(R.id.pager);
    pagerAdapter = new MyPagerAdapter(getChildFragmentManager());
    pager.setAdapter(pagerAdapter);
    final int pageMargin =
        (int)
            TypedValue.applyDimension(
                TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics());
    pager.setPageMargin(pageMargin);
    tabs.setViewPager(pager);
    //        if(mParamPatientData.getpIsInClinic() > 0) {
    //            pager.setCurrentItem(1);
    //        }

    return myFragmentView;
  }
コード例 #23
0
ファイル: ProjectFragment.java プロジェクト: evil123/RWCJO_M
  /** 初始化Fragment和设置适配器 */
  private void initPager() {
    mPagerSlidingTabStrip = (PagerSlidingTabStrip) getView().findViewById(R.id.tabs);
    mViewPager = (ViewPager) getView().findViewById(R.id.pager);
    String[] titles = {"工点", "人员", "基点"};
    mViewPager.setAdapter(new MyPagerAdapter(getChildFragmentManager(), titles));
    mPagerSlidingTabStrip.setViewPager(mViewPager);
    mPagerSlidingTabStrip.setOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {

          @Override
          public void onPageSelected(int arg0) {
            // colorChange(arg0);
          }

          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {}

          @Override
          public void onPageScrollStateChanged(int arg0) {}
        });
  }
コード例 #24
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
      getSupportActionBar().setTitle(null);
    }

    ViewPageAdapter adapter = new ViewPageAdapter(getSupportFragmentManager());
    viewPager.setAdapter(adapter);

    pagerSlidingTabStrip.setViewPager(viewPager);
    int pageMargin =
        (int)
            TypedValue.applyDimension(
                TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics());
    viewPager.setPageMargin(pageMargin);
  }
コード例 #25
0
  @Nullable
  @Override
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    if (mView == null) {
      mView = inflater.inflate(R.layout.fragment_head_pager, container, false);
      mPagerSlidingTabStrip = (PagerSlidingTabStrip) mView.findViewById(R.id.tab_host);
      ViewPager viewPager = (ViewPager) mView.findViewById(R.id.view_pager);
      if (viewPager != null) {
        viewPager.setAdapter(new PagerAdapter(getFragmentManager()));
        viewPager.setOffscreenPageLimit(1);
        mPagerSlidingTabStrip.setViewPager(viewPager);
      }
      setTabsValue();
    }

    ViewGroup parent = (ViewGroup) mView.getParent();
    if (parent != null) {
      parent.removeView(mView);
    }

    return mView;
  }
コード例 #26
0
 private void initAdapter() {
   vpContent.setAdapter(new MyViewPagerAdapter(getSupportFragmentManager()));
   tabs.setViewPager(vpContent);
 }
コード例 #27
0
 @Override
 public void fillViewPagerAdapter(MyViewPagerAdapter adapter) {
   vpContent.setAdapter(adapter);
   tabs.setViewPager(vpContent);
 }
コード例 #28
0
ファイル: NewsCategory.java プロジェクト: drudoshanks/Newsapp
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.news_catagory, container, false);

    main_model = ((HomeScreen) getActivity()).main_model;

    // if (main_model.size() > 0)
    main_cat_id = main_model.get(((HomeScreen) getActivity()).list_position).getCat_id();

    for (int i = 0; i < main_model.size(); i++) {
      if (main_model.get(i).getParent_cat_id() == main_cat_id) {
        sub_main_model.add(main_model.get(i));
        new_main_model.add(main_model.get(i));
      }
    }

    // this condition if it has no sub categories
    if (sub_main_model.size() == 0) {
      sub_main_model.add(main_model.get(((HomeScreen) getActivity()).list_position));

      new_main_model.add(main_model.get(((HomeScreen) getActivity()).list_position));
    }

    // new_main_model = sub_main_model;

    for (int i = 0; i < sub_main_model.size(); i++) {

      if (sub_main_model.get(i).getCat_type_tag().equalsIgnoreCase("TP")) {

        new_main_model.remove(0);

        new_main_model.add(0, sub_main_model.get(i));

        new_main_model.remove(i);
        new_main_model.add(i, sub_main_model.get(0));
      }
    }

    tabs = (PagerSlidingTabStrip) view.findViewById(R.id.tabs);

    pager = (ViewPager) view.findViewById(R.id.pager);

    // initialiseTabHost();

    // pager.setCurrentItem(new_main_model.size());

    adapter = new MyPagerAdapter(getChildFragmentManager(), new_main_model);

    // wrap pager to provide infinite paging with wrap-around
    // PagerAdapter wrappedAdapter = new InfinitePagerAdapter(adapter);

    // pager.setAdapter(wrappedAdapter);

    pager.setAdapter(adapter);

    final int pageMargin =
        (int)
            TypedValue.applyDimension(
                TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics());
    pager.setPageMargin(pageMargin);

    // pager.setOnPageChangeListener(new OnPageChangeListener() {
    //
    // @Override
    // public void onPageSelected(int position) {
    // // TODO Auto-generated method stub
    //
    // Log.d("ankit", "I am here::::" + position);
    //
    // }
    //
    // @Override
    // public void onPageScrolled(int arg0, float arg1, int arg2) {
    // // TODO Auto-generated method stub
    //
    // int pos = pager.getCurrentItem();
    // mTabHost.setCurrentTab(pos);
    //
    // }
    //
    // @Override
    // public void onPageScrollStateChanged(int arg0) {
    // // TODO Auto-generated method stub
    //
    // }
    // });

    tabs.setViewPager(pager);

    return view;
  }
コード例 #29
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onViewCreated(view, savedInstanceState);

    aq.id(R.id.header_logo_inivit)
        .clicked(
            new OnClickListener() {

              @Override
              public void onClick(View arg0) {
                // TODO Auto-generated method stub

                getFragmentManager().popBackStack();
              }
            });
    aq.id(R.id.organizer)
        .text(
            Html.fromHtml(
                "<i><small><font color=\"#c5c5c5\">"
                    + "Competitor ID: "
                    + "</font></small></i>"
                    + "<font color=\"#47a842\">"
                    + "compID"
                    + "</font>"));

    pager = (ViewPager) getActivity().findViewById(R.id.pager_invit);

    tabPagerAdapter = new TabPagerAdapter1(getChildFragmentManager());
    tabPagerAdapter.setTabHolderScrollingContent(
        new InvitationScrollHolder() {

          @Override
          public void onScroll(
              AbsListView view,
              int firstVisibleItem,
              int visibleItemCount,
              int totalItemCount,
              int pagePosition) {
            // TODO Auto-generated method stub

          }

          @Override
          public void adjustScroll(int scrollHeight) {
            // TODO Auto-generated method stub

          }
        });

    pager.setAdapter(tabPagerAdapter);

    // Bind the tabs to the ViewPager
    final PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) aq.id(R.id.tabs_invit).getView();

    tabs.setShouldExpand(false);
    tabs.setDividerColorResource(android.R.color.transparent);
    tabs.setUnderlineColorResource(android.R.color.transparent);
    tabs.setTextSize(Utils.getPxFromDp(getActivity(), 14));
    tabs.setIndicatorHeight(Utils.getPxFromDp(getActivity(), 3));

    tabs.setMinimumWidth(Utils.getPxFromDp(getActivity(), 200));

    tabs.setIndicatorColor(Color.parseColor("#ffffff"));
    tabs.setTextColor(Color.parseColor("#ffffff"));
    tabs.setSmoothScrollingEnabled(true);
    tabs.setShouldExpand(false);
    tabs.setAllCaps(false);
    tabs.setTypeface(null, Typeface.NORMAL);

    tabs.setViewPager(pager);
    tabPagerAdapter.notifyDataSetChanged();
  }
コード例 #30
0
  @Override
  protected void onCreated() {
    setContentView(R.layout.activity_vocabulary_details);

    layoutRoot = (LinearLayout) findViewById(R.id.layoutRoot);
    txtVocabulary = (TextView) findViewById(R.id.txtVocabulary);
    chkBookmark = (CheckBox) findViewById(R.id.chkBookmark);
    tabCategories = (PagerSlidingTabStrip) findViewById(R.id.tabDescriptions);
    pagerCategories = (ViewPager) findViewById(R.id.pagerDescItems);

    int vocabularyId = getIntent().getIntExtra(VOCAB_ID, 0);

    vocabulary = Vocabularies.select(vocabularyId);
    assert vocabulary != null;
    txtVocabulary.setText(vocabulary.getVocabulary());

    chkBookmark.setChecked(vocabulary.getBookmarked());

    chkBookmark.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            boolean bookmarked = chkBookmark.isChecked();
            vocabulary.setBookmarked(bookmarked);
            if (Vocabularies.update(vocabulary) > 0) {
              if (bookmarked) {
                MySnackbar.show(layoutRoot, "Vocabulary added to bookmarks", Snackbar.LENGTH_SHORT);
              } else {
                MySnackbar.show(
                    layoutRoot, "Vocabulary removed from bookmarks", Snackbar.LENGTH_SHORT);
              }
            }
          }
        });

    sentences = Sentences.getVocabSentences(vocabularyId);
    notes = Notes.getNotes(vocabularyId);

    ArrayList<String> tabTitles = new ArrayList<>();
    tabTitles.add("Definition");
    tabTitles.add("Sentences");
    if (notes.size() > 0) {
      tabTitles.add("Notes");
      tabCount = 3;
    }

    descriptionPagerAdapter =
        new DescriptionPagerAdapter(getSupportFragmentManager(), tabTitles, vocabularyId);
    pagerCategories.setAdapter(descriptionPagerAdapter);

    // Bind the tabCategories to the ViewPager
    tabCategories.setViewPager(pagerCategories);

    pagerCategories.addOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {
          @Override
          public void onPageScrolled(
              int position, float positionOffset, int positionOffsetPixels) {}

          @Override
          public void onPageSelected(int position) {
            changeTabTitleColors(position);
          }

          @Override
          public void onPageScrollStateChanged(int state) {}
        });

    changeTabsFont();
    changeTabTitleColors(0);
  }