Example usage for android.widget ListView setFooterDividersEnabled

List of usage examples for android.widget ListView setFooterDividersEnabled

Introduction

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

Prototype

public void setFooterDividersEnabled(boolean footerDividersEnabled) 

Source Link

Document

Enables or disables the drawing of the divider for footer views.

Usage

From source file:net.doode.android.MainActivity.java

/**
 * Create the sidebar on the left.//from w  ww . j a va  2  s . c  om
 */
private void prepareSidebar() {
    mSidebar = new SlidingMenu(this, SlidingMenu.SLIDING_CONTENT);
    mSidebar.setBehindWidth(280); // temp
    mSidebar.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
    mSidebar.setFadeDegree(0.3f);
    mSidebar.setShadowDrawable(R.drawable.sidebar_shadow);
    mSidebar.setShadowWidth(30); // temp

    View sidebar = LayoutInflater.from(this).inflate(R.layout.sidebar, null);
    final ListView listView = (ListView) sidebar.findViewById(android.R.id.list);
    listView.setFooterDividersEnabled(true);
    listView.setAdapter(new SidebarAdapter());
    mSidebar.setMenu(sidebar);
}

From source file:com.redwoodsystems.android.apps.LightingListFragment.java

private void setupScenesList() {
    Log.d(TAG, "setupScenesList called");
    ListView listView = (ListView) getActivity().findViewById(android.R.id.list);
    TextView dummy = new TextView(getActivity());
    ImageView dummy2 = new ImageView(getActivity());
    listView.addFooterView(dummy, null, true);
    listView.setFooterDividersEnabled(true);
    listView.addHeaderView(dummy2, null, true);
    listView.setHeaderDividersEnabled(true);
    int[] colors = { 0, 0xFFF47836, 0 }; // Pantone172 for the example
    listView.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));
    listView.setDividerHeight(1);//from  w w w .  ja  v  a2  s  . com

    //TODO: set Empty Text inside View
    //setEmptyText("No Scenes found");

    mSceneAdapter = new SceneAdapter(getActivity(), R.layout.scene_item_layout, R.id.sceneText);

    setListAdapter(mSceneAdapter);

    Uri dummyUri = null;
    Bundle params = new Bundle();
    Bundle args = new Bundle();
    args.putParcelable(ARGS_URI, dummyUri);
    args.putParcelable(ARGS_PARAMS, params);

    // Initialize the Loader.
    Log.d(TAG, "calling initLoader..");
    getActivity().getSupportLoaderManager().initLoader(LOADER_SCENES, null, this);

}

From source file:com.nadmm.airports.tfr.TfrListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);

    final ListView listView = getListView();
    View footer = inflater.inflate(R.layout.tfr_list_footer_view, listView, false);
    footer.setLayoutParams(//from   www  .  ja  v  a 2 s . co m
            new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.WRAP_CONTENT));
    TextView tv = (TextView) footer.findViewById(R.id.tfr_warning_text);
    tv.setText("Depicted TFR data may not be a complete listing. Pilots should not use "
            + "the information for flight planning purposes. For the latest information, "
            + "call your local Flight Service Station at 1-800-WX-BRIEF.");
    listView.addFooterView(footer, null, false);
    listView.setFooterDividersEnabled(true);

    return view;
}

