Java Code Examples for android.app.ActionBar#setIcon()

The following examples show how to use android.app.ActionBar#setIcon() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserInfoEditActivity.java    From WeCenterMobile-Android with GNU General Public License v2.0 6 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.user_information_edit);
	// ��ӷ��ذ�ť��ActionBar
	ActionBar actionBar = getActionBar();
	actionBar.setIcon(null);
	actionBar.setDisplayHomeAsUpEnabled(true);
	actionBar.setDisplayUseLogoEnabled(false);
	actionBar.show();
	// ��������Activity�����IJ���
	Intent intent = this.getIntent();
	Bundle bundle = intent.getExtras();
	uid = bundle.getString("uid");
	avatar_file = bundle.getString("avatar_file");
	// ͼ�ν����ʼ��
	init();
}
 
Example 2
Source File: TweetActivity.java    From catnut with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	if (CatnutApp.getTingtingApp().getPreferences()
			.getBoolean(getString(R.string.pref_enable_analytics), true)) {
		mTracker = EasyTracker.getInstance(this);
	}
	ActionBar bar = getActionBar();
	bar.setIcon(R.drawable.ic_title_view_tweet);
	bar.setDisplayHomeAsUpEnabled(true);

	long id = getIntent().getLongExtra(Constants.ID, 0L);
	String json = getIntent().getStringExtra(Constants.JSON);
	if (savedInstanceState == null) {
		TweetFragment fragment = id != 0L
				? TweetFragment.getFragment(id)
				: TweetFragment.getFragment(json);
		// 添加back回调
		mKeyDownListener = fragment;
		getFragmentManager().beginTransaction()
				.replace(android.R.id.content, fragment)
				.commit();
	}
}
 
Example 3
Source File: TopicDetailFragmentActivity.java    From WeCenterMobile-Android with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example 4
Source File: HomeNavDrawerController.java    From commcare-android with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
protected void setupNavDrawer(Bundle savedInstanceState) {
    initDrawerItemsMap();
    determineDrawerItemsToInclude();
    navDrawerList.setOnItemClickListener(getNavDrawerClickListener());
    refreshItems();

    ActionBar actionBar = activity.getActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayUseLogoEnabled(false);
    actionBar.setIcon(R.drawable.ic_menu_bar);

    if (savedInstanceState != null &&
            savedInstanceState.getBoolean(KEY_DRAWER_WAS_OPEN)) {
        reopenDrawerWhenResumed = true;
    }
}
 
Example 5
Source File: ConversationFragment.java    From catnut with MIT License 5 votes vote down vote up
@Override
public void onStart() {
	super.onStart();
	ActionBar bar = getActivity().getActionBar();
	bar.setIcon(R.drawable.ic_action_conversation);
	bar.setTitle(getString(R.string.received_reply));
}
 
Example 6
Source File: ActivityProxy.java    From GPT with Apache License 2.0 5 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();

    // 统计使用时长
    if (!TextUtils.isEmpty(mTargetPackageName) && !TextUtils.isEmpty(mTargetClassName)) {
        timeStart = SystemClock.elapsedRealtime();
    }

    // 首次启动设置titile为子activity的title
    Activity currentActivity = getCurrentActivity();
    if (currentActivity != null) {
        setTitle(currentActivity.getTitle());
    }
    int SDK_INT = android.os.Build.VERSION.SDK_INT;
    // 设置actionbar的icon为插件的icon
    if (SDK_INT >= 11) {
        ActionBar actionBar = getActionBar();
        if (actionBar != null && currentActivity != null) {
            ActivityInfo targetInfo = ProxyEnvironment.getInstance(mTargetPackageName)
                    .getTargetMapping().getActivityInfo(mTargetClassName);
            int icon = targetInfo.icon != 0 ? targetInfo.icon : targetInfo.applicationInfo.icon;
            actionBar.setIcon(icon);
        }
    }

    if (sActivityLifecycleCallbacks != null) {
        sActivityLifecycleCallbacks.onActivityResumed(this);
    }
}
 
