Skip to content

Commit

Permalink
新增圆角支持,新增SuperButton,部分bug修复
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyao committed Jul 11, 2017
1 parent 09a7488 commit fe4bf89
Show file tree
Hide file tree
Showing 12 changed files with 852 additions and 194 deletions.
10 changes: 8 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@
</intent-filter>
</activity>
<activity android:name=".TypeActivity" />
<activity android:name=".ListActivity" />
<activity android:name=".ListActivity"
android:label="SuperTextView列表中使用" />
<activity
android:name=".CommonTextViewActivity"
android:label="CommonTextView" />
<activity android:name=".ClickActivity"></activity>
<activity android:name=".ClickActivity"
android:label="SuperTextView点击事件"/>
<activity
android:name=".SuperButtonActivity"
android:label="SuperButton" />

</application>

</manifest>
25 changes: 16 additions & 9 deletions app/src/main/java/com/allen/supertextview/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
public class MainActivity extends AppCompatActivity implements View.OnClickListener {


private Button button0, button1, button2, button3, button4, button5, button6, button7, button8, button9,button10;
private Button button0, button1, button2, button3,
button4, button5, button6, button7,button8, list_button, click_button,super_button;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -25,8 +26,9 @@ protected void onCreate(Bundle savedInstanceState) {
button6 = (Button) findViewById(R.id.button6);
button7 = (Button) findViewById(R.id.button7);
button8 = (Button) findViewById(R.id.button8);
button9 = (Button) findViewById(R.id.button9);
button10 = (Button) findViewById(R.id.button10);
list_button = (Button) findViewById(R.id.list_button);
click_button = (Button) findViewById(R.id.click_button);
super_button = (Button) findViewById(R.id.super_button);

button0.setOnClickListener(this);
button1.setOnClickListener(this);
Expand All @@ -37,8 +39,9 @@ protected void onCreate(Bundle savedInstanceState) {
button6.setOnClickListener(this);
button7.setOnClickListener(this);
button8.setOnClickListener(this);
button9.setOnClickListener(this);
button10.setOnClickListener(this);
list_button.setOnClickListener(this);
click_button.setOnClickListener(this);
super_button.setOnClickListener(this);
}

@Override
Expand Down Expand Up @@ -86,16 +89,20 @@ public void onClick(View v) {
startActivity(intent);
break;
case R.id.button8:
intent.setClass(this, TypeActivity.class);
intent.putExtra("type", 8);
startActivity(intent);
break;
case R.id.list_button:
intent.setClass(this, ListActivity.class);
startActivity(intent);
break;
case R.id.button9:
case R.id.click_button:
intent.setClass(this, ClickActivity.class);
startActivity(intent);
break;
case R.id.button10:
intent.setClass(this, TypeActivity.class);
intent.putExtra("type", 8);
case R.id.super_button:
intent.setClass(this, SuperButtonActivity.class);
startActivity(intent);
break;
}
Expand Down
25 changes: 25 additions & 0 deletions app/src/main/java/com/allen/supertextview/SuperButtonActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.allen.supertextview;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.allen.library.SuperTextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.squareup.picasso.Picasso;

/**
* Created by allen on 2017/7/10.
*/
public class SuperButtonActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.super_button_layout);

}

}
3 changes: 2 additions & 1 deletion app/src/main/java/com/allen/supertextview/TypeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.layout7);
break;
case 8:
setContentView(R.layout.super_button_layout);
setContentView(R.layout.layout8);
break;

}

}
Expand Down
24 changes: 13 additions & 11 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@
android:layout_marginBottom="5dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="展示几种常见的显示方式" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:gravity="center"
android:text="(更多组合方式可自行组合)"
android:text="demo是最好的老师"
android:textColor="@color/colorAccent" />

<Button
Expand Down Expand Up @@ -82,19 +75,28 @@
android:id="@+id/button8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="圆角样式"
android:textColor="@color/colorAccent" />