From source file:the.joevlc.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (!Util.hasCompatibleCPU()) {
        Log.e(TAG, Util.getErrorMsg());
        Intent i = new Intent(this, CompatErrorActivity.class);
        startActivity(i);/* w w w .jav a 2s  .co m*/
        finish();
        super.onCreate(savedInstanceState);
        return;
    }

    /* Get the current version from package */
    PackageInfo pinfo = null;
    try {
        pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    } catch (NameNotFoundException e) {
        Log.e(TAG, "package info not found.");
    }
    if (pinfo != null)
        mVersionNumber = pinfo.versionCode;

    /* Get settings */
    mSettings = PreferenceManager.getDefaultSharedPreferences(this);

    /* Check if it's the first run */
    mFirstRun = mSettings.getInt(PREF_FIRST_RUN, -1) != mVersionNumber;
    if (mFirstRun) {
        Editor editor = mSettings.edit();
        editor.putInt(PREF_FIRST_RUN, mVersionNumber);
        editor.commit();
    }

    try {
        // Start LibVLC
        LibVLC.getInstance();
    } catch (LibVlcException e) {
        e.printStackTrace();
        Intent i = new Intent(this, CompatErrorActivity.class);
        i.putExtra("runtimeError", true);
        i.putExtra("message", "LibVLC failed to initialize (LibVlcException)");
        startActivity(i);
        finish();
        super.onCreate(savedInstanceState);
        return;
    }

    super.onCreate(savedInstanceState);

    /*** Start initializing the UI ***/

    /* Enable the indeterminate progress feature */
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    // Set up the sliding menu
    setContentView(R.layout.sliding_menu);
    mMenu = (SlidingMenu) findViewById(R.id.sliding_menu);
    changeMenuOffset();

    View v_main = LayoutInflater.from(this).inflate(R.layout.main, null);
    mMenu.setContent(v_main);

    View sidebar = LayoutInflater.from(this).inflate(R.layout.sidebar, null);
    final ListView listView = (ListView) sidebar.findViewById(android.R.id.list);
    listView.setFooterDividersEnabled(true);
    mSidebarAdapter = new SidebarAdapter();
    listView.setAdapter(mSidebarAdapter);
    mMenu.setMenu(sidebar);

    /* Initialize UI variables */
    mInfoLayout = v_main.findViewById(R.id.info_layout);
    mInfoProgress = (ProgressBar) v_main.findViewById(R.id.info_progress);
    mInfoText = (TextView) v_main.findViewById(R.id.info_text);

    /* Set up the action bar */
    mActionBar = getSupportActionBar();
    mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    mActionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
    mActionBar.setDisplayHomeAsUpEnabled(true);

    /* Add padding between the home button and the arrow */
    ImageView home = (ImageView) findViewById(Util.isHoneycombOrLater() ? android.R.id.home : R.id.abs__home);
    if (home != null)
        home.setPadding(20, 0, 0, 0);

    /* Set up the sidebar click listener */
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            SidebarEntry entry = (SidebarEntry) listView.getItemAtPosition(position);
            Fragment current = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);

            if (current == null || current.getTag() == entry.id) { /* Already selected */
                mMenu.showAbove();
                return;
            }

            /*
             * Clear any backstack before switching tabs. This avoids
             * activating an old backstack, when a user hits the back button
             * to quit
             */
            for (int i = 0; i < getSupportFragmentManager().getBackStackEntryCount(); i++) {
                getSupportFragmentManager().popBackStack();
            }

            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            ft.detach(current);
            ft.attach(getFragment(entry.id));
            ft.commit();
            mCurrentFragment = entry.id;
            mMenu.showAbove();
        }
    });

    /* Set up the mini audio player */
    mAudioPlayer = new AudioMiniPlayer();
    mAudioController = AudioServiceController.getInstance();
    mAudioPlayer.setAudioPlayerControl(mAudioController);
    mAudioPlayer.update();

    getSupportFragmentManager().beginTransaction().replace(R.id.audio_mini_player, mAudioPlayer).commit();

    /* Show info/alpha/beta Warning */
    if (mSettings.getInt(PREF_SHOW_INFO, -1) != mVersionNumber)
        showInfoDialog();
    else if (mFirstRun) {
        /*
         * The sliding menu is automatically opened when the user closes
         * the info dialog. If (for any reason) the dialog is not shown,
         * open the menu after a short delay.
         */
        final Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                mMenu.showBehind();
            }
        }, 500);
    }

    /* Prepare the progressBar */
    IntentFilter filter = new IntentFilter();
    filter.addAction(ACTION_SHOW_PROGRESSBAR);
    filter.addAction(ACTION_HIDE_PROGRESSBAR);
    filter.addAction(ACTION_SHOW_TEXTINFO);
    registerReceiver(messageReceiver, filter);

    /* Reload the latest preferences */
    reloadPreferences();

    /* Load the thumbnailer */
    mThumbnailerManager = new ThumbnailerManager(this, getWindowManager().getDefaultDisplay());
}

