Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop caprice #91

Merged
merged 87 commits into from
Dec 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
9caf42c
Merge branch 'master' into develop-caprice
qiujuer May 13, 2016
b4c8ef8
Change start state onSizeChange callback to Fixed #76
qiujuer May 13, 2016
16fb66a
change the kit-handler module logic and add license
qiujuer May 20, 2016
6bcf29b
add gradle local version files
qiujuer May 21, 2016
f91049a
Add background thread handler run, and improve the method jurisdiction
qiujuer May 21, 2016
392608b
build new kit-handler in this we can support result to option cancel …
qiujuer May 22, 2016
2bca0f2
clear the deprecated module
qiujuer May 22, 2016
454b828
Fixed the return is null bug
qiujuer May 22, 2016
f6f4e00
add unchecked notify
qiujuer May 22, 2016
6bcfda4
Fixed the EditText animation run exception
qiujuer May 22, 2016
ae8627f
import to new gradle version build, to release #65
qiujuer May 22, 2016
dd9415d
add new module graphics
qiujuer May 29, 2016
fa3e326
fixed #78 the button not support set xml background="#colorvalue"
qiujuer Jun 1, 2016
4a3a5cd
remove aother use method by Ui class
qiujuer Jun 1, 2016
121d32b
update gradle version
qiujuer Jun 26, 2016
6dec060
fixed #79 Loading widget support padding, and improve the view
qiujuer Jun 26, 2016
4fb339b
improve the ui module #80 , remove dependency the res module
qiujuer Jun 26, 2016
ddfdec8
change the loading widget background to transparent color
qiujuer Jun 26, 2016
939263d
fixed the #79 , residual drawing color
qiujuer Jun 26, 2016
84eb2d2
update the sample app
qiujuer Jun 26, 2016
c812506
fixed the #79 twinkle on start
qiujuer Jun 27, 2016
c5ffbe0
change the default colors
qiujuer Jul 1, 2016
afcb367
update genius version to beta6
qiujuer Jul 1, 2016
2a61225
update app layout
qiujuer Jul 1, 2016
48cd19a
update the sample app style
qiujuer Jul 7, 2016
7684753
improve the TextView widget update the setBorder method in #65
qiujuer Jul 7, 2016
2aa7790
update he TextView getColor method logic
qiujuer Jul 7, 2016
1ea956a
we redo the enhancement #25
qiujuer Jul 7, 2016
4ca0377
update gradle version
qiujuer Jul 9, 2016
4a3410f
change the TextView to use
qiujuer Jul 9, 2016
b12ccc5
change the loading run style attr name
qiujuer Jul 10, 2016
83ee434
add some method notes Loading widget
qiujuer Jul 10, 2016
b6a0df8
add some default color
qiujuer Jul 10, 2016
8a69fd4
change the loading init logic
qiujuer Jul 10, 2016
15decbd
Loading widget add Line Style
qiujuer Jul 11, 2016
aeabc6f
update loading drawable license
qiujuer Jul 11, 2016
db9f614
add loading widget line style, and change the background color #65
qiujuer Jul 11, 2016
d1dd0fe
publish ui new version 2.0.0-beta7 #65
qiujuer Jul 11, 2016
c2dcee1
Merge branch 'master' into develop-caprice-v2
qiujuer Jul 12, 2016
91433cb
add gInterceptEvent attires
qiujuer Aug 4, 2016
c9c2303
change the gradle version
qiujuer Aug 5, 2016
4e41308
change the gitignore
qiujuer Aug 5, 2016
cbc3faf
transfer ndk build tool to cmake
qiujuer Aug 5, 2016
a6153e6
improve the Loading widget draw logic
qiujuer Aug 5, 2016
f4e7ef8
change the Loading widget default size
qiujuer Aug 5, 2016
c4c5923
publish beta version 2.0.0-beta8
qiujuer Aug 5, 2016
a7c1c50
Merge branch 'master' into develop-caprice-v2
qiujuer Aug 5, 2016
6726e8d
improve the TouchEddectDrawable fluency on scroll view
qiujuer Aug 5, 2016
1843a3e
change the build version and change the gradle version
qiujuer Aug 15, 2016
bf9f8a4
Change Button read style logic
qiujuer Sep 18, 2016
de64267
Improve UiCompatNotCrash class and Licensed information
qiujuer Sep 18, 2016
a5c341c
remove StateColorDrawable changeColor check
qiujuer Sep 18, 2016
c5f9438
remove Ui.java getColorsFromArrayRes check null
qiujuer Sep 18, 2016
a2e6b2a
improve Button TouchEffectDrawable initial logic and remove some method
qiujuer Sep 18, 2016
3cedb3c
Change project build version
qiujuer Sep 18, 2016
1f26c02
Improve Button widget and Fixed #86 bug
qiujuer Sep 19, 2016
1602d6c
Improve ImageView to fixed #86 bug
qiujuer Sep 19, 2016
2e49609
Improve FloatActionButton widget, change initial and get System enabl…
qiujuer Sep 19, 2016
ec37194
Change AbsSeekBar get "enable" attr logic
qiujuer Sep 19, 2016
860dc5a
Change EditText set setBackground logic
qiujuer Sep 19, 2016
1b898ef
Change ImageView get enabled attr logic by self
qiujuer Sep 19, 2016
80ab1ea
Change activity theme
qiujuer Sep 20, 2016
a1d1a79
change style and change activity widget xml
qiujuer Sep 20, 2016
416255d
change gradle version
qiujuer Sep 20, 2016
4edfa2b
improve FloatActionButton draw logic
qiujuer Sep 20, 2016
8ab00c7
Merge branch 'master' into develop-caprice-v2-effect
qiujuer Oct 21, 2016
d142eb6
Change gradle version
qiujuer Oct 22, 2016
fec4b7a
Change Reflector to add getActualTypeArguments method
qiujuer Oct 22, 2016
64397bf
Change Reflector test case
qiujuer Oct 22, 2016
6e9b0ab
Change ParameterizeTypeActualArgsDelegate to final
qiujuer Oct 22, 2016
51b9d57
Change FloatActionButton setTouchColor
qiujuer Oct 22, 2016
1a2fa5d
Add gradle-jcenter-push.gradle sign bool check
qiujuer Oct 22, 2016
bb68903
Change all project version and name
qiujuer Oct 22, 2016
bb4ae34
Change project version
qiujuer Dec 1, 2016
59f9018
Add InterceptEvent attr support
qiujuer Dec 1, 2016
8405f27
Change TouchEffectDrawable Interpolator values
qiujuer Dec 4, 2016
df8372f
Improve the genius-widget some ui code
qiujuer Dec 12, 2016
43d1781
Change sample codes
qiujuer Dec 14, 2016
3e461f9
Update gradle version to 3.2
qiujuer Dec 14, 2016
99fc0e4
Improve TouchEdddect Drawable
qiujuer Dec 14, 2016
53961f4
Improve handler some class
qiujuer Dec 14, 2016
728b1f9
Remove some unused values
qiujuer Dec 14, 2016
52319d4
Remove some unused values
qiujuer Dec 15, 2016
ffe4959
Remove some unused values
qiujuer Dec 15, 2016
e71baa1
Change graphics lib code to support clip image to blur
qiujuer Dec 20, 2016
326a91e
Merge pull request #89 from qiujuer/develop-caprice-v2-effect
qiujuer Dec 20, 2016
9270380
Merge pull request #90 from qiujuer/develop-caprice-v2
qiujuer Dec 20, 2016
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
14 changes: 0 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
/caprice/.idea/
/caprice/.gradle/
/caprice/.DS_Store/
/caprice/gradle/
/caprice/build/
/caprice/blur/build/
/caprice/kit/build/
/caprice/res/build/
/caprice/ui/build/
/caprice/sample/build/
/caprice/local.properties
/caprice/gradlew
/caprice/gradlew.bat

