Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
53 changes: 47 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,48 @@
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
# svn
*.svn*

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated GUI files
*/R.java

# generated folder
bin
gen

# local
local.properties

proguard_logs/

# log files
log*.txt

# archives
*.gz
*.tar
*.zip

# eclipse
*.metadata
*.settings
*.prefs

#idea
*.idea
*.iml
out/

build/
captures/
.gradle/

.DS_Store
/build
/captures
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
* Created by sergey on 4/22/16.
*/
public class CanvasApiView extends View {

private final int N = 4;
private final int shift = 50;
private Paint myPaint = new Paint();
private final int MARGIN = 100;
private final int SIZE = MARGIN + 400;

public CanvasApiView(Context context) {
super(context);
}
Expand All @@ -23,20 +30,17 @@ public CanvasApiView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

private final int N = 4;
private final int shift = 50;
private Paint myPaint = new Paint();
private final int MARGIN = 100;
private final int SIZE = MARGIN + 400;

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
for (int i = 0; i < N; i++) {
canvas.save();
// Each card is laid out a little to the right of the previous one.
myPaint.setColor(Color.RED / (i + 1));
myPaint.setStrokeWidth(10);
if (i != N - 1) canvas.clipRect(MARGIN + i * shift, MARGIN, MARGIN + i * shift + shift, SIZE);
canvas.drawRect(MARGIN + i * shift, MARGIN, SIZE + i * shift, SIZE, myPaint);
canvas.restore();
}
// Invalidate the whole view. Doing this calls onDraw() if the view is visible.
invalidate();
Expand Down
13 changes: 6 additions & 7 deletions app/src/main/res/layout/backgrounds_item.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:layout_margin="10dp">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/title"
android:background="@android:color/white"/>
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

</LinearLayout>
14 changes: 6 additions & 8 deletions app/src/main/res/layout/backgrounds_layout.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/backgrounds_title"
android:background="@android:color/white"/>
android:text="@string/backgrounds_title"/>

<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/backgrounds_list"
android:background="@android:color/white"/>
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</LinearLayout>
51 changes: 21 additions & 30 deletions app/src/main/res/layout/hierarchy_layout.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_marginTop="@dimen/activity_vertical_margin">

<!-- Version 1. Uses nested LinearLayouts -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ImageView
android:id="@+id/chat_author_avatar1"
android:layout_width="@dimen/avatar_dimen"
android:layout_height="@dimen/avatar_dimen"
android:layout_margin="@dimen/avatar_layout_margin"
android:src="@mipmap/ic_launcher"/>

<TextView
android:id="@+id/text_view_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:orientation="horizontal">

<ImageView
android:id="@+id/chat_author_avatar1"
android:layout_width="@dimen/avatar_dimen"
android:layout_height="@dimen/avatar_dimen"
android:layout_margin="@dimen/avatar_layout_margin"
android:src="@mipmap/ic_launcher" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_toRightOf="@+id/chat_author_avatar1"
android:text="@string/line1_text"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/line1_text" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/line2_text" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/text_view_title"
android:layout_toRightOf="@+id/chat_author_avatar1"
android:text="@string/line2_text"/>

</LinearLayout>
</RelativeLayout>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.tools.build:gradle:2.0.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Apr 22 13:18:03 EEST 2016
#Sat Apr 23 11:44:39 EEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip