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
40 changes: 33 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
# 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/
.gradle/
34 changes: 33 additions & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
/build
# 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/
.gradle/
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.backgrounds_layout);
ListView lv = (ListView) findViewById(R.id.backgrounds_list);
lv.setAdapter(new BackgroundListAdapter(this, 0, Arrays.asList(new String[]{"title1", "title2", "title3"})));
if (lv != null) {
lv.setAdapter(new BackgroundListAdapter(this, 0, Arrays.asList("title1", "title2", "title3")));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ public CanvasApiView(Context context, AttributeSet attrs, int defStyleAttr) {
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
for (int i = 0; i < N; i++) {
canvas.save();
if (i != N - 1) {
canvas.clipRect(MARGIN + i * shift, MARGIN, MARGIN + i * shift + shift, SIZE);
}
// Each card is laid out a little to the right of the previous one.
myPaint.setColor(Color.RED / (i + 1));
myPaint.setStrokeWidth(10);
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
6 changes: 3 additions & 3 deletions app/src/main/res/layout/backgrounds_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<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">
>

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

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

</LinearLayout>
13 changes: 4 additions & 9 deletions app/src/main/res/layout/canvas_layout.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?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">

<com.performance.ua.performancelab.CanvasApiView
android:layout_width="match_parent"
android:layout_height="match_parent" />

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

<!-- 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"/>

<LinearLayout
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" />
android:orientation="vertical">

<LinearLayout
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

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

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

</LinearLayout>