Example usage for android.widget ListView setDividerHeight

List of usage examples for android.widget ListView setDividerHeight

Introduction

In this page you can find the example usage for android.widget ListView setDividerHeight.

Prototype

public void setDividerHeight(int height) 

Source Link

Document

Sets the height of the divider that will be drawn between each item in the list.

Usage

From source file:eu.trentorise.smartcampus.jp.MyRecurItinerariesFragment.java

@Override
public void onStart() {
    super.onStart();

    ListView myJourneysList = (ListView) getView().findViewById(R.id.myitineraries_list);
    myItineraries = new ArrayList<BasicRecurrentJourney>();
    adapter = new MyRecurItinerariesListAdapter(getSherlockActivity(), R.layout.recur_itinerarychoices_row,
            myItineraries);/*from  w  w  w.  java 2 s . co  m*/
    myJourneysList.setAdapter(adapter);
    myJourneysList.setDivider(null);
    myJourneysList.setDividerHeight(Utils.convertDpToPixel(6, getActivity()));

    SCAsyncTask<Void, Void, List<BasicRecurrentJourney>> task = new SCAsyncTask<Void, Void, List<BasicRecurrentJourney>>(
            getSherlockActivity(), new GetMyRecurItinerariesProcessor(getSherlockActivity(), adapter));
    task.execute();

    myJourneysList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            FragmentTransaction fragmentTransaction = getSherlockActivity().getSupportFragmentManager()
                    .beginTransaction();
            Fragment fragment = new MyRecurItineraryFragment();
            Bundle b = new Bundle();
            b.putSerializable(MyRecurItineraryFragment.PARAMS, adapter.getItem(position));
            b.putBoolean(MyRecurItineraryFragment.PARAM_EDITING, false);
            fragment.setArguments(b);
            fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
            fragmentTransaction.replace(Config.mainlayout, fragment, Config.MY_RECUR_JOURNEYS_FRAGMENT_TAG);
            fragmentTransaction.addToBackStack(fragment.getTag());
            fragmentTransaction.commit();
        }
    });
}

From source file:com.noshufou.android.su.AppDetailsFragment.java

private void setupListView() {
    final ListView list = getListView();
    final LayoutInflater inflater = getActivity().getLayoutInflater();

    list.setDividerHeight(0);

    mAdapter = new LogAdapter(null, getActivity(), false);
    setListAdapter(mAdapter);//from w ww  .  java2 s . c om

    if (list instanceof PinnedHeaderListView && mAdapter.getDisplaySectionHeadersEnabled()) {
        PinnedHeaderListView pinnedHeaderListView = (PinnedHeaderListView) list;
        View pinnedHeader = inflater.inflate(R.layout.recent_list_section, list, false);
        pinnedHeaderListView.setPinnedHeaderView(pinnedHeader);
    }

    list.setOnScrollListener(mAdapter);
}

From source file:qr.cloud.qrpedia.BookmarksListFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // configure the list view
    ListView listView = getListView();
    QRCloudUtils.setListViewEmptyView(listView, getString(R.string.no_bookmarks), R.string.default_font,
            R.dimen.activity_horizontal_margin, R.dimen.activity_vertical_margin);
    listView.setSelector(R.drawable.message_row_selector); // override the default selector
    listView.setDivider(new ColorDrawable(this.getResources().getColor(R.color.list_divider)));
    listView.setDividerHeight(1);
    if (mIsInDialog && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        // fix black background issue pre-honeycomb
        listView.setBackgroundColor(Color.WHITE);
    }//from  ww w .  j  a  v a2s. c o m
}

From source file:qr.cloud.qrpedia.SavedTextListFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // configure the list view
    ListView listView = getListView();
    QRCloudUtils.setListViewEmptyView(listView, getString(R.string.no_saved_messages), R.string.default_font,
            R.dimen.activity_horizontal_margin, R.dimen.activity_vertical_margin);
    listView.setSelector(R.drawable.message_row_selector); // override the default selector
    listView.setDivider(new ColorDrawable(this.getResources().getColor(R.color.list_divider)));
    listView.setDividerHeight(1);
    listView.setOnItemLongClickListener(mLongClickListener);
    if (mIsInDialog && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        // fix black background issue pre-honeycomb
        listView.setBackgroundColor(Color.WHITE);
    }// w  ww.j ava2s .  c  o  m
}

From source file:net.niyonkuru.koodroid.ui.DataDetailFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    /* load data again to be used by the graph */
    getLoaderManager().initLoader(0, null, this);

    ListView lv = getListView();

    LayoutInflater inflater = LayoutInflater.from(mContext);

    View graph = inflater.inflate(R.layout.usage_graph, lv, false);
    lv.addHeaderView(graph, null, false);

    View header = inflater.inflate(R.layout.usage_list_item_labels, lv, false);
    lv.addHeaderView(header, null, false);

    lv.setDividerHeight(0);

    mAdapter = new UsageAdapter(mContext);

    setListAdapter(mAdapter);//from   w  w w  . j av a  2s  . c  o  m

    setListShown(false);
}

