Ejemplo n.º 1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);

    /*read settings*/
    settings = getSharedPreferences(PREFS_NAME, 0);
    boolean hide = settings.getBoolean(PREFS_HIDDEN, false);
    int color = settings.getInt(PREFS_COLOR, -1);

    flmg = new FileManager();
    flmg.setShowHiddenFiles(hide);

    handler = new EventHandler(Main.this, flmg);
    handler.setTextColor(color);
    table = handler.new TableRow();

    /*sets the ListAdapter for our ListActivity and
     *gives our EventHandler class the same adapter
     */
    handler.setListAdapter(table);
    setListAdapter(table);

    /* register context menu for our list view */
    registerForContextMenu(getListView());

    path_label = (TextView) findViewById(R.id.path_label);
    detail_label = (TextView) findViewById(R.id.detail_label);
    path_label.setText("path: /sdcard");

    handler.setUpdateLabel(path_label, detail_label);

    ImageButton help_b = (ImageButton) findViewById(R.id.help_button);
    help_b.setOnClickListener(handler);

    ImageButton home_b = (ImageButton) findViewById(R.id.home_button);
    home_b.setOnClickListener(handler);

    ImageButton back_b = (ImageButton) findViewById(R.id.back_button);
    back_b.setOnClickListener(handler);

    ImageButton info_b = (ImageButton) findViewById(R.id.info_button);
    info_b.setOnClickListener(handler);

    ImageButton manage_b = (ImageButton) findViewById(R.id.manage_button);
    manage_b.setOnClickListener(handler);

    ImageButton multi_b = (ImageButton) findViewById(R.id.multiselect_button);
    multi_b.setOnClickListener(handler);

    ImageButton operation_b = (ImageButton) findViewById(R.id.multioperation_button);
    operation_b.setOnClickListener(handler);
  }