Example 7
Source File: HomeFragment.java    From CameraV with GNU General Public License v3.0 5 votes vote down vote up
private void initHomeActionBar ()
{
	if (getActivity() != null)
	{
		ActionBar actionBar = getActivity().getActionBar();
		actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME|ActionBar.DISPLAY_SHOW_TITLE);
		actionBar.setTitle(R.string.app_name);			
		actionBar.setDisplayHomeAsUpEnabled(false);
		actionBar.setIcon(R.mipmap.ic_launcher);
		
	}
}
 
Example 8
Source File: TransientUsersFragment.java    From catnut with MIT License 5 votes vote down vote up
@Override
public void onStart() {
	super.onStart();
	ActionBar bar = getActivity().getActionBar();
	bar.setIcon(R.drawable.ic_title_people);
	bar.setTitle(getString(
			mFollowing ? R.string.his_followings : R.string.his_followers, mScreenName)
	);
}
 
Example 9
Source File: MaterialMenuIcon.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override @TargetApi(14)
protected void setActionBarSettings(Activity activity) {
    ActionBar actionBar = activity.getActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setIcon(getDrawable());
}
 
Example 10
Source File: MaterialMenuIcon.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override @TargetApi(14)
protected void setActionBarSettings(Activity activity) {
    ActionBar actionBar = activity.getActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setIcon(getDrawable());
}
 
Example 11
Source File: ConfigurationActivity.java    From Noyze with Apache License 2.0 5 votes vote down vote up
public static void setupActionBar(Activity activity) {

        // Tint the status bar, if available.
        SystemBarTintManager tintManager = new SystemBarTintManager(activity);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setTintColor(activity.getResources().getColor(R.color.action_bar_dark));

        ActionBar actionBar = activity.getActionBar();
        if (null != actionBar) {
            actionBar.setIcon(DateUtils.AppIcon());
            actionBar.setDisplayHomeAsUpEnabled(!activity.isTaskRoot());
            actionBar.setDisplayShowTitleEnabled(true);
        }
    }
 
Example 12
Source File: TopicFragmentActivity.java    From WeCenterMobile-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	// TODO Auto-generated method stub
	super.onCreate(savedInstanceState);
	ActionBar actionBar = getActionBar();
	actionBar.setIcon(null);
	actionBar.setDisplayHomeAsUpEnabled(true);
	actionBar.setDisplayUseLogoEnabled(false);
	actionBar.show();
	setContentView(R.layout.topic_activity);
}
 
Example 13
Source File: UserInfoShowActivity.java    From WeCenterMobile-Android with GNU General Public License v2.0 5 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.user_information_show);
	LinearLayout hidePart = (LinearLayout) findViewById(R.id.llHidePart);
	hidePart.setVisibility(View.GONE);
	// ��ӷ��ذ�ť��ActionBar
	ActionBar actionBar = getActionBar();
	actionBar.setIcon(null);
	actionBar.setDisplayHomeAsUpEnabled(true);
	actionBar.setDisplayUseLogoEnabled(false);
	// actionBar.setDisplayShowHomeEnabled(true);
	actionBar.show();
	// Bundle bundle = intent.getExtras();
	// ��ȡ����activity�Ĵ�������ֵ��
	Intent intent = this.getIntent();
	uid = intent.getStringExtra("uid");
	status = intent
			.getIntExtra("status", GlobalVariables.DISAVAILABLE_EDIT);
	// �ж�UID�Dz��DZ������ѵ�¼�û�������ǿ��Ա༭�����ع�ע��ť���������ر༭��ť��ʾ��ע��ť��
	ffGetUid = new FanfanSharedPreferences(this);
	if (uid.equals(ffGetUid.getUid(""))) {
		status = GlobalVariables.AVAILABLE_EDIT;
	}
	init();// ��ʼ������
	// ��ȡ����״̬����������״̬����
	if (uid != null) {
		NetworkState networkState = new NetworkState();
		if (networkState.isNetworkConnected(UserInfoShowActivity.this)) {
			getUserInfo();
		} else {
			Toast.makeText(UserInfoShowActivity.this, "�����磬�����ú����ԣ�",
					Toast.LENGTH_LONG).show();
		}

	}
}
 