/steady/.idea/
/steady/.gradle/
/steady/.DS_Store/
Expand Down
10 changes: 4 additions & 6 deletions caprice/.gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
*.iml
.idea
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
.idea/
*.iml
/captures
/gradle
gradlew
gradlew.bat
.externalNativeBuild
22 changes: 0 additions & 22 deletions caprice/README.md

This file was deleted.

File renamed without changes.
37 changes: 37 additions & 0 deletions caprice/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion ANDROID_BUILD_SDK_VERSION as int
buildToolsVersion ANDROID_BUILD_TOOLS_VERSION

defaultConfig {
applicationId "net.qiujuer.sample.genius"
minSdkVersion ANDROID_BUILD_MIN_SDK_VERSION as int
targetSdkVersion ANDROID_BUILD_TARGET_SDK_VERSION as int
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':graphics')
compile project(':res')
compile project(':ui')
compile project(':kit-cmd')
compile project(':kit-reflect')
compile project(':kit-handler')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:23.4.0'
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.qiujuer.sample.genius;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.MediumTest;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;


import static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@MediumTest
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentationTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("net.qiujuer.sample.genius", appContext.getPackageName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.qiujuer.sample.genius">

<!-- 网络 权限 -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- 日志写文件 权限 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- getDeviceId 权限 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -27,11 +19,19 @@
</activity>
<activity
android:name=".BlurActivity"
android:label="@string/title_activity_blur" />
android:label="@string/title_activity_blur"
android:theme="@style/AppTheme" />
<activity
android:name=".KitActivity"
android:label="@string/title_activity_kit" />
<activity android:name=".SeekBarActivity" />
android:label="@string/title_activity_kit"
android:theme="@style/AppTheme" />
<activity
android:name=".SeekBarActivity"
android:label="@string/title_activity_seek"
android:theme="@style/AppTheme" />
<activity
android:name=".BlurClipActivity"
android:theme="@style/AppTheme.FullScreen" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import android.widget.ImageView;
import android.widget.TextView;

import net.qiujuer.genius.blur.StackBlur;
import net.qiujuer.genius.graphics.Blur;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;


public class BlurActivity extends AppCompatActivity {
Expand Down Expand Up @@ -42,10 +45,40 @@ protected void onResume() {
applyBlur();
}

private static Bitmap codec(Bitmap src, Bitmap.CompressFormat format,
int quality) {
ByteArrayOutputStream os = new ByteArrayOutputStream();
src.compress(format, quality, os);

byte[] array = os.toByteArray();
return BitmapFactory.decodeByteArray(array, 0, array.length);
}

private Bitmap compressImage(Bitmap image) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.PNG, 100, baos);//质量压缩方法,这里100表示不压缩,把压缩后的数据存放到baos中
int options = 100;
while (baos.toByteArray().length / 1024 > 100) { //循环判断如果压缩后图片是否大于100kb,大于继续压缩
baos.reset();//重置baos即清空baos
image.compress(Bitmap.CompressFormat.JPEG, options, baos);//这里压缩options%,把压缩后的数据存放到baos中
options -= 10;//每次都减少10
}
ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());//把压缩后的数据baos存放到ByteArrayInputStream中
BitmapFactory.Options options1 = new BitmapFactory.Options();
options1.inPreferredConfig = Bitmap.Config.RGB_565;
Bitmap bitmap = BitmapFactory.decodeStream(isBm, null, options1);//把ByteArrayInputStream数据生成图片
return bitmap;
}


