Tuesday, December 27, 2016

[Movie Review] When a Peking family meets Au pair



*A movie (with Chinese name: 洋妞到我家) directed by Gang Chen, main actors include: Fan Xu,  Jianbing Chen and young actor from Columbia: Gianina Arana Terranova, the Chinese stars Honglei Sun and Liya Tong also shown up in the movie. 



A Chinese housewife (Fan Xu) was preparing for migrating to another country, mainly for her daughter (Pipi)'s education. She and her husband decided to hire an Au pair (Giannia) to teach Pipi English. Giannia is from Columbia, and she's an incurable optimist even though she had an unpleasant childhood since her mum died very early and she was raised up by her step mom who was really harsh to her. 

Overall speaking, the story is about the conflicts between Fan Xu and the au pair Giannia since they have totally different opinions on children's education, especially they were growing up in two different countries/cultures. Pipi's mom (Fan Xu) always over-protected her child: do not allow her child contact any "dirty" things, even prepared her own dishware when eating in restaurants. Do not allow her child get in touch with strangers, etc. While, Giannia wants Pipi to be independent, so she took Pipi outside, playing with her friends, took her to the subway where is full of strangers. After several rounds of conflicts, Fan Xu realized that Giannia is right, it's better to child to be independent. 

I thought about my daughter when I was watching the movie. Certainly I do not want my daughter to be over-protected, like the flower in a greenhouse, I want her to be independent as well. But how I can teach her to be independent, and what's the best way for her to grow up, this is for sure, as her father, I need to think more on this and to be prepared. 

  

Thursday, February 18, 2016

[Android UI]GridView and GridLayout

[Android UI]GridView and GridLayout

I was a bit confused about GridView and GridLayout at the very beginning when I was trying to use grid layout (not GridLayout, I had no idea what GridLayout is at that moment). What I want is the layout like this:


I want to know which one fits my need best. Here's what I have found:

1. GridView:
GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid. The grid items are automatically inserted to the layout using a ListAdapter.

A typical grid view definition in XML is like this:
<?xml version="1.0" encoding="utf-8"?><GridView xmlns:android="http://schemas.android.com/apk/res/android"    android:id="@+id/gridview"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:columnWidth="80dp"    android:numColumns="auto_fit"    android:verticalSpacing="16dp"    android:horizontalSpacing="16dp"    android:padding="16dp"    android:stretchMode="columnWidth"    android:gravity="center"/>
You can specify number of columns, rows, and also the column width etc. But seems the cells cannot be spanned which is actually what I wanted.

2. GridLayout:
Child views are aligned as cells in GridLayout, and you can scroll vertically or horizontally. 

A typical GridLayout definition in XML is like this:
<GridLayout    android:id="@+id/glfeature"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:rowCount="2"    android:columnCount="3"    android:alignmentMode="alignBounds"    android:layout_margin="6dp">
    <ImageView        android:id="@+id/button1"        android:layout_rowSpan="2"        android:layout_gravity="fill_vertical"
        android:layout_width="120dp"        android:layout_height="60dp"        android:layout_margin="10dp"        android:text="Button" />
    <ImageView        android:id="@+id/button1"        android:layout_gravity="fill_vertical"
        android:layout_margin="10dp"        android:text="Button" />
    <ImageView        android:id="@+id/button1"        android:layout_gravity="fill_vertical"
        android:layout_margin="10dp"        android:text="Button" />
    <ImageView        android:id="@+id/button1"        android:layout_gravity="fill_vertical"
        android:layout_margin="10dp"        android:text="Button" />
    <ImageView        android:id="@+id/button1"        android:layout_gravity="fill_vertical"
        android:layout_margin="10dp"        android:text="Button" />
</GridLayout>
You can specify column/row count for GridLayout, just like LinearLayout or RelativeLayout, you can specify the child views directly in XML file.

Okay, in a word. The major differences between these two can be summarized as below:
a). GridView is a ViewGroup, similar to ListView/RecyclerView. While GridLayout is a layout for holding views, similar to LinearLayout/RelativeLayout
b). You can set up adapter for GridView while you cannot do that for GridLayout
c). You cannot span cells in GridView, while GridLayout support spanning cells.

And I got my layout implemented with GridLayout finally.