Posts

Showing posts from 2017

10 tips to speed up Android Gradle build

Image
A few months ago, in the year’s Google I/O, there is a wonderful tutorial to guild us how to speed up Android Gradle build. Grade always has a notorious reputation about the slow build for large modules dependency project, those upgrade will solve those problems. I copy a few of them here for the future reference. Although I still wait for the latest Android Studio 3.0 and grade plugin release which those tips dependence on.

Expand View's Touch area in Android

Image
There is an issue that I met a few days ago, my colleague wants me to improve the checkbox's clickable experience in Android. Following is the layout code and its visual effect. Then the xml layout file: < LinearLayout android : layout_width = " wrap_content " android : layout_height = " wrap_content " android : orientation = " vertical " > < LinearLayout android : id = " @+id/checkbox1_container " android : layout_width = " wrap_content " android : layout_height = " wrap_content " android : layout_marginEnd = " 50dp " android : layout_marginRight = " 50dp " android : gravity = " center " android : orientation = " horizontal " > < CheckBox android : id = ...

How to do Flip Animation in Android

Image
In the last  post , I list a category of Animations in Android platform, that’s my road map to learn android animation and this post will give a specific live example about the flip transformation which is really common in our apps. In the last post, I list the two kinds of animation strategies in Android, Animation and more powerful Animator. Both of them can implement the flip animation in our case, and my purpose is to compare those two ways. Animation We can’t use the predefined Animation subclass directly, there are scale, rotate, alpha and translate Animations, but we can’t use rotate animation to build the card flip effect. We should subclass Animation class to define the flip effect. package suzp1984.github.io.exapidemo.animation import android.graphics.Camera import android.view.animation.Animation import android.view.animation.Transformation class FlipAnimation(fromDegre: Float, toDegre: Float, centerX : Float, centerY : Float) : ...

SQL tutorial - row column transform

Image
In this case, I intend to introduce a complicated SQL query problem: row column transform. In the last chapter, about the fundamental SQL syntax , I used a MySQL sample database named sakila . In this tutorial, I still use it. transform rows to columns Task #1: Take table actor inside sakila for example, How to query the most popular last_names? let limit the condition to the last_names repeat at least more than 3 times. USE sakila ; SELECT last_name , COUNT ( first_NAME ) as size FROM actor GROUP BY last_name having size > 3; We got the result: + -----------+------+ | last_name | size | + -----------+------+ | KILMER | 5 | | NOLTE | 4 | | TEMPLE | 4 | + -----------+------+ Task #2: Convert above result from row to column format. + --------+-------+--------+ | KILMER | NOLTE | TEMPLE | + --------+-------+--------+ | 5 | 4 | 4 | + --------+-------+--------+ Use CASE WHEN an...

SQL Tutorial - SQL Syntax

Image
This is my learning notes about the SQL (based on  MySql ). As far as I known, Mysql was acquired by Oracle , whose mainly product is also the enterprise highly professional database, and the founder of the Mysql worried the future of the MySQL, then he started another open sourced database named MariaDB . I consider the Mysql and MariaDB the same thing, they even have the same command line tool name. And with no hesitate, I use MariaDB as the alternative to Mysql in the tutorial. Database Creation The operation of Database include Change, Create, Alter, Drop database. USE db_name ; CREATE DATABASE IF NOT EXIST db_name CHARACTER SET = utf - 8 ; ALTER DATABASE db_name CHARACTER SET = utf - 8 ; DROP DATABASE IF EXIST db_name ; Table Creation The basic composition of a database is its tables, table schema definition is the beginning stage in the database design. There is two import aspect in define a table schema, the column data types and the constric...