Skip to content

Commit 4bf3176

Browse files
committed
add NOPTagsAdapter
1 parent d9ae522 commit 4bf3176

File tree

12 files changed

+222
-64
lines changed

12 files changed

+222
-64
lines changed

app/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ android {
2323
dependencies {
2424
compile fileTree(dir: 'libs', include: ['*.jar'])
2525
compile project(path: ':tagcloudlib')
26-
compile 'com.android.support:appcompat-v7:23.2.0'
27-
compile 'com.android.support:design:23.2.0'
26+
compile 'com.android.support:appcompat-v7:23.2.1'
27+
compile 'com.android.support:design:23.2.1'
2828
compile 'com.android.support:support-vector-drawable:23.2.0'
2929
compile 'com.android.support:animated-vector-drawable:23.2.0'
30+
compile 'com.android.support:support-v4:23.2.1'
3031
}

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<category android:name="android.intent.category.LAUNCHER" />
1616
</intent-filter>
1717
</activity>
18+
<activity android:name=".FragmentTestActivity"></activity>
1819
</application>
1920

20-
</manifest>
21+
</manifest>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.moxun.tagcloud;
2+
3+
import android.os.Bundle;
4+
import android.support.v7.app.AppCompatActivity;
5+
6+
public class FragmentTestActivity extends AppCompatActivity {
7+
8+
@Override
9+
protected void onCreate(Bundle savedInstanceState) {
10+
super.onCreate(savedInstanceState);
11+
setContentView(R.layout.activity_fragment_test);
12+
getSupportFragmentManager()
13+
.beginTransaction()
14+
.add(R.id.container, TestFragment.newInstance())
15+
.commit();
16+
}
17+
}

app/src/main/java/com/moxun/tagcloud/MainActivity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.moxun.tagcloud;
22

3+
import android.content.Intent;
34
import android.graphics.Color;
45
import android.os.Bundle;
6+
import android.support.annotation.NonNull;
57
import android.support.v7.app.AppCompatActivity;
68
import android.view.View;
79

@@ -47,5 +49,12 @@ public void onClick(View v) {
4749
tagCloudView.setAdapter(vectorTagsAdapter);
4850
}
4951
});
52+
53+
findViewById(R.id.test_fragment).setOnClickListener(new View.OnClickListener() {
54+
@Override
55+
public void onClick(View v) {
56+
startActivity(new Intent(MainActivity.this, FragmentTestActivity.class));
57+
}
58+
});
5059
}
5160
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.moxun.tagcloud;
2+
3+
4+
import android.os.Bundle;
5+
import android.support.v4.app.Fragment;
6+
import android.view.LayoutInflater;
7+
import android.view.View;
8+
import android.view.ViewGroup;
9+
10+
import com.moxun.tagcloudlib.view.TagCloudView;
11+
12+
13+
/**
14+
* A simple {@link Fragment} subclass.
15+
* Use the {@link TestFragment#newInstance} factory method to
16+
* create an instance of this fragment.
17+
*/
18+
public class TestFragment extends Fragment {
19+
private View rootView;
20+
private TagCloudView fragmentTagcloud;
21+
22+
public TestFragment() {
23+
// Required empty public constructor
24+
}
25+
26+
public static TestFragment newInstance() {
27+
TestFragment fragment = new TestFragment();
28+
return fragment;
29+
}
30+
31+
@Override
32+
public void onCreate(Bundle savedInstanceState) {
33+
super.onCreate(savedInstanceState);
34+
}
35+
36+
@Override
37+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
38+
Bundle savedInstanceState) {
39+
rootView = inflater.inflate(R.layout.fragment_test, container, false);
40+
instantiationViews();
41+
TextTagsAdapter adapter = new TextTagsAdapter(new String[20]);
42+
fragmentTagcloud.setAdapter(adapter);
43+
return rootView;
44+
}
45+
46+
private void instantiationViews() {
47+
fragmentTagcloud = (TagCloudView) rootView.findViewById(R.id.fragment_tagcloud);
48+
}
49+
}
Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<vector xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:width="30dp"
4-
android:height="29dp"
5-
android:viewportHeight="29"
6-
android:viewportWidth="30">
7-
<group
8-
android:name="图形"
9-
android:translateX="0.0"
10-
android:translateY="0.0">
11-
<path
12-
android:name="Shape"
2+
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:viewportWidth="30"
3+
android:viewportHeight="29" android:width="30dp" android:height="29dp">
4+
<group android:name="图形" android:translateX="0.0" android:translateY="0.0">
5+
<path android:name="Shape"
136
android:pathData="M24.2544512,28.6066525 L15,23.4072998 L5.74551584,28.6066525 L7.81223126,18.1663875 L0.0286011935,10.9415817 L10.5568375,9.6888899 L15,0.0210890645 L19.4431625,9.6888899 L29.9713988,10.9415817 L22.1877357,18.1663876 L24.2544512,28.6066525 L24.2544512,28.6066525 Z M15,21.9919353 L22.5239744,26.2187841 L20.8428803,17.7301291 L27.1768156,11.8520272 L18.6104553,10.8325171 L15,2.97593523 L11.3895447,10.8325171 L2.82318442,11.8520272 L9.15711968,17.730129 L7.47602565,26.218784 L15,21.9919353 L15,21.9919353 Z"
14-
android:fillColor="#ffffff"/>
7+
android:fillColor="#F4454D" />
158
</group>
169
</vector>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:paddingBottom="@dimen/activity_vertical_margin"
7+
android:paddingLeft="@dimen/activity_horizontal_margin"
8+
android:paddingRight="@dimen/activity_horizontal_margin"
9+
android:paddingTop="@dimen/activity_vertical_margin"
10+
tools:context="com.moxun.tagcloud.FragmentTestActivity">
11+
12+
<FrameLayout
13+
android:id="@+id/container"
14+
android:layout_width="match_parent"
15+
android:layout_height="match_parent"
16+
android:gravity="center" />
17+
18+
</RelativeLayout>
Lines changed: 63 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,69 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
android:layout_width="match_parent"
5-
android:layout_height="match_parent"
6-
xmlns:app="http://schemas.android.com/apk/res-auto"
7-
android:id="@+id/container"
8-
android:gravity="center"
9-
android:orientation="vertical"
10-
tools:context="com.moxun.tagcloud.MainActivity">
11-
12-
<LinearLayout
13-
android:layout_width="match_parent"
14-
android:layout_height="20dp"
15-
android:orientation="horizontal">
16-
<View
17-
android:layout_width="0dp"
18-
android:layout_weight="1"
19-
android:background="@color/tagLight"
20-
android:layout_height="match_parent"/>
21-
<View
22-
android:layout_width="0dp"
23-
android:layout_weight="1"
24-
android:background="@color/tagDark"
25-
android:layout_height="match_parent"/>
26-
</LinearLayout>
27-
<com.moxun.tagcloudlib.view.TagCloudView
28-
android:id="@+id/tag_cloud"
29-
android:layout_margin="10dp"
30-
android:layout_width="wrap_content"
31-
android:layout_height="wrap_content"
32-
app:autoScrollMode="uniform"
33-
app:lightColor="@color/tagLight"
34-
app:darkColor="@color/tagDark"
35-
app:radiusPercent="0.6"
36-
app:scrollSpeed="3"/>
37-
38-
<Button
39-
android:id="@+id/tag_text"
40-
android:layout_width="match_parent"
41-
android:layout_height="wrap_content"
42-
android:text="Simple Text Tag"/>
43-
<Button
44-
android:id="@+id/tag_view"
45-
android:layout_width="match_parent"
46-
android:layout_height="wrap_content"
47-
android:text="Custom View Tag"/>
48-
<Button
49-
android:id="@+id/tag_vector"
5+
android:layout_height="wrap_content">
6+
7+
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
8+
android:id="@+id/container"
509
android:layout_width="match_parent"
5110
android:layout_height="wrap_content"
52-
android:text="VectorDrawable Tag"/>
11+
android:gravity="center"
12+
android:orientation="vertical"
13+
tools:context="com.moxun.tagcloud.MainActivity">
14+
15+
<LinearLayout
16+
android:layout_width="match_parent"
17+
android:layout_height="20dp"
18+
android:orientation="horizontal">
5319

