Git Product home page Git Product logo

ultimateandroid's Introduction

UltimateAndroid

###Version:0.1.0 beta ###当前版本:0.1.0 beta

Build Status
#####Formerly known as CommonLibsForAndroid #####原名: CommonLibsForAndroid
###Using UltimateAndroid is a fast way to help you develop Android apps

快速开发Android应用的框架


[English Introduction](#english_introduction)

中文简介

###中文详细教程



#####The framework contains many feature like View Injection,ORM,Asynchronous Http and Image,User scenario testing,many UI Modules,Https Utils etc.And there are also many useful feature like WebViewUtils,DaoUtils, TripleDes Utils etc.The framework will be added by more feature in the future.

Up to now,I have only write the demo of most parts of UI modules and View Injection.The demo is something boring,but you can also see many kinds of UI modules.The DemoOfUi's screenshots are below,and you can download the apk directly.

Demo of Ui's screenshot is here.

#####Welcome to fork.

Demo Manual

Demo is rely on appcompat and the UltimateAndroid, you can change CONFIGURATION in your IDES etc.

###Quick Setup(Basic Usage) 1.If this is the first time for you to use the framework, you can use CommonApplication as your Application of Android app or just let your custom application extends CommonApplication.

  1. As the function of View Injection which use ButterKnife,you should config your IDE before you can compile the project.Most of IDEs require additional configuration in order to enable annotation processing for Butter Knife, or you can see IntelliJ IDEA Configuration for Butter Knife or Eclipse Configuration for butter Knife.

3.View Injection:

Example:

class ExampleActivity extends Activity {
@InjectView(R.id.title) TextView title;
@InjectView(R.id.subtitle) TextView subtitle;
@InjectView(R.id.footer) TextView footer;

@Override public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.simple_activity);
	ButterKnife.inject(this);
	// TODO Use "injected" views...

} }

Another use is simplifying the view holder pattern inside of a list adapter.

public class MyAdapter extends BaseAdapter {
@Override public View getView(int position, View view, ViewGroup parent) {
	ViewHolder holder;
	if (view != null) {
  	holder = (ViewHolder) view.getTag();
	} else {
  	view = inflater.inflate(R.layout.whatever, parent, false);
  	holder = new ViewHolder(view);
  	view.setTag(holder);
	}
	holder.name.setText("John Doe");
	// etc...
	return view;
	}
	static class ViewHolder {
	@InjectView(R.id.title) TextView name;
	@InjectView(R.id.job_title) TextView jobTitle;
	public ViewHolder(View view) {
	ButterKnife.inject(this, view);
  }
  }
}

4.Asynchronous Network: Use asynchronous utils,you do not need to use an addtional Thread to visit network.

HttpUtilsAsync.get("http://www.google.com", new AsyncHttpResponseHandler() {

@Override
public void onStart() {
    // called before request is started
}

@Override
public void onSuccess(int statusCode, Header[] headers, byte[] response) {
    // called when response HTTP status is "200 OK"
}

@Override
public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) {
    // called when response HTTP status is "4XX" (eg. 401, 403, 404)
}

@Override
public void onRetry(int retryNo) {
    // called when request is retried
}
});

Post request:

HttpUtilsAsync.post("http://www.google.com", new AsyncHttpResponseHandler() {

@Override
public void onStart() {
    // called before request is started
}

@Override
public void onSuccess(int statusCode, Header[] headers, byte[] response) {
    // called when response HTTP status is "200 OK"
}

@Override
public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) {
    // called when response HTTP status is "4XX" (eg. 401, 403, 404)
}

@Override
public void onRetry(int retryNo) {
    // called when request is retried
}
});

5.Display Images: If you have already use or extend CommonApplication,you can use like this: ImageLoader.getInstance().displayImage((imageUri, imageView));

Or for some advantage usage:

imageLoader.displayImage(imageUri, imageView, displayOptions, new ImageLoadingListener() 	{
    @Override
	public void onLoadingStarted(String imageUri, View view) {
    	...
	}
	@Override
	public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
        ...
    }
    @Override
    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
    ...
    }
    @Override
    public void onLoadingCancelled(String imageUri, View view) {
     ...
     }
}, new ImageLoadingProgressListener() {
 @Override
 public void onProgressUpdate(String imageUri, View view, int current, int total) {
 ...
 }
});

