baseactvity:Use decorative mode to decouple your duties
Https://github.com/luhaoaimama1/ZoneStudio/blob/master/Android_Zone_Lib/src/and/base/activity/BaseActvity.java
Decorater are all baseactvity's parents.
Pop_zone (life cycle): Easier to use.
Https://github.com/luhaoaimama1/ZoneStudio/blob/master/Android_Zone_Lib/src/and/base/Pop_Zone.java
How to use
Public class pop_bottom extends pop_zone implements Onclicklistener { PrivateButton bt_how,bt_are,bt_you;PrivateActivity context; Public Pop_bottom(Activity activity,intSHOWATLOCATIONVIEWID) {Super(activity, SHOWATLOCATIONVIEWID); This. context=activity; Setpopcontentview (R.layout.pop_bottom, Mode.wrap,-1); }@Override protected void Findview(View Mmenuview) {bt_how= (Button) Mmenuview.findviewbyid (r.id.bt_how); Bt_are= (Button) Mmenuview.findviewbyid (R.id.bt_are); bt_you= (Button) Mmenuview.findviewbyid (r.id.bt_you); }@Override protected void InitData() { }@Override protected void Setlistener() {Bt_how.setonclicklistener ( This); Bt_are.setonclicklistener ( This); Bt_you.setonclicklistener ( This); }@Override protected void setlocation(View view) { This. Showasdropdown (View,0,0); }@Override Public void OnClick(View v) {Toastutils.showlong (context,"hehe"); Dismiss (); }}
fragment_lazy Lazy Loading: (Viewpager compatible with hide show)
Https://github.com/luhaoaimama1/ZoneStudio/blob/master/Android_Zone_Lib/src/and/base/Fragment_Lazy.java
fragmentswitcher:fragment Switching Device
Https://github.com/luhaoaimama1/ZoneStudio/blob/master/Android_Zone_Lib/src/and/utils/FragmentSwitcher.java
How to use
Public class framentswitchacitiviy extends fragmentactivity implements Onclicklistener { PrivateFragmentswitcher Fragmentswitcher;@Override protected void onCreate(Bundle arg0) {Super. OnCreate (ARG0); Setcontentview (r.layout.a_frament_switch_test); Fragmentswitcher=NewFragmentswitcher ( This, r.id.framelayout); Fragmentswitcher.setpridefaultanimal (Android. R.anim.fade_in,android. R.anim.fade_out);//Fragmentswitcher.initfragment (Tab1.class, Tab2.class, tab3.class);TAB2 TAB2 =NewTAB2 (); Bundle bundle =NewBundle (); Bundle.putstring ("mode","Normal"); Tab2.setarguments (bundle); Fragmentswitcher.initfragment (NewTAB1 (), TAB2,NewTAB3 ()); Fragmentswitcher.switchtonull ();//fragmentswitcher.switchpage (0);}@Override Public void OnClick(View v) {Switch(V.getid ()) { CaseR.id.open1:fragmentswitcher.switchpage (0); Break; CaseR.id.open2:fragmentswitcher.switchpage (1); Break; CaseR.id.open3:fragmentswitcher.switchpage (2); Break; CaseR.id.open4:fragmentswitcher.switchtonull (); Break;default: Break; } }}
Featuresdecorater: Decoupling by subscribing to this mode
https://github.com/luhaoaimama1/ZoneStudio/blob/master/Android_Zone_Lib/src/and/base/activity/decorater/ Featuresdecorater.java
The main solution: the problem of Onactivityresult
How to use
Public class photo_shot_mainactivity extends baseactvity implements Onclicklistener{ PrivateFeature_pic Feature_pic;@Override Public void Setcontentview() {System.err.println ("Photo_shot_mainactivity Setcontentview"); Setcontentview (R.layout.a_photo_shot); }@Override Public void Findids() { }@Override Public void InitData() { }@Override Public void Setlistener() { }@Override Public void OnClick(View v) {Switch(V.getid ()) { CaseR.id.shot:feature_pic.opencamera (); Break; CaseR.id.photo:feature_pic.openphotos (); Break; CaseR.id.clip:startactivity (NewIntent ( This, Cliptest.class)); Break;default: Break; } }@Override protected void initfeature() {feature_pic =NewFeature_pic ( This) {@Override protected void Getreturnedpicpath(String Path) {System.out.println (path); Intent Intent =NewIntent (photo_shot_mainactivity. This, Showpicactivity.class); Uri uri = uri.parse (path); Intent.setdata (URI); StartActivity (Intent); } }; Addfeature (Feature_pic); }}
reflectcloneutils: Deep clone of any object
- Temporarily supports object class, underlying type, underlying type wrapper class, List, Map
- Static clone does not change neither assignment nor value
- TODO final is not going to be an anomaly.
- Simple enumeration supports too-deep representations that have not been considered
Https://github.com/luhaoaimama1/ZoneStudio/blob/master/Android_Zone_Lib/src/and/utils/reflect/ReflectCloneUtils.java
measureutils:
measure: Measure the size of the control in OnCreate
measureimage: This return shows both the ImageView show's width and position (after ScaleType Marix processing)
Https://github.com/luhaoaimama1/ZoneStudio/blob/master/Android_Zone_Lib/src/and/utils/measure/MeasureUtils.java
How to use Measure
Measureutils.measure (Imagegroup_zone, Listenerstate.measure_remove,NewOnmeasurelistener () {@Override Public void Measureresult(View V,intViewwidth,intViewheight) {imagegroup_zone.setbackgroundcolor (color.white); for(inti =0; I < Imagegroup_zone.getchildcount (); i++) {Imagegroup_zone.getchild_childpro (i). Iv.setbackgroundcolor (colorarray[i%4]); } } });
How to use Measureimage
new MeasureUtils.ImageListener() { @Override publicvoidimageShowProperty(ImageView iv,floatfloatintint imageShowY) { System.out.println("scaleType :"+iv.getScaleType()+"\t left:"+left+" \ttop:"+top+" \timageShowX:"+imageShowX+"\timageShowY:"+imageShowY); } });
I think some very useful common classes (super-gods)