Search in sources :

Example 6 with AbsListView

use of android.widget.AbsListView in project android-app-common-tasks by multidots.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mContext = MainActivity.this;
    //Activity mActivity = MainActivity.this;
    tvText = (TextView) findViewById(R.id.text);
    String[] sdkFunctionalityListValue = new String[] { "Validations", /* 0 */
    "Internet availability", /* 1 */
    "Date formats", /* 2 */
    "Device id", /* 3 */
    "Set preferences", /* 4 */
    "Get preferences", /* 5 */
    "Get current location", /* 6 */
    "Pinchzoom image", /* 7 */
    "Get application icon", /* 8 */
    "Send notification", /* 9 */
    "Get random character from A to Z", /* 10 */
    "Screen sleep mode on off", /* 11 */
    "Open image from path", /* 12 */
    "Open video from path", /* 13 */
    "Open url in browser", /* 14 */
    "Show address on map", /* 15 */
    "Create folder or directory", /* 16 */
    "Download image from url", /* 17 */
    "Open date picker", /* 18 */
    "Open time picker", /* 19 */
    "Get files count in directory", /* 20 */
    "Get date difference", /* 21 */
    "Convert string date to dateformat", /* 22 */
    "Get device height", /* 23 */
    "Get device width", /* 24 */
    "Generate random number", /* 25 */
    "Postfix for number", /* 26 */
    "Convert comma separated string to arraylist and viseversa", /* 27 */
    "Music ON OFF", /* 28 */
    "Apply blur bffect on image", /* 29 */
    "Drawable to bitmap and viceversa", /* 30 */
    "Set device volume as app volume", /* 31 */
    "Set and get image from preferences", /* 32 */
    "Application version", /* 33 */
    "Vertical text views", /* 34 */
    "Is SDCard available?", /* 35 */
    "Show share dialog", /* 36 */
    "Change device profile", /* 37 */
    "Change bitmap to rounded cornered", /* 38 */
    "Show toast", /* 39 */
    "Prevent double click", /* 40 */
    "Bluetooth/wifi ON OFF", /* 41 */
    "Pick/capture/preview image/video and crop image", /* 42 */
    "Url validation & ripple effect", /* 43 */
    "Contacts with email id & screenshot", /* 44 */
    "Social integration", /* 45 */
    "Pick color", /* 46 */
    "Remote file size or download file" };
    ListView sdkFunctionalityList = (ListView) findViewById(R.id.Md_list_company);
    ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, sdkFunctionalityListValue);
    sdkFunctionalityList.setAdapter(stringArrayAdapter);
    sdkFunctionalityList.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            selectedListItem(position);
        }
    });
    sdkFunctionalityList.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            tvText.setText("");
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
        }
    });
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Example 7 with AbsListView

use of android.widget.AbsListView in project Rashr by DsLNeXuS.

the class FlashFragment method optimizeLayout.

/**
     * optimizeLayout checks which cards need to be added to UI. So if you device doesn't support
     * kernel flashing optimizeLayout will not add it to UI.
     *
     * @param root RootView from Fragment
     * @throws NullPointerException layout can't be inflated
     */
@SuppressLint("PrivateResource")
public void optimizeLayout(View root) throws NullPointerException {
    CardUI RashrCards = (CardUI) root.findViewById(R.id.RashrCards);
    if (RashrApp.DEVICE.isRecoverySupported() || RashrApp.DEVICE.isKernelSupported() || BuildConfig.DEBUG) {
        /** If device is supported start setting up layout */
        setupSwipeUpdater(root);
        /** Avoid overlapping scroll on CardUI and SwipeRefreshLayout */
        RashrCards.getListView().setOnScrollListener(new AbsListView.OnScrollListener() {

            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {
            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
                int topRowVerticalPosition = (view == null || view.getChildCount() == 0) ? 0 : view.getChildAt(0).getTop();
                if (mSwipeUpdater != null)
                    mSwipeUpdater.setEnabled((topRowVerticalPosition >= 0));
            }
        });
        if (RashrApp.DEVICE.isRecoverySupported() || BuildConfig.DEBUG) {
            addRecoveryCards(RashrCards);
        }
        if (RashrApp.DEVICE.isKernelSupported() || BuildConfig.DEBUG) {
            addKernelCards(RashrCards);
        }
        //Device has been flashed over Rashr so you can choose previously used images
        if (getHistoryFiles().size() > 0) {
            final IconCard HistoryCard = new IconCard(getString(R.string.history), R.drawable.ic_history, getString(R.string.history_description));
            HistoryCard.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    showFlashHistory();
                }
            });
            RashrCards.addCard(HistoryCard, true);
        }
    }
    addRebooterCards(RashrCards);
}
Also used : CardUI(com.fima.cardsui.views.CardUI) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint) IconCard(com.fima.cardsui.views.IconCard) SuppressLint(android.annotation.SuppressLint)

