Skip to content

Base is a lightweight library that gives you a clean architecture foundation for your HMOS MVP's.

License

Notifications You must be signed in to change notification settings

Applib-HarmonyOS/Base

Repository files navigation

Build Quality Gate Status license 1.0.0

Base

Base is a lightweight library that gives you a clean architecture foundation for your Harmony project.

icon

The main objective of this repository is to show developers how I would architect my Harmony code in future projects.

Source

This library has been inspired by thiagokimo/Base.

Integration


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

  1. 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')
  2. 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'])

Usages


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.

License

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.

About

Base is a lightweight library that gives you a clean architecture foundation for your HMOS MVP's.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages