Java Code Examples for android.widget.ViewFlipper#setDisplayedChild()

The following examples show how to use android.widget.ViewFlipper#setDisplayedChild() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EmoticonGridFragment.java    From EmoticonGIFKeyboard with Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ViewFlipper mainViewFlipper = view.findViewById(R.id.recent_emoticon_flipper);

    List<Emoticon> emoticonList = getEmoticonsList(getArguments().getInt(ARG_CATEGORY_ID, -1));

    if (emoticonList.isEmpty()) {
        mainViewFlipper.setDisplayedChild(1);
    } else {
        mainViewFlipper.setDisplayedChild(0);

        GridView emoticonGrid = view.findViewById(R.id.emoticon_list_grid);
        emoticonGrid.setNumColumns(getResources().getInteger(R.integer.emoticon_recycler_view_span_size));
        emoticonGrid.setOnItemClickListener(this);

        //Bind the adapter
        //noinspection WrongConstant
        EmoticonGridAdapter emoticonGridAdapter = new EmoticonGridAdapter(getActivity(),
                mEmoticonProvider, emoticonList);
        emoticonGrid.setAdapter(emoticonGridAdapter);
    }
}
 
Example 2
Source File: BaseActivity.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
@SuppressLint("NewApi")
public void showSearch() {
    ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.uv_view_flipper);
    viewFlipper.setDisplayedChild(1);
    if (hasActionBar()) {
        if (originalNavigationMode == -1)
            originalNavigationMode = getActionBar().getNavigationMode();
        getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    }
}
 
Example 3
Source File: BaseActivity.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
@SuppressLint("NewApi")
public void hideSearch() {
    ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.uv_view_flipper);
    viewFlipper.setDisplayedChild(0);
    if (hasActionBar()) {
        getActionBar().setNavigationMode(originalNavigationMode == -1 ? ActionBar.NAVIGATION_MODE_STANDARD : originalNavigationMode);
    }
}
 
Example 4
Source File: RecentActivity.java    From document-viewer with GNU General Public License v3.0 5 votes vote down vote up
void changeLibraryView(final int view) {
    final ViewFlipper vf = getViewflipper();
    if (view == VIEW_LIBRARY) {
        vf.setDisplayedChild(VIEW_LIBRARY);
    } else {
        vf.setDisplayedChild(VIEW_RECENT);
    }
}
 
Example 5
Source File: SearchActivity.java    From uservoice-android-sdk with MIT License 5 votes vote down vote up
public void showSearch() {
    ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.uv_view_flipper);
    viewFlipper.setDisplayedChild(1);
    if (hasActionBar()) {
        if (originalNavigationMode == -1)
            originalNavigationMode = actionBar.getNavigationMode();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    }
}
 
Example 6
Source File: SearchActivity.java    From uservoice-android-sdk with MIT License 5 votes vote down vote up
public void hideSearch() {
    ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.uv_view_flipper);
    viewFlipper.setDisplayedChild(0);
    if (hasActionBar()) {
        actionBar.setNavigationMode(originalNavigationMode == -1 ? ActionBar.NAVIGATION_MODE_STANDARD : originalNavigationMode);
    }
}