]> Joshua Wise's Git repositories - dumload.git/commitdiff
Make dumload configurable
authorasmw <asmw@asmw.de>
Mon, 20 Feb 2012 09:37:22 +0000 (10:37 +0100)
committerasmw <asmw@asmw.de>
Mon, 20 Feb 2012 09:37:22 +0000 (10:37 +0100)
12 files changed:
AndroidManifest.xml
res/layout/main.xml
res/layout/passwd.xml
res/layout/progressnotif.xml
res/layout/textnotif.xml
res/values/ids.xml [new file with mode: 0644]
res/values/strings.xml
res/xml/preferences.xml [new file with mode: 0644]
src/com/joshuawise/dumload/Dumload.java
src/com/joshuawise/dumload/NotifSlave.java
src/com/joshuawise/dumload/Preferences.java [new file with mode: 0644]
src/com/joshuawise/dumload/Uploader.java

index b24610e9305e2201f8b2a220bda1995be6a6d5a4..e3e7b93c495e5f2b6366b68752a216953209ed43 100644 (file)
@@ -1,30 +1,51 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-      package="com.joshuawise.dumload"
-      android:versionCode="1"
-      android:versionName="1.0">
-    <application android:icon="@drawable/icon" android:label="Dumload">
-        <activity android:name=".Dumload"
-                  android:label="@string/app_name">
+    package="com.joshuawise.dumload"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-permission android:name="android.permission.INTERNET" >
+    </uses-permission>
+    <uses-permission android:name="android.permission.STATUS_BAR" >
+    </uses-permission>
+    <uses-permission android:name="android.permission.VIBRATE" >
+    </uses-permission>
+
+    <application
+        android:icon="@drawable/icon"
+        android:label="Dumload" >
+        <activity
+            android:name=".Dumload"
+            android:label="@string/app_name" >
             <intent-filter>
             <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            
