@Override public void onTagCreated(String tag) { if (!TextUtils.isEmpty(tag)) { R1Push.getInstance(this).addTag(tag); fillLayout(); } }
private void fillLayout() { final LinearLayout layout = (LinearLayout) findViewById(R.id.tags); if (layout != null) { layout.removeAllViews(); String[] tags = R1Push.getInstance(this).getTags(this); if (tags != null) { for (String strKey : tags) { final View v = View.inflate(this, R.layout.r1_push_tag_item, null); TextView name = (TextView) v.findViewById(R.id.tag_name); if (name != null) { name.setText(strKey); } View delete = v.findViewById(R.id.delete); if (delete != null) { delete.setTag(strKey); delete.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (v != null && v.getTag() instanceof String) { String deleteKey = (String) v.getTag(); R1Push.getInstance(R1PushPreferencesActivity.this).removeTag(deleteKey); fillLayout(); } } }); } layout.addView(v); } } } }