Source Code|Cloud Tags

Source Code|Cloud Tags

Source code introduction: cloud tag deletion, addition, beautiful style

Download address: http://download..com/data/2194855

Source code effect:

Source code snippet:

  1. package com.niceapp.lib.tagview;
  2.   
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.   
  6. import android.app.Activity;
  7. import android.os.Bundle;
  8. import android.widget.TextView;
  9. import android.widget.Toast;
  10.   
  11. import com.niceapp.lib.tagview.widget.Tag;
  12. import com.niceapp.lib.tagview.widget.TagListView;
  13. import com.niceapp.lib.tagview.widget.TagListView.OnDelClickListener;
  14. import com.niceapp.lib.tagview.widget.TagListView.OnTagClickListener;
  15. import com.niceapp.lib.tagview.widget.TagView;
  16.   
  17. public   class MainActivity extends Activity {
  18.   
  19. private TagListView mTagListView;
  20. private   final List<tag> mTags = new ArrayList<tag>();
  21. private   final String[] titles = { "Safety Essentials" , "Music" , "Parenting" , "Essentials for Office Workers" , "360 Mobile Guard" ,
  22. "QQ" , "input method" , "WeChat" , "most beautiful application" , "AndevUI" , "Mogujie" , "add" };
  23.   
  24. @Override  
  25. protected   void onCreate(Bundle savedInstanceState) {
  26. super .onCreate(savedInstanceState);
  27. setContentView(R.layout.select_tag_activity);
  28.   
  29. mTagListView = (TagListView) findViewById(R.id.tagview);
  30. // mTagListView.setTagViewTextColorRes(Color.parseColor("#ff999999"));  
  31. // mTagListView.setDeleteMode(true);  
  32. setUpData();
  33. mTagListView.setTags(mTags);
  34. mTagListView.setOnTagClickListener( new OnTagClickListener() {
  35.   
  36. @Override  
  37. public   void onTagClick(TagView tagView, Tag tag) {
  38. // TODO Auto-generated method stub  
  39. Toast.makeText(getApplicationContext(), tag.getTitle(),
  40. Toast.LENGTH_LONG).show();
  41.   
  42. for (Tag mTag : mTags) {
  43. if (mTag.equals(tag)) {
  44. mTag.setChecked( true );
  45. } else {
  46. mTag.setChecked( false );
  47. }
  48. }
  49. mTagListView.setTags(mTags);
  50. }
  51. });
  52. mTagListView.setOnDelClickListener( new OnDelClickListener() {
  53.   
  54. @Override  
  55. public   void onDelClick(TextView textView, Tag tag) {
  56. // TODO Auto-generated method stub  
  57. Toast.makeText(MainActivity. this , "Delete" + tag.getTitle(),
  58. Toast.LENGTH_LONG).show();
  59. }
  60. });
  61. }
  62.   
  63. private   void setUpData() {
  64. for ( int i = 0 ; i < titles.length; i++) {
  65. Tag tag = new Tag();
  66. tag.setId(i);
  67. if (i % 2 == 0 ) {
  68. tag.setChecked( true );
  69. } else {
  70. tag.setChecked( false );
  71. }
  72. if (titles[i].equals( "Add" )) {
  73. tag.setShowDel( false );
  74. }
  75. tag.setTitle(titles[i]);
  76. mTags.add(tag);
  77. }
  78. }
  79. }
  80. </tag></tag>

<<:  Source code | Uber's welcome screen

>>:  Many apps ignore Apple's Human Interface Guidelines details

Recommend

From dinosaurs to birds, why did evolution slow down?

There are some important node events in the histo...

Operational promotion: How to use red envelopes to attract new customers?

The end of the year is coming soon. I would like ...

Analysis of China Merchants Bank’s private domain operation case

When it comes to the banking industry, many peopl...

I always feel tired and sleepy. Is this a disease?

Spring is always described with many beautiful wo...