private void initBlur() {
// Find Bitmap
mBitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_blur);
//Bitmap.Config config = mBitmap.getConfig();
//mBitmap = mBitmap.copy(Bitmap.Config.RGB_565, true);
//mBitmap = compressImage(mBitmap);


mImageJava = (ImageView) findViewById(R.id.image_blur_java);
mImageJniPixels = (ImageView) findViewById(R.id.image_blur_jni_pixels);
mImageJniBitmap = (ImageView) findViewById(R.id.image_blur_jni_bitmap);
Expand All @@ -61,6 +94,8 @@ private void initBlur() {
mCompressBitmap = Bitmap.createBitmap(mBitmap, 0, 0,
mBitmap.getWidth(), mBitmap.getHeight(), matrix, true);

mCompressBitmap = mCompressBitmap.copy(Bitmap.Config.RGB_565, true);

// Set On OnCheckedChangeListener
CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox_blur_isCompress);
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
Expand Down Expand Up @@ -117,21 +152,29 @@ else if (i == 3)

// Is Compress
float radius = 20;
Bitmap overlay = mBitmap;
Bitmap overlay = mBitmap.copy(mBitmap.getConfig(), true);
if (mCompress) {
radius = 3;
overlay = mCompressBitmap;
overlay = mCompressBitmap.copy(mCompressBitmap.getConfig(), true);
}