From source file:com.nttec.everychan.ui.theme.CustomThemeHelper.java

@Override
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
    int mappingCount = 0;
    if (attrs != null) {
        for (int i = 0, size = attrs.getAttributeCount(); i < size; ++i) {
            String value = attrs.getAttributeValue(i);
            if (!value.startsWith("?"))
                continue;
            int attrId = resources.getIdentifier(value.substring(1), null, null); //Integer.parseInt(value.substring(1));
            if (attrId == 0) {
                Logger.e(TAG, "couldn't get id for attribute: " + value);
                continue;
            }//w  w  w .  ja  va2s.  com
            int index = customAttrs.indexOfKey(attrId);
            if (index >= 0) {
                mappingKeys[mappingCount] = attrs.getAttributeNameResource(i);
                mappingValues[mappingCount] = customAttrs.valueAt(index);
                ++mappingCount;
            }
        }
    }

    if (mappingCount == 0 && textColorPrimaryOverridden == textColorPrimaryOriginal)
        return null;

    View view = instantiate(name, context, attrs);
    if (view == null)
        return null;

    boolean shouldOverrideTextColor = textColorPrimaryOverridden != textColorPrimaryOriginal
            && view instanceof TextView;
    for (int i = 0; i < mappingCount; ++i) {
        switch (mappingKeys[i]) {
        case android.R.attr.background:
            view.setBackgroundColor(mappingValues[i]);
            break;
        case android.R.attr.textColor:
            if (view instanceof TextView) {
                ((TextView) view).setTextColor(mappingValues[i]);
                shouldOverrideTextColor = false;
            } else {
                Logger.e(TAG, "couldn't apply attribute 'textColor' on class " + name
                        + " (not instance of TextView)");
            }
            break;
        case android.R.attr.divider:
            if (view instanceof ListView) {
                ListView listView = (ListView) view;
                int dividerHeight = listView.getDividerHeight();
                listView.setDivider(new ColorDrawable(mappingValues[i]));
                listView.setDividerHeight(dividerHeight);
            } else {
                Logger.e(TAG,
                        "couldn't apply attribute 'divider' on class " + name + " (not instance of ListView)");
            }
            break;
        default:
            String attrResName = null;
            try {
                attrResName = resources.getResourceName(mappingKeys[i]);
            } catch (Exception e) {
                attrResName = Integer.toString(mappingKeys[i]);
            }
            Logger.e(TAG, "couldn't apply attribure '" + attrResName + "' on class " + name);
        }
    }

    if (shouldOverrideTextColor) {
        TextView tv = (TextView) view;
        if (tv.getCurrentTextColor() == textColorPrimaryOriginal) {
            tv.setTextColor(textColorPrimaryOverridden);
        }
    }

    return view;
}

From source file:com.sft.blackcatapp.SearchCoachActivity.java

private void showOpenCityPopupWindow(View parent) {
    if (openCityPopupWindow == null) {
        LinearLayout popWindowLayout = (LinearLayout) View.inflate(mContext, R.layout.pop_window, null);
        popWindowLayout.removeAllViews();
        // LinearLayout popWindowLayout = new LinearLayout(mContext);
        popWindowLayout.setOrientation(LinearLayout.VERTICAL);
        ListView OpenCityListView = new ListView(mContext);
        OpenCityListView.setDividerHeight(0);
        OpenCityListView.setCacheColorHint(android.R.color.transparent);
        OpenCityListView.setOnItemClickListener(new OnItemClickListener() {

            @Override// w  ww . java  2s. c o m
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                OpenCityVO selectCity = openCityList.get(position);
                System.out.println(selectCity.getName());
                cityname = selectCity.getName().replace("", "");
                licensetype = "";
                coachname = "";
                ordertype = "0";
                index = 1;
                obtainCaoch();
                openCityPopupWindow.dismiss();
                openCityPopupWindow = null;
            }
        });
        LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        popWindowLayout.addView(OpenCityListView, param);
        OpenCityAdapter openCityAdapter = new OpenCityAdapter(mContext, openCityList);
        OpenCityListView.setAdapter(openCityAdapter);

        openCityPopupWindow = new PopupWindow(popWindowLayout, 130, LayoutParams.WRAP_CONTENT);
    }
    openCityPopupWindow.setFocusable(true);
    openCityPopupWindow.setOutsideTouchable(true);
    // Back???
    openCityPopupWindow.setBackgroundDrawable(new BitmapDrawable());

    openCityPopupWindow.showAsDropDown(parent);
}

From source file:org.telegram.ui.PrivacySettingsActivity.java

