Skip to content
Browse files

first commit

  • Loading branch information...
1 parent 6a15492 commit b7135d2b961476c5368ce5ca95184a5045afa513 Carles Sentis committed Jul 18, 2012
View
8 .classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+ <classpathentry kind="output" path="bin/classes"/>
+</classpath>
View
33 .project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>091 Labs lo-lo</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
38 AndroidManifest.xml
@@ -0,0 +1,38 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.codeskraps.lolo"
+ android:versionCode="2"
+ android:versionName="1.1" >
+
+ <uses-sdk
+ android:minSdkVersion="7"
+ android:targetSdkVersion="15" />
+
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity android:name=".PrefsActivity"
+ android:theme="@android:style/Theme.Light.NoTitleBar" >
+ <intent-filter>
+ <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
+ </intent-filter>
+ </activity>
+
+ <receiver android:name=".LoloProvider" >
+ <intent-filter>
+ <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
+ <action android:name="com.codeskraps.lolo.FORCE_WIDGET_UPDATE" />
+ </intent-filter>
+
+ <meta-data
+ android:name="android.appwidget.provider"
+ android:resource="@xml/loloinfo" />
+ </receiver>
+
+ <service android:name=".UpdateWidgetService" />
+ </application>
+
+</manifest>
View
BIN ic_launcher-web.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN libs/android-support-v4.jar
Binary file not shown.
View
20 proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
View
14 project.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-16
View
BIN res/drawable-hdpi/ic_action_search.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-ldpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-mdpi/ic_action_search.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-xhdpi/ic_action_search.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-xhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/closed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/open.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
36 res/layout/header.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:background="#222222"
+ android:orientation="horizontal" >
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="5dp"
+ android:background="@drawable/ic_launcher"
+ android:contentDescription="@string/iconImageDescription" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="15dp"
+ android:text="@string/app_name"
+ android:textColor="#B39000"
+ android:textSize="25dp"
+ android:typeface="normal" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="1dp"
+ android:background="#666666"
+ android:orientation="horizontal" />
+
+</LinearLayout>
View
12 res/layout/test.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+
+ <Button
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="ok"/>
+</LinearLayout>
View
17 res/layout/widget.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:orientation="vertical" >
+
+ <ImageView
+ android:id="@+id/imgLolo"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal|center"
+ android:contentDescription="@string/contentDescription"
+ android:src="@drawable/closed"
+ android:padding="15dip" />
+
+</LinearLayout>
View
6 res/menu/activity_main.xml
@@ -0,0 +1,6 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/menu_settings"
+ android:title="@string/menu_settings"
+ android:orderInCategory="100"
+ android:showAsAction="never" />
+</menu>
View
7 res/values-large/dimens.xml
@@ -0,0 +1,7 @@
+<resources>
+
+ <dimen name="padding_small">8dp</dimen>
+ <dimen name="padding_medium">16dp</dimen>
+ <dimen name="padding_large">16dp</dimen>
+
+</resources>
View
5 res/values-v11/styles.xml
@@ -0,0 +1,5 @@
+<resources>
+
+ <style name="AppTheme" parent="android:Theme.Holo.Light" />
+
+</resources>
View
5 res/values-v14/styles.xml
@@ -0,0 +1,5 @@
+<resources>
+
+ <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" />
+
+</resources>
View
7 res/values/dimens.xml
@@ -0,0 +1,7 @@
+<resources>
+
+ <dimen name="padding_small">8dp</dimen>
+ <dimen name="padding_medium">8dp</dimen>
+ <dimen name="padding_large">16dp</dimen>
+
+</resources>
View
30 res/values/strings.xml
@@ -0,0 +1,30 @@
+<resources>
+
+ <string name="app_name">091 Labs lo-lo</string>
+ <string name="menu_settings">Settings</string>
+ <string name="contentDescription">lo-lo Image</string>
+ <string name="iconImageDescription">logo</string>
+
+ <!-- Preference Activity -->
+ <string name="prefsCat_General">General</string>
+ <string name="prefsOnClick_title">OnClick event</string>
+ <string name="prefsOnClick_dialogTitle">Select One</string>
+
+ <string-array name="OnClick_entries">
+ <item>Nothing</item>
+ <item>Update lo-lo status</item>
+ <item>Open preference screen</item>
+ <item>Open 091 Labs web page</item>
+ </string-array>
+ <string-array name="OnClick_values">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ </string-array>
+
+ <string name="prefsCat_Info">Information</string>
+ <string name="prefsInfo_Title">091 Labs lo-lo v1.1</string>
+ <string name="prefsInfo_summary">GNU GPL License v3 - 2012</string>
+
+</resources>
View
5 res/values/styles.xml
@@ -0,0 +1,5 @@
+<resources>
+
+ <style name="AppTheme" parent="android:Theme.Light" />
+
+</resources>
View
9 res/xml/colors.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <color name="themeColor" >#B39000</color>
+ <color name="themeColorBackground" >#66B39000</color>
+ <color name="regColorBackground" >#00000000</color>
+ <color name="regColor" >#eeeeee</color>
+
+</resources>
View
8 res/xml/loloinfo.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
+ android:initialLayout="@layout/widget"
+ android:minHeight="72dip"
+ android:minWidth="72dip"
+ android:updatePeriodMillis="90000"
+ android:configure="com.codeskraps.lolo.PrefsActivity"
+ android:previewImage="@drawable/open" />
View
19 res/xml/preferences.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <PreferenceCategory android:title="@string/prefsCat_General" >
+ <ListPreference
+ android:key="lstOnClick"
+ android:title="@string/prefsOnClick_title"
+ android:entries="@array/OnClick_entries"
+ android:entryValues="@array/OnClick_values"
+ android:defaultValue="0"
+ android:dialogTitle="@string/prefsOnClick_dialogTitle" />
+ </PreferenceCategory>
+ <PreferenceCategory android:title="@string/prefsCat_Info" >
+ <Preference
+ android:summary="@string/prefsInfo_summary"
+ android:title="@string/prefsInfo_Title" />
+ </PreferenceCategory>
+
+</PreferenceScreen>
View
83 src/com/codeskraps/lolo/LoloProvider.java
@@ -0,0 +1,83 @@
+package com.codeskraps.lolo;
+
+import android.app.PendingIntent;
+import android.appwidget.AppWidgetManager;
+import android.appwidget.AppWidgetProvider;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.net.Uri;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.widget.RemoteViews;
+
+public class LoloProvider extends AppWidgetProvider {
+ private static final String TAG = LoloProvider.class.getSimpleName();
+ public static final String FORCE_WIDGET_UPDATE = "com.codeskraps.lolo.FORCE_WIDGET_UPDATE";
+ private static final String URL = "http://091labs.com";
+
+ @Override
+ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
+ updateWidget(context);
+ super.onUpdate(context, appWidgetManager, appWidgetIds);
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ final String action = intent.getAction();
+
+ if (action.equals(FORCE_WIDGET_UPDATE))
+ updateWidget(context);
+
+ super.onReceive(context, intent);
+ }
+
+ public void updateWidget(Context context) {
+ ComponentName thisWidget = new ComponentName(context, LoloProvider.class);
+ AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
+ int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget);
+ updateWidget(context, appWidgetManager, appWidgetIds);
+ }
+
+ private void updateWidget(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
+ final int N = appWidgetIds.length;
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+ Intent serviceIntent = new Intent(context, UpdateWidgetService.class);
+ serviceIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
+
+ Intent intent = null;
+ PendingIntent pendingIntent = null;
+
+ int onClick = Integer.parseInt(prefs.getString(PrefsActivity.ONCLICK, "0"));
+ RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
+
+ for (int i = 0; i < N; i++) {
+ int appWidgetId = appWidgetIds[i];
+
+ switch (onClick) {
+ case 0:
+ intent = new Intent("com.codeskraps.lol.DO_NOTHING");
+ break;
+ case 1:
+ pendingIntent = PendingIntent.getService(context, 0, serviceIntent, 0);
+ break;
+ case 2:
+ intent = new Intent(context, PrefsActivity.class);
+ pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
+ break;
+ case 3:
+ intent = new Intent(Intent.ACTION_VIEW);
+ intent.setData(Uri.parse(URL));
+ pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
+ break;
+ }
+ remoteViews.setOnClickPendingIntent(R.id.imgLolo, pendingIntent);
+ appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
+ }
+
+ // Update the widgets via the service
+ context.startService(serviceIntent);
+ }
+}
View
99 src/com/codeskraps/lolo/PrefsActivity.java
@@ -0,0 +1,99 @@
+package com.codeskraps.lolo;
+
+import android.appwidget.AppWidgetManager;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
+import android.os.Bundle;
+import android.preference.ListPreference;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.view.KeyEvent;
+
+public class PrefsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener {
+ private static final String TAG = PrefsActivity.class.getSimpleName();
+ private static String CONFIGURE_ACTION = "android.appwidget.action.APPWIDGET_CONFIGURE";
+ public static final String FORCE_WIDGET_UPDATE = "com.codeskraps.lolo.FORCE_WIDGET_UPDATE";
+ public static final String ONCLICK = "lstOnClick";
+
+ private SharedPreferences prefs = null;
+ private ListPreference lstOnClick = null;
+ private String[] entries_OnClick = null;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ Log.d(TAG, "onCreate");
+ super.onCreate(savedInstanceState);
+
+ // setContentView(R.layout.header);
+ addPreferencesFromResource(R.xml.preferences);
+
+ prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ prefs.registerOnSharedPreferenceChangeListener(this);
+
+ entries_OnClick = getResources().getStringArray(R.array.OnClick_entries);
+
+ lstOnClick = (ListPreference) findPreference(ONCLICK);
+
+ String onClick = prefs.getString(ONCLICK, "Nothing");
+ lstOnClick.setSummary(entries_OnClick[Integer.parseInt(onClick)]);
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ prefs.unregisterOnSharedPreferenceChangeListener(this);
+ }
+
+ @Override
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+ if (key.equals(ONCLICK)) {
+ String onClick = prefs.getString(ONCLICK, "Nothing");
+ lstOnClick.setSummary(entries_OnClick[Integer.parseInt(onClick)]);
+ }
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR
+ && keyCode == KeyEvent.KEYCODE_BACK
+ && event.getRepeatCount() == 0) {
+ // Take care of calling this method on earlier versions of
+ // the platform where it doesn't exist.
+ //Log.d(TAG, "SDK < Eclair");
+ onBackPressed();
+ }
+
+ return super.onKeyDown(keyCode, event);
+ }
+
+ @Override
+ public void onBackPressed() {
+ // This will be called either automatically for you on 2.0
+ // or later, or by the code above on earlier versions of the
+ // platform.
+ //Log.d(TAG, "onBackPressed");
+ resultIntent();
+ finish();
+ return;
+ }
+
+ private void resultIntent() {
+ Log.d(TAG, "resultIntent");
+
+ if (CONFIGURE_ACTION.equals(getIntent().getAction())) {
+ Intent intent = getIntent();
+ Bundle extras = intent.getExtras();
+ if (extras != null) {
+ int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,
+ AppWidgetManager.INVALID_APPWIDGET_ID);
+ Intent result = new Intent();
+
+ result.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
+ setResult(RESULT_OK, result);
+ }
+ }
+ sendBroadcast(new Intent(FORCE_WIDGET_UPDATE));
+ }
+}
View
87 src/com/codeskraps/lolo/UpdateWidgetService.java
@@ -0,0 +1,87 @@
+package com.codeskraps.lolo;
+
+import java.io.IOException;
+
+import android.app.Service;
+import android.appwidget.AppWidgetManager;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Handler;
+import android.os.IBinder;
+import android.util.Log;
+import android.widget.RemoteViews;
+
+public class UpdateWidgetService extends Service {
+ private static final String TAG = UpdateWidgetService.class.getSimpleName();
+
+ private static Context context = null;
+ private static Intent intent = null;
+ private static Handler handler;
+ private static boolean lolo;
+ private Thread downloadThread;
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ Log.d(TAG, "onStartCommand");
+
+ UpdateWidgetService.context = getApplicationContext();
+ UpdateWidgetService.intent = intent;
+ handler = new Handler();
+
+ if (Utils.isNetworkAvailable(getApplicationContext())) {
+ downloadThread = new MyThread();
+ downloadThread.start();
+ } else {
+ Log.d(TAG, "No network connection");
+ }
+
+ stopSelf();
+
+ return super.onStartCommand(intent, flags, startId);
+ }
+
+ static public class MyThread extends Thread {
+ @Override
+ public void run() {
+ try {
+ lolo = Utils.getLolo();
+ handler.post(new MyRunnable());
+ } catch (IOException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+ }
+
+ static private class MyRunnable implements Runnable {
+ public void run() {
+ AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context
+ .getApplicationContext());
+
+ int[] appWidgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
+
+ if (appWidgetIds.length > 0) {
+ for (int widgetId : appWidgetIds) {
+
+ RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
+ R.layout.widget);
+
+ if (lolo) {
+ remoteViews.setImageViewResource(R.id.imgLolo, R.drawable.open);
+ Log.d(TAG, "The labs is open");
+ } else {
+ remoteViews.setImageViewResource(R.id.imgLolo, R.drawable.closed);
+ Log.d(TAG, "The labs is close");
+ }
+ appWidgetManager.updateAppWidget(widgetId, remoteViews);
+ }
+ } else {
+ Log.d(TAG, "No widgets installed");
+ }
+ }
+ }
+}
View
66 src/com/codeskraps/lolo/Utils.java
@@ -0,0 +1,66 @@
+package com.codeskraps.lolo;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.util.Log;
+
+public class Utils {
+ private static final String TAG = Utils.class.getSimpleName();
+ private static final String URL = "http://scruffy.091labs.com/lolo/json/status.json";
+
+ public static boolean isNetworkAvailable(Context context) {
+ ConnectivityManager cm = (ConnectivityManager) context
+ .getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo networkInfo = cm.getActiveNetworkInfo();
+ if (networkInfo != null && networkInfo.isConnected()) {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean getLolo() throws IOException {
+ long startTime = System.currentTimeMillis();
+ Log.d(TAG, "download begining");
+ Log.d(TAG, "download url:" + URL);
+
+ HttpClient client = new DefaultHttpClient();
+ HttpGet request = new HttpGet(URL);
+ HttpResponse response = client.execute(request);
+
+ BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity()
+ .getContent(), "UTF-8"));
+ String json = reader.readLine();
+ Log.d(TAG, "json: " + json);
+ JSONTokener tokener = new JSONTokener(json);
+
+ String lolo = null;
+ try {
+ JSONObject finalResult = new JSONObject(tokener);
+ lolo = finalResult.getString("open");
+ Log.d(TAG, "lolo: " + lolo);
+ } catch (JSONException e) {
+ Log.e(TAG, e.getMessage());
+ }
+
+ Log.d(TAG, "download ready in"
+ + ((System.currentTimeMillis() - startTime) / 1000) + " sec");
+
+ if (lolo.equals("true")) {
+ return true;
+ } else
+ return false;
+ }
+}

0 comments on commit b7135d2

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