Skip to content

Commit 3f99ffa

Browse files
committed
setup lib
1 parent f84de76 commit 3f99ffa

File tree

89 files changed

+1475
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1475
-0
lines changed

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/app.iml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="android-gradle" name="Android-Gradle">
5+
<configuration>
6+
<option name="GRADLE_PROJECT_PATH" value=":app" />
7+
</configuration>
8+
</facet>
9+
<facet type="android" name="Android">
10+
<configuration>
11+
<option name="SELECTED_BUILD_VARIANT" value="debug" />
12+
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
13+
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
14+
<afterSyncTasks>
15+
<task>generateDebugSources</task>
16+
</afterSyncTasks>
17+
<option name="ALLOW_USER_CONFIGURATION" value="false" />
18+
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
19+
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
20+
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
21+
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
22+
</configuration>
23+
</facet>
24+
</component>
25+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
26+
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
27+
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
28+
<exclude-output />
29+
<content url="file://$MODULE_DIR$">
30+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
31+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
32+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
33+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
34+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
35+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
36+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
37+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
38+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
39+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
40+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
41+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
42+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
43+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
44+
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
45+
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
46+
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
47+
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
48+
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
49+
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
50+
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
51+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
52+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
53+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
54+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
55+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
56+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
57+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
58+
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
59+
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
60+
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
61+
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
62+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
63+
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
64+
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
65+
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
66+
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
67+
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
68+
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
69+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
70+
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
71+
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
72+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
73+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
74+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
75+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
76+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
77+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
78+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
79+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
80+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
81+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
82+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
83+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
84+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
85+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
86+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
87+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
88+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
89+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
90+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
91+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
92+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
93+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
94+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
95+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
96+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
97+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
98+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
99+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
100+
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
101+
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
102+
</content>
103+
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
104+
<orderEntry type="sourceFolder" forTests="false" />
105+
<orderEntry type="library" exported="" scope="TEST" name="runner-0.5" level="project" />
106+
<orderEntry type="library" exported="" scope="TEST" name="espresso-idling-resource-2.2.2" level="project" />
107+
<orderEntry type="library" exported="" name="constraint-layout-1.0.2" level="project" />
108+
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-library-1.3" level="project" />
109+
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-integration-1.3" level="project" />
110+
<orderEntry type="library" exported="" name="support-core-ui-25.3.1" level="project" />
111+
<orderEntry type="library" exported="" scope="TEST" name="jsr305-2.0.1" level="project" />
112+
<orderEntry type="library" exported="" name="support-core-utils-25.3.1" level="project" />
113+
<orderEntry type="library" exported="" name="support-fragment-25.3.1" level="project" />
114+
<orderEntry type="library" exported="" scope="TEST" name="espresso-core-2.2.2" level="project" />
115+
<orderEntry type="library" exported="" scope="TEST" name="exposed-instrumentation-api-publish-0.5" level="project" />
116+
<orderEntry type="library" exported="" scope="TEST" name="rules-0.5" level="project" />
117+
<orderEntry type="library" exported="" name="constraint-layout-solver-1.0.2" level="project" />
118+
<orderEntry type="library" exported="" scope="TEST" name="javax.annotation-api-1.2" level="project" />
119+
<orderEntry type="library" exported="" scope="TEST" name="javax.inject-1" level="project" />
120+
<orderEntry type="library" exported="" scope="TEST" name="javawriter-2.1.1" level="project" />
121+
<orderEntry type="library" exported="" name="support-v4-25.3.1" level="project" />
122+
<orderEntry type="library" exported="" name="support-media-compat-25.3.1" level="project" />
123+
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
124+
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
125+
<orderEntry type="library" exported="" name="support-annotations-25.3.1" level="project" />
126+
<orderEntry type="library" exported="" name="appcompat-v7-25.3.1" level="project" />
127+
<orderEntry type="library" exported="" name="support-vector-drawable-25.3.1" level="project" />
128+
<orderEntry type="library" exported="" name="support-compat-25.3.1" level="project" />
129+
<orderEntry type="library" exported="" name="animated-vector-drawable-25.3.1" level="project" />
130+
<orderEntry type="module" module-name="progressimageview" exported="" />
131+
<orderEntry type="library" exported="" name="picasso-2.5.2" level="project" />
132+
</component>
133+
</module>

app/build.gradle

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 25
5+
buildToolsVersion "25.0.2"
6+
defaultConfig {
7+
applicationId "safety.com.br.progress_image_view"
8+
minSdkVersion 15
9+
targetSdkVersion 25
10+
versionCode 1
11+
versionName "1.0"
12+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
compile fileTree(dir: 'libs', include: ['*.jar'])
24+
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25+
exclude group: 'com.android.support', module: 'support-annotations'
26+
})
27+
compile 'com.android.support:appcompat-v7:25.3.1'
28+
compile 'com.android.support.constraint:constraint-layout:1.0.2'
29+
testCompile 'junit:junit:4.12'
30+
compile project(path: ':progressimageview')
31+
//compile 'com.squareup.picasso:picasso:2.5.2'
32+
}

