Giter Site home page Giter Site logo

uitools's Introduction

UI Tools Library for Android

Build Status Maven Central

Description

UI Tools Library contains lots of useful methods for working with Android User Interface API

Requirements

The Library requires Android SDK version 9 (Gingerbread) and higher

Gradle Dependency

dependencies {
	compile 'com.github.shell-software:uitools:1.1.0'
}

Activity Stream

Full ChangeLog

1.1.0 - current

  1. Changed the standard Android logging API to SLF4J Logging API

1.0.0 - previous

  1. The first release! Everything is new.

Features in the next versions:

TBD

Usage

IdGenerator

IdGenerator is responsible for views id generation.

To generate the view id:

View view;
// ... view initialization code goes here

view.setId(IdGenerator.next());

ColorModifier

ColorModifier contains utility methods for color modification.

To modify the color exposure:

int color = Color.DKGRAY;

// Darken the color:
int darkerColor = ColorModifier.modifyExposure(color, 0.8f);

// Lighten the color:
int lighterColor = ColorModifier.modifyExposure(color, 1.5f);

DensityConverter

DensityConverter contains utility methods for density values conversion based on the current device's display metrics.

To convert the density-independent pixels into density-dependent ones and vice versa:

float pixels = 100.0f;

// Convert to real pixels:
float realPixels = DensityConverter.dpToPx(getContext(), pixels)

// Convert to density-independent pixels:
float densityPixels = DensityConverter.pxToDp(getContext(), pixels);

Logging

To enable logging:

  1. Add the following dependency:

    dependencies {
    	compile 'com.github.tony19:logback-android-classic:1.1.1-3'
    }
  2. Create the logback.xml file in the src/main/assets with the sample configuration:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    	<appender name="LOGCAT" class="ch.qos.logback.classic.android.LogcatAppender">
    		<tagEncoder>
    			<pattern>%logger{0}</pattern>
    		</tagEncoder>
    		<encoder>
    			<pattern>%d{HH:mm:ss.SSS} [%thread] [%logger{0}] - %msg%n</pattern>
    		</encoder>
    	</appender>
    
    	<root level="TRACE" additivity="false">
    		<appender-ref ref="LOGCAT" />
    	</root>
    </configuration>

    You may wish to configure different appenders with different log levels for packages, classes etc.

    More information about LOGBack can be found @ LOGBack Project Site

  3. Add the following InvalidPackage ignore rule into lint.xml file (located @ the root of the project):

    <issue id="InvalidPackage" >
    	<ignore path="**/logback-android-core/*" />
    </issue>

License

  Copyright 2015 Shell Software Inc.

  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.

Shell Software Inc. Links

uitools's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.