Example 8 with AbsListView

use of android.widget.AbsListView in project android_frameworks_base by ResurrectionRemix.

the class ChooserActivity method onPrepareAdapterView.

@Override
public void onPrepareAdapterView(AbsListView adapterView, ResolveListAdapter adapter, boolean alwaysUseOption) {
    final ListView listView = adapterView instanceof ListView ? (ListView) adapterView : null;
    mChooserListAdapter = (ChooserListAdapter) adapter;
    if (mCallerChooserTargets != null && mCallerChooserTargets.length > 0) {
        mChooserListAdapter.addServiceResults(null, Lists.newArrayList(mCallerChooserTargets));
    }
    mChooserRowAdapter = new ChooserRowAdapter(mChooserListAdapter);
    mChooserRowAdapter.registerDataSetObserver(new OffsetDataSetObserver(adapterView));
    adapterView.setAdapter(mChooserRowAdapter);
    if (listView != null) {
        listView.setItemsCanFocus(true);
    }
}
Also used : ListView(android.widget.ListView) AbsListView(android.widget.AbsListView)

Example 9 with AbsListView

use of android.widget.AbsListView in project android_frameworks_base by ResurrectionRemix.

the class ResolverDrawerLayout method getHeightUsed.

private int getHeightUsed(View child) {
    // This method exists because we're taking a fast path at measuring ListViews that
    // lets us get away with not doing the more expensive wrap_content measurement which
    // imposes double child view measurement costs. If we're looking at a ListView, we can
    // check against the lowest child view plus padding and margin instead of the actual
    // measured height of the ListView. This lets the ListView hang off the edge when
    // all of the content would fit on-screen.
    int heightUsed = child.getMeasuredHeight();
    if (child instanceof AbsListView) {
        final AbsListView lv = (AbsListView) child;
        final int lvPaddingBottom = lv.getPaddingBottom();
        int lowest = 0;
        for (int i = 0, N = lv.getChildCount(); i < N; i++) {
            final int bottom = lv.getChildAt(i).getBottom() + lvPaddingBottom;
            if (bottom > lowest) {
                lowest = bottom;
            }
        }
        if (lowest < heightUsed) {
            heightUsed = lowest;
        }
    }
    final LayoutParams lp = (LayoutParams) child.getLayoutParams();
    return lp.topMargin + heightUsed + lp.bottomMargin;
}
Also used : AbsListView(android.widget.AbsListView)

Example 10 with AbsListView

use of android.widget.AbsListView in project android_frameworks_base by ResurrectionRemix.

the class RenderSessionImpl method postInflateProcess.

/**
     * Post process on a view hierarchy that was just inflated.
     * <p/>
     * At the moment this only supports TabHost: If {@link TabHost} is detected, look for the
     * {@link TabWidget}, and the corresponding {@link FrameLayout} and make new tabs automatically
     * based on the content of the {@link FrameLayout}.
     * @param view the root view to process.
     * @param layoutlibCallback callback to the project.
     * @param skip the view and it's children are not processed.
     */