+                <category android:name="android.intent.category.DEFAULT" />
 
 
-</intent-filter>
-        <intent-filter><action android:name="android.intent.action.SEND"></action>
-        <category android:name="android.intent.category.DEFAULT" />
-<data android:mimeType="image/jpeg"></data>
-</intent-filter>
-</activity>
+                <action android:name="android.intent.action.SEND" >
+                </action>
 
 
-<service android:name=".Uploader"><intent-filter><action android:name="com.joshuawise.dumload.Uploader" /></intent-filter></service>
-<activity android:name=".NotifSlave"><intent-filter><action android:name="com.joshuawise.dumload.NotifSlave" /></intent-filter></activity>
-    </application>
+                <data android:mimeType="image/jpeg" >
+                </data>
+            </intent-filter>
+        </activity>
+
+        <service android:name=".Uploader" >
+            <intent-filter>
+                <action android:name="com.joshuawise.dumload.Uploader" />
+            </intent-filter>
+        </service>
 
 
+        <activity android:name=".NotifSlave" >
+            <intent-filter>
+                <action android:name="com.joshuawise.dumload.NotifSlave" />
+            </intent-filter>
+        </activity>
+        <activity android:name=".Preferences" >
+            <intent-filter>
+                <category android:name="android.intent.category.LAUNCHER" />
 
 
+                <action android:name="android.intent.action.MAIN" />
+            </intent-filter>
+        </activity>
+    </application>
 
 
-<uses-permission android:name="android.permission.INTERNET"></uses-permission>
-<uses-permission android:name="android.permission.STATUS_BAR"></uses-permission>
-<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
-</manifest> 
\ No newline at end of file
+</manifest>
\ No newline at end of file
index 9a37aeaf8da68d97b5841da7a837b8228d0b056b..3d983b58c45275ad330e1b8f7f2d6e741e915398 100644 (file)
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    >
-<TextView  
-    android:id="@+id/suckit"
-    android:layout_width="fill_parent" 
-    android:layout_height="wrap_content" 
-    android:text="@string/hello"
-    />
-<EditText
-    android:id="@+id/entry"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content"
-    android:background="@android:drawable/editbox_background"
-    />
-<Button
-    android:id="@+id/go"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:text="Go!"
-    />
-
-</LinearLayout>
+<?xml version="1.0" encoding="utf-8"?>\r
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:orientation="vertical"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="fill_parent"\r
+    >\r
+<TextView  \r
+    android:id="@+id/suckit"\r
+    android:layout_width="fill_parent" \r
+    android:layout_height="wrap_content" \r
+    android:text="@string/hello"\r
+    />\r
+<EditText\r
+    android:id="@+id/entry"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="wrap_content"\r
+    android:background="@android:drawable/editbox_background"\r
+    />\r
+<Button\r
+    android:id="@+id/go"\r
+    android:layout_width="wrap_content"\r
+    android:layout_height="wrap_content"\r
+    android:text="Go!"\r
+    />\r
+\r
+</LinearLayout>\r
index f475e8d3a513049e594284fa5c059bbad1053d0b..897f21990921ae3439b45c300907bccf5c341647 100644 (file)
@@ -1,38 +1,38 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:padding="10dp"
-    >
-<TextView  
-    android:id="@+id/prompt"
-    android:layout_width="fill_parent" 
-    android:layout_height="wrap_content" 
-    />
-<EditText
-    android:id="@+id/entry"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content"
-    android:background="@android:drawable/editbox_background"
-    android:password="true"
-    />
-<LinearLayout
-    android:orientation="horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content"
-    >
-<Button
-    android:id="@+id/ok"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:text="OK"
-    />
-<Button
-    android:id="@+id/cancel"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:text="Cancel"
-    />
-</LinearLayout>
-</LinearLayout>
+<?xml version="1.0" encoding="utf-8"?>\r
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:orientation="vertical"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="fill_parent"\r
+    android:padding="10dp"\r
+    >\r
+<TextView  \r
+    android:id="@+id/prompt"\r
+    android:layout_width="fill_parent" \r
+    android:layout_height="wrap_content" \r
+    />\r
+<EditText\r
+    android:id="@+id/entry"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="wrap_content"\r
+    android:background="@android:drawable/editbox_background"\r
+    android:password="true"\r
+    />\r
+<LinearLayout\r
+    android:orientation="horizontal"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="wrap_content"\r
+    >\r
+<Button\r
+    android:id="@+id/ok"\r
+    android:layout_width="wrap_content"\r
+    android:layout_height="wrap_content"\r
+    android:text="OK"\r
+    />\r
+<Button\r
+    android:id="@+id/cancel"\r
+    android:layout_width="wrap_content"\r
+    android:layout_height="wrap_content"\r
+    android:text="Cancel"\r
+    />\r
+</LinearLayout>\r
+</LinearLayout>\r
index d742e57a68af77ceea4ea38ff30a2010fa44d5e3..5a44454425df77f1f666c3896a888cf17b9c0eaa 100644 (file)
@@ -1,35 +1,35 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:padding="3dp"
-    >
-
-<ImageView
-    android:id="@+id/image"
-    android:layout_width="wrap_content"
-    android:layout_height="fill_parent"
-    android:layout_marginRight="10dp"
-    />
-
-<LinearLayout
-    android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content"
-    >
-<TextView  
-    android:id="@+id/headline"
-    android:layout_width="fill_parent" 
-    android:layout_height="wrap_content" 
-    android:textStyle="bold"
-    />
-<ProgressBar
-    android:id="@+id/status"
-    android:layout_width="fill_parent" 
-    android:layout_height="wrap_content" 
-    style="?android:attr/progressBarStyleHorizontal"
-    />
-
-</LinearLayout>
-</LinearLayout>
+<?xml version="1.0" encoding="utf-8"?>\r
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:orientation="horizontal"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="fill_parent"\r
+    android:padding="3dp"\r
+    >\r
+\r
+<ImageView\r
+    android:id="@+id/image"\r
+    android:layout_width="wrap_content"\r
+    android:layout_height="fill_parent"\r
+    android:layout_marginRight="10dp"\r
+    />\r
+\r
+<LinearLayout\r
+    android:orientation="vertical"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="wrap_content"\r
+    >\r
+<TextView  \r
+    android:id="@+id/headline"\r
+    android:layout_width="fill_parent" \r
+    android:layout_height="wrap_content" \r
+    android:textStyle="bold"\r
+    />\r
+<ProgressBar\r
+    android:id="@+id/status"\r
+    android:layout_width="fill_parent" \r
+    android:layout_height="wrap_content" \r
+    style="?android:attr/progressBarStyleHorizontal"\r
+    />\r
+\r
+</LinearLayout>\r
+</LinearLayout>\r
index 1e1060a0f16373591fde22d131a8d6a71f35c184..473cd8d6769eaa630654be00828133d4c8b5c8b9 100644 (file)
@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:padding="3dp"
-    >
-
-<ImageView
-    android:id="@+id/image"
-    android:layout_width="wrap_content"
-    android:layout_height="fill_parent"
-    android:layout_marginRight="10dp"
-    />
-
-<LinearLayout
-    android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content"
-    >
-<TextView  
-    android:id="@+id/headline"
-    android:layout_width="fill_parent" 
-    android:layout_height="wrap_content" 
-    android:textStyle="bold"
-    />
-<TextView  
-    android:id="@+id/status"
-    android:layout_width="fill_parent" 
-    android:layout_height="wrap_content" 
-    />
-
-</LinearLayout>
-</LinearLayout>
+<?xml version="1.0" encoding="utf-8"?>\r
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:orientation="horizontal"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="fill_parent"\r
+    android:padding="3dp"\r
+    >\r
+\r
+<ImageView\r
+    android:id="@+id/image"\r
+    android:layout_width="wrap_content"\r
+    android:layout_height="fill_parent"\r
+    android:layout_marginRight="10dp"\r
+    />\r
+\r
+<LinearLayout\r
+    android:orientation="vertical"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="wrap_content"\r
+    >\r
+<TextView  \r
+    android:id="@+id/headline"\r
+    android:layout_width="fill_parent" \r
+    android:layout_height="wrap_content" \r
+    android:textStyle="bold"\r
+    />\r
+<TextView  \r
+    android:id="@+id/status"\r
+    android:layout_width="fill_parent" \r
+    android:layout_height="wrap_content" \r
+    />\r
+\r
+</LinearLayout>\r
+</LinearLayout>\r
diff --git a/res/values/ids.xml b/res/values/ids.xml
new file mode 100644 (file)
index 0000000..caa570f
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<resources>
+    <item name="actionCreateSshKey" type="id"/>
+    <item name="actionRemoveSshKey" type="id"/>\r
+    \r
+</resources>
\ No newline at end of file
index 4606407c988ac52e95ade8b73f91b53ffec16cce..cad5d57a9548b8f2fe185f8b6f89a7f2c2be64ae 100644 (file)
@@ -1,5 +1,21 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-    <string name="hello">Hello World, Dumload!</string>
+<?xml version="1.0" encoding="utf-8"?>\r
+<resources>\r
+    <string name="hello">Hello World, Dumload!</string>\r
     <string name="app_name">dumload</string>
     <string name="app_name">dumload</string>
