Skip to content
Browse files

clarup

  • Loading branch information...
1 parent 2dbbeac commit 8bc56a13c45ee63a798b46c61b50784f5e55e188 @voidcode committed
Showing with 0 additions and 346 deletions.
  1. +0 −44 assets/donation.html
  2. BIN assets/images/donation_in_bitcoins_qrtag.gif
  3. BIN bin/classes/com/voidcode/diasporawebclient/JavaScriptInterface.class
  4. BIN bin/classes/com/voidcode/diasporawebclient/JsReshareHandler$1.class
  5. BIN bin/classes/com/voidcode/diasporawebclient/JsReshareHandler.class
  6. BIN bin/classes/com/voidcode/diasporawebclient/SettingsActivity$1.class
  7. BIN bin/classes/com/voidcode/diasporawebclient/SettingsActivity$2.class
  8. BIN bin/classes/com/voidcode/diasporawebclient/SettingsActivity.class
  9. BIN bin/diasporawebclient.apk
  10. BIN bin/res/drawable-hdpi/ic_menu_donation.png
  11. BIN bin/res/drawable-hdpi/ic_menu_exit.png
  12. BIN bin/res/drawable-hdpi/ic_menu_settings.png
  13. BIN bin/res/drawable-ldpi/ic_menu_donation.png
  14. BIN bin/res/drawable-ldpi/ic_menu_exit.png
  15. BIN bin/res/drawable-ldpi/ic_menu_settings.png
  16. BIN bin/res/drawable-mdpi/ic_menu_donation.png
  17. BIN bin/res/drawable-mdpi/ic_menu_exit.png
  18. BIN bin/res/drawable-mdpi/ic_menu_settings.png
  19. BIN bin/res/drawable-xhdpi/ic_menu_donation.png
  20. BIN bin/res/drawable-xhdpi/ic_menu_exit.png
  21. BIN bin/res/drawable-xhdpi/ic_menu_settings.png
  22. BIN res/drawable-hdpi/ic_menu_donation.png
  23. BIN res/drawable-hdpi/ic_menu_exit.png
  24. BIN res/drawable-hdpi/ic_menu_settings.png
  25. BIN res/drawable-ldpi/ic_menu_donation.png
  26. BIN res/drawable-ldpi/ic_menu_exit.png
  27. BIN res/drawable-ldpi/ic_menu_settings.png
  28. BIN res/drawable-mdpi/ic_menu_donation.png
  29. BIN res/drawable-mdpi/ic_menu_exit.png
  30. BIN res/drawable-mdpi/ic_menu_settings.png
  31. BIN res/drawable-xhdpi/ic_menu_donation.png
  32. BIN res/drawable-xhdpi/ic_menu_exit.png
  33. BIN res/drawable-xhdpi/ic_menu_settings.png
  34. +0 −45 res/layout/settings.xml
  35. +0 −50 src/com/voidcode/diasporawebclient/JsReshareHandler.java
  36. +0 −207 src/com/voidcode/diasporawebclient/SettingsActivity.java
