diff --git a/UltimateAndroidGradle/.gitignore b/UltimateAndroidGradle/.gitignore index afbdab33..257b2bbb 100644 --- a/UltimateAndroidGradle/.gitignore +++ b/UltimateAndroidGradle/.gitignore @@ -4,3 +4,4 @@ /.idea/libraries .DS_Store /build +/gradle.properties diff --git a/UltimateAndroidGradle/demoofui/src/main/java/com/marshalchen/common/demoofui/activityanimation/ActivityAnimationsActivity.java b/UltimateAndroidGradle/demoofui/src/main/java/com/marshalchen/common/demoofui/activityanimation/ActivityAnimationsActivity.java index 09af1252..61b12250 100644 --- a/UltimateAndroidGradle/demoofui/src/main/java/com/marshalchen/common/demoofui/activityanimation/ActivityAnimationsActivity.java +++ b/UltimateAndroidGradle/demoofui/src/main/java/com/marshalchen/common/demoofui/activityanimation/ActivityAnimationsActivity.java @@ -73,7 +73,7 @@ private void findViews() { } @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { //RadiozGroup的回调,监听checked change int id = buttonView.getId(); if(id == R.id.random_anim && isChecked) { mAnimationType = AnimatedRectLayout.ANIMATION_RANDOM; diff --git a/UltimateAndroidGradle/demoofui/src/main/java/com/marshalchen/common/demoofui/androidanimationsdemo/AndroidAnimationsDemoActivity.java b/UltimateAndroidGradle/demoofui/src/main/java/com/marshalchen/common/demoofui/androidanimationsdemo/AndroidAnimationsDemoActivity.java index 6fe89432..8259345e 100755 --- a/UltimateAndroidGradle/demoofui/src/main/java/com/marshalchen/common/demoofui/androidanimationsdemo/AndroidAnimationsDemoActivity.java +++ b/UltimateAndroidGradle/demoofui/src/main/java/com/marshalchen/common/demoofui/androidanimationsdemo/AndroidAnimationsDemoActivity.java @@ -35,7 +35,7 @@ protected void onCreate(Bundle savedInstanceState) { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { Techniques technique = (Techniques)view.getTag(); - rope = YoYo.with(technique) + rope = YoYo.with(technique) //设置动画 .duration(1200) .interpolate(new AccelerateDecelerateInterpolator()) .withListener(new Animator.AnimatorListener() { diff --git a/UltimateAndroidGradle/gradle.properties b/UltimateAndroidGradle/gradle.properties index 1d3591c8..daa261a8 100644 --- a/UltimateAndroidGradle/gradle.properties +++ b/UltimateAndroidGradle/gradle.properties @@ -1,18 +1,19 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. - +## Project-wide Gradle settings. +# # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html - +# # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - +# # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true +#Mon Dec 14 16:49:30 CST 2015 +systemProp.http.proxyPassword=hai123zhi456 +systemProp.http.proxyHost=hk.haizhi.me +systemProp.http.proxyUser=haizhi +systemProp.http.proxyPort=8089 diff --git a/UltimateAndroidGradle/ultimateandroiduianimation/src/main/java/com/marshalchen/common/uimodule/activityanimation/AnimatedRectLayout.java b/UltimateAndroidGradle/ultimateandroiduianimation/src/main/java/com/marshalchen/common/uimodule/activityanimation/AnimatedRectLayout.java index ba465f4d..fd545fd2 100755 --- a/UltimateAndroidGradle/ultimateandroiduianimation/src/main/java/com/marshalchen/common/uimodule/activityanimation/AnimatedRectLayout.java +++ b/UltimateAndroidGradle/ultimateandroiduianimation/src/main/java/com/marshalchen/common/uimodule/activityanimation/AnimatedRectLayout.java @@ -108,15 +108,15 @@ private void prepareGrid() { int w = getMeasuredWidth(); int h = getMeasuredHeight(); - int rectWidth = w/ RECT_COUNT_IN_WIDTH; + int rectWidth = w/ RECT_COUNT_IN_WIDTH; //根基宽度判断 RECT_COUNT_IN_WIDTH范围内的个数 int rectHeight = rectWidth; - mRectCountInWidth = w/rectWidth; + mRectCountInWidth = w/rectWidth; //count个数 mRectCountInHeight = h/rectHeight; - int delta = w%rectWidth; - if(delta>0) { - rectWidth += delta/mRectCountInWidth; + int delta = w%rectWidth; // 取余数 + if(delta>0) { //宽度的微调 + rectWidth += delta/mRectCountInWidth; //保证 rectWidti * mRectCountInWidth == w } delta = h%rectWidth; @@ -124,8 +124,8 @@ private void prepareGrid() { rectHeight += delta/mRectCountInHeight; } - mRects = new Rect[mRectCountInWidth][mRectCountInHeight]; - mRectIndexes = new int[mRectCountInWidth * mRectCountInHeight][2]; + mRects = new Rect[mRectCountInWidth][mRectCountInHeight]; //初始化数组和数组元素是分开的嘛?? + mRectIndexes = new int[mRectCountInWidth * mRectCountInHeight][2]; //每个方块的显示顺序 x y的index for (int x = 0; x < mRectCountInWidth; x++) { for (int y = 0; y < mRectCountInHeight; y++) { @@ -134,21 +134,21 @@ private void prepareGrid() { int right = left + rectWidth; int bottom = top + rectHeight; - if (x + 1 >= mRectCountInWidth) { + if (x + 1 >= mRectCountInWidth) { //如果右边没有空间了 right = w; } if (y + 1 >= mRectCountInHeight) { bottom = h; } - mRects[x][y] = new Rect(left, top, right, bottom); + mRects[x][y] = new Rect(left, top, right, bottom); //如果不加这个new的操作是不是会报错 } } sIndexesBuilder.get(mAnimationType).build(mRectIndexes, mRectCountInWidth, mRectCountInHeight); if (IS_JBMR2) { - mFullBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); + mFullBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); //创建一张整个屏幕大小的Bitmap Canvas canvas = new Canvas(mFullBitmap); getChildAt(0).draw(canvas); } @@ -167,7 +167,7 @@ protected void dispatchDraw(Canvas canvas) { if(i >= threshold) { return; } - canvas.save(); + canvas.save(); //保存画布的状态 Note:保证画布的其他的东西不受影响 int[] index = mRectIndexes[i]; Rect rect = mRects[index[0]][index[1]]; @@ -175,11 +175,11 @@ protected void dispatchDraw(Canvas canvas) { if(IS_JBMR2) { canvas.drawBitmap(mFullBitmap, rect, rect, null); } else { - canvas.clipRect(rect); + canvas.clipRect(rect); //局部绘制 截取画布中的一块区域 super.dispatchDraw(canvas); } - canvas.restore(); + canvas.restore(); //取出画布的状态 } } @@ -198,7 +198,7 @@ public int[][] build(int[][] indexes, int rectCountInWidth, int rectCountInHeigh index++; } } - return shuffle(indexes); + return shuffle(indexes); //random的实现 } }; diff --git a/UltimateAndroidGradle/ultimateandroiduiwidget/src/main/java/com/marshalchen/common/uimodule/simplemodule/ProgressLayout.java b/UltimateAndroidGradle/ultimateandroiduiwidget/src/main/java/com/marshalchen/common/uimodule/simplemodule/ProgressLayout.java index 81344ccc..b394a389 100755 --- a/UltimateAndroidGradle/ultimateandroiduiwidget/src/main/java/com/marshalchen/common/uimodule/simplemodule/ProgressLayout.java +++ b/UltimateAndroidGradle/ultimateandroiduiwidget/src/main/java/com/marshalchen/common/uimodule/simplemodule/ProgressLayout.java @@ -40,9 +40,14 @@ public ProgressLayout(Context context, AttributeSet attrs, int defStyle) { } private void init(AttributeSet attrs) { - TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ProgressLayout); + TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ProgressLayout); // 属性数组 int backgroundColor = a.getColor(R.styleable.ProgressLayout_progressLayoutProgressBackground, Color.TRANSPARENT); boolean startFromProgress = a.getBoolean(R.styleable.ProgressLayout_progressLayoutProgress, false); + /* + * 在TypedArray后调用recycle主要是为了缓存。 + * 当recycle被调用后,这就说明这个对象从现在可以被重用了。 + * TypedArray 内部持有部分数组,它们缓存在Resources类中的静态字段中,这样就不用每次使用前都需要分配内存。你可以看看TypedArray.recycle()中的代码: + * */ a.recycle(); LayoutParams layoutParams;