-</resources>
+    <string name="prefSshServerTitle">SSH server</string>
+    <string name="preferenceTitle">Preferences</string>
+    <string name="prefConnection">Connection preferences</string>
+    <string name="prefServerTitle">Server</string>
+    <string name="prefServerSummary">The SSH server to connect to</string>
+    <string name="prefUsernameTitle">Username</string>
+    <string name="prefUsernameSummary">The username to use for the ssh connection</string>
+    <string name="prefPortTitle">Port</string>
+    <string name="prefPortSummary">The SSH port on the remote server</string>
+    <string name="prefDefaultPathTitle">Default remote path</string>
+    <string name="prefDefaultPathSummary">Uploads are put in this directory on the remote server by default</string>
+    <string name="prefCrypto">Cryptography</string>
+    <string name="menuGenSshKey">Generate a new SSH key</string>
+    <string name="menuDelSshKey">Remove generated SSH key</string>
+    <string name="msgNoGenKeyFound">No generated SSH key was found.</string>
+    <string name="msgKeyExists">A generated key already exists.</string>\r
+</resources>\r
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
new file mode 100644 (file)
index 0000000..84f2ab7
--- /dev/null
@@ -0,0 +1,23 @@
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:title="@string/preferenceTitle" >\r
+\r
+    <PreferenceCategory android:title="@string/prefConnection" >\r
+        <EditTextPreference\r
+            android:key="userName"\r
+            android:summary="@string/prefUsernameSummary"\r
+            android:title="@string/prefUsernameTitle" />\r
+        <EditTextPreference\r
+            android:key="server"\r
+            android:summary="@string/prefServerSummary"\r
+            android:title="@string/prefServerTitle" />\r
+        <EditTextPreference\r
+            android:key="port"\r
+            android:summary="@string/prefPortSummary"\r
+            android:title="@string/prefPortTitle" />\r
+        <EditTextPreference\r
+            android:key="defaultUploadPath"\r
+            android:summary="@string/prefDefaultPathSummary"\r
+            android:title="@string/prefDefaultPathTitle" />\r
+    </PreferenceCategory>\r
+\r
+</PreferenceScreen>
\ No newline at end of file
index f0919b78d4ec22fdc467b18e5e1c3f5dafd37758..f3317c43f2e93d8c410b0e1574cbd7ec280f05a0 100644 (file)
@@ -1,21 +1,21 @@
 package com.joshuawise.dumload;
 
 package com.joshuawise.dumload;
 
