private void initialisePeopleGridView() { // for API 11 and above, buttons are in the action bar - could use XML-v11 but maintenance is a // hassle if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { findViewById(R.id.panel_people).setVisibility(View.GONE); } if (mParentId == null) { findViewById(R.id.button_people_add_user).setVisibility(View.GONE); findViewById(R.id.button_people_change_colour).setVisibility(View.GONE); ((Button) findViewById(R.id.button_people_view_homesteads)) .setCompoundDrawablesWithIntrinsicBounds(0, android.R.drawable.ic_menu_revert, 0, 0); ((Button) findViewById(R.id.button_people_view_public_media)) .setCompoundDrawablesWithIntrinsicBounds(0, android.R.drawable.ic_menu_share, 0, 0); } mPersonAdapter = new PersonAdapter(this, mParentId); mDefaultIcon = mPersonAdapter.getDefaultIcon(); mGrid = (GridView) findViewById(R.id.grid_people); final GridView grid = mGrid; grid.setAdapter(mPersonAdapter); grid.setOnScrollListener(new ScrollManager()); grid.setOnTouchListener(new FingerTracker()); grid.setOnItemSelectedListener(new SelectionTracker()); grid.setOnItemClickListener(new PersonViewer()); // TODO: make this work // TextView emptyView = new TextView(this); // emptyView.setText("unknown"); // grid.setEmptyView(emptyView); }
private void shareToPeople() { // TODO: currently, if the view is re-created, the selected ids are lost - fix (save in temp // prefs?) ArrayList<String> selectedItems = mPersonAdapter.getSelectedItems(); Intent resultIntent = new Intent(PeopleBrowserActivity.this, MediaViewerActivity.class); resultIntent.putExtra( getString(R.string.extra_selected_items), selectedItems.toArray(new String[selectedItems.size()])); setResult(Activity.RESULT_OK, resultIntent); finish(); }