Android Open Source - Flippy-Radio Flippy Browse Activity






From Project

Back to project page Flippy-Radio.

License

The source code is released under:

Apache License

If you think the Android project Flippy-Radio listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.bitflippersanonymous.flippy.activity;
//w w w .j  av a 2 s.co  m
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v4.widget.CursorAdapter;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.bitflippersanonymous.flippy.R;
import com.bitflippersanonymous.flippy.domain.EntryView;
import com.bitflippersanonymous.flippy.domain.PlsDbAdapter;
import com.bitflippersanonymous.flippy.domain.PlsEntry;
import com.bitflippersanonymous.flippy.domain.SimpleCursorLoader;

public class FlippyBrowseActivity extends FlippyBaseActivity 
  implements LoaderManager.LoaderCallbacks<Cursor> {

  private CursorAdapter mAdapter = null;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.browse);

        final ListView list = (ListView) findViewById(R.id.listViewBrowse);
    getSupportLoaderManager().initLoader(0, null, this);
      mAdapter = new PlsDbAdapter(this, null, 0);
    list.setAdapter(mAdapter);
    
      list.setOnItemClickListener(new AdapterView.OnItemClickListener(){
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              PlsEntry entry = ((EntryView)view).getEntry();
          Intent intent = new Intent(FlippyBrowseActivity.this, FlippyInfoActivity.class);
          startActivity(intent);
            }});
  }

  @Override
  protected void update() {
    super.update();
  }

  // Invoked via reflection in MainActivity
  public static void popMenuView(View view) {
    ImageView icon = (ImageView) view.findViewById(R.id.EntryIcon);
    icon.setImageDrawable(view.getContext().getResources().getDrawable(R.drawable.browse));
    TextView title = (TextView) view.findViewById(R.id.entryTitle);
    title.setText(view.getResources().getString(R.string.browse_menu));
  }

  @Override
    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    return new SimpleCursorLoader(this) {
      @Override
      public Cursor loadInBackground() {
        return getService().fetchAllEntries();
      }
    };
  }

  @Override
    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    mAdapter.swapCursor(data);
  }

  @Override
    public void onLoaderReset(Loader<Cursor> loader) {
        mAdapter.swapCursor(null);
    
  }
}




Java Source Code List

.PlsAdapter.java
com.bitflippersanonymous.flippy.activity.FlippyAboutActivity.java
com.bitflippersanonymous.flippy.activity.FlippyBaseActivity.java
com.bitflippersanonymous.flippy.activity.FlippyBrowseActivity.java
com.bitflippersanonymous.flippy.activity.FlippyInfoActivity.java
com.bitflippersanonymous.flippy.activity.FlippyMainActivity.java
com.bitflippersanonymous.flippy.activity.FlippyQueueActivity.java
com.bitflippersanonymous.flippy.activity.FlippySearchActivity.java
com.bitflippersanonymous.flippy.activity.FlippySettingsActivity.java
com.bitflippersanonymous.flippy.db.FlippyDatabaseAdapter.java
com.bitflippersanonymous.flippy.db.FlippyDatabaseHelper.java
com.bitflippersanonymous.flippy.domain.EntryView.java
com.bitflippersanonymous.flippy.domain.PlsDbAdapter.java
com.bitflippersanonymous.flippy.domain.PlsEntry.java
com.bitflippersanonymous.flippy.domain.PodcastParser.java
com.bitflippersanonymous.flippy.domain.SimpleCursorLoader.java
com.bitflippersanonymous.flippy.service.FlippyPlayerService.java
com.bitflippersanonymous.flippy.util.ActivitySwipeDetector.java
com.bitflippersanonymous.flippy.util.Util.java