-import java.io.InputStream;
-
 import android.app.Activity;
 import android.app.Activity;
-import android.app.Service;
 import android.content.Intent;
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.net.Uri;
 import android.os.Bundle;
 import android.net.Uri;
 import android.os.Bundle;
-import android.os.IBinder;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
 import android.widget.TextView;
 import android.widget.Toast;
 import android.widget.TextView;
 import android.widget.Toast;
-import android.widget.TextView;
-import android.widget.Button;
-import android.view.View;
-import android.util.Log;
 
 public class Dumload extends Activity {
 
 public class Dumload extends Activity {
+       
+       private SharedPreferences prefs;
+       
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
@@ -33,12 +33,16 @@ public class Dumload extends Activity {
                super.onStart();
                final Dumload thisact = this;
                
                super.onStart();
                final Dumload thisact = this;
                
+               prefs = PreferenceManager.getDefaultSharedPreferences(this);
+               
                Intent i = getIntent(); /* i *am* not an intent! */
                
                if (!i.getAction().equals(Intent.ACTION_SEND))
                {
                Intent i = getIntent(); /* i *am* not an intent! */
                
                if (!i.getAction().equals(Intent.ACTION_SEND))
                {
-                       say("Unknown intent for dumload");
-                       this.finish();
+//                     say("Unknown intent for dumload");
+//                     this.finish();
+                       Intent pi = new Intent(this, Preferences.class);
+                       startActivity(pi);
                        return;
                }
                
                        return;
                }
                
@@ -68,7 +72,7 @@ public class Dumload extends Activity {
                
                
                ((TextView) findViewById(R.id.suckit)).setText("Where to?");
                
                
                ((TextView) findViewById(R.id.suckit)).setText("Where to?");
-               ((TextView) findViewById(R.id.entry)).setText("/var/www/" + uribase.substring(uribase.lastIndexOf("/") + 1) + ".jpg");
+               ((TextView) findViewById(R.id.entry)).setText(prefs.getString("defaultUploadPath", "/var/www/") + uribase.substring(uribase.lastIndexOf("/") + 1) + ".jpg");
                
        }
 }
\ No newline at end of file
                
        }
 }
\ No newline at end of file
index 40db024f8a7a3ccdab338cf61d33d5c2b1f4a072..15d1ad182c2eef9102fc9dbe3f43caf6046b1448 100644 (file)
@@ -1,23 +1,18 @@
 package com.joshuawise.dumload;
 
 package com.joshuawise.dumload;
 
