@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } setHasOptionsMenu(true); ((ActionBarActivity) getActivity()).getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true); playSmsDb = new PlaySmsDb(getActivity()); adapter = new SentMessageAdapter(getActivity()); User u = getUserCookie(LoginActivity.KEY_USER, User.class); service = new AndroidMasterServiceImpl(u); }
private void onSuccess(Weather result) { if (isDetached()) { return; } // TODO: for debugging final ActionBar actionBar = ((ActionBarActivity) getActivity()).getSupportActionBar(); if (actionBar == null) { throw new IllegalStateException("ActionBar does not exist"); } actionBar.setTitle(result.getCity().getName()); actionBar.setSubtitle(result.getCity().getCountryCode()); final View view = getView(); if (!(view instanceof WeatherView)) { throw new IllegalStateException("getView() return invalid view:" + view); } ((WeatherView) getView()).update(result); }
private ToolbarWrapper changeToBack(final ViewGroup contentView) { final ActionBarActivity aty = (ActionBarActivity) contentView.getContext(); ToolbarWrapper contain = (ToolbarWrapper) View.inflate(mContext, R.layout.view_toolbar, null); Toolbar newTb = ButterKnife.findById(contain, R.id.toolbar); newTb.setTag("backToolbar"); aty.setSupportActionBar(newTb);/*替换toolBar为actionBar*/ final ActionBar supportActionBar = aty.getSupportActionBar(); supportActionBar.setHomeButtonEnabled(true); // 设置返回键可用 supportActionBar.setDisplayHomeAsUpEnabled(true); /*supportActionBar.setHomeAsUpIndicator(R.drawable.ic_launcher);*//*设置返回键样式*/ newTb.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { aty.finish(); } }); return contain; }
public static void setActionBarDashboard(ActionBarActivity activity, String title) { if (PreferencesState.getInstance().isVerticalDashboard()) { LayoutUtils.setActionbarAppName(activity); } else { //Get Tab + User title = getCapitalizeName(title); String user = getCurrentUsername(); String appNameColorString = getAppNameColorString(); String appName = getAppName(); Spanned spannedTitle = Html.fromHtml( String.format("<font color=\"#%s\"><b>%s</b></font> | %s", appNameColorString, appName, title)); LayoutUtils.setActionbarTitle(activity, spannedTitle, user); } }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.credits, container, false); setFragmentView(view); ((ActionBarActivity)getActivity()).getSupportActionBar().setDisplayShowTitleEnabled(true); ((ActionBarActivity)getActivity()).getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); charger(); remplir(); ajouterListeners(); return view; }
@Override public void onResume() { super.onResume(); SharedPreferencesUtil preferences = new SharedPreferencesUtil(getActivity()); API api = API.getInstance(preferences.getUrl(), preferences.getToken()); versionFragmentSubscription(this, api) .subscribe(files -> VersionsListFragment.replace((ActionBarActivity) getActivity(), (ArrayList<File>) files), new RetrofitAction1() { @Override protected void onHttpStatusError(RestError body) { VersionsListFragment.replace((ActionBarActivity) getActivity(), body); } }); }
private static void sendMessagesOnCallback(Context context, Object event) { if (context instanceof Activity) { //Enumerate activity's views Activity activity = (Activity)context; Window win = activity.getWindow(); if (win != null) { View decor = win.getDecorView(); enumViewsOnCallback(decor, event); } if (activity instanceof ActionBarActivity) { ActionBarActivity barActivity = (ActionBarActivity)activity; FragmentManager manager = barActivity.getSupportFragmentManager(); if (manager != null) { List<Fragment> fragments = manager.getFragments(); if (fragments != null) { for (Fragment frag : new ArrayList<Fragment>(fragments)) { if (frag != null) { callIfMatches(frag, event); } } } } } //Call activity callback after view callbacks } callIfMatches(context, event); }
protected void onSystemUiShown() { ActionBar ab = ((ActionBarActivity) mActivity).getSupportActionBar(); if (ab != null) { ab.show(); } mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); setIsShowing(true); }
protected void onSystemUiHidden() { ActionBar ab = ((ActionBarActivity) mActivity).getSupportActionBar(); if (ab != null) { ab.hide(); } mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); setIsShowing(false); }
/** * Set TimeControl ListView with proper Adapter and item(s) selection positions. */ private void setupListView(Bundle savedInstanceState) { if (savedInstanceState != null) { // Restore list selection mode. isMultiSelectionActive = savedInstanceState.getBoolean(KEY_ACTION_MODE); // Restore last list item check position mItemChecked = savedInstanceState.getInt(KEY_ITEM_SELECTED, 0); } else { isMultiSelectionActive = false; mItemChecked = mListener.getCheckedTimeControlIndex(); } // Init the CAB helper mMultiSelectionController = MultiSelectionUtil.attachMultiSelectionController( mListView, (ActionBarActivity) getActivity(), this); if (isMultiSelectionActive) { adapterCAB = new TimeControlCABAdapter(getActivity(), mListener.getCurrentTimeControls(), this); mListView.setAdapter(adapterCAB); mListView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); mMultiSelectionController.tryRestoreInstanceState(savedInstanceState); // Hide Start Button mStartBtn.setVisibility(View.GONE); } else { adapter = new TimeControlAdapter(getActivity(), mListener.getCurrentTimeControls()); mListView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); mListView.setAdapter(adapter); } }
public static Controller attach(ListView listView, ActionBarActivity activity, MultiChoiceModeListener listener) { Controller controller = new Controller(); controller.mListView = listView; controller.mActivity = activity; controller.mListener = listener; return controller; }
@Override public void onCross(boolean crossed) { LinearLayout navChanll; navChanll = (LinearLayout)getView().findViewById(R.id.navchanll); if (!crossed ) { if (Globo.chatlogChanNav.get()) { Globo.chatlogChanNav.set(false); navChanll.setVisibility(View.GONE); }else{ Globo.chatlogChanNav.set(true); navChanll.setVisibility(View.VISIBLE); this.refreshNavBar(); } }else{ if (Globo.chatlogActNav.get()) { Globo.chatlogActNav.set(false); ((ActionBarActivity)getActivity()).getSupportActionBar().hide(); }else{ Globo.chatlogActNav.set(true); ((ActionBarActivity)getActivity()).getSupportActionBar().show(); } } }
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mDrawerLayoutView = (DrawerLayout) getActivity().findViewById(mNavConf.getDrawerLayoutViewId()); mDrawerToggle = new ActionBarDrawerToggle( this.getActivity(), mDrawerLayoutView, (Toolbar) getActivity().findViewById(mNavConf.getToolbarId()), mNavConf.getDrawerOpenDesc(), mNavConf.getDrawerCloseDesc() ) { public void onDrawerClosed(View view) { ((ActionBarActivity)getActivity()).getSupportActionBar().setTitle(mTitle); ActivityCompat.invalidateOptionsMenu(NavigationDrawerFragment.this.getActivity()); if ( NavigationDrawerFragment.this.mSelectItemOnClosed != null ) { NavigationDrawerFragment.this.deferedOnNavItemSelected(); } } public void onDrawerOpened(View drawerView) { ((ActionBarActivity)getActivity()).setTitle(mDrawerTitle); ActivityCompat.invalidateOptionsMenu(NavigationDrawerFragment.this.getActivity()); } }; mDrawerLayoutView.setDrawerListener(mDrawerToggle); mDrawerToggle.syncState(); setTitle(mTitle); }
private void initializeBatchListener() { getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> arg0, View v, int position, long id) { ConversationListAdapter adapter = (ConversationListAdapter)getListAdapter(); actionMode = ((ActionBarActivity)getActivity()).startSupportActionMode(ConversationListFragment.this); adapter.initializeBatchMode(true); adapter.toggleThreadInBatchSet(((ConversationListItem) v).getThreadId()); adapter.notifyDataSetChanged(); return true; } }); }
/** * ShareSDK集成方法有两种</br> * 1、第一种是引用方式,例如引用onekeyshare项目,onekeyshare项目再引用mainlibs库</br> * 2、第二种是把onekeyshare和mainlibs集成到项目中,本例子就是用第二种方式</br> * 请看“ShareSDK 使用说明文档”,SDK下载目录中 </br> * 或者看网络集成文档 http://wiki.mob.com/Android_%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E6%8C%87%E5%8D%97 * 3、混淆时,把sample或者本例子的混淆代码copy过去,在proguard-project.txt文件中 * <p/> * <p/> * 平台配置信息有三种方式: * 1、在我们后台配置各个微博平台的key * 2、在代码中配置各个微博平台的key,http://mob.com/androidDoc/cn/sharesdk/framework/ShareSDK.html * 3、在配置文件中配置,本例子里面的assets/ShareSDK.conf, */ public static void showShare(ActionBarActivity activity, boolean silent, String platform, boolean captureView) { OnekeyShare oks = new OnekeyShare(); //关闭sso授权 oks.disableSSOWhenAuthorize(); // 分享时Notification的图标和文字 2.5.9以后的版本不调用此方法 //oks.setNotification(R.drawable.ic_launcher, getString(R.string.app_name)); // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用 oks.setTitle(activity.getString(R.string.share)); // titleUrl是标题的网络链接,仅在人人网和QQ空间使用 oks.setTitleUrl("http://sharesdk.cn"); // text是分享文本,所有平台都需要这个字段 oks.setText("我是分享文本"); // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数 oks.setImagePath("/sdcard/test.png");//确保SDcard下面存在此张图片 // url仅在微信(包括好友和朋友圈)中使用 oks.setUrl("http://sharesdk.cn"); // comment是我对这条分享的评论,仅在人人网和QQ空间使用 oks.setComment("我是测试评论文本"); // site是分享此内容的网站名称,仅在QQ空间使用 oks.setSite(activity.getString(R.string.app_name)); // siteUrl是分享此内容的网站地址,仅在QQ空间使用 oks.setSiteUrl("http://sharesdk.cn"); // 启动分享GUI oks.show(activity); }
@Override public void onStart() { super.onStart(); ActionBarActivity activity = (ActionBarActivity) getActivity(); if (activity != null) { ActionBar actionBar = activity.getSupportActionBar(); final Integer titleResId = getActionBarTitle(); if (actionBar != null && titleResId != null) { actionBar.setTitle(titleResId); } } }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.cameras_gallery_fragment, container, false); mVibrator = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE); mAdapterView = (GridView) view.findViewById(R.id.grid_view_cameras); mEmptyGalleryTextView = (TextView) view.findViewById(R.id.text_view_no_favorites); mPullToRefreshLayout = (PullToRefreshLayout) view.findViewById(R.id.ptr_layout); mAdapterView.setOnItemClickListener(new CameraItemClickListener()); mAdapterView.setOnItemLongClickListener(new CameraItemLongClickListener()); if (savedInstanceState != null) { mCurrentIndex = savedInstanceState.getInt( Constants.BUNDLE_CURRENT_INDEX, 0); } mDrawerLayout = (DrawerLayout) getActivity().findViewById(R.id.drawer_layout); mDrawerList = (ExpandableListView) getActivity().findViewById(R.id.left_drawer); mActionBar = ((ActionBarActivity) getActivity()).getSupportActionBar(); // Now setup the PullToRefreshLayout ActionBarPullToRefresh.from(getActivity()) // Mark All Children as pullable .allChildrenArePullable() // Set the OnRefreshListener .listener(this) .options(Options.create().refreshOnUp(true).build()) // Finally commit the setup to our PullToRefreshLayout .setup(mPullToRefreshLayout); return view; }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(getResources().getString(R.string.lecture_detail_title)); ((ActionBarActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); ((MainActivity) getActivity()).getMenu().findItem(R.id.action_docents).setVisible(false); ((MainActivity) getActivity()).getMenu().findItem(R.id.action_events).setVisible(false); ((MainActivity) getActivity()).getMenu().findItem(R.id.action_add).setVisible(false); }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(getResources().getString(R.string.docent_list_title)); ((ActionBarActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); ((MainActivity) getActivity()).getMenu().findItem(R.id.action_docents).setVisible(false); ((MainActivity) getActivity()).getMenu().findItem(R.id.action_events).setVisible(false); ((MainActivity) getActivity()).getMenu().findItem(R.id.action_add).setVisible(false); }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle("Add Event"); ((ActionBarActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); ((MainActivity) getActivity()).getMenu().findItem(R.id.action_docents).setVisible(false); ((MainActivity) getActivity()).getMenu().findItem(R.id.action_events).setVisible(false); ((MainActivity) getActivity()).getMenu().findItem(R.id.action_add).setVisible(false); }
/** * Per the navigation drawer design guidelines, updates the action bar to show the global app * 'context', rather than just what's in the current screen. */ private void showGlobalContextActionBar() { ActionBarActivity actionBarActivity = (ActionBarActivity) getActivity(); actionBarActivity.getSupportActionBar(); actionBarActivity.getSupportActionBar().setTitle(R.string.app_name); ((ActionBarActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); ((ActionBarActivity) getActivity()).getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_schedule, container, false); DatabaseManager db = DatabaseManager.getInstance(); ArrayList<Day> days = db.getDates(track); String subTitle = ""; for (Day day : days) { if (days.indexOf(day) != 0) { subTitle += ", "; } subTitle += day.getDate(); } ((ActionBarActivity) getActivity()).getSupportActionBar().setSubtitle(subTitle); holder = new ViewHolder(); holder.contentView = view.findViewById(R.id.content); holder.emptyView = view.findViewById(android.R.id.empty); holder.pager = (ViewPager) view.findViewById(R.id.pager); holder.slidingTabs = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs); holder.contentView.setVisibility(View.VISIBLE); holder.emptyView.setVisibility(View.GONE); if (holder.pager.getAdapter() == null) { holder.pager.setAdapter(daysAdapter); } holder.slidingTabs.setViewPager(holder.pager); if (days.size() > 0) { String[] date = days.get(0).getDate().split(" "); int position = Integer.parseInt(date[1]) - 13; holder.pager.setCurrentItem(position); } return view; }
@Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int index, long l) { if (mActionMode != null) { return true; } mActionMode = ((ActionBarActivity) getActivity()).startSupportActionMode(new ImagesFragmentActionModeCallback()); mActionMode.setTitle(R.string.delete_selected); onItemClick(adapterView, view, index, l); return true; }
@Override public void onStart() { super.onStart(); // Hide the Action Bar ActionBar actionBar = ((ActionBarActivity) getActivity()).getSupportActionBar(); if (actionBar != null) { actionBar.hide(); } }
public static void configureToolbar(ActionBarActivity activity, boolean isChild) { Toolbar toolbar = (Toolbar) activity.findViewById(R.id.toolbar); if(toolbar != null) { activity.setSupportActionBar(toolbar); activity.getSupportActionBar().setDisplayHomeAsUpEnabled(isChild); } }
/** * Per the navigation drawer design guidelines, updates the action bar to show the global app * 'context', rather than just what's in the current screen. */ /* private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle(R.string.app_name); } */ private ActionBar getActionBar() { return ((ActionBarActivity) getActivity()).getSupportActionBar(); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mDrawerListView = (ListView) inflater.inflate( R.layout.fragment_navigation_drawer, container, false); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } }); /*mDrawerListView.setAdapter(new ArrayAdapter<String>( getActivity().getApplicationContext(), android.R.layout.simple_list_item_activated_1, android.R.id.text1, new String[]{ getString(R.string.title_section1), getString(R.string.title_section2), getString(R.string.title_section3), }));*/ actionBarActivity = ((ActionBarActivity)getActivity()); mDrawerListView.setAdapter(new NavigationDrawerAdapter(new String[]{ "Home", "Email", "Gallery", "Social", "Phone", "Media" }, actionBarActivity)); mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); return mDrawerListView; }
@SuppressLint("NewApi") public static int getActionbarHeight(Object mObject) { int res = 0; if (ActionBarActivity.class.isAssignableFrom(mObject.getClass())) { res = ((ActionBarActivity) mObject).getSupportActionBar().getHeight(); } else if (Activity.class.isAssignableFrom(mObject.getClass())) { res = ((Activity) mObject).getActionBar().getHeight(); } return res; }
public static Context getThemedContext(Context context) { if (context instanceof ActionBarActivity) { ActionBar actionBar = ((ActionBarActivity)context).getSupportActionBar(); if (actionBar != null) { return actionBar.getThemedContext(); } } return context; }
private void setActivityTitle() { ActionBar actionBar = ((ActionBarActivity)getActivity()).getSupportActionBar(); if (mState.equals(Constants.FOLLOWER)) { actionBar.setTitle(getString(R.string.followers_label)); } else { actionBar.setTitle(getString(R.string.following_label)); } }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (getActivity() instanceof MainActivity) { ((MainActivity) getActivity()).onSectionAttached( getArguments().getInt(ARG_SECTION_NUMBER), null); } // Set up the action bar to show a dropdown list. final ActionBar actionBar = ((ActionBarActivity)getActivity()).getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); // Set up the dropdown list navigation in the action bar. actionBar.setListNavigationCallbacks( // Specify a SpinnerAdapter to populate the dropdown list. new ArrayAdapter<>( actionBar.getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1, new String[]{ getString(R.string.rooms_search_title), getString(R.string.users_search_title) }), this); if (savedInstanceState != null) { if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) { actionBar.setSelectedNavigationItem( savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM)); } } }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mThisView = inflater.inflate(R.layout.fragment_recycler_swipe, container, false); Toolbar toolbar = (Toolbar) mThisView.findViewById(R.id.toolbar); ActionBarActivity activity = (ActionBarActivity) getActivity(); activity.setSupportActionBar(toolbar); activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); activity.getSupportActionBar().setHomeButtonEnabled(true); return mThisView; }
private void removerOutrosFragments() { FragmentManager fragmentManager = ((ActionBarActivity)getActivity()).getSupportFragmentManager(); for(android.support.v4.app.Fragment fragment : fragmentManager.getFragments()) { if(fragment != null && fragment.getId() != R.id.navigation_drawer) { fragmentManager.beginTransaction().remove(fragment).commit(); } } }
public void setView() { ((ActionBarActivity)this.getActivity()).getSupportActionBar().setTitle(scouting.getTeam().toString()); multimedia = new MultimediaAdapter(this.getActivity(),scouting); Timber.d("thumbs: "+multimedia.getItemCount()); gallery.setAdapter(multimedia); Timber.d("imageviews: "+gallery.getChildCount()); notes.setText(scouting.getNotes()); }
public ViewAnimator(ActionBarActivity activity, List<T> items, ScreenShotable screenShotable, final DrawerLayout drawerLayout, ViewAnimatorListener animatorListener) { this.actionBarActivity = activity; this.list = items; this.screenShotable = screenShotable; this.drawerLayout = drawerLayout; this.animatorListener = animatorListener; }
public Card(String title, String desc, String titleColor, int imageRes, ActionBarActivity fa) { this.title = title; this.desc = desc; this.imageRes = imageRes; this.titleColor = titleColor; this.fa = fa; }
public Card(String title, String desc, String unit, int seekBarMax, int seekBarProgress, ActionBarActivity fa, ActionMode.Callback callback) { this.title = title; this.desc = desc; this.unit = unit; this.seekBarMax = seekBarMax; this.seekBarProgress = seekBarProgress; this.fa = fa; this.callback = callback; }
public Card(String title, String desc, String color, String unit, String prop, int seekBarMax, int seekBarProgress, ActionBarActivity fa, SeekBar.OnSeekBarChangeListener seekBarChangeListener) { this.title = title; this.desc = desc; this.color = color; this.unit = unit; this.prop = prop; this.seekBarMax = seekBarMax; this.seekBarProgress = seekBarProgress; this.fa = fa; this.listener = seekBarChangeListener; }
public Card(String title, String desc, String unit, String prop, int seekBarMax, int seekBarProgress, ActionBarActivity fa) { this.title = title; this.desc = desc; this.unit = unit; this.seekBarMax = seekBarMax; this.seekBarProgress = seekBarProgress; this.fa = fa; this.prop = prop; }
public Card(String title, String desc, String color, String unit, String prop, int seekBarMax, int seekBarProgress, int seekBarProgress2, ActionBarActivity fa, ActionMode.Callback callback) { this.title = title; this.desc = desc; this.color = color; this.unit = unit; this.seekBarMax = seekBarMax; this.seekBarProgress = seekBarProgress; this.seekBarProgress2 = seekBarProgress2; this.fa = fa; this.prop = prop; this.callback = callback; }