// Java
if (i == 1)
overlay = StackBlur.blur(overlay, (int) radius, false);
// Bitmap JNI Native
else if (i == 2)
overlay = StackBlur.blurNatively(overlay, (int) radius, false);

if (i == 1) {
// Java
overlay = Blur.onStackBlurJava(overlay, (int) radius);
} else if (i == 2) {
// Pixels JNI Native
else if (i == 3)
overlay = StackBlur.blurNativelyPixels(overlay, (int) radius, false);
int w = overlay.getWidth();
int h = overlay.getHeight();
int[] pix = new int[w * h];
overlay.getPixels(pix, 0, w, 0, 0, w, h);
// Jni Pixels Blur
pix = Blur.onStackBlurPixels(pix, w, h, (int) radius);
overlay.setPixels(pix, 0, w, 0, 0, w, h);
} else if (i == 3) {
// Bitmap JNI Native
overlay = Blur.onStackBlur(overlay, (int) radius);
}

// Show
showDrawable(view, overlay);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package net.qiujuer.sample.genius;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;

import net.qiujuer.genius.graphics.Blur;

public class BlurClipActivity extends AppCompatActivity {
private Bitmap mSrc1;
private Bitmap mSrc2;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_blur_clip);

try {
// Find Bitmap
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.walkthrough);
mSrc1 = bitmap.copy(bitmap.getConfig(), true);
mSrc2 = bitmap.copy(bitmap.getConfig(), true);
bitmap.recycle();
} catch (OutOfMemoryError error) {
error.printStackTrace();
finish();
}

findViewById(R.id.btn_todo1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clipBlur();
}
});
findViewById(R.id.btn_todo2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
blur();
}
});
findViewById(R.id.btn_clear).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clear();
}
});
}

private void clear() {
Drawable drawable = ((ImageView) findViewById(R.id.iv_show1)).getDrawable();
if (drawable != null && drawable instanceof BitmapDrawable) {
((ImageView) findViewById(R.id.iv_show1)).setImageDrawable(null);
((BitmapDrawable) drawable).getBitmap().recycle();
}
}

private void clipBlur() {
((ImageView) findViewById(R.id.iv_show1)).setImageBitmap(Blur.onStackBlurClip(mSrc1, 120));
}

private void blur() {
((ImageView) findViewById(R.id.iv_show1)).setImageBitmap(Blur.onStackBlur(mSrc2, 120));
}


@Override
protected void onDestroy() {
super.onDestroy();
if (mSrc1 != null && !mSrc1.isRecycled())
mSrc1.recycle();
if (mSrc2 != null && !mSrc2.isRecycled())
mSrc2.recycle();

System.gc();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import android.view.View;
import android.widget.TextView;

import net.qiujuer.genius.kit.Kit;
import net.qiujuer.genius.kit.cmd.Cmd;
import net.qiujuer.genius.kit.cmd.Command;
import net.qiujuer.genius.kit.cmd.DnsResolve;
Expand Down Expand Up @@ -57,9 +56,9 @@ protected void onCreate(Bundle savedInstanceState) {
}

private void init() {
Application kitApp = Kit.getApplication();
//Application kitApp = Kit.getApplication();
Application application = getApplication();
showLog(TAG, "Kit.getApplication() eq getApplication() is:" + (kitApp == application));
//showLog(TAG, "Kit.getApplication() eq getApplication() is:" + (kitApp == application));
Cmd.init(application);
}

Expand Down
Loading