Skip to content

Instantly share code, notes, and snippets.

Avatar

Felipe Arimateia felipearimateia

View GitHub Profile
View TextViewLine.java
/**
* Created by felipearimateia on 02/11/14.
*/
public class TextViewLine extends TextView{
private BorderDrawable borderDrawable;
private int selectColor;
private int backgroundColor;
public TextViewLine(Context context) {
View BorderDrawable.java
public class BorderDrawable extends Drawable {
private int mLeftBorderWidth = 0;
private int mRightBorderWidth = 0;
private int mLeftBorderColor = Color.BLACK;
private int mRightBorderColor = Color.BLACK;
private int mTopBorderWidth = 0;
private int mBottomBorderWidth = 0;
private int mTopBorderColor = Color.BLACK;
View exemplo.java
public class BaseActvity extends Activity{
public void toast(String message, int duration) {
Toast.makeText(this, message, duration);
}
}
public class MainActvity extends BaseActvity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View exemplo.kt
fun Activity.toast(message: CharSequence, duration: Int = Toast.LENGTH_SHORT) {
Toast.makeText(this, message, duration).show()
}
class MainActivity : Activity(){
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
toast("Hello, Kotlin!")
}
}