// Load image, decode it to Bitmap and return Bitmap to callback
ImageSize targetSize = new ImageSize(120, 80); // result Bitmap will be fit to this size
imageLoader.loadImage(imageUri, targetSize, displayOptions, new 	SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
    // Do whatever you want with Bitmap
}
});	

Acceptable URIs examples:

String imageUri = "http://site.com/image.png"; // from Web
String imageUri = "file:///mnt/sdcard/image.png"; // from SD card
String imageUri = "content://media/external/audio/albumart/13"; // from content provider
String imageUri = "assets://image.png"; // from assets
String imageUri = "drawable://" + R.drawable.image; // from drawables (only images, 	non-9patch)

NOTE: Use drawable:// only if you really need it! Always consider the native way to load drawables - ImageView.setImageResource(...) instead of using of ImageLoader.

6.ORM:

The Orm Module of the framework contains both GreenDao and ActiveRecord.

You can choose either of them freely.

Please set the ides before you run the demo apps.

UltimateAndroid depends on appcompat.UltimateAndroidUi depends on UltimateAndroid.And the DemoOfUi is depends on UltimateAndroidUi.

However,if you want to use UltimateAndroid without the UIModules,you can just depend on UltimateAndroid and this will make the app more flexible.

##UI Modules

  • Support animations for Android 2.3
  • EnhanceListView for listview which can swipe to dismiss the item
  • Shimmer and Titanic to let the textview more amazing
  • SmoothProgressBar to let the progress bar like Gmail or Google +
  • Flip View for implementing flipping between views as seen in the popular Flipboard application
  • PhotoView to help produce an easily usable implementation of a zooming Android ImageView
  • PagerSlidingTabStrip and ViewPagerIndicator to help customing View Pager more easily.
  • SwipeBackLayout to help you finish a activity by swipe the screen.
    And there are also many UI modules which I do not mention here.

简介


####框架目前主要包含的功能有View Injection,ORM,异步网络请求和图片加载,自动化脚本测试,磁盘LRU等功能.同时提供了类似于TripleDes、Webview快速设置、Md5处理、String处理,Https处理等常用工具类,还有多种UI控件效果。并且这些功能正在逐步增加中。

使用DemoOfUI的时候,需要注意UltimateAndroid 依赖 appcompat.UltimateAndroidUi 依赖 UltimateAndroid.DemoOfUi 依赖 UltimateAndroidUi.如果你不需要使用UiModule的话,可以直接依赖UltimateAndroid,这样体积会更纤细。Demo的Apk文件可以直接下载使用.

UI截图在这里

#####Welcome to fork.

###QQ交流群:341970175(请注明Android开发)

Demo 使用方法

Demo依赖于appcompat 和 UltimateAndroid,你可以在IDE或者配置文件里面添加一下依赖。

###快速入门(基础使用) 1.如果这是您第一次使用UltimateAndroid,你可以使用CommonApplication作为Android App的Application或者使用自定义的Application继承CommonApplication。

2.由于框架使用了View Injection,大部分IDE需要开启annotation的编译(使用了Butter Knife),如果不清楚如何开启可以看一下IntelliJ IDEA Configuration for Butter Knife or Eclipse Configuration for butter Knife.

3.视图注入:

Example:

class ExampleActivity extends Activity {
@InjectView(R.id.title) TextView title;
@InjectView(R.id.subtitle) TextView subtitle;
@InjectView(R.id.footer) TextView footer;

@Override public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.simple_activity);
	ButterKnife.inject(this);
	// TODO Use "injected" views...
  }
}

Another use is simplifying the view holder pattern inside of a list adapter.

public class MyAdapter extends BaseAdapter {
@Override public View getView(int position, View view, ViewGroup parent) {
	ViewHolder holder;
	if (view != null) {
  	holder = (ViewHolder) view.getTag();
	} else {
  	view = inflater.inflate(R.layout.whatever, parent, false);
  	holder = new ViewHolder(view);
  	view.setTag(holder);
	}
	holder.name.setText("John Doe");
	// etc...
	return view;
	}
	static class ViewHolder {
	@InjectView(R.id.title) TextView name;
	@InjectView(R.id.job_title) TextView jobTitle;
	public ViewHolder(View view) {
	ButterKnife.inject(this, view);
  }
  }
}	

4.异步网络请求: 使用异步网络请求工具,你不需要在额外的声明Thread来进行网络请求。

