本文整理汇总了Java中android.support.v7.app.ActionBarActivity类的典型用法代码示例。如果您正苦于以下问题:Java ActionBarActivity类的具体用法?Java ActionBarActivity怎么用?Java ActionBarActivity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionBarActivity类属于android.support.v7.app包,在下文中一共展示了ActionBarActivity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
@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);
}
示例2: onSuccess
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
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);
}
示例3: changeToBack
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
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;
}
示例4: setActionBarDashboard
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
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);
}
}
示例5: onCreateView
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
@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;
}
示例6: onResume
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
@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);
}
});
}
示例7: sendMessagesOnCallback
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
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);
}
示例8: onSystemUiShown
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
protected void onSystemUiShown() {
ActionBar ab = ((ActionBarActivity) mActivity).getSupportActionBar();
if (ab != null) {
ab.show();
}
mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
setIsShowing(true);
}
示例9: onSystemUiHidden
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
protected void onSystemUiHidden() {
ActionBar ab = ((ActionBarActivity) mActivity).getSupportActionBar();
if (ab != null) {
ab.hide();
}
mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
setIsShowing(false);
}
示例10: setupListView
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
/**
* 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);
}
}
示例11: attach
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
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;
}
示例12: onCross
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
@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();
}
}
}
示例13: onActivityCreated
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
@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);
}
示例14: initializeBatchListener
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
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;
}
});
}
示例15: showShare
import android.support.v7.app.ActionBarActivity; //导入依赖的package包/类
/**
* 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);
}