@Override public void onStart() { super.onStart(); ActionBar bar = getActivity().getActionBar(); bar.setIcon(R.drawable.ic_stat_mention); bar.setTitle(getString(R.string.mention_me_timeline)); }
public void restoreActionBar() { ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); actionBar.setIcon(R.drawable.actionbar_logo); }
@Override protected void setActionBarIcon(final Drawable icon) { final ActionBar actionBar = getActionBar(); if (actionBar == null) { throw new RuntimeException("Should have ActionBar"); } actionBar.setIcon(icon); }
@Override @TargetApi(14) protected void setActionBarSettings(Activity activity) { ActionBar actionBar = activity.getActionBar(); actionBar.setDisplayShowHomeEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setIcon(getDrawable()); }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.install_app); actionBar = getActionBar(); actionBar.setIcon(null); actionBar.setDisplayHomeAsUpEnabled(true); appList = getAPPInstalled(); initView(); }
private void handleSetIcon(String url) { if (actionBar == null) { Log.w(TAG, "ActionBar is not enabled"); return; } Drawable icon = getDrawableFromUrl(url); if (icon != null) { actionBar.setIcon(icon); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_task); String title = ((DoneApplication) getApplication()).getSelectedTask().getTitle(); final ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setIcon(android.R.color.transparent); if (savedInstanceState == null) { getFragmentManager().beginTransaction().add(R.id.container, new TaskFragment(title)).commit(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_inputs_history); currentActivity = this; selectedInputs = new ArrayList<File>(); this.overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out); // UI components ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle("Inputs History"); actionBar.setIcon(this.getResources().getDrawable(R.drawable.taverna_wheel_logo_medium)); // TODO: temp replacement of statistic wfHistoryStatistics = (TextView) this.findViewById(R.id.wfHistoryStatistics); TextView wfHistoryWfTitle = (TextView) this.findViewById(R.id.wfHistoryWfTitle); inputsList = (ListView) findViewById(R.id.savedInputsList); defaultText = (TextView) findViewById(R.id.workflow_frag_default_textview); workflowEntity = (WorkflowBE) getIntent().getSerializableExtra("workflowEntity"); Activity_Starter_Code = (Integer) getIntent().getIntExtra("Activity_Starter_Code", 1); if (workflowEntity != null) { wfHistoryWfTitle.setText(workflowEntity.getTitle()); // get directory path File root = android.os.Environment.getExternalStorageDirectory(); String inputsSubPath = "/TavernaAndroid/Inputs/" + workflowEntity.getTitle().replace(" ", "") + "_" + workflowEntity.getVersion() + "_" + workflowEntity.getUploaderName().replace(" ", "") + "/"; INITIAL_DIRECTORY = root.getAbsolutePath() + inputsSubPath; mDirectory = new File(INITIAL_DIRECTORY); mFiles = new ArrayList<File>(); checkboxesStates = new ArrayList<Boolean>(); mAdapter = new InputsHistoryListAdapter(mFiles); inputsList.setAdapter(mAdapter); } }
@SuppressLint("InflateParams") private void setupActionBar() { ActionBar ab = getActionBar(); ab.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#253939"))); ab.setDisplayShowCustomEnabled(true); ab.setDisplayShowTitleEnabled(false); ab.setIcon(R.drawable.ic_launcher); LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflator.inflate(R.layout.comment_view_action_bar, null); TextView titleTV = (TextView) v.findViewById(R.id.comment_action_bar_title); titleTV.setText(this.title); ab.setCustomView(v); ab.setDisplayHomeAsUpEnabled(true); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); // Show the Up button in the action bar. setupActionBar(); actionBar = getActionBar(); actionBar.setIcon(getResources().getDrawable(R.drawable.logo)); sharedpreferences = getSharedPreferences(SignUpActivity.MyPREFERENCES, Context.MODE_PRIVATE); mListviewSettings = (ListView) findViewById(R.id.settingsListView); if (ParseUser.getCurrentUser() != null) currentUser = ParseUser.getCurrentUser(); MyCustomAdapter mAdapter; mAdapter = new MyCustomAdapter(); mAdapter.addSeparatorItem("CURRENT ACCOUNT:"); mAdapter.addItem("Username: "******"Email: " + "Change Email Id via FB."); } else mAdapter.addItem("Email: " + currentUser.getEmail()); mAdapter.addItem("Change Profile Picture "); mAdapter.addSeparatorItem("SPREAD THE WORD:"); mAdapter.addItem("Invite Your Friends"); mAdapter.addSeparatorItem("MORE INFO:"); mAdapter.addItem("Terms of Use"); mAdapter.addItem("Privacy Policy"); mAdapter.addItem("Getting Started"); mListviewSettings.setAdapter(mAdapter); // setListAdapter(mAdapter); mListviewSettings.setOnItemClickListener(this); }
protected void initView() { // Set layout setContentView(R.layout.settings); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { ActionBar ab = getActionBar(); if (ab != null) { ab.setHomeButtonEnabled(true); ab.setTitle(R.string.settings); ab.setHomeButtonEnabled(true); ab.setDisplayShowTitleEnabled(true); ab.setDisplayShowHomeEnabled(true); ab.setDisplayHomeAsUpEnabled(true); ab.setDisplayUseLogoEnabled(false); ab.setIcon(R.drawable.menu_ic_settings); } } mAppIdView = (EditText) findViewById(R.id.appIdText); mTokenTextView = (EditText) findViewById(R.id.tokenText); }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.topic_detail); ActionBar actionBar = getActionBar(); actionBar.setIcon(null); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayUseLogoEnabled(false); actionBar.show(); Intent intent = getIntent(); String topic_id = intent.getStringExtra("topic_id"); int isFocus = intent.getIntExtra("isFocus", 10); dm = getResources().getDisplayMetrics(); ViewPager pager = (ViewPager) findViewById(R.id.pager); tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); pager.setAdapter(new TopicDetailAdapter(getSupportFragmentManager(), topic_id, isFocus)); tabs.setViewPager(pager); setTabsValue(); }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.add_to_music_library, menu); ActionBar actionBar = getActionBar(); actionBar.setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); actionBar.setIcon( mContext .getResources() .getIdentifier(libraryIconName, "drawable", mContext.getPackageName())); SpannableString s = new SpannableString(libraryName); s.setSpan( new TypefaceSpan(this, "RobotoCondensed-Light"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); actionBar.setTitle(s); return super.onCreateOptionsMenu(menu); }
private void initView() { // Set layout setContentView(R.layout.information); mConferenceManager = ConferenceManager.getInstance(getApplicationContext()); mSessionIdView = (TextView) findViewById(R.id.sessionIdInformationValueLabel); mActiveUsersList = (ListView) findViewById(R.id.activeUsersList); mActiveUsersList.setDivider(null); mActiveUsersList.setDividerHeight(0); mCustomAdapter = new CustomParticipantAdapter(mConferenceManager.getActiveUsers()); ActionBar ab = getActionBar(); if (ab != null) { ab.setHomeButtonEnabled(true); ab.setTitle(R.string.information_screen_name); ab.setHomeButtonEnabled(true); ab.setDisplayShowTitleEnabled(true); ab.setDisplayShowHomeEnabled(true); ab.setDisplayHomeAsUpEnabled(true); ab.setDisplayUseLogoEnabled(false); ab.setIcon(R.drawable.menu_ic_info); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); // Show the Up button in the action bar. setupActionBar(); actionBar = getActionBar(); actionBar.setIcon(getResources().getDrawable(R.drawable.logo)); WebView theWebPage = new WebView(this); setContentView(theWebPage); theWebPage.loadUrl("http://www.hkmytravel.com"); theWebPage.setWebViewClient( new WebViewClient() { public void onPageFinished(WebView view, String url) { setProgressBarIndeterminateVisibility(false); } }); }
@TargetApi(14) public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ly_search); // Get the intent, verify the action and get the query Intent intent = getIntent(); intent.putExtra("android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES", new String[] {}); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { query = intent.getStringExtra(SearchManager.QUERY); // doMySearch(query); } ActionBar actionbar = getActionBar(); actionbar.setTitle(getResources().getString(R.string.search_result_pre) + " " + query); actionbar.setIcon(R.drawable.ic_action_search); list = (ListView) findViewById(R.id.list); _scope = this; getTask = new GetTask(); getTask.execute(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.edit_activity); etName = (EditText) findViewById(R.id.upContactName); etNumber = (EditText) findViewById(R.id.upContactPhoneNo); etEmail = (EditText) findViewById(R.id.upContactEmail); etCity = (EditText) findViewById(R.id.upContactCity); etDesignation = (EditText) findViewById(R.id.upContactDescription); etHome = (EditText) findViewById(R.id.upContactHome); imageView = (ImageView) findViewById(R.id.upimageView); // set db instance contactDBHelper = ContactDBHelper.getInstance(getApplicationContext()); sp = (Spinner) findViewById(R.id.upSpSelectGroup); ActionBar actionBar = getActionBar(); // remove icon actionBar.setIcon(android.R.color.transparent); // actionBar.setIcon(R.drawable.ic_action_back); // set extra value setAllInfo(); imageView.setOnClickListener( new android.view.View.OnClickListener() { @Override public void onClick(View v) { selectImage(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainscreen_layout); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); mSelected = new HashMap<Integer, Boolean>(); CONF = new Configuration(this); SESSION = new SessionManager(getApplicationContext()); ficheros = leeFicheros(); ctx = this; SESSION.checkLogin(); this.ERRORS = new MainScreen_Errors(ctx); this.MSUTILS = new MainScreen_Utils(); this.CREATE = new CreateFolders(ctx); this.PDF = new PDF_Methods(ctx, null); CREATE.createScoreFolder(); CREATE.createImageFolder(); UpdateMoney(CONF.getUserEmail()); ActionBar action = getActionBar(); action.setTitle(R.string.titulo_coleccion); action.setIcon(R.drawable.ic_menu); // Si no hay partituras, mostramos un mensaje al usuario. Si hay partituras cargamos la galería // de partituras if (ficherosLength() == 0) { new InterfazNoPartituras(ctx, scores_gallery); } else { interfazCuandoHayPartituras(ficheros); } }
@Override public void setIcon(Drawable icon) { mActionBar.setIcon(icon); }
@Override public void setIcon(int resId) { mActionBar.setIcon(resId); }
@SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { // requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.activity_home); final ActionBar actionBar = getActionBar(); // // if (android.os.Build.VERSION.SDK_INT < 11) { // requestWindowFeature(Window.FEATURE_NO_TITLE); // } actionBar.setHomeButtonEnabled(false); actionBar.setIcon(R.drawable.ic_list); actionBar.setDisplayOptions(actionBar.getDisplayOptions() | ActionBar.DISPLAY_SHOW_CUSTOM); ImageView imageView = new ImageView(actionBar.getThemedContext()); imageView.setScaleType(ImageView.ScaleType.CENTER); imageView.setImageResource(R.drawable.ic_list); ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams( ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL); // actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // // firstTab = actionBar.newTab().setIcon(R.drawable.ic_launcher) // .setText("First Tab"); // secondTab = actionBar.newTab().setIcon(R.drawable.ic_launcher) // .setText("Second Tab"); // thirdTab = actionBar.newTab().setIcon(R.drawable.ic_launcher) // .setText("Third Tab"); // // /* // * firstTab.setTabListener(new TabListener(firstFragmentTab)); // * secondTab.setTabListener(new TabListener(secondFragmentTab)); // * thirdTab.setTabListener(new TabListener(thirdFragmentTab)); // */ // // actionBar.addTab(firstTab); // actionBar.addTab(secondTab); // actionBar.addTab(thirdTab); // // viewPager = (ViewPager) findViewById(R.id.pager); // List<Fragment> fragments = getFragments(); // // obj_pagerAdapter = new TabsPagerAdapter(getSupportFragmentManager(), // fragments); // // ViewPager pager = (ViewPager) findViewById(R.id.pager); // // pager.setAdapter(obj_pagerAdapter); analytics = GoogleAnalytics.getInstance(this); analytics.setLocalDispatchPeriod(1800); tracker = analytics.newTracker("UA-66147419-1"); // Replace with actual // tracker/property // Id tracker.enableExceptionReporting(true); tracker.enableAdvertisingIdCollection(true); tracker.enableAutoActivityTracking(true); tracker.setScreenName("main screen"); tracker.send( new HitBuilders.EventBuilder() .setCategory("UX") .setAction("click") .setLabel("submit") .build()); viewPager = (ViewPager) findViewById(R.id.pager); // actionBar = getActionBar(); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); // actionBar.setHomeButtonEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Adding Tabs for (String tab_name : tabs) { actionBar.addTab(actionBar.newTab().setText(tab_name).setTabListener(this)); } viewPager.setOnPageChangeListener( new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); easyTracker = EasyTracker.getInstance(); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) {} @Override public void onPageScrollStateChanged(int arg0) {} }); imgBtnList = (ImageView) findViewById(R.id.imgBtn_list); arraylist_Drawer = new ArrayList<String>(); drawer = (ListView) findViewById(R.id.left_drawer); mydrawer = (DrawerLayout) findViewById(R.id.drawer_layout); ArrayAdapter<String> adpt = new ArrayAdapter<String>( HomeActivity.this, android.R.layout.simple_list_item_1, navMenuTitles); drawer.setAdapter(adpt); imgBtnList.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub mydrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); if (mydrawer.isDrawerOpen(drawer)) { // Animation animation1 = AnimationUtils.loadAnimation( // getApplicationContext(), R.anim.clockwise); // imgBtnList.startAnimation(animation1); mydrawer.closeDrawer(drawer); // imgBtnList.setBackgroundResource(R.drawable.ic_list); } else { // Animation animation2 = AnimationUtils.loadAnimation( // getApplicationContext(), R.anim.clockwise); // imgBtnList.startAnimation(animation2); mydrawer.openDrawer(drawer); // imgBtnList.setBackgroundResource(R.drawable.img_back); } } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); Bundle extras = getIntent() != null ? getIntent().getExtras() : new Bundle(); final Person person = extras.getParcelable("person"); final Activity currentActivity = this; final ActionBar bar = getActionBar(); View viewActionBar = getLayoutInflater().inflate(R.layout.layout_action_bar, null); ImageView backView = (ImageView) viewActionBar.findViewById(R.id.actionbar_left); backView.setImageResource(R.drawable.arrow_left); backView.setVisibility(View.VISIBLE); backView.setClickable(true); backView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { currentActivity.finish(); } }); ActionBar.LayoutParams params = new ActionBar.LayoutParams( ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.MATCH_PARENT); bar.setCustomView(viewActionBar, params); bar.setDisplayShowCustomEnabled(true); bar.setDisplayShowTitleEnabled(false); bar.setIcon(new ColorDrawable(Color.TRANSPARENT)); bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#F15153"))); TextView attendeeNameView = (TextView) findViewById(R.id.attendeeName); attendeeNameView.setText(person.getFirstName() + " " + person.getLastName()); final ImageView attendeeImageView = (ImageView) findViewById(R.id.attendeeImage); final TextView attendeeHeadlineView = (TextView) findViewById(R.id.attendeeHeadline); final TextView attendeeLocationView = (TextView) findViewById(R.id.attendeeLocation); boolean isAccessTokenValid = LISessionManager.getInstance(currentActivity).getSession().isValid(); if (isAccessTokenValid) { String url = Constants.personByIdBaseUrl + person.getLinkedinId() + Constants.personProjection; APIHelper.getInstance(currentActivity) .getRequest( currentActivity, url, new ApiListener() { @Override public void onApiSuccess(ApiResponse apiResponse) { try { JSONObject s = apiResponse.getResponseDataAsJson(); String headline = s.has("headline") ? s.getString("headline") : ""; String pictureUrl = s.has("pictureUrl") ? s.getString("pictureUrl") : null; JSONObject location = s.getJSONObject("location"); String locationName = location != null && location.has("name") ? location.getString("name") : ""; attendeeHeadlineView.setText(headline); attendeeLocationView.setText(locationName); if (pictureUrl != null) { new FetchImageTask(attendeeImageView).execute(pictureUrl); } else { attendeeImageView.setImageResource(R.drawable.ghost_person); } } catch (JSONException e) { } } @Override public void onApiError(LIApiError apiError) {} }); ViewStub viewOnLIStub = (ViewStub) findViewById(R.id.viewOnLIStub); View viewOnLI = viewOnLIStub.inflate(); Button viewOnLIButton = (Button) viewOnLI.findViewById(R.id.viewOnLinkedInButton); viewOnLIButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { DeepLinkHelper.getInstance() .openOtherProfile( currentActivity, person.getLinkedinId(), new DeepLinkListener() { @Override public void onDeepLinkSuccess() {} @Override public void onDeepLinkError(LIDeepLinkError error) {} }); } }); } else { attendeeImageView.setImageResource(R.drawable.ghost_person); } }
private void setupActionBar() { ActionBar actionBar = getActivity().getActionBar(); actionBar.setIcon(R.drawable.ic_transparent); // getActionBarTitleView().setAlpha(0f); }
@Override protected void initActionBar(ActionBar actionBar) { super.initActionBar(actionBar); actionBar.setIcon(com.mfh.comna.R.drawable.white_logo); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (Log.STRICT_MODE) { StrictMode.enableDefaults(); } if (Log.CRITTERCISM) { Crittercism.initialize(getApplicationContext(), "522a584297c8f23137000001"); } sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); try { int versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode; int lastVersionCode = sharedPreferences.getInt(Keys.PREF_LAST_UPDATED_VERSION, 0); if (versionCode >= lastVersionCode && lastVersionCode > 0) { SQLiteDatabase db = new DBHelper(getApplicationContext()).getReadableDatabase(); if (db != null) { db.close(); sharedPreferences.edit().putInt(Keys.PREF_LAST_UPDATED_VERSION, versionCode).apply(); } } } catch (PackageManager.NameNotFoundException e) { Log.e(e, e.getMessage()); } pagerAdapter = new PagerAdapter(getSupportFragmentManager()); pagerAdapter.addFragment(mainFragment = new MainFragment()); viewPager = (ViewPager) findViewById(R.id.viewPager); viewPager.setAdapter(pagerAdapter); viewPager.setOnPageChangeListener( new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int i, float v, int i2) {} @Override public void onPageSelected(int i) { if (i == 0) { drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); } else { drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } } @Override public void onPageScrollStateChanged(int i) {} }); ActionBar actionBar = getActionBar(); actionBar.setIcon(null); actionBar.setDisplayOptions( ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP); drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); drawerAbToggle = new ActionBarDrawerToggle( this, drawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { float prevOffset; @Override public void onDrawerSlide(View drawerView, float slideOffset) { super.onDrawerSlide(drawerView, slideOffset); isSliderOpen = prevOffset <= slideOffset; prevOffset = slideOffset; invalidateOptionsMenu(); } }; drawerLayout.setDrawerListener(drawerAbToggle); accountsList = (ListView) findViewById(R.id.drawerList); accountsAdapter = new AccountsAdapter(getApplicationContext(), accounts); accountsList.setAdapter(accountsAdapter); accountsList.setOnItemLongClickListener( new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick( AdapterView<?> parent, View view, final int position, long id) { if (position == 0) { return false; } Account account = accountsAdapter.getItem(position); AlertDialog.Builder builder = new AlertDialog.Builder( new ContextThemeWrapper(MainActivity.this, R.style.DroidHub_AlertDialog)); builder.setTitle("Delete account"); builder.setMessage("Do you really want to remove " + account.type.accName + "?"); builder.setPositiveButton( "Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { removeAccount(position); } }); builder.setNegativeButton( "No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) {} }); builder.show(); return true; } }); accountsList.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { mainFragment.adapter.reloadType(accountsAdapter.getItem(position).type); drawerLayout.closeDrawer(accountsList); } }); new BackgroundTasks().execute(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.slide_in_left, R.anim.activity_zoom_exit); try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ex) { // Ignore } context = this; sharedPrefs = context.getSharedPreferences( "com.klinker.android.twitter_world_preferences", Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE); settings = AppSettings.getInstance(this); try { searchQuery = getIntent().getStringExtra(SearchManager.QUERY); } catch (Exception e) { searchQuery = ""; } if (searchQuery == null) { searchQuery = ""; } handleIntent(getIntent()); if (Build.VERSION.SDK_INT > 18 && settings.uiExtras && (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE || getResources().getBoolean(R.bool.isTablet))) { translucent = true; getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); try { int immersive = android.provider.Settings.System.getInt(getContentResolver(), "immersive_mode"); if (immersive == 1) { translucent = false; } } catch (Exception e) { } } else { translucent = false; } Utils.setUpTheme(context, settings); setContentView(R.layout.search_pager); actionBar = getActionBar(); actionBar.setTitle(getResources().getString(R.string.search)); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); View statusBar = findViewById(R.id.activity_status_bar); mViewPager = (ViewPager) findViewById(R.id.pager); if (translucent) { statusBar.setVisibility(View.VISIBLE); int statusBarHeight = Utils.getStatusBarHeight(context); LinearLayout.LayoutParams statusParams = (LinearLayout.LayoutParams) statusBar.getLayoutParams(); statusParams.height = statusBarHeight; statusBar.setLayoutParams(statusParams); } else { mViewPager.setPadding(0, 0, 0, 0); } mSectionsPagerAdapter = new SearchPagerAdapter( getFragmentManager(), context, onlyStatus, onlyProfile, searchQuery, translucent); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOffscreenPageLimit(3); if (settings.addonTheme) { PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip); strip.setBackgroundColor(settings.pagerTitleInt); } mViewPager.setCurrentItem(1); Utils.setActionBar(context, true); if (onlyProfile) { mViewPager.setCurrentItem(2); } }