From source file:org.videolan.vlc.gui.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (!LibVlcUtil.hasCompatibleCPU(this)) {
        Log.e(TAG, LibVlcUtil.getErrorMsg());
        Intent i = new Intent(this, CompatErrorActivity.class);
        startActivity(i);//from www  . j a  v a2  s  .  c  o  m
        finish();
        super.onCreate(savedInstanceState);
        return;
    }

    /* Get the current version from package */
    PackageInfo pinfo = null;
    try {
        pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    } catch (NameNotFoundException e) {
        Log.e(TAG, "package info not found.");
    }
    if (pinfo != null)
        mVersionNumber = pinfo.versionCode;

    /* Get settings */
    mSettings = PreferenceManager.getDefaultSharedPreferences(this);

    /* Check if it's the first run */
    mFirstRun = mSettings.getInt(PREF_FIRST_RUN, -1) != mVersionNumber;
    if (mFirstRun) {
        Editor editor = mSettings.edit();
        editor.putInt(PREF_FIRST_RUN, mVersionNumber);
        editor.commit();
    }

    try {
        // Start LibVLC
        Util.getLibVlcInstance();
    } catch (LibVlcException e) {
        e.printStackTrace();
        Intent i = new Intent(this, CompatErrorActivity.class);
        i.putExtra("runtimeError", true);
        i.putExtra("message", "LibVLC failed to initialize (LibVlcException)");
        startActivity(i);
        finish();
        super.onCreate(savedInstanceState);
        return;
    }

    super.onCreate(savedInstanceState);

    /*** Start initializing the UI ***/

    /* Enable the indeterminate progress feature */
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    // Set up the sliding menu
    setContentView(R.layout.sliding_menu);
    mMenu = (SlidingMenu) findViewById(R.id.sliding_menu);
    changeMenuOffset();

    View v_main = LayoutInflater.from(this).inflate(R.layout.main, null);
    mMenu.setContent(v_main);

    View sidebar = LayoutInflater.from(this).inflate(R.layout.sidebar, null);
    final ListView listView = (ListView) sidebar.findViewById(android.R.id.list);
    listView.setFooterDividersEnabled(true);
    mSidebarAdapter = new SidebarAdapter();
    listView.setAdapter(mSidebarAdapter);
    mMenu.setMenu(sidebar);

    /* Initialize UI variables */
    mInfoLayout = v_main.findViewById(R.id.info_layout);
    mInfoProgress = (ProgressBar) v_main.findViewById(R.id.info_progress);
    mInfoText = (TextView) v_main.findViewById(R.id.info_text);

    /* Set up the action bar */
    mActionBar = getSupportActionBar();
    mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    mActionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
    mActionBar.setDisplayHomeAsUpEnabled(true);

    /* Add padding between the home button and the arrow */
    ImageView home = (ImageView) findViewById(Util.isHoneycombOrLater() ? android.R.id.home : R.id.abs__home);
    if (home != null)
        home.setPadding(20, 0, 0, 0);

    /* Set up the sidebar click listener */
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            SidebarAdapter.SidebarEntry entry = (SidebarEntry) listView.getItemAtPosition(position);
            Fragment current = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);

            if (current == null || current.getTag().equals(entry.id)) { /* Already selected */
                mMenu.showContent();
                return;
            }

            /*
             * Clear any backstack before switching tabs. This avoids
             * activating an old backstack, when a user hits the back button
             * to quit
             */
            for (int i = 0; i < getSupportFragmentManager().getBackStackEntryCount(); i++) {
                getSupportFragmentManager().popBackStack();
            }

            /**
             * Do not move this getFragment("audio")!
             * This is to ensure that if audio is not already loaded, it
             * will be loaded ahead of the detach/attach below.
             * Otherwise if you add() a fragment after an attach/detach,
             * it will take over the placeholder and you will end up with
             * the audio fragment when some other fragment should be there.
             */
            Fragment audioFragment = getFragment("audio");

            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            ft.detach(current);
            ft.attach(getFragment(entry.id));
            ft.commit();
            mCurrentFragment = entry.id;

            /*
             * Set user visibility hints to work around weird Android
             * behaviour of duplicate context menu events.
             */
            current.setUserVisibleHint(false);
            getFragment(mCurrentFragment).setUserVisibleHint(true);
            // HACK ALERT: Set underlying audio browser to be invisible too.
            if (current.getTag().equals("tracks"))
                audioFragment.setUserVisibleHint(false);

            mMenu.showContent();
        }
    });

    /* Set up the mini audio player */
    // TODO use mini player
    //        mAudioPlayer = new AudioMiniPlayer(); 
    mAudioController = MediaServiceController.getInstance();
    //        mAudioPlayer.setAudioPlayerControl(mAudioController);
    //        mAudioPlayer.update();
    //
    //        getSupportFragmentManager().beginTransaction()
    //            .replace(R.id.audio_mini_player, mAudioPlayer)
    //            .commit();

    /* Show info/alpha/beta Warning */
    if (mSettings.getInt(PREF_SHOW_INFO, -1) != mVersionNumber)
        showInfoDialog();
    else if (mFirstRun) {
        /*
         * The sliding menu is automatically opened when the user closes
         * the info dialog. If (for any reason) the dialog is not shown,
         * open the menu after a short delay.
         */
        final Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                mMenu.showMenu();
            }
        }, 500);
    }

    /* Prepare the progressBar */
    IntentFilter filter = new IntentFilter();
    filter.addAction(ACTION_SHOW_PROGRESSBAR);
    filter.addAction(ACTION_HIDE_PROGRESSBAR);
    filter.addAction(ACTION_SHOW_TEXTINFO);
    registerReceiver(messageReceiver, filter);

    /* Reload the latest preferences */
    reloadPreferences();
}