54-
</LinearLayout>
20+
<View
21+
android:layout_width="0dp"
22+
android:layout_height="match_parent"
23+
android:layout_weight="1"
24+
android:background="@color/tagLight" />
25+
26+
<View
27+
android:layout_width="0dp"
28+
android:layout_height="match_parent"
29+
android:layout_weight="1"
30+
android:background="@color/tagDark" />
31+
</LinearLayout>
32+
33+
<com.moxun.tagcloudlib.view.TagCloudView
34+
android:id="@+id/tag_cloud"
35+
android:layout_width="wrap_content"
36+
android:layout_height="wrap_content"
37+
android:layout_margin="10dp"
38+
app:autoScrollMode="uniform"
39+
app:darkColor="@color/tagDark"
40+
app:lightColor="@color/tagLight"
41+
app:radiusPercent="0.6"
42+
app:scrollSpeed="3" />
43+
44+
<Button
45+
android:id="@+id/tag_text"
46+
android:layout_width="match_parent"
47+
android:layout_height="wrap_content"
48+
android:text="Simple Text Tag" />
49+
50+
<Button
51+
android:id="@+id/tag_view"
52+
android:layout_width="match_parent"
53+
android:layout_height="wrap_content"
54+
android:text="Custom View Tag" />
55+
56+
<Button
57+
android:id="@+id/tag_vector"
58+
android:layout_width="match_parent"
59+
android:layout_height="wrap_content"
60+
android:text="VectorDrawable Tag" />
61+
62+
<Button
63+
android:id="@+id/test_fragment"
64+
android:layout_width="match_parent"
65+
android:layout_height="wrap_content"
66+
android:text="Using in Fragment" />
67+
68+
</LinearLayout>
69+
</ScrollView>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
tools:context="com.moxun.tagcloud.TestFragment">
6+
7+
<com.moxun.tagcloudlib.view.TagCloudView xmlns:app="http://schemas.android.com/apk/res-auto"
8+
android:id="@+id/fragment_tagcloud"
9+
android:layout_width="wrap_content"
10+
android:layout_height="wrap_content"
11+
app:autoScrollMode="uniform"
12+
app:darkColor="#FF0000"
13+
app:lightColor="#00FF00"
14+
app:radiusPercent="0.6"/>
15+
16+
</FrameLayout>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
<resources>
22
<string name="app_name">TagCloudView</string>
3+
4+
<!-- TODO: Remove or change this placeholder text -->
5+
<string name="hello_blank_fragment">Hello blank fragment</string>
36
</resources>

0 commit comments

Comments
 (0)