Skip to content

Commit

Permalink
2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyao committed Jul 4, 2017
1 parent 5fd8adb commit 6534810
Show file tree
Hide file tree
Showing 28 changed files with 1,931 additions and 1,357 deletions.
351 changes: 118 additions & 233 deletions README.md

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile project(':library')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.bumptech.glide:glide:3.8.0'
compile 'com.zhy:base-rvadapter:3.0.3'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
13 changes: 8 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.allen.supertextview">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand All @@ -16,10 +17,12 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TypeActivity"/>
<activity android:name=".ListActivity"/>
<activity android:name=".CommonTextViewActivity"
android:label="CommonTextView"/>
<activity android:name=".TypeActivity" />
<activity android:name=".ListActivity" />
<activity
android:name=".CommonTextViewActivity"
android:label="CommonTextView" />
<activity android:name=".ClickActivity"></activity>
</application>

</manifest>
88 changes: 88 additions & 0 deletions app/src/main/java/com/allen/supertextview/ClickActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.allen.supertextview;

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

import com.allen.library.SuperTextView;

public class ClickActivity extends AppCompatActivity {

private SuperTextView superTextView;

private String string;

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

superTextView = (SuperTextView) findViewById(R.id.super_tv);

/**
* 根据实际需求对需要的View设置点击事件
*/
superTextView.setOnSuperTextViewClickListener(new SuperTextView.OnSuperTextViewClickListener() {
@Override
public void onClickListener() {
string = "整个item的点击事件";
Toast.makeText(ClickActivity.this, string, Toast.LENGTH_SHORT).show();
}
}).setLeftTopTvClickListener(new SuperTextView.OnLeftTopTvClickListener() {
@Override
public void onClickListener() {
string = superTextView.getLeftTopString();
Toast.makeText(ClickActivity.this, string, Toast.LENGTH_SHORT).show();
}
}).setLeftTvClickListener(new SuperTextView.OnLeftTvClickListener() {
@Override
public void onClickListener() {
string = superTextView.getLeftString();
Toast.makeText(ClickActivity.this, string, Toast.LENGTH_SHORT).show();
}
}).setLeftBottomTvClickListener(new SuperTextView.OnLeftBottomTvClickListener() {
@Override
public void onClickListener() {
string = superTextView.getLeftBottomString();
Toast.makeText(ClickActivity.this, string, Toast.LENGTH_SHORT).show();
}
}).setCenterTopTvClickListener(new SuperTextView.OnCenterTopTvClickListener() {
@Override
public void onClickListener() {
string = superTextView.getCenterTopString();
Toast.makeText(ClickActivity.this, string, Toast.LENGTH_SHORT).show();
}
}).setCenterTvClickListener(new SuperTextView.OnCenterTvClickListener() {
@Override
public void onClickListener() {
string = superTextView.getCenterString();
Toast.makeText(ClickActivity.this, string, Toast.LENGTH_SHORT).show();
}
}).setCenterBottomTvClickListener(new SuperTextView.OnCenterBottomTvClickListener() {
@Override
public void onClickListener() {
string = superTextView.getCenterBottomString();
Toast.makeText(ClickActivity.this, string, Toast.LENGTH_SHORT).show();
}
}).setRightTopTvClickListener(new SuperTextView.OnRightTopTvClickListener() {
@Override
public void onClickListener() {
string = superTextView.getRightTopString();
Toast.makeText(ClickActivity.this, string, Toast.LENGTH_SHORT).show();
}
}).setRightTvClickListener(new SuperTextView.OnRightTvClickListener() {
@Override
public void onClickListener() {
string = superTextView.getRightString();
Toast.makeText(ClickActivity.this, string, Toast.LENGTH_SHORT).show();
}
}).setRightBottomTvClickListener(new SuperTextView.OnRightBottomTvClickListener() {
@Override
public void onClickListener() {
string = superTextView.getRightBottomString();
Toast.makeText(ClickActivity.this, string, Toast.LENGTH_SHORT).show();
}
});

}
}
4 changes: 2 additions & 2 deletions app/src/main/java/com/allen/supertextview/ListActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ private List<NewsBean> getData() {
for (int i = 0; i < 10; i++) {
NewsBean newsBean = new NewsBean();
newsBean.setImgUrl(url[i]);
newsBean.setTitle("新闻标题----"+i);
newsBean.setTime("2016.10.31----"+i);
newsBean.setTitle("新闻标题"+i);
newsBean.setTime("哈佛有嘻哈教你如何用一个freestyle轻松毕业"+i);
newsBeanList.add(newsBean);
}
return newsBeanList;
Expand Down
93 changes: 22 additions & 71 deletions app/src/main/java/com/allen/supertextview/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
package com.allen.supertextview;

import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.allen.library.SuperTextView;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

private SuperTextView superTextView;

private Drawable drawable;
private Button button0, button1, button2, button3, button4, button5, button6, button7,button8;

private Button button0,button1,button2,button3,button4,button5,button6,button7;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -29,6 +24,7 @@ protected void onCreate(Bundle savedInstanceState) {
button5 = (Button) findViewById(R.id.button5);
button6 = (Button) findViewById(R.id.button6);
button7 = (Button) findViewById(R.id.button7);
button8 = (Button) findViewById(R.id.button8);

button0.setOnClickListener(this);
button1.setOnClickListener(this);
Expand All @@ -38,102 +34,57 @@ protected void onCreate(Bundle savedInstanceState) {
button5.setOnClickListener(this);
button6.setOnClickListener(this);
button7.setOnClickListener(this);
button8.setOnClickListener(this);
}

@Override
public void onClick(View v) {
Intent intent = new Intent();
switch (v.getId()){
switch (v.getId()) {
case R.id.button0:
intent.setClass(this,TypeActivity.class);
intent.putExtra("type",0);
intent.setClass(this, TypeActivity.class);
intent.putExtra("type", 0);
startActivity(intent);
break;
case R.id.button1:
intent.setClass(this,TypeActivity.class);
intent.putExtra("type",1);
intent.setClass(this, TypeActivity.class);
intent.putExtra("type", 1);
startActivity(intent);
break;
case R.id.button2:
intent.setClass(this,TypeActivity.class);
intent.putExtra("type",2);
intent.setClass(this, TypeActivity.class);
intent.putExtra("type", 2);
startActivity(intent);
break;
case R.id.button3:
intent.setClass(this,TypeActivity.class);
intent.putExtra("type",3);
intent.setClass(this, TypeActivity.class);
intent.putExtra("type", 3);
startActivity(intent);
break;
case R.id.button4:
intent.setClass(this,TypeActivity.class);
intent.putExtra("type",4);
intent.setClass(this, TypeActivity.class);
intent.putExtra("type", 4);
startActivity(intent);
break;
case R.id.button5:
intent.setClass(this,TypeActivity.class);
intent.putExtra("type",5);
intent.setClass(this, TypeActivity.class);
intent.putExtra("type", 5);
startActivity(intent);
break;
case R.id.button6:
// intent.setClass(this, ListActivity.class);
intent.setClass(this,TypeActivity.class);
intent.setClass(this, TypeActivity.class);
intent.putExtra("type", 6);
startActivity(intent);
break;
case R.id.button7:
// intent.setClass(this, ListActivity.class);
intent.setClass(this, CommonTextViewActivity.class);
intent.putExtra("type", 6);
intent.setClass(this, ListActivity.class);
startActivity(intent);
break;
case R.id.button8:
intent.setClass(this, ClickActivity.class);
startActivity(intent);
break;
}
}

/**
* 可以通过链式设置大部分常用的属性值
*/
// private void setSuperTextView() {
// superTextView.setLeftIcon(drawable)
// .setLeftString("")
// .setLeftTVColor(0)
// .setLeftTopString("")
// .setLeftTopTVColor(0)
// .setLeftBottomString("")
// .setLeftBottomTVColor(0)
// .setLeftBottomString2("")
// .setLeftBottomTVColor2(0)
// .setRightString("")
// .setRightTVColor(0)
// .setCbChecked(true)
// .setCbBackground(drawable)
// .setRightIcon(drawable)
// .setRightString("")
// .setRightTVColor(0)
// .setLeftString("")
// .setOnSuperTextViewClickListener(new SuperTextView.OnSuperTextViewClickListener() {
// @Override
// public void onSuperTextViewClick() {
// super.onSuperTextViewClick();
// //do something
// }
//
// @Override
// public void onLeftTopClick() {
// super.onLeftTopClick();
// //do something
// }
//
// @Override
// public void onLeftBottomClick() {
// super.onLeftBottomClick();
// //do something
// }
//
// @Override
// public void onLeftBottomClick2() {
// super.onLeftBottomClick2();
// //do something
// }
// });
// }
}
33 changes: 21 additions & 12 deletions app/src/main/java/com/allen/supertextview/TypeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

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

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;

/**
Expand All @@ -13,10 +16,10 @@
public class TypeActivity extends AppCompatActivity {

private int type;
private SuperTextView superTextView,superTextView2,superTextView3;
private SuperTextView superTextView, superTextView2, superTextView3;

@Override
protected void onCreate( Bundle savedInstanceState) {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
type = getIntent().getIntExtra("type", 0);
switch (type) {
Expand All @@ -42,25 +45,31 @@ protected void onCreate( Bundle savedInstanceState) {
case 6:
setContentView(R.layout.layout6);
break;
case 7:
setContentView(R.layout.layout7);
break;
}



}

private void setData() {
superTextView = (SuperTextView) findViewById(R.id.super_tv1);
superTextView2 = (SuperTextView) findViewById(R.id.super_tv2);

superTextView.setLeftTopString("姓名").setLeftBottomString("188********");
superTextView2.setLeftTopString("姓名").setLeftBottomString("181********");

superTextView3 = (SuperTextView) findViewById(R.id.super_tv3);

Picasso.with(this).load("https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=3860616424,1789830124&fm=80&w=179&h=119&img.PNG")
.placeholder(R.drawable.head_default).into((ImageView) superTextView.getView(SuperTextView.leftImageViewId));
Picasso.with(this).load("https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=219781665,3032880226&fm=80&w=179&h=119&img.JPEG")
.placeholder(R.drawable.head_default).into((ImageView) superTextView2.getView(SuperTextView.rightImageViewId));
.placeholder(R.drawable.head_default).into(superTextView.getLeftIconIV());
Glide.with(this).load("https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=219781665,3032880226&fm=80&w=179&h=119&img.JPEG")
.placeholder(R.drawable.head_default).fitCenter().into(superTextView2.getRightIconIV());

Glide.with(this).load("https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=3860616424,1789830124&fm=80&w=179&h=119&img.PNG")
.placeholder(R.drawable.head_default)
.into(new SimpleTarget<GlideDrawable>() {
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
superTextView3.setRightTvDrawableRight(resource);
}
});
}


Expand Down
Loading

0 comments on commit 6534810

Please sign in to comment.