Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f33fd8a4
authored
Jan 08, 2014
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moar of bacroce
1 parent
cfaf2f9f
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
79 additions
and
58 deletions
muutSoftat/AndroidBarcode/AndroidManifest.xml
muutSoftat/AndroidBarcode/bin/AndroidBarcode.apk
muutSoftat/AndroidBarcode/bin/AndroidManifest.xml
muutSoftat/AndroidBarcode/bin/classes.dex
muutSoftat/AndroidBarcode/bin/dexedLibs/android-support-v4-4d351852e78e12420b9ae555045b1fa4.jar
muutSoftat/AndroidBarcode/bin/jarlist.cache
muutSoftat/AndroidBarcode/bin/resources.ap_
muutSoftat/AndroidBarcode/res/layout/activity_main.xml
muutSoftat/AndroidBarcode/res/values/strings.xml
muutSoftat/AndroidBarcode/src/fi/codecrew/androidbarcode/MainActivity.java
muutSoftat/AndroidBarcode/AndroidManifest.xml
View file @
f33fd8a
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
<uses-sdk
<uses-sdk
android:minSdkVersion=
"8"
android:minSdkVersion=
"8"
android:targetSdkVersion=
"10"
/>
android:targetSdkVersion=
"10"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<application
<application
android:allowBackup=
"true"
android:allowBackup=
"true"
...
...
muutSoftat/AndroidBarcode/bin/AndroidBarcode.apk
deleted
100644 → 0
View file @
cfaf2f9
No preview for this file type
muutSoftat/AndroidBarcode/bin/AndroidManifest.xml
deleted
100644 → 0
View file @
cfaf2f9
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"fi.codecrew.androidbarcode"
android:versionCode=
"1"
android:versionName=
"1.0"
>
<uses-sdk
android:minSdkVersion=
"8"
android:targetSdkVersion=
"10"
/>
<application
android:allowBackup=
"true"
android:icon=
"@drawable/ic_launcher"
android:label=
"@string/app_name"
android:theme=
"@style/AppTheme"
>
<activity
android:name=
"fi.codecrew.androidbarcode.MainActivity"
android:label=
"@string/app_name"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
</application>
</manifest>
muutSoftat/AndroidBarcode/bin/classes.dex
deleted
100644 → 0
View file @
cfaf2f9
No preview for this file type
muutSoftat/AndroidBarcode/bin/dexedLibs/android-support-v4-4d351852e78e12420b9ae555045b1fa4.jar
View file @
f33fd8a
No preview for this file type
muutSoftat/AndroidBarcode/bin/jarlist.cache
deleted
100644 → 0
View file @
cfaf2f9
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
muutSoftat/AndroidBarcode/bin/resources.ap_
deleted
100644 → 0
View file @
cfaf2f9
No preview for this file type
muutSoftat/AndroidBarcode/res/layout/activity_main.xml
View file @
f33fd8a
<
RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
ScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:paddingBottom=
"@dimen/activity_vertical_margin"
android:paddingBottom=
"@dimen/activity_vertical_margin"
android:paddingLeft=
"@dimen/activity_horizontal_margin"
android:paddingLeft=
"@dimen/activity_horizontal_margin"
android:paddingRight=
"@dimen/activity_horizontal_margin"
android:paddingRight=
"@dimen/activity_horizontal_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
android:orientation=
"vertical"
tools:context=
".MainActivity"
>
tools:context=
".MainActivity"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<Button
android:id=
"@+id/button1"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/readBarcode"
android:onClick=
"readBarcode"
/>
<TextView
<TextView
android:id=
"@+id/textView1"
android:id=
"@+id/textView1"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
fill_par
ent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"26dp"
android:text=
"@string/readedCode"
android:text=
"@string/readedCode"
android:textAppearance=
"?android:attr/textAppearanceMedium"
/>
android:textAppearance=
"?android:attr/textAppearanceMedium"
/>
<EditText
<EditText
android:id=
"@+id/readedCode"
android:id=
"@+id/readedCode"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
fill_par
ent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignLeft=
"@+id/textView1"
android:layout_below=
"@+id/textView1"
android:ems=
"10"
android:ems=
"10"
android:focusable=
"
fals
e"
android:focusable=
"
tru
e"
android:focusableInTouchMode=
"
fals
e"
android:focusableInTouchMode=
"
tru
e"
android:inputType=
"text"
/>
android:inputType=
"text"
/>
<TextView
<TextView
android:id=
"@+id/
textView2
"
android:id=
"@+id/
success_text
"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignLeft=
"@+id/readedCode"
android:text=
"@string/success"
android:layout_below=
"@+id/readedCode"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:layout_marginTop=
"71dp"
android:textColor=
"#00AA00"
/>
<TextView
android:id=
"@+id/textView2"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"70dp"
android:text=
"@string/readerName"
android:text=
"@string/readerName"
android:textAppearance=
"?android:attr/textAppearanceMedium"
/>
android:textAppearance=
"?android:attr/textAppearanceMedium"
/>
<TextView
<TextView
android:id=
"@+id/textView3"
android:id=
"@+id/textView3"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
fill_par
ent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignLeft=
"@+id/textView2"
android:layout_below=
"@+id/textView2"
android:text=
"@string/seenInMoya"
android:text=
"@string/seenInMoya"
android:textAppearance=
"?android:attr/textAppearanceSmall"
/>
android:textAppearance=
"?android:attr/textAppearanceSmall"
/>
<EditText
<EditText
android:id=
"@+id/readerName"
android:id=
"@+id/readerName"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
fill_par
ent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignLeft=
"@+id/textView3"
android:layout_below=
"@+id/textView3"
android:layout_marginTop=
"14dp"
android:ems=
"10"
android:ems=
"10"
android:inputType=
"text"
>
android:inputType=
"text"
>
<requestFocus
/>
</EditText>
</EditText>
</RelativeLayout>
<Button
android:id=
"@+id/button2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/change"
android:onClick=
"changeReaderName"
/>
</LinearLayout>
</ScrollView>
muutSoftat/AndroidBarcode/res/values/strings.xml
View file @
f33fd8a
...
@@ -9,5 +9,7 @@
...
@@ -9,5 +9,7 @@
<string
name=
"readerName"
>
Reader Name
</string>
<string
name=
"readerName"
>
Reader Name
</string>
<string
name=
"seenInMoya"
>
(as seen in Moya)
</string>
<string
name=
"seenInMoya"
>
(as seen in Moya)
</string>
<string
name=
"shared_pref_readername"
>
readername
</string>
<string
name=
"shared_pref_readername"
>
readername
</string>
<string
name=
"change"
>
Change
</string>
<string
name=
"success"
>
Success
</string>
</resources>
</resources>
muutSoftat/AndroidBarcode/src/fi/codecrew/androidbarcode/MainActivity.java
View file @
f33fd8a
...
@@ -13,10 +13,12 @@ import android.content.SharedPreferences;
...
@@ -13,10 +13,12 @@ import android.content.SharedPreferences;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.view.Menu
;
import
android.view.Menu
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.EditText
;
import
android.widget.TextView
;
public
class
MainActivity
extends
Activity
{
public
class
MainActivity
extends
Activity
{
private
static
String
URL
=
"http://demo.codecrew.fi/MoyaWeb/"
;
private
static
String
URL
=
"http://demo.codecrew.fi/MoyaWeb/
shop/rfidListener.jsf
"
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
@@ -24,9 +26,14 @@ public class MainActivity extends Activity {
...
@@ -24,9 +26,14 @@ public class MainActivity extends Activity {
setContentView
(
R
.
layout
.
activity_main
);
setContentView
(
R
.
layout
.
activity_main
);
EditText
readedCode
=
(
EditText
)
findViewById
(
R
.
id
.
readedCode
);
readedCode
.
requestFocus
();
EditText
readerName
=
(
EditText
)
findViewById
(
R
.
id
.
readerName
);
EditText
readerName
=
(
EditText
)
findViewById
(
R
.
id
.
readerName
);
readerName
.
setText
(
getReaderName
());
readerName
.
setText
(
getReaderName
());
TextView
successText
=
(
TextView
)
findViewById
(
R
.
id
.
success_text
);
successText
.
setVisibility
(
View
.
INVISIBLE
);
}
}
...
@@ -38,7 +45,8 @@ public class MainActivity extends Activity {
...
@@ -38,7 +45,8 @@ public class MainActivity extends Activity {
}
}
public
void
readBarcode
(
View
view
)
{
public
void
readBarcode
(
View
view
)
{
TextView
successText
=
(
TextView
)
findViewById
(
R
.
id
.
success_text
);
successText
.
setVisibility
(
View
.
INVISIBLE
);
Intent
intent
=
new
Intent
(
"com.google.zxing.client.android.SCAN"
);
Intent
intent
=
new
Intent
(
"com.google.zxing.client.android.SCAN"
);
// intent.putExtra("com.google.zxing.client.android.SCAN.SCAN_MODE",
// intent.putExtra("com.google.zxing.client.android.SCAN.SCAN_MODE",
// "QR_CODE_MODE");
// "QR_CODE_MODE");
...
@@ -57,6 +65,9 @@ public class MainActivity extends Activity {
...
@@ -57,6 +65,9 @@ public class MainActivity extends Activity {
editor
.
putString
(
getString
(
R
.
string
.
shared_pref_readername
),
readerName
.
getText
().
toString
());
editor
.
putString
(
getString
(
R
.
string
.
shared_pref_readername
),
readerName
.
getText
().
toString
());
editor
.
commit
();
editor
.
commit
();
readerName
.
clearFocus
();
EditText
readedCode
=
(
EditText
)
findViewById
(
R
.
id
.
readedCode
);
readedCode
.
requestFocus
();
}
}
private
String
getReaderName
()
{
private
String
getReaderName
()
{
...
@@ -67,15 +78,24 @@ public class MainActivity extends Activity {
...
@@ -67,15 +78,24 @@ public class MainActivity extends Activity {
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
intent
)
{
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
intent
)
{
if
(
requestCode
==
0
)
{
if
(
requestCode
==
0
)
{
if
(
resultCode
==
RESULT_OK
)
{
if
(
resultCode
==
RESULT_OK
)
{
String
contents
=
intent
.
getStringExtra
(
"SCAN_RESULT"
);
String
contents
=
intent
.
getStringExtra
(
"SCAN_RESULT"
);
EditText
readedCode
=
(
EditText
)
findViewById
(
R
.
id
.
readedCode
);
EditText
readedCode
=
(
EditText
)
findViewById
(
R
.
id
.
readedCode
);
readedCode
.
requestFocus
();
readedCode
.
setText
(
contents
);
readedCode
.
setText
(
contents
);
TextView
successText
=
(
TextView
)
findViewById
(
R
.
id
.
success_text
);
if
(
sendBarcode
(
contents
))
{
if
(
sendBarcode
(
contents
))
{
successText
.
setVisibility
(
View
.
VISIBLE
);
}
}
Button
readBcode
=
(
Button
)
findViewById
(
R
.
id
.
button1
);
readBcode
.
requestFocus
();
}
else
if
(
resultCode
==
RESULT_CANCELED
)
{
}
else
if
(
resultCode
==
RESULT_CANCELED
)
{
...
@@ -86,9 +106,9 @@ public class MainActivity extends Activity {
...
@@ -86,9 +106,9 @@ public class MainActivity extends Activity {
private
boolean
sendBarcode
(
String
barcode
)
{
private
boolean
sendBarcode
(
String
barcode
)
{
try
{
try
{
HttpClient
client
=
new
DefaultHttpClient
();
HttpClient
client
=
new
DefaultHttpClient
();
String
getUrl
=
this
.
URL
+
"?barcode
="
+
barcode
+
"&reader="
+
getReaderName
();
String
getUrl
=
URL
+
"?tag
="
+
barcode
+
"&reader="
+
getReaderName
();
HttpGet
get
=
new
HttpGet
(
getU
RL
);
HttpGet
get
=
new
HttpGet
(
getU
rl
);
HttpResponse
responseGet
=
client
.
execute
(
get
);
HttpResponse
responseGet
=
client
.
execute
(
get
);
HttpEntity
resEntityGet
=
responseGet
.
getEntity
();
HttpEntity
resEntityGet
=
responseGet
.
getEntity
();
if
(
resEntityGet
!=
null
)
{
if
(
resEntityGet
!=
null
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment