@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // load previous position and parent on screen rotation mParentId = null; if (savedInstanceState != null) { mParentId = savedInstanceState.getString(getString(R.string.extra_parent_id)); } else { final Intent intent = getIntent(); if (intent != null) { mParentId = intent.getStringExtra(getString(R.string.extra_parent_id)); String personId = intent.getStringExtra(getString(R.string.extra_internal_id)); if (personId != null) { onView(personId); } } } if (mParentId != null) { UIUtilities.addActionBarTabs( this, new ReflectionTab[] { new ReflectionTab( R.id.intent_homestead_browser, R.drawable.ic_menu_homesteads, getString(R.string.title_homestead_browser)), new ReflectionTab( R.id.intent_people_browser, R.drawable.ic_menu_people, getString(R.string.title_people_browser), true) }, mReflectionTabListener); } else { UIUtilities.addActionBarTabs( this, new ReflectionTab[] { new ReflectionTab( R.id.intent_people_browser, R.drawable.ic_menu_people, getString(R.string.title_people_browser_selection), true) }, null); } UIUtilities.configureActionBar(this, true, false, R.string.title_people_browser, 0); setContentView(R.layout.people_browser); initialisePeopleGridView(); }
@Override public void colorChanged(int colour) { HomesteadItem editedHomestead = HomesteadManager.findHomesteadByInternalId(getContentResolver(), mParentId); editedHomestead.setColour(colour); HomesteadManager.updateHomestead(getContentResolver(), editedHomestead); UIUtilities.showToast(PeopleBrowserActivity.this, R.string.message_colour_changed); }
/** * Switch to an item's view when it is touched * * @param ownerId the PersonItem.INTERNAL_ID of the person whose media should be shown */ private void onView(String ownerId) { PersonItem person = PersonManager.findPersonByInternalId(getContentResolver(), ownerId); Intent browseMediaIntent = new Intent(PeopleBrowserActivity.this, MediaBrowserActivity.class); browseMediaIntent.putExtra(getString(R.string.extra_parent_id), ownerId); // not really the best place to manage person re-locking, but never mind... if (!person.isLocked()) { if (person.lockExpired()) { person.setLockStatus(PersonItem.PERSON_LOCKED); PersonManager.updatePerson(getContentResolver(), person); } else { browseMediaIntent.putExtra( getString(R.string.extra_media_visibility), MediaItem.MEDIA_PRIVATE); } } else { UIUtilities.showToast(PeopleBrowserActivity.this, R.string.message_view_locked_person, true); } startActivityForResult(browseMediaIntent, R.id.intent_media_browser); }