<Button
android:id="@+id/list_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="在列表中使用" />

<Button
android:id="@+id/button9"
android:id="@+id/click_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="点击事件使用" />

<Button
android:id="@+id/button10"
android:id="@+id/super_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="超级按钮" />
android:background="@color/colorAccent"
android:text="超级按钮"
android:textColor="@color/white" />

</LinearLayout>
</ScrollView>
Expand Down
76 changes: 76 additions & 0 deletions app/src/main/res/layout/layout8.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:stv="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp">

<com.allen.library.SuperTextView
android:layout_width="match_parent"
android:layout_height="50dp"
stv:sLeftTextString="声音"
stv:sRightViewType="switchBtn"
stv:sShapeCornersRadius="10dp"
stv:sShapeSelectorPressedColor="@color/gray"
stv:sShapeStrokeColor="@color/colorAccent"
stv:sShapeStrokeWidth="0.3dp"
stv:sSwitchIsChecked="true"
stv:sSwitchMinWidth="40dp"
stv:sThumbResource="@drawable/thumb"
stv:sTrackResource="@drawable/track"
stv:sUseShape="true" />

<com.allen.library.SuperTextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="20dp"
stv:sLeftTextString="账号与安全"
stv:sRightIconRes="@drawable/arrow_right_red"
stv:sRightTextString="已保护"
stv:sRightTvDrawableLeft="@drawable/v1"
stv:sShapeCornersRadius="5dp"
stv:sShapeSelectorPressedColor="@color/gray"
stv:sShapeStrokeColor="@color/colorAccent"
stv:sShapeStrokeWidth="0.3dp"
stv:sUseShape="true" />


<com.allen.library.SuperTextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="20dp"
stv:sLeftTextString="上圆角"
stv:sRightIconRes="@drawable/arrow_right_red"
stv:sShapeCornersTopLeftRadius="10dp"
stv:sShapeCornersTopRightRadius="10dp"
stv:sShapeSelectorPressedColor="@color/gray"
stv:sShapeStrokeColor="@color/colorAccent"
stv:sShapeStrokeWidth="0.2dp"
stv:sUseShape="true" />

<com.allen.library.SuperTextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="20dp"
stv:sLeftTextString="下圆角"
stv:sRightIconRes="@drawable/arrow_right_red"
stv:sShapeCornersBottomLeftRadius="10dp"
stv:sShapeCornersBottomRightRadius="10dp"
stv:sShapeSelectorPressedColor="@color/gray"
stv:sShapeStrokeColor="@color/colorAccent"
stv:sShapeStrokeWidth="0.2dp"
stv:sUseShape="true" />

<com.allen.library.SuperTextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="20dp"
stv:sCenterTextColor="@color/white"
stv:sCenterTextString="填充色"
stv:sShapeCornersRadius="10dp"
stv:sShapeSelectorNormalColor="@color/red_btn"
stv:sShapeSelectorPressedColor="@color/gray"
stv:sUseShape="true" />

</LinearLayout>
14 changes: 14 additions & 0 deletions app/src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,20 @@
stv:sBackgroundDrawableRes="@drawable/selector_red"
stv:sLeftTextString="自定义背景点击效果"
stv:sRightIconRes="@drawable/arrow_right_red" />

<com.allen.library.SuperTextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="20dp"
stv:sLeftTextString="账号与安全"
stv:sRightIconRes="@drawable/arrow_right_red"
stv:sRightTextString="已保护"
stv:sRightTvDrawableLeft="@drawable/v1"
stv:sShapeCornersRadius="5dp"
stv:sShapeSelectorPressedColor="@color/gray"
stv:sShapeStrokeColor="@color/colorAccent"
stv:sShapeStrokeWidth="0.3dp"
stv:sUseShape="true" />
</LinearLayout>
</ScrollView>

Expand Down
Loading

0 comments on commit fe4bf89

Please sign in to comment.