This file contains hidden or 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
| public class VG extends ViewGroup { | |
| private static final String TAG = "VG"; | |
| private final ViewDragHelper mDragHelper; | |
| private Rect[] mBounds = new Rect[4]; | |
| public VG(Context context) { | |
| super(context); | |
| int[] colors = {Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW}; | |
| for (int i = 0; i < 4; i++) { | |
| TextView tv = new TextView(getContext()); |
This file contains hidden or 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
| package com.example.app.myapplication; | |
| import android.content.Context; | |
| import android.util.AttributeSet; | |
| import android.view.View; | |
| /* | |
| res/layout/fsvt.xml test layout file: | |
| <?xml version="1.0" encoding="utf-8"?> |
This file contains hidden or 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
| package com.example.app.myapplication; | |
| import android.database.Cursor; | |
| import android.database.CursorWrapper; | |
| public class ColumnExtenderCursor extends CursorWrapper { | |
| private final String[] columnNames; | |
| public ColumnExtenderCursor(Cursor cursor, String... newColumns) { |
This file contains hidden or 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
| // add in Activity#onCreate | |
| ListView lv = new ListView(this); | |
| setContentView(lv); | |
| Uri uri = ContactsContract.Contacts.CONTENT_URI; | |
| Wrapper c = Wrapper.query(getContentResolver(), uri, null, null, null, ContactsContract.Contacts.DISPLAY_NAME, getResources()); | |
| String[] from = { | |
| ContactsContract.Contacts.DISPLAY_NAME, | |
| Wrapper.PHONES, | |
| }; |
This file contains hidden or 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
| abstract class DecoratedDrawable extends LevelListDrawable { | |
| public DecoratedDrawable(Context ctx, int resId) { | |
| TypedArray typedArray = ctx.obtainStyledAttributes(new int[] {resId}); | |
| Drawable drawable = typedArray.getDrawable(0); | |
| typedArray.recycle(); | |
| if (drawable == null) { | |
| drawable = ctx.getResources().getDrawable(resId); | |
| } | |
| init(drawable); | |
| } |
This file contains hidden or 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
| class CircleBitmapDrawable extends Drawable { | |
| Bitmap bitmap; | |
| Paint maskPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |
| Paint borderPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |
| float side; | |
| float radius; | |
| public CircleBitmapDrawable(Bitmap wrappedBitmap, float borderWidth, int borderColor) { | |
| bitmap = wrappedBitmap; | |
| borderPaint.setStyle(Paint.Style.STROKE); |
This file contains hidden or 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
| class RoundedListView extends StatefulWidget { | |
| @override | |
| _RoundedListViewState createState() => _RoundedListViewState(); | |
| } | |
| class _RoundedListViewState extends State<RoundedListView> with TickerProviderStateMixin { | |
| var size = 32; | |
| @override | |
| Widget build(BuildContext context) { |
This file contains hidden or 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
| /* | |
| * | |
| <declare-styleable name="GridSpanLayout"> | |
| <attr name="rows" format="integer" /> | |
| <attr name="columns" format="integer" /> | |
| <attr name="column" format="integer" /> | |
| <attr name="row" format="integer" /> | |
| <attr name="columnSpan" format="integer" /> | |
| <attr name="rowSpan" format="integer" /> |
This file contains hidden or 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
| class LongPressRipple extends StatefulWidget { | |
| final Widget child; | |
| final VoidCallback onLongPress; | |
| LongPressRipple({ | |
| Key key, | |
| this.child, | |
| @required this.onLongPress, | |
| }) : assert(onLongPress != null), super(key: key); |
This file contains hidden or 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
| class FruitColorizer extends TextEditingController { | |
| final Map<String, TextStyle> mapping; | |
| final Pattern pattern; | |
| FruitColorizer(this.mapping) | |
| : pattern = RegExp(mapping.keys.map((key) => RegExp.escape(key)).join('|')); | |
| FruitColorizer.fromColors(Map<String, Color> colorMap) | |
| : this(colorMap.map((text, color) => MapEntry(text, TextStyle(color: color)))); |
OlderNewer