Java Code Examples for android.widget.ListView.setEnabled()

The following are Jave code examples for showing how to use setEnabled() of the android.widget.ListView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: sa-android   File: HomeActivity.java   View Source Code Vote up 5 votes
private void setUIBusy(Boolean busy) {
    mUIBusy = busy;

    ListView listView = (ListView) findViewById(R.id.listView);
    ProgressBar pbBusy = (ProgressBar) findViewById(R.id.pbBusy);

    listView.setEnabled(!busy);

    if (busy) {
        pbBusy.setVisibility(View.VISIBLE);
    } else {
        pbBusy.setVisibility(View.INVISIBLE);
    }
}
 
Example 2
Project: ThunderMusic   File: NowplayingOnlineFragment.java   View Source Code Vote up 4 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {

    mPlaylist = "queue";


    RelativeLayout main = (RelativeLayout) inflater.inflate(
            R.layout.media_picker_activity_playlist, container, false);

    activity = getActivity();
    mTxt = (TextView) main.findViewById(R.id.nointernet);
    listView = (ListView) main.findViewById(android.R.id.list);
    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                                long arg3) {

            if (!isNetworkAvailable(getActivity())) {
                listView.setEnabled(false);
                mTxt.setVisibility(View.VISIBLE);
            } else
                MusicUtils.execute(false, new clickerTask(arg2), true);

        }
    });
    if (!isNetworkAvailable(activity)) {
        listView.setEnabled(false);
        mTxt.setVisibility(View.VISIBLE);
    }

    ((TouchInterceptor) listView).setDropListener(mDropListener);
    ((TouchInterceptor) listView).setRemoveListener(mRemoveListener);

    IntentFilter f = new IntentFilter();
    f.addAction(MediaPlaybackService.META_CHANGED);
    f.addAction(MediaPlaybackService.QUEUE_CHANGED);
    activity.registerReceiver(mNowPlayingListener, new IntentFilter(f));
    mNowPlayingListener.onReceive(activity, new Intent(
            MediaPlaybackService.META_CHANGED));
    mToken = MusicUtils.bindToService(activity, this);

    return main;
}
 
Example 3
Project: ThunderMusic   File: TrackOnlinePlaylistBrowser.java   View Source Code Vote up 4 votes
/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    PreferenceManager.getDefaultSharedPreferences(this)
            .registerOnSharedPreferenceChangeListener(this);
    Intent intent = getIntent();
    if (savedInstanceState != null) {
        mPlaylist = savedInstanceState.getString("playlist");
        called = savedInstanceState.getBoolean("called");
        mCenter = savedInstanceState.getBoolean("center");
    } else {
        mPlaylist = intent.getStringExtra("playlist");
        called = intent.getBooleanExtra("called", true);
        mCenter = intent.getBooleanExtra("center", false);
    }

    getWindow().setUiOptions(
            ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
    if (!called)
        ThemeUtils.getAppTheme(this);
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.media_picker_activity_playlist);
    if (!called) {
        getActionBar().setDisplayHomeAsUpEnabled(false);
        getActionBar().setDisplayShowHomeEnabled(true);
        getActionBar().setHomeButtonEnabled(true);
        // Initialize part of the UI only if we are not in the
        // Nowplaying activity
        if (!mPlaylist.equalsIgnoreCase("queue")) {
            getActionBar().setTitle(mPlaylist);

            InterfaceUtils.setUpFAB(this,
                    R.drawable.music_playall_holo_dark, (FloatingActionButton) findViewById(R.id.FAB), mFABlistener);
        } else
            getActionBar().setTitle(R.string.nowplaying_title);

    }

    activity = this;
    mTxt = (TextView) findViewById(R.id.nointernet);
    listView = (ListView) findViewById(android.R.id.list);
    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                                long arg3) {

            if (!isNetworkAvailable(getBaseContext())) {
                listView.setEnabled(false);
                mTxt.setVisibility(View.VISIBLE);
            } else
                MusicUtils.execute(false, new clickerTask(arg2), true);

        }
    });
    if (!isNetworkAvailable(this)) {
        listView.setEnabled(false);
        mTxt.setVisibility(View.VISIBLE);
    }

    if (!called)
        ((TouchInterceptor) listView).setDropListener(mDropListener);
    ((TouchInterceptor) listView).setRemoveListener(mRemoveListener);

    IntentFilter f = new IntentFilter();
    f.addAction(MediaPlaybackService.META_CHANGED);
    f.addAction(MediaPlaybackService.QUEUE_CHANGED);
    registerReceiver(mNowPlayingListener, new IntentFilter(f));
    mNowPlayingListener.onReceive(this, new Intent(
            MediaPlaybackService.META_CHANGED));
    mToken = MusicUtils.bindToService(this, this);

}