-import java.io.InputStream;
-
 import android.app.Activity;
 import android.app.Activity;
-import android.app.Service;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.Intent;
-import android.net.Uri;
 import android.os.Bundle;
 import android.os.Bundle;
-import android.os.IBinder;
-import android.widget.TextView;
-import android.widget.Button;
+import android.os.Message;
+import android.os.Messenger;
+import android.util.Log;
 import android.view.View;
 import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
 import android.widget.Toast;
 import android.widget.Toast;
-import android.util.Log;
-import android.os.Messenger;
-import android.os.Message;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.DialogInterface;
 
 public class NotifSlave extends Activity {
        /** Called when the activity is first created. */
 
 public class NotifSlave extends Activity {
        /** Called when the activity is first created. */
diff --git a/src/com/joshuawise/dumload/Preferences.java b/src/com/joshuawise/dumload/Preferences.java
new file mode 100644 (file)
index 0000000..ad825b9
--- /dev/null
@@ -0,0 +1,102 @@
+package com.joshuawise.dumload;
+
+import java.io.File;
+
+import android.content.SharedPreferences;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceManager;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.Window;
+import android.widget.Toast;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.KeyPair;
+
+public class Preferences extends PreferenceActivity {
+
+       private class KeygenTask extends AsyncTask<Void, Void, String> {
+
+               @Override
+               protected String doInBackground(Void... params) {
+                       String ret = null;
+                       String homedir = getFilesDir().getAbsolutePath();
+                       String filename = homedir + "/id_dsa_generated";
+                       File file = new File(filename);
+                       if (file.exists()) {
+                               return getString(R.string.msgKeyExists);
+                       } else {
+                               JSch jsch = new JSch();
+                               int type = KeyPair.DSA;
+                               try {
+                                       KeyPair kpair = KeyPair.genKeyPair(jsch, type);
+                                       // TODO: query for a passphrase
+                                       kpair.setPassphrase("");
+                                       kpair.writePrivateKey(filename);
+                                       kpair.writePublicKey(filename + ".pub", "generated by dumload");
+                                       ret = "Fingerprint: " + kpair.getFingerPrint();
+                                       kpair.dispose();
+                               } catch (Exception e) {
+                                       System.out.println(e);
+                               }
+                       }
+                       return ret;
+               }
+
+               @Override
+               protected void onPostExecute(String result) {
+                       setProgressBarIndeterminateVisibility(false);
+                       Toast.makeText(getApplicationContext(), result, Toast.LENGTH_LONG).show();
+                       super.onPostExecute(result);
+               }
+               
+       }
+       
+       @Override
+       public void onCreate(Bundle savedInstanceState) {
+               requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
+               super.onCreate(savedInstanceState);
+               // Load the preferences from an XML resource
+               addPreferencesFromResource(R.xml.preferences);
+       }
+
+       @Override
+       public boolean onCreateOptionsMenu(Menu menu) {
+               super.onCreateOptionsMenu(menu);
+
+               menu.add(Menu.NONE, R.id.actionCreateSshKey, Menu.NONE,
+                               getString(R.string.menuGenSshKey));
+               menu.add(Menu.NONE, R.id.actionRemoveSshKey, Menu.NONE,
+                               getString(R.string.menuDelSshKey));
+               return true;
+       }
+
+       public boolean onOptionsItemSelected(MenuItem item) {
+               switch (item.getItemId()) {
+               case R.id.actionCreateSshKey:
+                       generateDSAKeyPair();
+                       break;
+               case R.id.actionRemoveSshKey:
+                       String homedir = getFilesDir().getAbsolutePath();
+                       String filename = homedir + "/id_dsa_generated";
+                       File file = new File(filename);
+                       if (file.exists()) {
+                               file.delete();
+                               Toast.makeText(this,
+                                               "Deleted",
+                                               Toast.LENGTH_LONG).show();
+                       } else {
+                               Toast.makeText(this, getString(R.string.msgNoGenKeyFound), Toast.LENGTH_SHORT).show();
+                       }
+               }
+               return false;
+       }
+
+       private void generateDSAKeyPair() {
+               setProgressBarIndeterminateVisibility(true);
+               KeygenTask t = new KeygenTask();
+               t.execute();
+       }
+}
index f1dfc7eee702dda3a44fd4de46975da435645f4d..e7725e9603f967282f5b59f8e60f6c7772b03ed4 100644 (file)
@@ -3,28 +3,32 @@ package com.joshuawise.dumload;
 import java.io.InputStream;
 import java.io.OutputStream;
 
 import java.io.InputStream;
 import java.io.OutputStream;
 
-import com.jcraft.jsch.*;
-import java.lang.Boolean;
-
-import android.app.Activity;
-import android.app.Service;
-import android.content.Intent;
+import android.app.Notification;
+import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.PendingIntent;
+import android.app.Service;
 import android.content.Context;
 import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
 import android.net.Uri;
 import android.os.Bundle;
 import android.net.Uri;
 import android.os.Bundle;
-import android.os.IBinder;
-import android.widget.TextView;
-import android.widget.Toast;
-import android.util.Log;
-import android.app.NotificationManager;
-import android.app.Notification;
 import android.os.Handler;
 import android.os.Handler;
-import android.os.Messenger;
+import android.os.IBinder;
 import android.os.Looper;
 import android.os.Message;
 import android.os.Looper;
 import android.os.Message;
+import android.os.Messenger;
 import android.os.SystemClock;
 import android.os.SystemClock;
+import android.preference.PreferenceManager;
+import android.util.Log;
 import android.widget.RemoteViews;
 import android.widget.RemoteViews;
+import android.widget.Toast;
+
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelExec;
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.Session;
+import com.jcraft.jsch.UIKeyboardInteractive;
+import com.jcraft.jsch.UserInfo;
 
 public class Uploader extends Service implements Runnable, UserInfo, UIKeyboardInteractive {
        private Uri uri;
 
 public class Uploader extends Service implements Runnable, UserInfo, UIKeyboardInteractive {
        private Uri uri;
@@ -261,7 +265,6 @@ public class Uploader extends Service implements Runnable, UserInfo, UIKeyboardI
                mNotificationManager.notify(thenotifid, thenotif);
        }
        
                mNotificationManager.notify(thenotifid, thenotif);
        }
        
-       @Override
        public void run()
        {
                Looper.prepare();
        public void run()
        {
                Looper.prepare();
@@ -281,7 +284,12 @@ public class Uploader extends Service implements Runnable, UserInfo, UIKeyboardI
                                jsch.addIdentity(homedir + "/id_dsa");
                        } catch (java.lang.Exception e) {
                        }
                                jsch.addIdentity(homedir + "/id_dsa");
                        } catch (java.lang.Exception e) {
                        }
-                       Session s = jsch.getSession("joshua", "nyus.joshuawise.com", 22);
+                       SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+                       String server = prefs.getString("server", "").trim();
+                       String userName = prefs.getString("userName", "").trim();
+                       Integer port = prefs.getInt("serverPort", 22);
+                       Log.d("dbg", userName + "@" + server + ":" + port);
+                       Session s = jsch.getSession(userName, server, port);
                        s.setUserInfo(this);
                        s.connect();
                        
                        s.setUserInfo(this);
                        s.connect();
                        
@@ -370,6 +378,7 @@ public class Uploader extends Service implements Runnable, UserInfo, UIKeyboardI
                dest = i.getStringExtra("com.joshuawise.dumload.dest");
                homedir = getApplicationContext().getFilesDir().getAbsolutePath();
                int shits = 0;
                dest = i.getStringExtra("com.joshuawise.dumload.dest");
                homedir = getApplicationContext().getFilesDir().getAbsolutePath();
                int shits = 0;
+               int giggles = 1;
                
                super.onStart(i, startId);
                
                
                super.onStart(i, startId);
                
This page took 0.058195 seconds and 4 git commands to generate.