Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Up to now,I have only write the demo of most parts of UI modules and View Inject

UltimateAndroidUi project now has four separate ui projects:widget,component,animations and lollipop. So if you want to only use part of the ui project you can simply use the separate project. However if you want to use all of them, you can also use the UltimateAndroidUi project.

facebook/fresco is integrated into the framework,this provides a new image loading plan. Fresco is a powerful system for displaying images in Android applications. Fresco takes care of image loading and display, so you don't have to. It will load images from the network, local storage, or local resources, and display a placeholder until the image has arrived. It has two levels of cache; one in memory and another in internal storage.

[Update Log](https://github.com/cymcsg/UltimateAndroid/blob/master/updateLog.md)


Expand Down Expand Up @@ -326,6 +328,72 @@ String imageUri = "drawable://" + R.drawable.image; // from drawables (only imag
You can read the documents of [GreenDao](https://github.com/greenrobot/greenDAO)


7.A new scheme for display Images

If you have already use or extend CommonApplication,you can use like this:

``` //circle image and set a placeholder image
FrescoHelper.load(Uri.parse(imageUrl))
.placeholder(CommonUtil.getDrawable(R.drawable.ic_image3))
.circle()
.into(simple_drawee_view);```

Or for some advantage usage:

FrescoHelper.load(Uri.parse(imageUrl))
.placeholder(CommonUtil.getDrawable(R.drawable.ic_image3))
.circle()
.into(simple_drawee_view, new ControllerListener<Object>() {
@Override
public void onSubmit(String s, Object o) {
...
}
@Override
public void onFinalImageSet(String s, Object o, Animatable animatable) {
...
}
@Override
public void onIntermediateImageSet(String s, Object o) {
...
}
@Override
public void onIntermediateImageFailed(String s, Throwable throwable) {
...
}
@Override
public void onFailure(String s, Throwable throwable) {
...
}
@Override
public void onRelease(String s) {
...
}
}, new Postprocessor() {
@Override
public CloseableReference<Bitmap> process(Bitmap bitmap, PlatformBitmapFactory platformBitmapFactory) {
return null;
}
@Override
public String getName() {
return null;
}
@Override
public CacheKey getPostprocessorCacheKey() {
return null;
}
});

Acceptable URIs examples:

``` java
String imageUri = "http://site.com/image.png"; // from Web
String imageUri = "https://static.pexels.com/photos/6789/flowers-petals-gift-flower-medium.jpg"; // from SSL 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 = "res://package name(any String or "")/" + R.drawable.ic_launcher
```


## UI Modules

Expand Down Expand Up @@ -367,6 +435,8 @@ You can read the documents of [GreenDao](https://github.com/greenrobot/greenDAO)

UltimateUI 项目分拆成widget,component,animations,lollipop 4个子项目,如果你只需要部分UI效果的话,你可以只依赖这些子项目.如果你想使用多个种类的UI项目的话,也可以简单的依赖UltimateAndroidUi项目(当然,你也可以依赖4个子项目)。

将facebook/fresco集成入框架中,这提供了一种新的图片加载方案。此框架加载图片的效率更高,会自动处理包括显示占位图直到加载完成、下载图片、缓存图片、图片不再显示时,从内存中移除等等功能。

[UI截图在这里](#demo_of_ui)

[部分UI模块介绍](http://arccode.net/2015/02/03/UltimateAndroid-demo%E6%95%88%E6%9E%9C%E5%9B%BE%E6%96%87%E6%A1%A3-%E4%B8%80/)(感谢arccode)
Expand Down Expand Up @@ -627,6 +697,72 @@ String imageUri = "drawable://" + R.drawable.image; // from drawables (only imag
可以查看Greendao的文档 :[GreenDao](https://github.com/greenrobot/greenDAO)


7.新的图片加载方案

如果你已经使用或继承了CommonApplication,你可以如下使用:

``` //圆形图片,并设置占位图
FrescoHelper.load(Uri.parse(imageUrl))
.placeholder(CommonUtil.getDrawable(R.drawable.ic_image3))
.circle()
.into(simple_drawee_view);```

或者高级使用:

FrescoHelper.load(Uri.parse(imageUrl))
.placeholder(CommonUtil.getDrawable(R.drawable.ic_image3))
.circle()
.into(simple_drawee_view, new ControllerListener<Object>() {
@Override
public void onSubmit(String s, Object o) {
...
}
@Override
public void onFinalImageSet(String s, Object o, Animatable animatable) {
...
}
@Override
public void onIntermediateImageSet(String s, Object o) {
...
}
@Override
public void onIntermediateImageFailed(String s, Throwable throwable) {
...
}
@Override
public void onFailure(String s, Throwable throwable) {
...
}
@Override
public void onRelease(String s) {
...
}
}, new Postprocessor() {
@Override
public CloseableReference<Bitmap> process(Bitmap bitmap, PlatformBitmapFactory platformBitmapFactory) {
return null;
}
@Override
public String getName() {
return null;
}
@Override
public CacheKey getPostprocessorCacheKey() {
return null;
}
});

可以使用的URI格式:

``` java
String imageUri = "http://site.com/image.png"; // from Web
String imageUri = "https://static.pexels.com/photos/6789/flowers-petals-gift-flower-medium.jpg"; // from SSL 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 = "res://package name(any String or "")/" + R.drawable.ic_launcher
```


## UI 模块

Expand Down
2 changes: 2 additions & 0 deletions UltimateAndroidGradle/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ android {
targetSdkVersion 23
versionCode 1
versionName "1.0"

multiDexEnabled true
}
buildTypes {
release {
Expand Down
6 changes: 4 additions & 2 deletions UltimateAndroidGradle/demoofui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ android {
defaultConfig {
applicationId "com.marshalchen.common.demoofui"
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 23
versionCode 5
versionName "1.0.4"
renderscriptTargetApi 22
renderscriptSupportModeEnabled true

multiDexEnabled true
}

signingConfigs {
Expand Down Expand Up @@ -83,5 +85,5 @@ dependencies {
compile project(':ultimateandroiduilollipop')
// compile 'com.marshalchen.ultimateandroid:ultimateandroidui:0.6.0'
compile 'com.android.support:percent:23.1.0'

compile 'com.android.support:multidex:1.0.1'
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.marshalchen.common.demoofui;

import android.app.Application;
import android.support.multidex.MultiDexApplication;

import com.marshalchen.common.commonUtils.urlUtils.UniversalImageLoader;
import com.marshalchen.common.uimodule.customFonts.CalligraphyConfig;
import com.marshalchen.common.uimodule.passcodelock.AppLockManager;
Expand All @@ -10,7 +12,7 @@
/**
* Created by cym on 14-4-30.
*/
public class CommonApplication extends Application {
public class CommonApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Dec 13 21:22:23 CST 2014
#Mon Oct 26 10:45:18 CST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
6 changes: 4 additions & 2 deletions UltimateAndroidGradle/ultimateandroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ android {

defaultConfig {
// applicationId "com.marshalchen.common"
minSdkVersion 8
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"

multiDexEnabled true
}
buildTypes {
release {
Expand Down Expand Up @@ -46,7 +48,7 @@ dependencies {
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'

compile 'com.facebook.fresco:fresco:0.8.0'
compile 'com.marshalchen.ultimaterecyclerview:library:0.3.6'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.nineoldandroids:library:2.4.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.marshalchen.common;

import android.app.Application;

import com.marshalchen.common.commonUtils.urlUtils.FrescoHelper;
import com.marshalchen.common.commonUtils.urlUtils.ImagePipelineConfigFactory;
import com.marshalchen.common.commonUtils.urlUtils.UniversalImageLoader;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
Expand All @@ -16,6 +19,9 @@ public void onCreate() {
// Create global configuration and initialize ImageLoader with this configuration
ImageLoaderConfiguration config = UniversalImageLoader.getDefaultImageLoaderConfiguration(getApplicationContext());
ImageLoader.getInstance().init(config);

// Initialize Fresco
FrescoHelper.init(getApplicationContext(), ImagePipelineConfigFactory.getImagePipelineConfig(getApplicationContext()));
}

@Override
Expand Down
Loading