-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
222 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/src/main/java/com/moxun/tagcloud/FragmentTestActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.moxun.tagcloud; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
public class FragmentTestActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_fragment_test); | ||
getSupportFragmentManager() | ||
.beginTransaction() | ||
.add(R.id.container, TestFragment.newInstance()) | ||
.commit(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.moxun.tagcloud; | ||
|
||
|
||
import android.os.Bundle; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import com.moxun.tagcloudlib.view.TagCloudView; | ||
|
||
|
||
/** | ||
* A simple {@link Fragment} subclass. | ||
* Use the {@link TestFragment#newInstance} factory method to | ||
* create an instance of this fragment. | ||
*/ | ||
public class TestFragment extends Fragment { | ||
private View rootView; | ||
private TagCloudView fragmentTagcloud; | ||
|
||
public TestFragment() { | ||
// Required empty public constructor | ||
} | ||
|
||
public static TestFragment newInstance() { | ||
TestFragment fragment = new TestFragment(); | ||
return fragment; | ||
} | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
} | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) { | ||
rootView = inflater.inflate(R.layout.fragment_test, container, false); | ||
instantiationViews(); | ||
TextTagsAdapter adapter = new TextTagsAdapter(new String[20]); | ||
fragmentTagcloud.setAdapter(adapter); | ||
return rootView; | ||
} | ||
|
||
private void instantiationViews() { | ||
fragmentTagcloud = (TagCloudView) rootView.findViewById(R.id.fragment_tagcloud); | ||
} | ||
} |
17 changes: 5 additions & 12 deletions
17
app/src/main/res/drawable/vector_drawable_iconfont_xingxing.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="30dp" | ||
android:height="29dp" | ||
android:viewportHeight="29" | ||
android:viewportWidth="30"> | ||
<group | ||
android:name="图形" | ||
android:translateX="0.0" | ||
android:translateY="0.0"> | ||
<path | ||
android:name="Shape" | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:viewportWidth="30" | ||
android:viewportHeight="29" android:width="30dp" android:height="29dp"> | ||
<group android:name="图形" android:translateX="0.0" android:translateY="0.0"> | ||
<path android:name="Shape" | ||
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" | ||
android:fillColor="#ffffff"/> | ||
android:fillColor="#F4454D" /> | ||
</group> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
android:paddingLeft="@dimen/activity_horizontal_margin" | ||
android:paddingRight="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin" | ||
tools:context="com.moxun.tagcloud.FragmentTestActivity"> | ||
|
||
<FrameLayout | ||
android:id="@+id/container" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:gravity="center" /> | ||
|
||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,69 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:id="@+id/container" | ||
android:gravity="center" | ||
android:orientation="vertical" | ||
tools:context="com.moxun.tagcloud.MainActivity"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="20dp" | ||
android:orientation="horizontal"> | ||
<View | ||
android:layout_width="0dp" | ||
android:layout_weight="1" | ||
android:background="@color/tagLight" | ||
android:layout_height="match_parent"/> | ||
<View | ||
android:layout_width="0dp" | ||
android:layout_weight="1" | ||
android:background="@color/tagDark" | ||
android:layout_height="match_parent"/> | ||
</LinearLayout> | ||
<com.moxun.tagcloudlib.view.TagCloudView | ||
android:id="@+id/tag_cloud" | ||
android:layout_margin="10dp" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:autoScrollMode="uniform" | ||
app:lightColor="@color/tagLight" | ||
app:darkColor="@color/tagDark" | ||
app:radiusPercent="0.6" | ||
app:scrollSpeed="3"/> | ||
|
||
<Button | ||
android:id="@+id/tag_text" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Simple Text Tag"/> | ||
<Button | ||
android:id="@+id/tag_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Custom View Tag"/> | ||
<Button | ||
android:id="@+id/tag_vector" | ||
android:layout_height="wrap_content"> | ||
|
||
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:id="@+id/container" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="VectorDrawable Tag"/> | ||
android:gravity="center" | ||
android:orientation="vertical" | ||
tools:context="com.moxun.tagcloud.MainActivity"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="20dp" | ||
android:orientation="horizontal"> | ||
|
||
</LinearLayout> | ||
<View | ||
android:layout_width="0dp" | ||
android:layout_height="match_parent" | ||
android:layout_weight="1" | ||
android:background="@color/tagLight" /> | ||
|
||
<View | ||
android:layout_width="0dp" | ||
android:layout_height="match_parent" | ||
android:layout_weight="1" | ||
android:background="@color/tagDark" /> | ||
</LinearLayout> | ||
|
||
<com.moxun.tagcloudlib.view.TagCloudView | ||
android:id="@+id/tag_cloud" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="10dp" | ||
app:autoScrollMode="uniform" | ||
app:darkColor="@color/tagDark" | ||
app:lightColor="@color/tagLight" | ||
app:radiusPercent="0.6" | ||
app:scrollSpeed="3" /> | ||
|
||
<Button | ||
android:id="@+id/tag_text" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Simple Text Tag" /> | ||
|
||
<Button | ||
android:id="@+id/tag_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Custom View Tag" /> | ||
|
||
<Button | ||
android:id="@+id/tag_vector" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="VectorDrawable Tag" /> | ||
|
||
<Button | ||
android:id="@+id/test_fragment" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Using in Fragment" /> | ||
|
||
</LinearLayout> | ||
</ScrollView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context="com.moxun.tagcloud.TestFragment"> | ||
|
||
<com.moxun.tagcloudlib.view.TagCloudView xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:id="@+id/fragment_tagcloud" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:autoScrollMode="uniform" | ||
app:darkColor="#FF0000" | ||
app:lightColor="#00FF00" | ||
app:radiusPercent="0.6"/> | ||
|
||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
<resources> | ||
<string name="app_name">TagCloudView</string> | ||
|
||
<!-- TODO: Remove or change this placeholder text --> | ||
<string name="hello_blank_fragment">Hello blank fragment</string> | ||
</resources> |
36 changes: 36 additions & 0 deletions
36
tagcloudlib/src/main/java/com/moxun/tagcloudlib/view/NOPTagsAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.moxun.tagcloudlib.view; | ||
|
||
import android.content.Context; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
/** | ||
* Default adapter and do nothing | ||
* Created by moxun on 16/3/25. | ||
*/ | ||
/*package*/ class NOPTagsAdapter extends TagsAdapter { | ||
@Override | ||
public int getCount() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public View getView(Context context, int position, ViewGroup parent) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Object getItem(int position) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public int getPopularity(int position) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void onThemeColorChanged(View view, int themeColor) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters