当前位置: 首页>>代码示例>>Java>>正文


Java BadgeView类代码示例

本文整理汇总了Java中com.readystatesoftware.viewbadger.BadgeView的典型用法代码示例。如果您正苦于以下问题:Java BadgeView类的具体用法?Java BadgeView怎么用?Java BadgeView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BadgeView类属于com.readystatesoftware.viewbadger包,在下文中一共展示了BadgeView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initHead

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
private void initHead() {
    View v = mInflater.inflate(layout.fragment_message_user_list_head, null, false);

    v.findViewById(id.atLayout).setOnClickListener(v1 -> startNotifyListActivity(0));
    v.findViewById(id.commentLayout).setOnClickListener(v1 -> startNotifyListActivity(1));
    v.findViewById(id.systemLayout).setOnClickListener(v1 -> startNotifyListActivity(4));

    badgeAt = (BadgeView) v.findViewById(id.badgeAt);
    badgeAt.setVisibility(View.INVISIBLE);
    badgeComment = (BadgeView) v.findViewById(id.badgeComment);
    badgeComment.setVisibility(View.INVISIBLE);
    badgeSystem = (BadgeView) v.findViewById(id.badgeSystem);
    badgeSystem.setVisibility(View.INVISIBLE);

    listView.addHeaderView(v);
}
 
开发者ID:huang303513,项目名称:Coding-Android,代码行数:17,代码来源:UsersListFragment.java

示例2: init

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
@AfterViews
void init() {
    UserObject user = AccountInfo.loadAccount(getActivity());
    setControlContent(user);

    for (int i = 0; i < radioIds.length; ++i) {
        radios[i] = (RadioButton) getView().findViewById(radioIds[i]);
        radios[i].setOnClickListener(clickItem);
    }

    radios[0].setChecked(true);

    badgeProject = (BadgeView) getView().findViewById(R.id.badge0);
    badgeProject.setVisibility(View.INVISIBLE);
    badgeMessage = (BadgeView) getView().findViewById(R.id.badge3);
    badgeMessage.setVisibility(View.INVISIBLE);

    if (mFirstDisplay) {
        updateUserinfo();
    }
}
 
开发者ID:huang303513,项目名称:Coding-Android,代码行数:22,代码来源:NavigationDrawerFragment.java

示例3: getView

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
	View v = super.getView(position, convertView, parent);

	TextView itemName = (TextView) v.findViewById(R.id.text_menu_item);

	if (itemName.getText().equals("个人信息")) {

		if (convertView != null) {
			return v;
		}

		JSONObject notificationJSON = FileUtil.readConfigFile(noticePath);
		try {
			BadgeView bvUser = new BadgeView(mContext, itemName);
			bvUser.setVisibility(View.GONE);

			if (notificationJSON.getInt(URLs.kSetting) > 0) {
				RedPointView.showRedPoint(mContext, "user", bvUser);
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}

	return v;
}
 
开发者ID:jay16,项目名称:shengyiplus-android,代码行数:27,代码来源:MenuAdapter.java

示例4: setBadgeCount

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
private void setBadgeCount(TopFragmentType type) {
	int count = 0;
	BadgeView view = null;
	if (type == TopFragmentType.MyMessage) {
		count = Cache.self().getUnReadedCount();
		view = mMessageCount;
	} else {
		count = Cache.self().getTimelineCount();
		view = mTimelineCount;
	}

	if (count == 0) {
		view.setVisibility(View.GONE);
	} else {
		view.setVisibility(View.VISIBLE);
		view.setText(String.valueOf(count));
		view.setTextSize(10);
		view.setBadgePosition(BadgeView.POSITION_TOP_LEFT);
		view.show();
	}
}
 
开发者ID:tassadar2002,项目名称:ouser,代码行数:22,代码来源:MenuFragment.java

示例5: getView

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    final ViewHolder holder;
    if (convertView == null) {
        view = mInflater.inflate(R.layout.project_all_list_item, parent, false);
        holder = new ViewHolder();
        holder.name2 = (TextView) view.findViewById(R.id.name2);
        holder.image = (ImageView) view.findViewById(R.id.icon);
        holder.content = (TextView) view.findViewById(R.id.comment);
        holder.badge = (BadgeView) view.findViewById(R.id.badge);
        holder.privateIcon = view.findViewById(R.id.privateIcon);
        holder.tv_follow_count = (TextView) view.findViewById(R.id.tv_follow_count);
        holder.tv_fork_count = (TextView) view.findViewById(R.id.tv_fork_count);
        holder.tv_star_count = (TextView) view.findViewById(R.id.tv_start_count);
        holder.ll_bottom_menu = (LinearLayout) view.findViewById(R.id.ll_bottom_menu);
        holder.desc = (TextView) view.findViewById(R.id.txtDesc);
        view.setTag(holder);
    } else {
        holder = (ViewHolder) view.getTag();
    }

    ProjectObject item = (ProjectObject) getItem(position);
    holder.privateIcon.setVisibility(View.INVISIBLE);
    holder.name2.setVisibility(View.VISIBLE);
    holder.name2.setText(item.name);
    holder.privateIcon.setVisibility(item.isPublic() ? View.INVISIBLE : View.VISIBLE);
    holder.content.setVisibility(View.INVISIBLE);
    holder.desc.setText(item.getDescription());
    holder.tv_follow_count.setText(item.getWatch_count() + "");
    holder.tv_star_count.setText(item.getStar_count() + "");
    holder.tv_fork_count.setText(item.getFork_count() + "");
    holder.badge.setVisibility(View.INVISIBLE);
    holder.ll_bottom_menu.setVisibility(View.VISIBLE);
    ImageLoader.getInstance().displayImage(item.icon, holder.image, ImageLoadTool.optionsRounded2);
    return view;
}
 
