PyxInjector
Annotation Field Injector Library
Pyx is abbreviation of Pyxis, small and faint constellation in the southern sky.
PyxInjector help you to inject field, methods by various annotation field
??? ?? ?? ?? ??? PyxisPub ?? ?? ? ????.
Usages
rootProject/build.gradle
allprojects {
repositories {
maven {
url 'https://jitpack.io'
}
}
}
app/build.gradle
dependencies {
implementation 'com.github.WindSekirun:PyxInjector:1.1.5'
}
Annotation Fields
@BindView
Annotation Field with @BindView with Optional View ID for PyxInjector to find and cast the corresponding view.
@Extra
Annotation Field with @Extra with Optional extra key to find and cast the corresponding intent extras.
@Argument
Annotation Field with @Argument with Optional extra key to find and cast the corrsponding fragment arguments.
@OnClicks / @OnClicks
Annotation Field with @OnClick, @OnClicks with View ID to find and invoke methods
@OnLongClick / @OnLongClicks
Annotation Field with @OnLongClick, @OnLongClicks with View ID to find and invoke methods
@OnSeekbarChange [Since 1.1]
Annotation Field with @OnSeekbarChange with View ID to find and invoke OnSeekBarChangeListener.onProgressChanged(seekbar: SeekBar?, progress: Int, fromUser: Boolean)
@OnEditTextChange [Since 1.1]
Annotation Field with @OnEditTextChange with View ID to find and invoke methods of TextWatcher
@OnCheckChange [Since 1.1]
Annotation Field with @OnCheckChange with View ID to find and invoke CompoundButton.OnCheckedChangeListener.onCheckedChanged (CompoundButton buttonView, boolean isChecked)
Non-Activity / Fragment Binding [Since 1.1]
public class ListHolder extends RecyclerView.ViewHolder {
private @BindView TextView txtNum;
public ListHolder(View itemView) {
super(itemView);
PyxInjector.getInstance().execute(getActivity(), this, itemView);
}
}
find(@resId, View) [Since 1.1.5]
txtName2 = PyxInjector.find(R.id.txtName2, PyxUtils.content(this));
Config (Optional)
as 1.0.0 We support Config of PyxInjector.
Application class
Config config = new Config(BindViewPrefix.PREFIX_M);
PyxInjector.initializeApplication(config);
BindViewPrefix
Custom Object
as 1.0.0, We support InjectActivity, InjectFragment, InjectSupportFragment to inject all activity / fragement.
if you need to inherit other class, insert this code in proper methods
License
Copyright 2017 WindSekirun (DongGil, Seo) 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.