1 Star 0 Fork 0

OSCHINA-MIRROR/HarmonyOS-tpc-butterknife

Join Gitlife
Discover and participate in excellent open source projects with over 10 million developers. Private repositories are also completely free :)
Join for free
Clone/Download
Contribute code
Sync code
Cancel
Hint: Since Git does not support empty folders, creating a folder will generate an empty .keep file.
Loading...
README.md

ButterKnife

Введение

Привязка полей и методов для компонентов OpenHarmony, которая использует обработку аннотаций для генерации шаблонного кода за вас.

  • Устраните вызовы findComponentById, используя @BindComponent для полей.
  • Группируйте несколько представлений в список или массив. Работайте со всеми ними сразу с помощью действий, сеттеров или свойств.
  • Удалите анонимные внутренние классы для слушателей, аннотируя методы с @OnClick и другими.
  • Исключите поиск ресурсов, используя аннотации ресурсов для полей.

Функции

Добавлена поддержка:

  • @BindArray
  • @BindBool
  • @BindColor
  • @BindComponent
  • @BindComponents
  • @BindDimen
  • @BindElement
  • @BindFloat
  • @BindFont
  • @BindInt
  • @BindPixelMap
  • @BindString
  • @OnCheckedChanged
  • @OnClick
  • @OnEditorAction
  • @OnFocusChange
  • @OnItemClick
  • @OnItemLongClick
  • @OnItemSelected
  • @OnLongClick
  • @OnPageChange
  • @OnTextChanged
  • @OnTouch
  • @OnOptional

Инструкции по использованию

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.

Comments ( 0 )

You can comment after Login

Introduction

No description available Expand Collapse
Apache-2.0
Cancel

Releases

No releases yet

Contributor

All

Recent Activities

Load more
No more results to load
1
https://gitlife.ru/oschina-mirror/HarmonyOS-tpc-butterknife.git
git@gitlife.ru:oschina-mirror/HarmonyOS-tpc-butterknife.git
oschina-mirror
HarmonyOS-tpc-butterknife
HarmonyOS-tpc-butterknife
master