From source file:org.videolan.vlc2.gui.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (!LibVlcUtil.hasCompatibleCPU(this)) {
        Log.e(TAG, LibVlcUtil.getErrorMsg());
        Intent i = new Intent(this, CompatErrorActivity.class);
        startActivity(i);/*from   w ww.  ja  va 2s. co m*/
        finish();
        super.onCreate(savedInstanceState);
        return;
    }

    /* Get the current version from package */
    PackageInfo pinfo = null;
    try {
        pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    } catch (NameNotFoundException e) {
        Log.e(TAG, "package info not found.");
    }
    if (pinfo != null)
        mVersionNumber = pinfo.versionCode;

    /* Get settings */
    mSettings = PreferenceManager.getDefaultSharedPreferences(this);

    /* Check if it's the first run */
    mFirstRun = mSettings.getInt(PREF_FIRST_RUN, -1) != mVersionNumber;
    if (mFirstRun) {
        Editor editor = mSettings.edit();
        editor.putInt(PREF_FIRST_RUN, mVersionNumber);
        editor.commit();
    }

    try {
        // Start LibVLC
        VLCInstance.getLibVlcInstance();
    } catch (LibVlcException e) {
        e.printStackTrace();
        Intent i = new Intent(this, CompatErrorActivity.class);
        i.putExtra("runtimeError", true);
        i.putExtra("message", "LibVLC failed to initialize (LibVlcException)");
        startActivity(i);
        finish();
        super.onCreate(savedInstanceState);
        return;
    }

    super.onCreate(savedInstanceState);

    /*** Start initializing the UI ***/

    /* Enable the indeterminate progress feature */
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    // Set up the sliding menu
    mMenu = (SlidingMenu) LayoutInflater.from(this).inflate(R.layout.sliding_menu, null);
    changeMenuOffset();

    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
    boolean enableBlackTheme = pref.getBoolean("enable_black_theme", false);
    if (enableBlackTheme)
        setTheme(R.style.Theme_VLC_Black);

    View v_main = LayoutInflater.from(this).inflate(R.layout.main, null);
    setContentView(v_main);

    mSlidingPane = (SlidingPaneLayout) v_main.findViewById(R.id.pane);
    mSlidingPane.setPanelSlideListener(mPanelSlideListener);

    View sidebar = LayoutInflater.from(this).inflate(R.layout.sidebar, null);
    final ListView listView = (ListView) sidebar.findViewById(android.R.id.list);
    listView.setFooterDividersEnabled(true);
    mSidebarAdapter = new SidebarAdapter(this);
    listView.setAdapter(mSidebarAdapter);
    mMenu.setMenu(sidebar);
    mMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT, true);

    /* Initialize UI variables */
    mInfoLayout = v_main.findViewById(R.id.info_layout);
    mInfoProgress = (ProgressBar) v_main.findViewById(R.id.info_progress);
    mInfoText = (TextView) v_main.findViewById(R.id.info_text);
    mAudioPlayerFilling = v_main.findViewById(R.id.audio_player_filling);
    mRootContainer = (RelativeLayout) v_main.findViewById(R.id.root_container);

    /* Set up the action bar */
    prepareActionBar();

    /* Set up the sidebar click listener */
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            SidebarAdapter.SidebarEntry entry = (SidebarEntry) listView.getItemAtPosition(position);
            Fragment current = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);

            if (current == null
                    || (entry != null && current.getTag().equals(entry.id))) { /* Already selected */
                mMenu.showContent();
                return;
            }

            // This should not happen
            if (entry == null || entry.id == null)
                return;

            /*
             * Clear any backstack before switching tabs. This avoids
             * activating an old backstack, when a user hits the back button
             * to quit
             */
            getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);

            /* Slide down the audio player */
            slideDownAudioPlayer();

            /* Switch the fragment */
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            ft.replace(R.id.fragment_placeholder, getFragment(entry.id), entry.id);
            ft.commit();
            mCurrentFragment = entry.id;

            /*
             * Set user visibility hints to work around weird Android
             * behaviour of duplicate context menu events.
             */
            current.setUserVisibleHint(false);
            getFragment(mCurrentFragment).setUserVisibleHint(true);
            // HACK ALERT: Set underlying audio browser to be invisible too.
            if (current.getTag().equals("tracks"))
                getFragment("audio").setUserVisibleHint(false);

            mMenu.showContent();
        }
    });

    /* Set up the audio player */
    mAudioPlayer = new AudioPlayer();
    mAudioController = AudioServiceController.getInstance();

    getSupportFragmentManager().beginTransaction().replace(R.id.audio_player, mAudioPlayer).commit();

    if (mFirstRun) {
        /*
         * The sliding menu is automatically opened when the user closes
         * the info dialog. If (for any reason) the dialog is not shown,
         * open the menu after a short delay.
         */
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                mMenu.showMenu();
            }
        }, 500);
    }

    /* Prepare the progressBar */
    IntentFilter filter = new IntentFilter();
    filter.addAction(ACTION_SHOW_PROGRESSBAR);
    filter.addAction(ACTION_HIDE_PROGRESSBAR);
    filter.addAction(ACTION_SHOW_TEXTINFO);
    filter.addAction(ACTION_SHOW_PLAYER);
    registerReceiver(messageReceiver, filter);

    /* Reload the latest preferences */
    reloadPreferences();
}