开发者ID:huang303513,项目名称:Coding-Android,代码行数:38,代码来源:ProjectSquareActivity.java

示例6: getView

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
        convertView = mInflater.inflate(layout.fragment_message_user_list_item, parent, false);
        holder = new ViewHolder();
        holder.icon =
                (ImageView) convertView.findViewById(id.icon);
        holder.icon.setFocusable(false);
        holder.title = (TextView) convertView.findViewById(id.title);
        holder.content = (TextView) convertView.findViewById(id.comment);
        holder.time = (TextView) convertView.findViewById(id.time);
        holder.badge = (BadgeView) convertView.findViewById(id.badge);
        holder.badge.setFocusable(false);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    Message.MessageObject user = (Message.MessageObject) getItem(position);
    iconfromNetwork(holder.icon, user.friend.avatar);
    holder.title.setText(user.friend.name);
    boolean isUnPlayedVoiceMessage = !user.sender.isMe() && user.played == 0 && user.file != null && user.file.endsWith(".amr");
    holder.content.setText(isUnPlayedVoiceMessage ? Html.fromHtml("<font color='#3bbd79'>" + user.content + "</font>") : Global.recentMessage(user.content, myImageGetter, Global.tagHandler));
    holder.time.setText(Global.dayToNow(user.created_at, false));

    if (user.unreadCount > 0) {
        UnreadNotify.displayNotify(holder.badge, Unread.countToString(user.unreadCount));
        holder.badge.setVisibility(View.VISIBLE);
    } else {
        holder.badge.setVisibility(View.INVISIBLE);
    }

    if (position == (mData.size() - 1)) {
        loadMore();
    }

    return convertView;
}
 
开发者ID:huang303513,项目名称:Coding-Android,代码行数:40,代码来源:UsersListFragment.java

