Code pull completed, the page will refresh automatically
Привязка полей и методов для компонентов OpenHarmony, которая использует обработку аннотаций для генерации шаблонного кода за вас.
findComponentById
, используя @BindComponent
для полей.@OnClick
и другими.Добавлена поддержка:
class ExampleAbility extends Ability {
@BindComponent(ResourceTable.Id_user) TextField username;
@BindComponent(ResourceTable.Id_pass) TextField password;
@BindString(ResourceTable.String_login_error) String loginErrorMessage;
@OnClick(ResourceTable.Id_submit) void submit() {
// TODO вызвать сервер...
}
@Override
public void onStart(Intent intent) {
super.onStart(intent);
ComponentContainer rootlayout = (ComponentContainer) LayoutScatter.getInstance(this).parse(ResourceTable.Layout_ability_main, null, false);
ButterKnife.bind(this, rootlayout);
// TODO Использовать поля...
}
}
Способ 1: Сгенерируйте пакет har из библиотеки и добавьте его в папку lib.
добавьте следующий код в gradle записи
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
annotationProcessor files('libs/butterknife_compiler.jar')
Способ 2:
allprojects{
repositories{
mavenCentral()
}
}
implementation 'io.openharmony.tpc.thirdlib:butterKnife:1.0.2'
annotationProcessor 'io.openharmony.tpc.thirdlib:butterknife-compiler:1.0.2'
Copyright 2013 Jake Wharton
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.
You can comment after Login
Inappropriate content may be displayed here and will not be shown on the page. You can check and modify it through the relevant editing function
If you confirm that the content does not involve inappropriate language/advertisement redirection/violence/vulgar pornography/infringement/piracy/false/insignificant or illegal content related to national laws and regulations, you can click submit to make an appeal, and we will handle it as soon as possible.
Comments ( 0 )