// For the use of Pair
@SuppressWarnings("deprecation")
private void postInflateProcess(View view, LayoutlibCallback layoutlibCallback, View skip) throws PostInflateException {
    if (view == skip) {
        return;
    }
    if (view instanceof TabHost) {
        setupTabHost((TabHost) view, layoutlibCallback);
    } else if (view instanceof QuickContactBadge) {
        QuickContactBadge badge = (QuickContactBadge) view;
        badge.setImageToDefault();
    } else if (view instanceof AdapterView<?>) {
        // get the view ID.
        int id = view.getId();
        BridgeContext context = getContext();
        // get a ResourceReference from the integer ID.
        ResourceReference listRef = context.resolveId(id);
        if (listRef != null) {
            SessionParams params = getParams();
            AdapterBinding binding = params.getAdapterBindings().get(listRef);
            // if there was no adapter binding, trying to get it from the call back.
            if (binding == null) {
                binding = layoutlibCallback.getAdapterBinding(listRef, context.getViewKey(view), view);
            }
            if (binding != null) {
                if (view instanceof AbsListView) {
                    if ((binding.getFooterCount() > 0 || binding.getHeaderCount() > 0) && view instanceof ListView) {
                        ListView list = (ListView) view;
                        boolean skipCallbackParser = false;
                        int count = binding.getHeaderCount();
                        for (int i = 0; i < count; i++) {
                            Pair<View, Boolean> pair = context.inflateView(binding.getHeaderAt(i), list, false, skipCallbackParser);
                            if (pair.getFirst() != null) {
                                list.addHeaderView(pair.getFirst());
                            }
                            skipCallbackParser |= pair.getSecond();
                        }
                        count = binding.getFooterCount();
                        for (int i = 0; i < count; i++) {
                            Pair<View, Boolean> pair = context.inflateView(binding.getFooterAt(i), list, false, skipCallbackParser);
                            if (pair.getFirst() != null) {
                                list.addFooterView(pair.getFirst());
                            }
                            skipCallbackParser |= pair.getSecond();
                        }
                    }
                    if (view instanceof ExpandableListView) {
                        ((ExpandableListView) view).setAdapter(new FakeExpandableAdapter(listRef, binding, layoutlibCallback));
                    } else {
                        ((AbsListView) view).setAdapter(new FakeAdapter(listRef, binding, layoutlibCallback));
                    }
                } else if (view instanceof AbsSpinner) {
                    ((AbsSpinner) view).setAdapter(new FakeAdapter(listRef, binding, layoutlibCallback));
                }
            }
        }
    } else if (view instanceof ViewGroup) {
        mInflater.postInflateProcess(view);
        ViewGroup group = (ViewGroup) view;
        final int count = group.getChildCount();
        for (int c = 0; c < count; c++) {
            View child = group.getChildAt(c);
            postInflateProcess(child, layoutlibCallback, skip);
        }
    }
}
Also used : SessionParams(com.android.ide.common.rendering.api.SessionParams) TabHost(android.widget.TabHost) ViewGroup(android.view.ViewGroup) BridgeContext(com.android.layoutlib.bridge.android.BridgeContext) AbsListView(android.widget.AbsListView) FakeAdapter(com.android.layoutlib.bridge.impl.binding.FakeAdapter) FakeExpandableAdapter(com.android.layoutlib.bridge.impl.binding.FakeExpandableAdapter) MenuView(com.android.internal.view.menu.MenuView) View(android.view.View) AdapterView(android.widget.AdapterView) ActionMenuItemView(com.android.internal.view.menu.ActionMenuItemView) IconMenuItemView(com.android.internal.view.menu.IconMenuItemView) ListView(android.widget.ListView) ListMenuItemView(com.android.internal.view.menu.ListMenuItemView) AbsListView(android.widget.AbsListView) ActionMenuView(android.widget.ActionMenuView) ExpandableListView(android.widget.ExpandableListView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) ExpandableListView(android.widget.ExpandableListView) QuickContactBadge(android.widget.QuickContactBadge) AdapterBinding(com.android.ide.common.rendering.api.AdapterBinding) AbsSpinner(android.widget.AbsSpinner) AdapterView(android.widget.AdapterView) ResourceReference(com.android.ide.common.rendering.api.ResourceReference) ExpandableListView(android.widget.ExpandableListView)

Aggregations

AbsListView (android.widget.AbsListView)218 View (android.view.View)126 ListView (android.widget.ListView)80 AdapterView (android.widget.AdapterView)54 TextView (android.widget.TextView)46 ViewGroup (android.view.ViewGroup)33 ImageView (android.widget.ImageView)29 RecyclerView (android.support.v7.widget.RecyclerView)21 GridView (android.widget.GridView)21 SuppressLint (android.annotation.SuppressLint)20 ScrollView (android.widget.ScrollView)20 OnScrollListener (android.widget.AbsListView.OnScrollListener)19 Intent (android.content.Intent)17 ArrayList (java.util.ArrayList)16 Context (android.content.Context)12 Point (android.graphics.Point)12 Handler (android.os.Handler)12 ExpandableListView (android.widget.ExpandableListView)12 ArrayListLoader (com.klinker.android.twitter.adapters.ArrayListLoader)10 ItemManager (org.lucasr.smoothie.ItemManager)10