示例7: displayNotify

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
public static void displayNotify(BadgeView badgeView, String messageCount) {
    if (messageCount.isEmpty()) {
        badgeView.setVisibility(View.INVISIBLE);
    } else {
        badgeView.setText(messageCount);
        badgeView.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:huang303513,项目名称:Coding-Android,代码行数:9,代码来源:UnreadNotify.java

示例8: setBadgeView

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
public static void setBadgeView(BadgeView badge, int count) {
    if (count > 0) {
        String countString = count > 99 ? "99+" : ("" + count);
        badge.setText(countString);
        badge.setVisibility(View.VISIBLE);
    } else {
        badge.setVisibility(View.INVISIBLE);
    }
}
 
开发者ID:huang303513,项目名称:Coding-Android,代码行数:10,代码来源:Global.java

示例9: showRedPoint

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
public static void showRedPoint(Context context,String type, BadgeView badgeView) {
	//获取当前设备屏幕密度
	DisplayMetrics dm = context.getResources().getDisplayMetrics();
	int displayDpi = dm.densityDpi;

	//根据不同屏幕显示密度设置小红点大小
	if (displayDpi < 320) {
		badgeView.setWidth(9);
		badgeView.setHeight(9);
	}
	else if (displayDpi >= 320 && displayDpi < 480) {
		badgeView.setWidth(19);
		badgeView.setHeight(19);
	}
	else if (displayDpi >= 480) {
		badgeView.setWidth(25);
		badgeView.setHeight(25);
	}

	//badgeView.setText(badgerCount);  //暂不需要计数
	switch (type) {
		case URLs.kSetting:
			badgeView.setBadgeMargin(20, 15);
			break;
		case "tab":
			badgeView.setBadgeMargin(45, 0);
			break;
		case URLs.kSettingPgyer:
		case URLs.kSettingPassword:
		case URLs.kSettingThursdaySay:
			badgeView.setBadgePosition(BadgeView.POSITION_TOP_LEFT);
			break;
		default:
			badgeView.setBadgePosition(BadgeView.POSITION_TOP_RIGHT);
			break;
	}
	badgeView.show();
}
 
开发者ID:jay16,项目名称:shengyiplus-android,代码行数:39,代码来源:RedPointView.java

示例10: create

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
public static BadgeView create(Context context, View view, String textValue) {
    BadgeView badgeView = new BadgeView(context, view);
    badgeView.setTextColor(Color.WHITE);
    badgeView.setText(textValue);
    badgeView.setBackground(context.getResources().getDrawable(R.drawable.dot_bg));
    badgeView.setTextSize(12);
    badgeView.setBadgePosition(BadgeView.POSITION_TOP_RIGHT);
    badgeView.setBadgeMargin(0, 0);
    badgeView.show();
    return badgeView;
}
 
开发者ID:idisfkj,项目名称:HightCopyWX,代码行数:12,代码来源:BadgeViewUtils.java

示例11: onActivityCreated

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mTextViewTitleExample.setText(R.string.criteria_alt_ex2_title);
    mTextViewDescriptionExample.setText(R.string.criteria_alt_ex2_description);
    mTextViewTitleExempleAxsYes.setText(R.string.criteria_accessible_example);
    mTextViewOptionEnabled.setText(getString(R.string.criteria_template_option_tb));

    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout myView = (LinearLayout) inflater.inflate(R.layout.extxt2_frag, null);
    mFrameLayoutExampleAxsYes.addView(myView);

    mTextViewTitleExempleAxsNo.setText(R.string.criteria_not_accessible_example);

    LinearLayout myView2 = (LinearLayout) inflater.inflate(R.layout.extxt2_frag, null);
    mFrameLayoutExampleAxsNo.addView(myView2);

    ImageButton btn = (ImageButton) myView.findViewById(R.id.imageButton10);
    ImageButton btnNo = (ImageButton) myView2.findViewById(R.id.imageButton10);
    BadgeView badge = new BadgeView(getActivity(), btn);
    badge.setText("3");
    badge.show();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        badge.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
    }
    btn.setContentDescription(badge.getText() +" "+ getString(R.string.criteria_alt_ex2_cd_btn));

    BadgeView badgeNo = new BadgeView(getActivity(), btnNo);
    badgeNo.setText("3");
    badgeNo.show();
}
 
开发者ID:Orange-OpenSource,项目名称:m-dan,代码行数:33,代码来源:ExTxt2Fragment.java

示例12: getView

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
        convertView = mInflater.inflate(android.R.layout.simple_list_item_2, null);
        holder = new ViewHolder();
        holder.text = (TextView) convertView.findViewById(android.R.id.text1);
        holder.badge = new BadgeView(mContext, holder.text);
        holder.badge.setBadgeBackgroundColor(droidGreen);
        holder.badge.setTextColor(Color.BLACK);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    holder.text.setText(DATA[position]);
    
    if (position % 3 == 0) {
    	holder.badge.setText(String.valueOf(position));
    	holder.badge.show();
    } else {
    	holder.badge.hide();
    }
    
    
    return convertView;
}
 
开发者ID:BigAppOS,项目名称:BigApp_Discuz_Android,代码行数:28,代码来源:DemoActivity.java

示例13: toggle

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
private void toggle() {
    Button button = (Button) findViewById(R.id.toggle);
    final BadgeView badge = new BadgeView(this, button);
    badge.setText("8");
    button.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // badge.show();
            // badge.hide();

            badge.toggle();
        }
    });
}
 
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:15,代码来源:AndroidViewbadgerSampleActivity.java

示例14: potision

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
private void potision() {
    Button button = (Button) findViewById(R.id.position);
    BadgeView badge = new BadgeView(this, button);
    badge.setText("10");
    badge.setBadgePosition(BadgeView.POSITION_TOP_LEFT);
    badge.show();
}
 
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:8,代码来源:AndroidViewbadgerSampleActivity.java

示例15: size

import com.readystatesoftware.viewbadger.BadgeView; //导入依赖的package包/类
private void size() {
    Button button = (Button) findViewById(R.id.size);
    BadgeView badge = new BadgeView(this, button);
    badge.setText("update");
    badge.setTextSize(20);
    badge.show();
}
 
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:8,代码来源:AndroidViewbadgerSampleActivity.java


注:本文中的com.readystatesoftware.viewbadger.BadgeView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。