Skip to content

Commit 2a7a0d8

Browse files
quiqui
authored andcommitted
Cleaned up code
Added case for illustrating transaction yielding, read/write conflicts, and transaction file locking Made TickerBar component to help illustrate cases SqliteTransactionEndListener and EventTimer works to time processes and also update ticker bar
1 parent d552485 commit 2a7a0d8

File tree

12 files changed

+1255
-425
lines changed

12 files changed

+1255
-425
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
*.iml
3+
.idea/*
4+
5+
bin
6+
gen
7+
target
8+
out

AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
android:versionName="1.0">
66
<uses-sdk android:minSdkVersion="5"/>
77
<application android:label="@string/app_name" android:icon="@drawable/icon">
8-
<activity android:name="co.touchlab.dblocking.MyActivity"
8+
<activity android:name=".dblocking.SqliteDbX"
99
android:label="@string/app_name">
1010
<intent-filter>
1111
<action android:name="android.intent.action.MAIN" />

gen/co/touchlab/R.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

res/layout/main.xml

Lines changed: 83 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,53 @@
44
android:layout_width="fill_parent"
55
android:layout_height="fill_parent"
66
>
7-
<TextView
8-
android:layout_width="fill_parent"
9-
android:layout_height="wrap_content"
10-
android:text="Hello World, MyActivity"
11-
/>
12-
<Button
13-
android:id="@+id/oneHelper"
14-
android:layout_width="wrap_content"
15-
android:layout_height="wrap_content"
16-
android:text="One Helper"/>
17-
<Button
18-
android:id="@+id/manyHelpers"
19-
android:layout_width="wrap_content"
7+
8+
<LinearLayout
9+
android:layout_width="fill_parent"
2010
android:layout_height="wrap_content"
21-
android:text="Many Helpers"/>
11+
android:orientation="horizontal">
12+
13+
<Button
14+
android:id="@+id/oneWrite"
15+
android:layout_width="wrap_content"
16+
android:layout_height="wrap_content"
17+
android:text="1 Write"/>
18+
<Button
19+
android:id="@+id/manyWrite"
20+
android:layout_width="wrap_content"
21+
android:layout_height="wrap_content"
22+
android:text="+ Write"/>
23+
24+
<Button
25+
android:id="@+id/oneWriteManyRead"
26+
android:layout_width="wrap_content"
27+
android:layout_height="wrap_content"
28+
android:text="1 Write + Read"/>
29+
<Button
30+
android:id="@+id/manyRead"
31+
android:layout_width="wrap_content"
32+
android:layout_height="wrap_content"
33+
android:text="+ Read"/>
34+
35+
</LinearLayout>
2236

2337
<Button
2438
android:id="@+id/testTransactionIsolation"
2539
android:layout_width="wrap_content"
2640
android:layout_height="wrap_content"
2741
android:text="Test Transaction Isolation"/>
2842

29-
<EditText
30-
android:layout_width="fill_parent"
31-
android:layout_height="wrap_content"
32-
android:id="@+id/numberOfInserts"/>
3343
<LinearLayout
3444
android:layout_width="fill_parent"
3545
android:layout_height="wrap_content"
3646
android:orientation="horizontal">
47+
48+
<EditText
49+
android:layout_width="60dp"
50+
android:layout_height="wrap_content"
51+
android:id="@+id/numberOfInserts"
52+
/>
53+
3754
<Button
3855
android:layout_width="wrap_content"
3956
android:layout_height="wrap_content"
@@ -48,17 +65,63 @@
4865
android:id="@+id/trans"/>
4966
</LinearLayout>
5067

68+
<LinearLayout
69+
android:layout_width="match_parent"
70+
android:layout_height="wrap_content"
71+
android:orientation="horizontal"
72+
>
73+
74+
<Button
75+
android:layout_width="wrap_content"
76+
android:layout_height="wrap_content"
77+
android:text="Exclusive No Yielding"
78+
android:id="@+id/no_yielding" />
79+
80+
<Button
81+
android:layout_width="wrap_content"
82+
android:layout_height="wrap_content"
83+
android:text="Safely Contend Yield"
84+
android:id="@+id/yielding" />
85+
86+
</LinearLayout>
87+
88+
89+
<LinearLayout
90+
android:layout_width="match_parent"
91+
android:layout_height="wrap_content"
92+
android:orientation="horizontal"
93+
>
94+
95+
<Button
96+
android:layout_width="wrap_content"
97+
android:layout_height="wrap_content"
98+
android:text="No Yield Read"
99+
android:id="@+id/no_yield_read" />
100+
101+
<Button
102+
android:layout_width="wrap_content"
103+
android:layout_height="wrap_content"
104+
android:text="Yield and Read"
105+
android:id="@+id/yield_and_read" />
106+
107+
</LinearLayout>
108+
51109
<TextView
52110
android:layout_width="fill_parent"
53111
android:layout_height="wrap_content"
54112
android:id="@+id/timeOut"/>
55113

56-
57114
<TextView
58115
android:layout_width="fill_parent"
59116
android:layout_height="wrap_content"
60117
android:id="@+id/results"
61-
android:text=""/>
118+
/>
119+
120+
<co.touchlab.dblocking.TickerBar
121+
android:id="@+id/tickerBar"
122+
android:layout_height="40px"
123+
android:layout_width="match_parent"
124+
/>
62125

63126
</LinearLayout>
64127

res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<string name="app_name">dblocking</string>
3+
<string name="app_name">SQLite DB Example, by touchlab</string>
44
</resources>

0 commit comments

Comments
 (0)