app/proguard-rules.pro

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /home/gerente/Android/Sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
18+
19+
# Uncomment this to preserve the line number information for
20+
# debugging stack traces.
21+
#-keepattributes SourceFile,LineNumberTable
22+
23+
# If you keep the line number information, uncomment this to
24+
# hide the original source file name.
25+
#-renamesourcefileattribute SourceFile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package safety.com.br.progress_image_view;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumentation test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("safety.com.br.progress_image_view", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="safety.com.br.progress_image_view">
4+
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
7+
<application
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher_round"
12+
android:supportsRtl="true"
13+
android:theme="@style/AppTheme">
14+
<activity android:name=".MainActivity">
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN" />
17+
18+
<category android:name="android.intent.category.LAUNCHER" />
19+
</intent-filter>
20+
</activity>
21+
</application>
22+
23+
</manifest>
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
package safety.com.br.progress_image_view;
2+
3+
import android.graphics.Color;
4+
import android.os.Bundle;
5+
import android.support.v7.app.AppCompatActivity;
6+
7+
import com.squareup.picasso.MemoryPolicy;
8+
import com.squareup.picasso.NetworkPolicy;
9+
import com.squareup.picasso.Picasso;
10+
11+
import java.util.Timer;
12+
import java.util.TimerTask;
13+
14+
import safety.com.br.progressimageview.ProgressImageView;
15+
import safety.com.br.progressimageview.animations.CircleTransform;
16+
17+
public class MainActivity extends AppCompatActivity {
18+
19+
private ProgressImageView progressImageViewAutoHide;
20+
private ProgressImageView hideFromAEvent;
21+
private ProgressImageView progressImageOffSet;
22+
private ProgressImageView progressImageColorAndSize;
23+
24+
@Override
25+
protected void onCreate(Bundle savedInstanceState) {
26+
super.onCreate(savedInstanceState);
27+
setContentView(R.layout.activity_main);
28+
29+
progressImageViewAutoHide();
30+
31+
progressImageViewFromAEvent();
32+
33+
progressImageViewOffSet();
34+
35+
progressImageColorAndSize();
36+
}
37+
38+
private void progressImageColorAndSize() {
39+
progressImageColorAndSize = (ProgressImageView) findViewById(R.id.progress_image_view_color_and_size);
40+
41+
progressImageColorAndSize.showLoading().withAutoHide(false).withBorderColor(Color.RED).withBorderSize(10);
42+
43+
Picasso picasso = Picasso.with(MainActivity.this);
44+
picasso.invalidate("https://randomuser.me/api/portraits/men/83.jpg");
45+
picasso.load("https://randomuser.me/api/portraits/men/83.jpg")
46+
.transform(new CircleTransform())
47+
.memoryPolicy(MemoryPolicy.NO_CACHE)
48+
.networkPolicy(NetworkPolicy.NO_CACHE)
49+
.into(progressImageColorAndSize);
50+
51+
new Timer().schedule(new TimerTask() {
52+
@Override
53+
public void run() {
54+
progressImageColorAndSize.hideLoading();
55+
56+
}
57+
}, 5000);
58+
}
59+
60+
private void progressImageViewOffSet() {
61+
progressImageOffSet = (ProgressImageView) findViewById(R.id.progress_image_view_offset);
62+
63+
progressImageOffSet.showLoading().withAutoHide(false).withBorderColor(Color.BLUE).withOffset(10);
64+
65+
Picasso picasso = Picasso.with(MainActivity.this);
66+
picasso.invalidate("https://randomuser.me/api/portraits/men/83.jpg");
67+
picasso.load("https://randomuser.me/api/portraits/men/83.jpg")
68+
.transform(new CircleTransform())
69+
.memoryPolicy(MemoryPolicy.NO_CACHE)
70+
.networkPolicy(NetworkPolicy.NO_CACHE)
71+
.into(progressImageOffSet);
72+
73+
new Timer().schedule(new TimerTask() {
74+
@Override
75+
public void run() {
76+
progressImageOffSet.hideLoading();
77+
78+
}
79+
}, 5000);
80+
81+
}
82+
83+
private void progressImageViewFromAEvent() {
84+
hideFromAEvent = (ProgressImageView) findViewById(R.id.progress_image_view_hide);
85+
86+
hideFromAEvent.showLoading().withAutoHide(false).withBorderColor(Color.BLUE);
87+
88+
Picasso picasso = Picasso.with(MainActivity.this);
89+
picasso.invalidate("https://randomuser.me/api/portraits/men/83.jpg");
90+
picasso.load("https://randomuser.me/api/portraits/men/83.jpg")
91+
.transform(new CircleTransform())
92+
.memoryPolicy(MemoryPolicy.NO_CACHE)
93+
.networkPolicy(NetworkPolicy.NO_CACHE)
94+
.into(hideFromAEvent);
95+
96+
new Timer().schedule(new TimerTask() {
97+
@Override
98+
public void run() {
99+
hideFromAEvent.hideLoading();
100+
101+
}
102+
}, 5000);
103+
104+
}
105+
106+
private void progressImageViewAutoHide() {
107+
progressImageViewAutoHide = (ProgressImageView) findViewById(R.id.progress_image_view);
108+
progressImageViewAutoHide.showLoading();
109+
110+
Picasso picasso = Picasso.with(MainActivity.this);
111+
picasso.invalidate("http://blog.alura.com.br/wp-content/uploads/2016/06/java_capa.jpg");
112+
picasso.load("http://blog.alura.com.br/wp-content/uploads/2016/06/java_capa.jpg")
113+
.transform(new CircleTransform())
114+
.memoryPolicy(MemoryPolicy.NO_CACHE)
115+
.networkPolicy(NetworkPolicy.NO_CACHE)
116+
.into(progressImageViewAutoHide);
117+
}
118+
119+
}
3.93 KB
Loading

0 commit comments

Comments
 (0)