The abstract class can be inherited of Android
- Simple and convenient and practical
- Helps you separate your logic and keep your class clear and clear
- Custom AbstractView by yourself
- Copy the files into your project.
- AbstractActivity
- AbstractFragment
- AbstractFragmentActivity
- Extents
AbstractActivity
,AbstractFragment
,AbstractFragmentActivity
according to your need and Add unimplemented methods, then you can write the following code in your java file.
public class MainActivity extends AbstractActivity {
@Override
protected int getLayoutResId() {
return R.layout.activity_main;
}
@Override
public void initView() {
// TODO Auto-generated method stub
// setContentView and initView and setClick()
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// handle the View.OnClickListener
}
}
public class MainFragment extends AbstractFragment{
@Override
protected int getLayoutResId() {
return 0;
}
@Override
public void initView() {
// TODO Auto-generated method stub
// initView and setClick()
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// handle the View.OnClickListener
}
}
- Use the following methods to initView and setClick().
$find(Resid)
$find(v, Resid)
$click(Resid)
$click(v, Resid)
$onClick(Resid, listener)
$onClick(v, Resid, listener)
$Title(Resid, text)
$Finish(Resid)
- Use the following methods according to your need.
beforeInitView()
beforeFinish()
getData()
Other()
By Rewrite AbstractView's code, you can easily customize whatever you want.
There is also a sample to get you started.
Have problem? Just tweet me or send me an email.
Copyright 2016 huangxy@GitSmark
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.