@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("PrivacySettings", R.string.PrivacySettings));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override/*from   www .  jav  a2 s  .c o  m*/
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(ContextCompat.getColor(context, R.color.settings_background));

    ListView listView = new ListView(context);
    listView.setDivider(null);
    listView.setDividerHeight(0);
    listView.setVerticalScrollBarEnabled(false);
    listView.setDrawSelectorOnTop(true);
    frameLayout.addView(listView,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) {
            if (i == blockedRow) {
                presentFragment(new BlockedUsersActivity());
            } else if (i == sessionsRow) {
                presentFragment(new SessionsActivity());
            } else if (i == deleteAccountRow) {
                if (getParentActivity() == null) {
                    return;
                }
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setTitle(LocaleController.getString("DeleteAccountTitle", R.string.DeleteAccountTitle));
                builder.setItems(
                        new CharSequence[] { LocaleController.formatPluralString("Months", 1),
                                LocaleController.formatPluralString("Months", 3),
                                LocaleController.formatPluralString("Months", 6),
                                LocaleController.formatPluralString("Years", 1) },
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                int value = 0;
                                if (which == 0) {
                                    value = 30;
                                } else if (which == 1) {
                                    value = 90;
                                } else if (which == 2) {
                                    value = 182;
                                } else if (which == 3) {
                                    value = 365;
                                }
                                final ProgressDialog progressDialog = new ProgressDialog(getParentActivity());
                                progressDialog
                                        .setMessage(LocaleController.getString("Loading", R.string.Loading));
                                progressDialog.setCanceledOnTouchOutside(false);
                                progressDialog.setCancelable(false);
                                progressDialog.show();

                                final TLRPC.TL_account_setAccountTTL req = new TLRPC.TL_account_setAccountTTL();
                                req.ttl = new TLRPC.TL_accountDaysTTL();
                                req.ttl.days = value;
                                ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
                                    @Override
                                    public void run(final TLObject response, final TLRPC.TL_error error) {
                                        AndroidUtilities.runOnUIThread(new Runnable() {
                                            @Override
                                            public void run() {
                                                try {
                                                    progressDialog.dismiss();
                                                } catch (Exception e) {
                                                    FileLog.e("tmessages", e);
                                                }
                                                if (response instanceof TLRPC.TL_boolTrue) {
                                                    ContactsController.getInstance()
                                                            .setDeleteAccountTTL(req.ttl.days);
                                                    listAdapter.notifyDataSetChanged();
                                                }
                                            }
                                        });
                                    }
                                });
                            }
                        });
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                showDialog(builder.create());
            } else if (i == lastSeenRow) {
                presentFragment(new PrivacyControlActivity(false));
            } else if (i == groupsRow) {
                presentFragment(new PrivacyControlActivity(true));
            } else if (i == passwordRow) {
                presentFragment(new TwoStepVerificationActivity(0));
            } else if (i == passcodeRow) {
                if (UserConfig.passcodeHash.length() > 0) {
                    presentFragment(new PasscodeActivity(2));
                } else {
                    presentFragment(new PasscodeActivity(0));
                }
            } else if (i == secretWebpageRow) {
                if (MessagesController.getInstance().secretWebpagePreview == 1) {
                    MessagesController.getInstance().secretWebpagePreview = 0;
                } else {
                    MessagesController.getInstance().secretWebpagePreview = 1;
                }
                ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE)
                        .edit().putInt("secretWebpage2", MessagesController.getInstance().secretWebpagePreview)
                        .commit();
                if (view instanceof TextCheckCell) {
                    ((TextCheckCell) view)
                            .setChecked(MessagesController.getInstance().secretWebpagePreview == 1);
                }
            }
        }
    });

    return fragmentView;
}

From source file:com.mrpoid.mrplist.ui.MrpListFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    initPathStack();// w  ww.  j av  a  2s . c o  m

    setHasOptionsMenu(true);
    setListShown(false);

    mAdapter = new MrpListAdapter(getActivity());
    setListAdapter(mAdapter);

    ListView listView = getListView();
    registerForContextMenu(listView);
    listView.setOnItemLongClickListener(this);

    listView.setFastScrollEnabled(true);
    listView.setCacheColorHint(Color.TRANSPARENT);

    if (PreferencesProvider.Interface.General.getThemeImage(0) >= 2) {
        listView.setDivider(new ColorDrawable(Color.TRANSPARENT));
        listView.setDividerHeight(1);
    }

    getLoaderManager().initLoader(1001, null, this);
}

From source file:org.solovyev.android.messenger.messages.MessagesFragment.java

@Override
protected void fillListView(@Nonnull ListView lv, @Nonnull Context context) {
    super.fillListView(lv, context);

    lv.setDividerHeight(0);
    lv.setStackFromBottom(true);/*w  w  w.j  a v  a 2s  .c  o  m*/
    lv.setFastScrollEnabled(false);
}