| author | Tomas Zeman <tzeman@volny.cz> |
| Fri, 10 Jan 2014 13:18:36 +0100 | |
| changeset 8 | 16d857ba45c8 |
| parent 1 | c3780fcb8441 |
| permissions | -rw-r--r-- |
|
1
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
1 |
package tz.signaturecapture; |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
2 |
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
3 |
import android.app.Activity; |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
4 |
import android.content.Intent; |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
5 |
import android.os.Bundle; |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
6 |
import android.view.Gravity; |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
7 |
import android.view.View; |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
8 |
import android.widget.Button; |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
9 |
import android.widget.Toast; |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
10 |
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
11 |
public class CaptureSignatureActivity extends Activity {
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
12 |
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
13 |
public static final int SIGNATURE_ACTIVITY = 1; |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
14 |
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
15 |
@Override |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
16 |
public void onCreate(Bundle savedInstanceState) {
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
17 |
super.onCreate(savedInstanceState); |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
18 |
setContentView(R.layout.main); |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
19 |
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
20 |
Button getSignature = (Button) findViewById(R.id.signature); |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
21 |
getSignature.setOnClickListener(new View.OnClickListener() {
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
22 |
public void onClick(View view) {
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
23 |
Intent intent = new Intent(CaptureSignatureActivity.this, CaptureSignature.class); |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
24 |
startActivityForResult(intent,SIGNATURE_ACTIVITY); |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
25 |
} |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
26 |
}); |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
27 |
} |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
28 |
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
29 |
protected void onActivityResult(int requestCode, int resultCode, Intent data) |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
30 |
{
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
31 |
switch(requestCode) {
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
32 |
case SIGNATURE_ACTIVITY: |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
33 |
if (resultCode == RESULT_OK) {
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
34 |
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
35 |
Bundle bundle = data.getExtras(); |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
36 |
String status = bundle.getString("status");
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
37 |
if(status.equalsIgnoreCase("done")){
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
38 |
Toast toast = Toast.makeText(this, "Signature capture successful!", Toast.LENGTH_SHORT); |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
39 |
toast.setGravity(Gravity.TOP, 105, 50); |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
40 |
toast.show(); |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
41 |
} |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
42 |
} |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
43 |
break; |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
44 |
} |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
45 |
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
46 |
} |
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
47 |
|
|
c3780fcb8441
Imported code from the blog post (renamed namespace com.as400samplecode -> tz.signaturecapture).
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
48 |
} |