Android Open Source - Flippy-Radio Flippy Main 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  a  va2 s . c  o  m*/

import java.lang.reflect.Method;

import com.bitflippersanonymous.flippy.R;


import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class FlippyMainActivity extends FlippyBaseActivity {
  private static final Class<?>[] sMenuItems = {
    FlippyInfoActivity.class,
    FlippyQueueActivity.class,
    FlippyBrowseActivity.class,
    FlippySearchActivity.class,
    FlippyAboutActivity.class
  };
  
    
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
  
    final ArrayAdapter<Class<?>> mAdapter = new ArrayAdapter<Class<?>>(this, 0, sMenuItems) { 
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(FlippyMainActivity.this).inflate(R.layout.main_entry, null);
        if ( position < sMenuItems.length ) {
          try {
            final Method populate = sMenuItems[position].getDeclaredMethod("popMenuView", View.class);
            populate.invoke(null, view);
          } catch (Exception e) {
            String text = sMenuItems[position].getSimpleName();
            TextView title = (TextView) view.findViewById(R.id.entryTitle);
            title.setText(text);
          }
        }
        return view;
      }
      
    };
    
    ListView list = (ListView) findViewById(R.id.ListViewMain);
    list.setAdapter(mAdapter);
    
      list.setOnItemClickListener(new AdapterView.OnItemClickListener(){
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              final Intent intent = new Intent(view.getContext(), sMenuItems[position]);
              startActivity(intent);  
            }
      });
  }
}




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