1 |
package com.grundfos.android.people; |
package com.grundfos.android.people; |
2 |
|
|
|
import java.io.File; |
|
3 |
import java.util.Date; |
import java.util.Date; |
4 |
|
|
5 |
import android.app.AlertDialog; |
import android.app.AlertDialog; |
6 |
import android.app.Dialog; |
import android.app.Dialog; |
7 |
import android.app.ListActivity; |
import android.app.ListActivity; |
8 |
import android.app.ProgressDialog; |
import android.app.ProgressDialog; |
9 |
|
import android.content.Context; |
10 |
import android.content.DialogInterface; |
import android.content.DialogInterface; |
11 |
import android.content.Intent; |
import android.content.Intent; |
12 |
import android.content.SharedPreferences; |
import android.content.SharedPreferences; |
14 |
import android.os.Bundle; |
import android.os.Bundle; |
15 |
import android.os.Handler; |
import android.os.Handler; |
16 |
import android.os.Message; |
import android.os.Message; |
17 |
|
import android.os.PowerManager; |
18 |
import android.text.Editable; |
import android.text.Editable; |
19 |
import android.text.TextWatcher; |
import android.text.TextWatcher; |
20 |
import android.util.Log; |
import android.util.Log; |
233 |
|
|
234 |
Runnable reloadDB = new Runnable() { |
Runnable reloadDB = new Runnable() { |
235 |
public void run() { |
public void run() { |
236 |
|
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); |
237 |
|
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag"); |
238 |
try |
try |
239 |
{ |
{ |
240 |
|
|
241 |
|
wl.acquire(); |
242 |
|
|
243 |
|
|
244 |
peopleDB.loadData(progressHandler); |
peopleDB.loadData(progressHandler); |
245 |
dbUpdateHandler.sendEmptyMessage(DOWNLOAD_SUCCESS); |
dbUpdateHandler.sendEmptyMessage(DOWNLOAD_SUCCESS); |
246 |
} catch (Exception e) { |
} catch (Exception e) { |
247 |
Log.e("PeopleList", "reloadDB", e); |
Log.e("PeopleList", "reloadDB", e); |
248 |
dbUpdateHandler.sendEmptyMessage(DOWNLOAD_FAILED); |
dbUpdateHandler.sendEmptyMessage(DOWNLOAD_FAILED); |
249 |
} |
} finally { |
250 |
|
wl.release(); |
251 |
|
} |
252 |
} |
} |
253 |
}; |
}; |
254 |
} |
} |