Search in sources :

Example 16 with Bundle

use of android.os.Bundle in project UltimateAndroid by cymcsg.

the class ViewPagerTabListViewFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.observable_scroll_view_fragment_listview, container, false);
    Activity parentActivity = getActivity();
    final ObservableListView listView = (ObservableListView) view.findViewById(R.id.list);
    listView.addHeaderView(inflater.inflate(R.layout.observable_scroll_view_padding, null));
    List<String> items = new ArrayList<String>();
    for (int i = 1; i <= 100; i++) {
        items.add("Item " + i);
    }
    listView.setAdapter(new ArrayAdapter<String>(parentActivity, android.R.layout.simple_list_item_1, items));
    if (parentActivity instanceof ObservableScrollViewCallbacks) {
        // Scroll to the specified position after layout
        Bundle args = getArguments();
        if (args != null && args.containsKey(ARG_INITIAL_POSITION)) {
            final int initialPosition = args.getInt(ARG_INITIAL_POSITION, 0);
            ViewTreeObserver vto = listView.getViewTreeObserver();
            vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

                @Override
                public void onGlobalLayout() {
                    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
                        listView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                    } else {
                        listView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                    }
                    // scrollTo() doesn't work, should use setSelection()
                    listView.setSelection(initialPosition);
                }
            });
        }
        listView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
    }
    return view;
}
Also used : Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) Activity(android.app.Activity) ObservableScrollViewCallbacks(com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks) View(android.view.View) ObservableListView(com.github.ksoichiro.android.observablescrollview.ObservableListView) ObservableListView(com.github.ksoichiro.android.observablescrollview.ObservableListView) ViewTreeObserver(android.view.ViewTreeObserver)

Example 17 with Bundle

use of android.os.Bundle in project UltimateAndroid by cymcsg.

the class ViewPagerTabScrollViewFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.observable_scroll_view_fragment_scrollview, container, false);
    final ObservableScrollView scrollView = (ObservableScrollView) view.findViewById(R.id.scroll);
    Activity parentActivity = getActivity();
    if (parentActivity instanceof ObservableScrollViewCallbacks) {
        // Scroll to the specified offset after layout
        Bundle args = getArguments();
        if (args != null && args.containsKey(ARG_SCROLL_Y)) {
            final int scrollY = args.getInt(ARG_SCROLL_Y, 0);
            ViewTreeObserver vto = scrollView.getViewTreeObserver();
            vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

                @Override
                public void onGlobalLayout() {
                    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
                        scrollView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                    } else {
                        scrollView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                    }
                    scrollView.scrollTo(0, scrollY);
                }
            });
        }
        scrollView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
    }
    return view;
}
Also used : ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) Bundle(android.os.Bundle) Activity(android.app.Activity) ObservableScrollViewCallbacks(com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks) ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) View(android.view.View) ViewTreeObserver(android.view.ViewTreeObserver)

Example 18 with Bundle

use of android.os.Bundle in project Launcher3 by chislon.

the class LauncherTransitionable method startSearch.

/**
     * Indicates that we want global search for this activity by setting the globalSearch
     * argument for {@link #startSearch} to true.
     */
@Override
public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData, boolean globalSearch) {
    showWorkspace(true);
    if (initialQuery == null) {
        // Use any text typed in the launcher as the initial query
        initialQuery = getTypedText();
    }
    if (appSearchData == null) {
        appSearchData = new Bundle();
        appSearchData.putString("source", "launcher-search");
    }
    Rect sourceBounds = new Rect();
    if (mSearchDropTargetBar != null) {
        sourceBounds = mSearchDropTargetBar.getSearchBarBounds();
    }
    startSearch(initialQuery, selectInitialQuery, appSearchData, sourceBounds);
}
Also used : Rect(android.graphics.Rect) Bundle(android.os.Bundle)

Example 19 with Bundle

use of android.os.Bundle in project cw-omnibus by commonsguy.

the class BitmapFragment method newInstance.

static BitmapFragment newInstance(int inSampleSize) {
    BitmapFragment frag = new BitmapFragment();
    Bundle args = new Bundle();
    args.putInt(KEY_SAMPLE_SIZE, inSampleSize);
    frag.setArguments(args);
    return (frag);
}
Also used : Bundle(android.os.Bundle)

Example 20 with Bundle

use of android.os.Bundle in project cw-omnibus by commonsguy.

the class EditorFragment method newInstance.

static EditorFragment newInstance(int position) {
    EditorFragment frag = new EditorFragment();
    Bundle args = new Bundle();
    args.putInt(KEY_POSITION, position);
    frag.setArguments(args);
    return (frag);
}
Also used : Bundle(android.os.Bundle)

Aggregations

Bundle (android.os.Bundle)6155 Intent (android.content.Intent)826 RemoteException (android.os.RemoteException)477 View (android.view.View)342 Test (org.junit.Test)266 ArrayList (java.util.ArrayList)216 TextView (android.widget.TextView)203 PersistableBundle (android.os.PersistableBundle)201 PendingIntent (android.app.PendingIntent)185 IOException (java.io.IOException)176 Uri (android.net.Uri)155 ImageView (android.widget.ImageView)152 ComponentName (android.content.ComponentName)124 Fragment (android.support.v4.app.Fragment)124 Message (android.os.Message)122 JSONObject (org.json.JSONObject)112 Account (android.accounts.Account)108 Context (android.content.Context)102 Parcelable (android.os.Parcelable)99 Bitmap (android.graphics.Bitmap)90