@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CookieSyncManager.createInstance(getApplicationContext()); mSettings.loadRedditPreferences(this, mClient); setRequestedOrientation(mSettings.getRotation()); setTheme(mSettings.getTheme()); requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.saved_comments); sdbh = new SavedDBHandler(this); savedContent = sdbh.getSavedContent(mSettings.getUsername()); Adapter lAdapter = new Adapter(this, R.layout.saved_comments_item, savedContent); listview = (ListView) findViewById(R.id.savedcommentslv); listview.setAdapter(lAdapter); listview.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { currentSavedContent = savedContent.get(position); showDialog(Constants.DIALOG_SAVED_COMMENTS); } }); }
@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); if (mSettings.isLoggedIn()) { menu.findItem(R.id.user_profile_menu_id).setVisible(true); menu.findItem(R.id.user_profile_menu_id) .setTitle( String.format( getResources().getString(R.string.user_profile), mSettings.getUsername())); } else { menu.findItem(R.id.user_profile_menu_id).setVisible(false); } MenuItem src, dest; src = Util.isLightTheme(mSettings.getTheme()) ? menu.findItem(R.id.dark_menu_id) : menu.findItem(R.id.light_menu_id); dest = menu.findItem(R.id.light_dark_menu_id); dest.setTitle(src.getTitle()); return true; }