Base is a lightweight library that gives you a clean architecture foundation for your Harmony project.
The main objective of this repository is to show developers how I would architect my Harmony code in future projects.
This library has been inspired by thiagokimo/Base.
Maven
<dependency>
<groupId>dev.applibgroup</groupId>
<artifactId>base</artifactId>
<version>1.0.0</version>
<type>har</type>
</dependency>
implementation 'dev.applibgroup:base:1.0.0'
From Source
-
For using Base module in sample app, include the source code and add the below dependencies in entry/build.gradle to generate hap/support.har.
implementation project(path: ':base')
-
For using Base module in separate application using har file, add the har file in the entry/libs folder and add the dependencies in entry/build.gradle file.
implementation fileTree(dir: 'libs', include: ['*.har'])
implement callback interfaces:
public class StudentDetailAbility extends BaseAbility<StudentDetailPresenter> implements StudentDetailContract.Component {
Then implement updateImage(String someUrl) method:
@Override
public void updateImage(String someUrl) {
Picasso.get()
.load(someUrl)
.placeholder(ResourceTable.Media_Jellyfish)
.error(ResourceTable.Media_Jellyfish)
.memoryPolicy(MemoryPolicy.NO_CACHE)
.into(mImage);
}
set the updated name, text course...
@Override
public void updateName(String someName) {
mTitle.setText(someName);
}
@Override
public void updateDescription(String someDescription) {
mDescription.setText(someDescription);
}
@Override
public void updateCourse(String someCourse) {
mSubtitle.setText(someCourse);
}
@Override
public int getLayoutResource() {
return ResourceTable.Layout_ability_detail;
}
@Override
public void configureUI() {}
@Override
public StudentDetailPresenter injectDependencies() {
Student student = mIntent.getSerializableParam(STUDENT);
return new StudentDetailPresenter(this, student);
}
Take a look at the sample project for more information.
Copyright 2011, 2012 Thiago Rocha
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.