View
44 assets/donation.html
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <!-- https://flattr.com/support/integrate/js -->
- <script type="text/javascript">
- /* <![CDATA[ */
- (function() {
- var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
- s.type = 'text/javascript';
- s.async = true;
- s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
- t.parentNode.insertBefore(s, t);
- })();
- /* ]]> */
- </script>
- <title>Donation</title>
- </head>
- <body>
- <h1>Donation.</h1>
- <h2>Help me make more diaspora relateret stuff.</h2>
- <p>I am a poor student from Denmark.<br/>
- I really like the idea of making free tech stuff.<br/>
- But since I also have to pay rent and food etc.<br/>
- Would a small donation from you, do wonders for me :)</p>
- <hr/>
- <h3>Flattr this app.</h3>
- <a class="FlattrButton" style="display:none;"
- title="Flattr Diaspora-Webclient"
- data-flattr-uid="Voidcode"
- data-flattr-category="software"
- href="https://github.com/voidcode/Diaspora-Webclient/">
- Help me make more diaspora relateret stuff.
- </a>
- <p>
- <i>Press the green flattr button to do this.</i>
- </p>
- <h3>Donation via Bitcoins.</h3>
- <p>16626BhMsp7p<br/>
- rm9ijLZGPyH4<br/>
- dWhsCLfYam</p>
- <p>Or http://btc.to/2hl</p>
- <img src="file:///android_asset/images/donation_in_bitcoins_qrtag.gif" />
- </body>
-</html>
View
BIN assets/images/donation_in_bitcoins_qrtag.gif
Deleted file not rendered
View
BIN bin/classes/com/voidcode/diasporawebclient/JavaScriptInterface.class
Binary file not shown.
View
BIN bin/classes/com/voidcode/diasporawebclient/JsReshareHandler$1.class
Binary file not shown.
View
BIN bin/classes/com/voidcode/diasporawebclient/JsReshareHandler.class
Binary file not shown.
View
BIN bin/classes/com/voidcode/diasporawebclient/SettingsActivity$1.class
Binary file not shown.
View
BIN bin/classes/com/voidcode/diasporawebclient/SettingsActivity$2.class
Binary file not shown.
View
BIN bin/classes/com/voidcode/diasporawebclient/SettingsActivity.class
Binary file not shown.
View
BIN bin/diasporawebclient.apk
Binary file not shown.
View
BIN bin/res/drawable-hdpi/ic_menu_donation.png
Deleted file not rendered
View
BIN bin/res/drawable-hdpi/ic_menu_exit.png
Deleted file not rendered
View
BIN bin/res/drawable-hdpi/ic_menu_settings.png
Deleted file not rendered
View
BIN bin/res/drawable-ldpi/ic_menu_donation.png
Deleted file not rendered
View
BIN bin/res/drawable-ldpi/ic_menu_exit.png
Deleted file not rendered
View
BIN bin/res/drawable-ldpi/ic_menu_settings.png
Deleted file not rendered
View
BIN bin/res/drawable-mdpi/ic_menu_donation.png
Deleted file not rendered
View
BIN bin/res/drawable-mdpi/ic_menu_exit.png
Deleted file not rendered
View
BIN bin/res/drawable-mdpi/ic_menu_settings.png
Deleted file not rendered
View
BIN bin/res/drawable-xhdpi/ic_menu_donation.png
Deleted file not rendered
View
BIN bin/res/drawable-xhdpi/ic_menu_exit.png
Deleted file not rendered
View
BIN bin/res/drawable-xhdpi/ic_menu_settings.png
Deleted file not rendered
View
BIN res/drawable-hdpi/ic_menu_donation.png
Deleted file not rendered
View
BIN res/drawable-hdpi/ic_menu_exit.png
Deleted file not rendered
View
BIN res/drawable-hdpi/ic_menu_settings.png
Deleted file not rendered
View
BIN res/drawable-ldpi/ic_menu_donation.png
Deleted file not rendered
View
BIN res/drawable-ldpi/ic_menu_exit.png
Deleted file not rendered
View
BIN res/drawable-ldpi/ic_menu_settings.png
Deleted file not rendered
View
BIN res/drawable-mdpi/ic_menu_donation.png
Deleted file not rendered
View
BIN res/drawable-mdpi/ic_menu_exit.png
Deleted file not rendered
View
BIN res/drawable-mdpi/ic_menu_settings.png
Deleted file not rendered
View
BIN res/drawable-xhdpi/ic_menu_donation.png
Deleted file not rendered
View
BIN res/drawable-xhdpi/ic_menu_exit.png
Deleted file not rendered
View
BIN res/drawable-xhdpi/ic_menu_settings.png
Deleted file not rendered
View
45 res/layout/settings.xml
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:background="@drawable/topmenu_repeat" >
- <ImageView
- android:id="@+id/imageView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/topmenu" />
- </LinearLayout>
-
- <TextView
- android:id="@+id/textView1"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/settings_text_currentpod"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
- <EditText
- android:id="@+id/editText_currentpod"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/settings_currentpod">
- </EditText>
-
-
-
-
-
-
-
- <Button
- android:id="@+id/settings_button_save"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:onClick="Onclick_SaveSettings"
- android:text="@string/settings_button_save" />
-
-
View
50 src/com/voidcode/diasporawebclient/JsReshareHandler.java
@@ -1,50 +0,0 @@
- //The JsReshareHandler class and this is a fix to bug 2: cannot reshare
-//see: https://github.com/voidcode/Diaspora-Webclient/issues/2
-
-//Idea by a user
-//Has email me and say
-//way can´t I reshare diaspora post to facebook, google+ and twitter?
-//maby this class can help on this feature
-//TODO
-//find facebook, google+ and twitter share-post-java class
-//add it here in a listview/AlertDialog
-
-package com.voidcode.diasporawebclient;
-
-import android.webkit.JsResult;
-import android.webkit.WebChromeClient;
-import android.webkit.WebView;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-
-public class JsReshareHandler extends WebChromeClient {
- @Override
- public boolean onJsAlert(WebView view, String url, String message, JsResult result)
- {
- final AlertDialog.Builder alert = new AlertDialog.Builder(view.getContext());
- final JsResult finalRes = result;
- alert
- .setMessage(message)
- .setPositiveButton(android.R.string.ok,
- new AlertDialog.OnClickListener()
- {
- public void onClick(DialogInterface dialog, int which) {
- finalRes.confirm();
- }
- })
- .setCancelable(false)
- .create()
- .show();
-
- //Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
- //sharingIntent.setType("text/plain");
-
- //String shareBody = "Here is the share content body";
-
- //sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
- //sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
- //sharingIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[]{"abc@def.com,pqr@xyz.com"});
- //startActivity(Intent.createChooser(sharingIntent, "Share via"));
- return true;
- }
-}
View
207 src/com/voidcode/diasporawebclient/SettingsActivity.java
@@ -1,207 +0,0 @@
-package com.voidcode.diasporawebclient;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.StatusLine;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.res.Configuration;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.os.Bundle;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.KeyEvent;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.EditText;
-import android.widget.ListView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.Toast;
-
-public class SettingsActivity extends Activity {
- public static final String SETTINGS_FILENAME="settings";
- public ListView lvPods;
- public String lvPods_arr[] = getPods();
- private EditText editTextCurrentpod;
- JSONArray jsonArray;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- if(isNetworkAvailable())
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.settings);
- editTextCurrentpod = (EditText) findViewById(R.id.editText_currentpod);
- lvPods = (ListView) findViewById(R.id.listView_poduptime);
-
- //show the currentpod to user
- SharedPreferences preferences = getSharedPreferences(SETTINGS_FILENAME, MODE_PRIVATE);
- editTextCurrentpod.setText(preferences.getString("currentpod", "You need to choose a pod"));
- editTextCurrentpod.selectAll();
-
- //fill listview with pods form http://podupti.me
- fillListview(this.lvPods_arr);
-
- //podsearch, A fast find search on editTextCurrentpod, So user don´t have to scholl the podlist to finde a pod
- editTextCurrentpod.addTextChangedListener(new TextWatcher()
- {
- List<String> filter_podurl_list = null;
- public void beforeTextChanged(CharSequence s, int start, int count, int after)
- {
- }
- public void onTextChanged(CharSequence s, int start, int before, int count)
- {
- filter_podurl_list=new ArrayList<String>();
- for(String podurl:lvPods_arr)
- {
- if(podurl.startsWith(s.toString()))
- {
- filter_podurl_list.add(podurl);
- }
- }
- }
- public void afterTextChanged(Editable s)
- {
- ///add reslut to listview
- if(!filter_podurl_list.equals(null))
- fillListview(filter_podurl_list.toArray(new String[filter_podurl_list.size()]));
- }
- });
- }
- else
- {
- this.finish();
- startActivity(new Intent(this, SetupInternetActivity.class));
- }
- }
- public void fillListview(String _lvPods_arr[])
- {
- lvPods.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, _lvPods_arr));
- lvPods.setOnItemClickListener(new OnItemClickListener(){
- public void onItemClick(AdapterView<?> a, View v, int position, long id) {
- //onclick put select pod to editTextCurrentpod
- editTextCurrentpod.setText(lvPods.getItemAtPosition(position).toString());
- }
- });
- }
- //Screen orientation crashes app fix
- //http://jamesgiang.wordpress.com/2010/06/05/screen-orientation-crashes-my-app/
- @Override
- public void onConfigurationChanged(Configuration newConfig)
- {
- super.onConfigurationChanged(newConfig);
- }
- // Handle the Back button
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent msg){
- if((keyCode == KeyEvent.KEYCODE_BACK))
- {
- this.finish();
- startActivity(new Intent(this, MainActivity.class));
- return false;
- }
- else
- return true;
- }
- public void Onclick_SaveSettings(View v) throws IOException
- {
- //get userinput
- String new_currentpod = editTextCurrentpod.getText().toString();
- //if user has added a pod
- if(!new_currentpod.equals(""))
- {
- // Save the new currentpod
- SharedPreferences preferences = getSharedPreferences(SETTINGS_FILENAME, MODE_PRIVATE);
- SharedPreferences.Editor editor = preferences.edit();
- editor.putString("currentpod", new_currentpod);
- editor.commit();
- //goto MainActivity
- this.finish();
- startActivity(new Intent(this, MainActivity.class));
- }
- else
- Toast.makeText(getApplicationContext(), "You need to choose a pod", Toast.LENGTH_SHORT).show();
- }
- //simple json parsing, to retrieve list of pods from podupti.me
- //https://github.com/voidcode/Diaspora-Webclient/pull/4
- //by: https://github.com/vipulnsward
- public String [] getPods()
- {
- StringBuilder builder = new StringBuilder();
- HttpClient client = new DefaultHttpClient();
- List<String> list = null;
- try {
- HttpGet httpGet = new HttpGet("http://podupti.me/api.php?key=4r45tg&format=json");
- HttpResponse response = client.execute(httpGet);
- StatusLine statusLine = response.getStatusLine();
- int statusCode = statusLine.getStatusCode();
- if (statusCode == 200) {
- HttpEntity entity = response.getEntity();
- InputStream content = entity.getContent();
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(content));
- String line;
- while ((line = reader.readLine()) != null) {
- builder.append(line);
- }
- } else {
- //TODO Notify User about failure
- //Log.e("Diaspora-WebClient", "Failed to download file");
- }
- } catch (ClientProtocolException e) {
- //TODO handle network unreachable exception here
- e.printStackTrace();
- } catch (IOException e) {
- //TODO handle json buggy feed
- e.printStackTrace();
- }
- //Parse the JSON Data
- try {
- JSONObject j=new JSONObject(builder.toString());
- JSONArray jr=j.getJSONArray("pods");
- //Log.i("Diaspora-WebClient","Number of entries " + jr.length());
- list=new ArrayList<String>();
- for (int i = 0; i < jr.length(); i++) {
- JSONObject jo = jr.getJSONObject(i);
- //Log.i("Diaspora-WebClient", jo.getString("domain"));
- String secure=jo.getString("secure");
- if(secure.equals("true"))
- list.add(jo.getString("domain"));
- }
-
- }catch (Exception e) {
- //TODO Handle Parsing errors here
- e.printStackTrace();
- }
- return list.toArray(new String[list.size()]);
- }
- private boolean isNetworkAvailable()
- {
- ConnectivityManager connec = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo mobileInfo = connec.getNetworkInfo(0);
- NetworkInfo wifiInfo = connec.getNetworkInfo(1);
- NetworkInfo wimaxInfo = connec.getNetworkInfo(6);
- if (wimaxInfo!=null) {
- return mobileInfo.isConnected() || wifiInfo.isConnected()|| wimaxInfo.isConnected();
- }
- else {
- return mobileInfo.isConnected() || wifiInfo.isConnected();
- }
- }
-}

0 comments on commit 8bc56a1

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