Example 14
Source File: AttentionUserActivity.java    From WeCenterMobile-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	// TODO Auto-generated method stub
	super.onCreate(savedInstanceState);
	setContentView(R.layout.attention_listview);
	ActionBar actionBar = getActionBar();
	actionBar.setIcon(null);
	actionBar.setDisplayHomeAsUpEnabled(true);
	actionBar.setDisplayUseLogoEnabled(false);
	actionBar.show();
	Intent intent = getIntent();
	String UserOrMe = intent.getStringExtra("userorme");
	uid = intent.getStringExtra("uid");
	if (UserOrMe.equals(GlobalVariables.ATTENEION_ME)) {
		url = Config.getValue("AttentionMe");
	} else {
		url = Config.getValue("AttentionUser");
	}
	attentionUserModels = new ArrayList<AttentionUserModel>();
	imageDownLoader = new ImageDownLoader(AttentionUserActivity.this);
	footerLinearLayout = (LinearLayout) LayoutInflater.from(
			AttentionUserActivity.this).inflate(R.layout.next_page_footer,
			null);
	footText = (TextView) footerLinearLayout.findViewById(R.id.footer_text);
	isFirstEnter = true;
	FanfanSharedPreferences fanfanSharedPreferences = new FanfanSharedPreferences(
			AttentionUserActivity.this);
	init();
	getInformation("1");
}
 
Example 15
Source File: PluginsPrefFragment.java    From catnut with MIT License 5 votes vote down vote up
@Override
public void onStart() {
	super.onStart();
	ActionBar bar = getActivity().getActionBar();
	bar.setIcon(R.drawable.ic_title_pref);
	bar.setTitle(getString(R.string.plugins_pref));
}
 
Example 16
Source File: HomeActivity.java    From CameraV with GNU General Public License v3.0 5 votes vote down vote up
private void resetActionBar()
{
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayShowTitleEnabled(true);
	actionBar.setTitle(R.string.app_name);
	actionBar.setDisplayShowHomeEnabled(true);
	actionBar.setDisplayHomeAsUpEnabled(false);
	actionBar.setHomeButtonEnabled(true);
	actionBar.setIcon(R.mipmap.ic_launcher);
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
 
Example 17
Source File: MentionTimelineFragment.java    From catnut with MIT License 5 votes vote down vote up
@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));
}
 
Example 18
Source File: PXVirtualActionBarIconAdapter.java    From pixate-freestyle-android with Apache License 2.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void setIconICS(PXStylerContext context, ActionBar actionBar) {
    actionBar.setIcon(context.getBackgroundImage());
}
 
Example 19
Source File: UserFragment.java    From v2ex-daily-android with Apache License 2.0 4 votes vote down vote up
private void setupActionBar() {
    ActionBar actionBar = getActivity().getActionBar();
    actionBar.setIcon(R.drawable.ic_transparent);

    //getActionBarTitleView().setAlpha(0f);
}
 
Example 20
Source File: EssayCommentActivity.java    From WeCenterMobile-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	// TODO Auto-generated method stub
	super.onCreate(savedInstanceState);
	setContentView(R.layout.comment_list);

	ActionBar actionBar = getActionBar();
	actionBar.setIcon(null);
	actionBar.setTitle("��������");
	actionBar.setDisplayUseLogoEnabled(false);
	actionBar.setDisplayHomeAsUpEnabled(true);
	actionBar.show();
	Intent intent = getIntent();
	id = intent.getStringExtra("artid");
	client = new AsyncHttpClient();
	myCookieStore = new PersistentCookieStore(this);
	client.setCookieStore(myCookieStore);
	comment = (EditText) findViewById(R.id.comment);
	publish = (ImageButton) findViewById(R.id.publish);
	publish.setOnClickListener(new OnClickListener() {

		@Override
		public void onClick(View arg0) {
			// TODO Auto-generated method stub
			RequestParams params = new RequestParams();
			params.put("article_id", id);
			params.put("message", comment.getText().toString());
			params.put("at_uid", atuid);
			postcom(params);
			comment.setText("");
			refresh();
		}
	});
	comitems = new ArrayList<EssayCommentModel>();
	imageDownLoader = new ImageDownLoader(this);
	comlist = (ListView) findViewById(R.id.comlist);
	isFirstEnter = true;
	comlist.setOnItemClickListener(this);
	comlist.setOnScrollListener(this);

	Getcom(id);

}