HttpUtilsAsync.get("http://www.google.com", new AsyncHttpResponseHandler() {

@Override
public void onStart() {
    // called before request is started
}

@Override
public void onSuccess(int statusCode, Header[] headers, byte[] response) {
    // called when response HTTP status is "200 OK"
}

@Override
public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) {
    // called when response HTTP status is "4XX" (eg. 401, 403, 404)
}

@Override
public void onRetry(int retryNo) {
    // called when request is retried
}
});

Post request:

HttpUtilsAsync.post("http://www.google.com", new AsyncHttpResponseHandler() {

@Override
public void onStart() {
    // called before request is started
}

@Override
public void onSuccess(int statusCode, Header[] headers, byte[] response) {
    // called when response HTTP status is "200 OK"
}

@Override
public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) {
    // called when response HTTP status is "4XX" (eg. 401, 403, 404)
}

@Override
public void onRetry(int retryNo) {
    // called when request is retried
}
});

5.显示图片: 如果你已经使用或继承了CommonApplication,你可以如下使用: ImageLoader.getInstance().displayImage((imageUri, imageView));

或者高级使用:

imageLoader.displayImage(imageUri, imageView, displayOptions, new ImageLoadingListener() 	{
    @Override
	public void onLoadingStarted(String imageUri, View view) {
    	...
	}
	@Override
	public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
        ...
    }
    @Override
    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
    ...
    }
    @Override
    public void onLoadingCancelled(String imageUri, View view) {
     ...
     }
}, new ImageLoadingProgressListener() {
 @Override
 public void onProgressUpdate(String imageUri, View view, int current, int total) {
 ...
 }
});

// Load image, decode it to Bitmap and return Bitmap to callback
ImageSize targetSize = new ImageSize(120, 80); // result Bitmap will be fit to this size
imageLoader.loadImage(imageUri, targetSize, displayOptions, new 	SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
    // Do whatever you want with Bitmap
}
});	

可以使用的URI格式:

String imageUri = "http://site.com/image.png"; // from Web
String imageUri = "file:///mnt/sdcard/image.png"; // from SD card
String imageUri = "content://media/external/audio/albumart/13"; // from content provider
String imageUri = "assets://image.png"; // from assets
String imageUri = "drawable://" + R.drawable.image; // from drawables (only images, 	non-9patch)

NOTE: Use drawable:// only if you really need it! Always consider the native way to load drawables - ImageView.setImageResource(...) instead of using of ImageLoader.

6.ORM:

Orm模块包括GreenDao and ActiveRecord.

你可以自由选择两者中的一个。

##UI 模块

  • 支持Android2.3 上面的动画效果

  • Listview的滑动删除

  • 动态的textview

  • 类似Gmail和Google+的进度条

  • 类似FlipBoard的翻页效果

  • 放大缩写图片的模块

  • 影视效果的图片

  • 更方便的定制ViewPager

  • 滑动后退

    还有许多其他模块没有提到

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

tutorials2

The UltimateAndroid use many opensource program and I am very grateful to the author of them. The opensource program which I use:

1.JakeWharton's Butter Knife for View Injection.

2.loopj's Asynchronous Http Client for Android.

3.nostra13's Universal Image Loader for Android

4.greenrobot's greenDAO

5.pardom's ActiveAndroid

6.JakeWharton's DiskLruCache

7.Issacw0ng's SwipeBackLayout

8.google-gson

9.RobotiumTech's robotium

10.JakeWharton's NineOldAndroids

11.JakeWharton's Android-ViewPagerIndicator

If there's anything I forgot to mention,I would be very appreciated for helping me notice it.

And there are also many useful feature like TripleDes Utils,WebViewUtils,Md5Utils etc.

TripleDes Utils,WebViewUtils,Md5Utils

目前主要包含的功能有View Injection,ORM,异步网络请求和图片加载,自动化脚本测试,磁盘LRU等功能,同时提供了类似于TripleDes、Webview快速设置、Md5 处理、String处理等常用工具类,还有类似于滑动返回、带动画的expandable listview等UI效果,以及类似于圆角图片,图像模糊等多种 控件效果。并且这些功能正在逐步增加中。

欢迎各种fork与提意见。

如果大家有需要的功能,欢迎随时提意见。

License

Copyright 2014 Marshal Chen

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.

=======

ultimateandroid's People

Contributors

cymcsg avatar

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.