Android Open Source - Android-Media-Library Media Library






From Project

Back to project page Android-Media-Library.

License

The source code is released under:

Apache License

If you think the Android project Android-Media-Library 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 grevian.MediaLibrary;
/*  ww w. jav a  2  s . c o  m*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;

public class MediaLibrary extends Activity {

  public static final String AUTHORITY = "grevian.MediaLibrary";

  private final static String TAG = "GrevianMedia";

  private TextSearchAdapter mSearchAdapter;
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Log.i(TAG, "Application Started.");

    // Setup the searching field
    EditText searchText = (EditText) findViewById(R.id.SearchText);
    mSearchAdapter = new TextSearchAdapter(((ListView)findViewById(R.id.ResultList)), searchText, this.getContentResolver());
    
    if ( savedInstanceState != null && savedInstanceState.containsKey("searchText"))
    {
      searchText.setText(savedInstanceState.getString("searchText"));
      mSearchAdapter.update();
    }
    
    // Setup the scanner
    Button mButton = (Button)findViewById(R.id.ScanButton);
    mButton.setOnClickListener(    
      new Button.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent("com.google.zxing.client.android.SCAN");
            intent.putExtra("SCAN_MODE", "ONE_D_MODE");
            startActivityForResult(intent, 0);
        }
    });
    
    // Set up the list to display item details when an item is selected
    ListView mList = (ListView)findViewById(R.id.ResultList);
    mList.setOnItemClickListener(
      new ListView.OnItemClickListener() {
      public void onItemClick(AdapterView<?> ListContents, View mView, int position, long arg3) {
        Media itemDetails = (Media)ListContents.getItemAtPosition(position);
        Intent i = new Intent(MediaLibrary.this, grevian.MediaLibrary.ItemFoundActivity.class);
            i.putExtra("UPC", itemDetails.getUPC() );
            startActivity(i);
      }
    });
    
  }

  public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    Log.v(TAG, "onActivityResult called in ScanHandler");
      if (requestCode == 0) {
          if (resultCode == RESULT_OK) {
              String contents = intent.getStringExtra("SCAN_RESULT");
              
              Intent i = new Intent(MediaLibrary.this, grevian.MediaLibrary.ItemFoundActivity.class);
              i.putExtra("UPC", contents);
              startActivity(i);
              
          } else if (resultCode == RESULT_CANCELED) {
            Log.i(TAG, "Scan Cancelled.");
          }
      }
  }

}




Java Source Code List

grevian.MediaLibrary.ItemFoundActivity.java
grevian.MediaLibrary.LookupException.java
grevian.MediaLibrary.MediaContentProvider.java
grevian.MediaLibrary.MediaFactory.java
grevian.MediaLibrary.MediaLibrary.java
grevian.MediaLibrary.Media.java
grevian.MediaLibrary.TextSearchAdapter.java
grevian.MediaLibrary.UPCDataSource.java
grevian.MediaLibrary.UPCRESTSource.java
grevian.MediaLibrary.movieDetailsDatasource.java
org.xmlrpc.android.Base64Coder.java
org.xmlrpc.android.XMLRPCClient.java
org.xmlrpc.android.XMLRPCException.java
org.xmlrpc.android.XMLRPCFault.java
org.xmlrpc.android.XMLRPCSerializer.java