Migrate deprecated HttpClient use to URLConnection

pull/1/head
Trevor Slocum 2015-10-26 02:10:16 -07:00
parent 02a3a88b0c
commit c1497926d8
87 changed files with 909 additions and 942 deletions

View File

@ -1,6 +1,7 @@
1.2.8:
- Hide analytics preference when applicable
- Add widgets to open source release
- Migrate deprecated HttpClient use to URLConnection
1.2.7: (First release on F-Droid)
- Fix crash on non-English devices

View File

@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
@ -15,12 +15,12 @@ repositories {
}
android {
compileSdkVersion 19
buildToolsVersion '22.0.1'
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 23
versionCode 128
versionName "1.2.8"
@ -74,33 +74,28 @@ android {
}
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.android.support:support-v4:23.1.0'
freeCompile 'com.google.android.gms:play-services-base:8.1.0'
fullCompile 'com.google.android.gms:play-services-base:8.1.0'
freeCompile 'com.google.android.gms:play-services-identity:8.1.0'
fullCompile 'com.google.android.gms:play-services-identity:8.1.0'
freeCompile 'com.google.android.gms:play-services-analytics:8.1.0'
fullCompile 'com.google.android.gms:play-services-analytics:8.1.0'
freeCompile 'com.google.android.gms:play-services-ads:8.1.0'
fullCompile 'com.google.android.gms:play-services-ads:8.1.0'
freeCompile 'com.google.android.gms:play-services-wearable:8.1.0'
fullCompile 'com.google.android.gms:play-services-wearable:8.1.0'
freeCompile 'com.google.android.gms:play-services-appinvite:8.1.0'
fullCompile 'com.google.android.gms:play-services-appinvite:8.1.0'
freeCompile 'com.google.android.gms:play-services-fitness:8.1.0'
fullCompile 'com.google.android.gms:play-services-fitness:8.1.0'
//noinspection GradleDynamicVersion
compile 'ch.acra:acra:4.6.2'
compile 'com.github.amlcurran.showcaseview:library:5.0.0'
//wearApp project(':MeditationAssistantWear')
// TODO: Uncomment when Wear app is ready
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
}

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<ignore path="build/**" />
<ignore path="build/**"/>
</lint>

View File

@ -8,33 +8,33 @@
<meta-data
android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAIqq_HCa56eFzfQpNSwYUIIytAyO6bh4fFUFUcYA" />
android:value="AEdPqrEAAAAIqq_HCa56eFzfQpNSwYUIIytAyO6bh4fFUFUcYA"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
android:value="@integer/google_play_services_version"/>
<meta-data
android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="@xml/analytics" />
android:resource="@xml/analytics"/>
<receiver
android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true"
tools:ignore="ExportedReceiver">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH"/>
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false" />
android:exported="false"/>
<!-- Register Wear data layer service -->
<service android:name=".WearListenerService">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
<action android:name="com.google.android.gms.wearable.BIND_LISTENER"/>
</intent-filter>
</service>
@ -42,7 +42,7 @@
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
android:theme="@android:style/Theme.Translucent"/>
</application>

View File

@ -8,33 +8,33 @@
<meta-data
android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAImiscQeePK7-fr6JMj14zZX47kvR0lSKdCgjnXQ" />
android:value="AEdPqrEAAAAImiscQeePK7-fr6JMj14zZX47kvR0lSKdCgjnXQ"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
android:value="@integer/google_play_services_version"/>
<meta-data
android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="@xml/analytics" />
android:resource="@xml/analytics"/>
<receiver
android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true"
tools:ignore="ExportedReceiver">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH"/>
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false" />
android:exported="false"/>
<!-- Register Wear data layer service -->
<service android:name=".WearListenerService">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
<action android:name="com.google.android.gms.wearable.BIND_LISTENER"/>
</intent-filter>
</service>
@ -55,23 +55,23 @@
android:name=".MeditationProvider2"
android:label="@string/widget2x1">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_2" />
android:resource="@xml/widget_2"/>
</receiver>
<receiver
android:name=".MeditationProvider3"
android:label="@string/widget3x1">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_3" />
android:resource="@xml/widget_3"/>
</receiver>
</application>

View File

@ -6,16 +6,16 @@
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="22" />
android:targetSdkVersion="22"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:name="sh.ftp.rocketninelabs.meditationassistant.MeditationAssistant"
@ -35,14 +35,14 @@
<intent-filter>
<action android:name="sh.ftp.rocketninelabs.meditationassistant.DAILY_NOTIFICATION"></action>
<action android:name="sh.ftp.rocketninelabs.meditationassistant.DAILY_NOTIFICATION_UPDATED"></action>
<action android:name="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE"/>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<data
android:path="${applicationId}"
android:scheme="package" />
android:scheme="package"/>
</intent-filter>
</receiver>
@ -53,8 +53,8 @@
android:label="@string/appNameShort"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="sh.ftp.rocketninelabs.meditationassistant.ALARM"></action>
@ -69,7 +69,7 @@
tools:ignore="UnusedAttribute">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity" />
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity"/>
</activity>
<activity
android:name="sh.ftp.rocketninelabs.meditationassistant.MediNETActivity"
@ -78,7 +78,7 @@
android:launchMode="singleTop">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity" />
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity"/>
</activity>
<activity
android:name="sh.ftp.rocketninelabs.meditationassistant.CompleteActivity"
@ -86,7 +86,7 @@
android:label="@string/sessioncomplete">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity" />
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity"/>
</activity>
<activity
android:name="sh.ftp.rocketninelabs.meditationassistant.AboutActivity"
@ -94,7 +94,7 @@
android:label="@string/about">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity" />
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity"/>
</activity>
<activity
android:name="sh.ftp.rocketninelabs.meditationassistant.ProgressActivity"
@ -102,7 +102,7 @@
android:label="@string/progress">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity" />
android:value="sh.ftp.rocketninelabs.meditationassistant.MainActivity"/>
</activity>
</application>

View File

@ -69,13 +69,11 @@ public class AboutActivity extends Activity {
if (!getMeditationAssistant().getMarketName().equals("google")) {
MenuItem share = menu.findItem(R.id.action_share_app);
share.setVisible(false);
invalidateOptionsMenu();
}
if (getMeditationAssistant().getMarketName().equals("fdroid")) {
MenuItem rate = menu.findItem(R.id.action_rate);
rate.setVisible(false);
invalidateOptionsMenu();
}
return true;

View File

@ -62,14 +62,14 @@ public class ListPreferenceSound extends ListPreference {
return mEntries;
}
public void setEntries(CharSequence[] entries) {
mEntries = entries;
}
public void setEntries(int entriesResId) {
setEntries(getContext().getResources().getTextArray(entriesResId));
}
public void setEntries(CharSequence[] entries) {
mEntries = entries;
}
public CharSequence getEntry() {
int index = getValueIndex();
return index >= 0 && mEntries != null ? mEntries[index] : null;
@ -79,15 +79,15 @@ public class ListPreferenceSound extends ListPreference {
return mEntryValues;
}
public void setEntryValues(CharSequence[] entryValues) {
mEntryValues = entryValues;
}
public void setEntryValues(int entryValuesResId) {
setEntryValues(getContext().getResources().getTextArray(
entryValuesResId));
}
public void setEntryValues(CharSequence[] entryValues) {
mEntryValues = entryValues;
}
@Override
public CharSequence getSummary() {
final CharSequence entry = getEntry();

View File

@ -17,18 +17,13 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import org.apache.http.cookie.Cookie;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
public class MediNETActivity extends Activity {
@ -202,22 +197,6 @@ public class MediNETActivity extends Activity {
"MA");
webView.getSettings().setJavaScriptEnabled(true);
// Cookies
List<Cookie> cookies = getMeditationAssistant().getHttpClient()
.getCookieStore().getCookies();
if (!cookies.isEmpty()) {
CookieManager cookieManager = CookieManager.getInstance();
for (Cookie cookie : cookies) {
String cookieString = cookie.getName() + "="
+ cookie.getValue() + "; domain="
+ cookie.getDomain();
cookieManager.setCookie("medinet.ftp.sh", cookieString);
CookieSyncManager.getInstance().sync();
}
}
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
@ -430,8 +409,7 @@ public class MediNETActivity extends Activity {
@Override
protected void onPause() {
getMeditationAssistant().utility.pauseAd(this);
CookieSyncManager.getInstance().stopSync();
super.onStop();
super.onPause();
}
@Override
@ -462,7 +440,6 @@ public class MediNETActivity extends Activity {
@Override
protected void onResume() {
CookieSyncManager.getInstance().startSync();
super.onResume();
getMeditationAssistant().utility.resumeAd(this);
}

View File

@ -5,24 +5,23 @@ import android.os.AsyncTask;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.HashMap;
import java.util.TimeZone;
public class MediNETTask extends AsyncTask<MediNET, Integer, MediNET> {
@ -31,9 +30,7 @@ public class MediNETTask extends AsyncTask<MediNET, Integer, MediNET> {
public String action = "";
public String actionextra = "";
public MediNET medinet;
public String x;
public FragmentActivity fragment_activity = null;
private BufferedReader webReader;
private MeditationAssistant ma = null;
private Crypt crypt = new Crypt();
@ -71,33 +68,31 @@ public class MediNETTask extends AsyncTask<MediNET, Integer, MediNET> {
Log.d("MeditationAssistant", "URL => " + this.nextURL);
HttpPost httpPost = new HttpPost(this.nextURL);
HttpResponse webResponse = null;
ArrayList<SessionSQL> sessionssql = null;
HashMap<String, String> postData = new HashMap<String, String>();
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("x", medinet
.getMeditationAssistant().getMediNETKey()));
postData.put("x", medinet
.getMeditationAssistant().getMediNETKey());
if (action.equals("connect")) {
nameValuePairs.add(new BasicNameValuePair("action", "connect"));
postData.put("action", "connect");
} else if (action.equals("postsession")) {
nameValuePairs.add(new BasicNameValuePair("postsession", Crypt
postData.put("postsession", Crypt
.bytesToHex(crypt.encrypt(medinet.getSession().export()
.toString()))));
.toString())));
if (actionextra.equals("manualposting")) {
nameValuePairs.add(new BasicNameValuePair("manualposting",
"true"));
postData.put("manualposting",
"true");
}
} else if (action.equals("deletesession")) {
nameValuePairs.add(new BasicNameValuePair("action",
"deletesession")); // Session start time
nameValuePairs.add(new BasicNameValuePair("session",
actionextra));
postData.put("action",
"deletesession"); // Session start time
postData.put("session",
actionextra);
} else if (action.equals("syncsessions")) {
nameValuePairs.add(new BasicNameValuePair("action",
"syncsessions"));
postData.put("action",
"syncsessions");
} else if (action.equals("uploadsessions")) {
JSONArray jsonsessions = new JSONArray();
sessionssql = getMeditationAssistant().db.getAllLocalSessions();
@ -124,20 +119,11 @@ public class MediNETTask extends AsyncTask<MediNET, Integer, MediNET> {
Log.d("MeditationAssistant", jsonsessions.toString());
nameValuePairs.add(new BasicNameValuePair("uploadsessions", Crypt
.bytesToHex(crypt.encrypt(jsonsessions.toString()))));
postData.put("uploadsessions", Crypt
.bytesToHex(crypt.encrypt(jsonsessions.toString())));
} else if (action.equals("signout")) {
nameValuePairs
.add(new BasicNameValuePair("signout", "signout"));
postData.put("signout", "signout");
}
Log.d("MeditationAssistant", "Post to " + this.nextURL + ", "
+ nameValuePairs.toString());
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
webResponse = getMeditationAssistant().getHttpClient().execute(
httpPost, getMeditationAssistant().getHttpContext());
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
@ -145,37 +131,69 @@ public class MediNETTask extends AsyncTask<MediNET, Integer, MediNET> {
e.printStackTrace();
}
if (webResponse == null) {
Log.d("MeditationAssistant", "Unable to connect to MediNET");
medinet.status = "disconnected";
/*
if (!getMeditationAssistant().getMediNETKey().equals("")
&& medinet.activity != null) {
getMeditationAssistant().longToast(medinet.activity,
getMeditationAssistant().getString(R.string.unableToConnect));
medinet.activity.updateTextsAsync();
}
return medinet;
}
Log.d("MeditationAssistant", "Post to " + this.nextURL + ", "
+ postData.toString());
httpPost.setEntity(new UrlEncodedFormEntity(postData));
webResponse = getMeditationAssistant().getHttpClient().execute(
httpPost);
HttpPost httpPost = new HttpPost(this.nextURL);
HttpResponse webResponse = null;
*/
String result = "";
HttpURLConnection medinetConnection = null;
try {
this.webReader = new BufferedReader(new InputStreamReader(
webResponse.getEntity().getContent()));
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
URL medinetURL = new URL(this.nextURL);
medinetConnection = (HttpURLConnection) medinetURL.openConnection();
String line;
try {
while ((line = this.webReader.readLine()) != null) {
result += line + "\n";
medinetConnection.setChunkedStreamingMode(0);
medinetConnection.setRequestMethod("POST");
medinetConnection.setDoInput(true);
medinetConnection.setDoOutput(true);
OutputStream os = medinetConnection.getOutputStream();
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(os, "UTF-8"));
writer.write(getMeditationAssistant().getPostDataString(postData));
medinetConnection.connect();
writer.flush();
writer.close();
os.close();
int responseCode = medinetConnection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
String line;
BufferedReader br = new BufferedReader(new InputStreamReader(medinetConnection.getInputStream()));
while ((line = br.readLine()) != null) {
result += line;
}
} else {
result = "";
}
} catch (IOException e) {
if (result.equals("")) {
Log.d("MeditationAssistant", "Unable to connect to MediNET");
medinet.status = "disconnected";
if (!getMeditationAssistant().getMediNETKey().equals("")
&& medinet.activity != null) {
getMeditationAssistant().longToast(medinet.activity,
getMeditationAssistant().getString(R.string.unableToConnect));
medinet.activity.updateTextsAsync();
}
}
} catch (Exception e) {
e.printStackTrace();
return medinet;
}
Calendar date = new GregorianCalendar();
@ -191,20 +209,17 @@ public class MediNETTask extends AsyncTask<MediNET, Integer, MediNET> {
);
Log.d("MeditationAssistant", "Result: " + result);
if (webResponse.getFirstHeader("x-MediNET") != null) {
if (webResponse.getFirstHeader("x-MediNET").getValue()
if (medinetConnection.getHeaderField("x-MediNET") != null) {
if (medinetConnection.getHeaderField("x-MediNET")
.equals("signin")) {
this.medinet.askToSignIn();
} else {
if (action.equals("signin") && webResponse.getFirstHeader("x-MediNET-Key") != null) {
if (action.equals("signin") && medinetConnection.getHeaderField("x-MediNET-Key") != null) {
/* Oauth2 sign in */
Log.d("MeditationAssistant", "Header key: "
+ webResponse.getFirstHeader("x-MediNET-Key")
.getValue());
if (!webResponse.getFirstHeader("x-MediNET-Key")
.getValue().equals("")) {
getMeditationAssistant().setMediNETKey(webResponse.getFirstHeader("x-MediNET-Key")
.getValue(), "Google");
+ medinetConnection.getHeaderField("x-MediNET-Key"));
if (!medinetConnection.getHeaderField("x-MediNET-Key").equals("")) {
getMeditationAssistant().setMediNETKey(medinetConnection.getHeaderField("x-MediNET-Key"), "Google");
//getMeditationAssistant().getMediNET().connect();
try {
@ -215,31 +230,25 @@ public class MediNETTask extends AsyncTask<MediNET, Integer, MediNET> {
e.printStackTrace();
}
}
} else if (webResponse.getFirstHeader("x-MediNET-Streak") != null) {
} else if (medinetConnection.getHeaderField("x-MediNET-Streak") != null) {
Log.d("MeditationAssistant", "Header streak: "
+ webResponse.getFirstHeader("x-MediNET-Streak")
.getValue());
if (!webResponse.getFirstHeader("x-MediNET-Streak")
.getValue().equals("")) {
String streak_header = webResponse.getFirstHeader(
"x-MediNET-Streak").getValue();
+ medinetConnection.getHeaderField("x-MediNET-Streak"));
if (!medinetConnection.getHeaderField("x-MediNET-Streak").equals("")) {
String streak_header = medinetConnection.getHeaderField("x-MediNET-Streak");
if (streak_header.contains(",")) {
getMeditationAssistant().setMeditationStreak(Integer.valueOf(streak_header.split(",")[0]), Integer.valueOf(streak_header.split(",")[1]));
getMeditationAssistant().recalculateMeditationStreak();
}
}
}
if (webResponse.getFirstHeader("x-MediNET-Meditating") != null) {
if (!webResponse.getFirstHeader("x-MediNET-Meditating")
.getValue().equals("")) {
if (medinetConnection.getHeaderField("x-MediNET-Meditating") != null) {
if (!medinetConnection.getHeaderField("x-MediNET-Meditating").equals("")) {
// TODO: Was this going to be a meditating-now feature?
}
}
if (webResponse.getFirstHeader("x-MediNET-MaxStreak") != null) {
if (!webResponse.getFirstHeader("x-MediNET-MaxStreak")
.getValue().equals("")) {
Integer maxstreak = Integer.valueOf(webResponse.getFirstHeader("x-MediNET-MaxStreak")
.getValue());
if (medinetConnection.getHeaderField("x-MediNET-MaxStreak") != null) {
if (!medinetConnection.getHeaderField("x-MediNET-MaxStreak").equals("")) {
Integer maxstreak = Integer.valueOf(medinetConnection.getHeaderField("x-MediNET-MaxStreak"));
if (maxstreak > getMeditationAssistant().getLongestMeditationStreak()) {
getMeditationAssistant().setLongestMeditationStreak(maxstreak);
}
@ -247,7 +256,7 @@ public class MediNETTask extends AsyncTask<MediNET, Integer, MediNET> {
}
}
Log.d("MeditationAssistant", "Header: "
+ webResponse.getFirstHeader("x-MediNET").getValue());
+ medinetConnection.getHeaderField("x-MediNET"));
if (!result.equals("")
&& !result.trim().startsWith("<")) {
@ -434,6 +443,7 @@ public class MediNETTask extends AsyncTask<MediNET, Integer, MediNET> {
t.printStackTrace();
}
medinetConnection.disconnect();
return medinet;
}

View File

@ -38,25 +38,23 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.CookieSyncManager;
import android.widget.ImageButton;
import android.widget.Toast;
import org.acra.ACRA;
import org.acra.annotation.ReportsCrashes;
import org.apache.http.client.protocol.ClientContext;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.BasicHttpContext;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
@ReportsCrashes(
@ -76,9 +74,6 @@ public class MeditationAssistant extends Application {
public long pausetime = 0;
public int previousRingerMode = -1;
public String toastText = "";
public DefaultHttpClient httpClient = null;
public BasicCookieStore cookieStore = null;
public BasicHttpContext httpContext = null;
public String pendingNotificationAction = "";
public Boolean asktorate = false;
public DatabaseHandler db = null;
@ -122,16 +117,6 @@ public class MeditationAssistant extends Application {
resources.getDisplayMetrics());
}
public static DefaultHttpClient getThreadSafeHttpClient() {
DefaultHttpClient client = new DefaultHttpClient();
ClientConnectionManager mgr = client.getConnectionManager();
HttpParams params = client.getParams();
client = new DefaultHttpClient(new ThreadSafeClientConnManager(params,
mgr.getSchemeRegistry()), params);
return client;
}
public static void setAlphaCompat(View view, float alpha) {
view.setAlpha(alpha);
}
@ -270,26 +255,6 @@ public class MeditationAssistant extends Application {
editingduration = bool;
}
public DefaultHttpClient getHttpClient() {
if (httpClient == null) {
httpClient = getThreadSafeHttpClient();
httpClient.setCookieStore(cookieStore);
}
return httpClient;
}
public BasicHttpContext getHttpContext() {
if (cookieStore == null) {
cookieStore = new BasicCookieStore();
httpContext = new BasicHttpContext();
// Bind custom cookie store to the local context
httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
}
return httpContext;
}
public int getMATextColor(Boolean enabled) {
if (enabled) {
if (!getMAThemeString().equals("dark") && !getMAThemeString().equals("buddhism")) {
@ -781,6 +746,9 @@ public class MeditationAssistant extends Application {
utility.ma = this;
CookieManager cookieManager = new CookieManager();
CookieHandler.setDefault(cookieManager);
Integer applaunches = getPrefs().getInt("applaunches", 0) + 1;
getPrefs().edit().putInt("applaunches", applaunches).apply();
@ -816,7 +784,6 @@ public class MeditationAssistant extends Application {
}*/
db = DatabaseHandler.getInstance(getApplicationContext());
CookieSyncManager.createInstance(getApplicationContext());
reminderAlarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
@ -827,6 +794,23 @@ public class MeditationAssistant extends Application {
sendBroadcast(intent);
}
public String getPostDataString(HashMap<String, String> params) throws UnsupportedEncodingException {
StringBuilder result = new StringBuilder();
boolean first = true;
for (Map.Entry<String, String> entry : params.entrySet()) {
if (first)
first = false;
else
result.append("&");
result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
result.append("=");
result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
}
return result.toString();
}
public boolean sendUsageReports() {
if (sendusage == null) {
sendusage = getPrefs().getBoolean("pref_sendusage", true);
@ -1046,7 +1030,7 @@ public class MeditationAssistant extends Application {
}
names[i] = getString(R.string.signInWithOpenID);
AlertDialog accountsAlertDialog = new AlertDialog.Builder(activity)
AlertDialog accountsAlertDialog = new AlertDialog.Builder(signin_activity)
.setTitle(getString(R.string.signInWith))
.setItems(names, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
@ -1064,7 +1048,7 @@ public class MeditationAssistant extends Application {
}));
}
} else {
showOpenIDSignInDialog(activity);
showOpenIDSignInDialog(signin_activity);
}
}
})
@ -1073,7 +1057,7 @@ public class MeditationAssistant extends Application {
return accountsAlertDialog;
} else {
return showOpenIDSignInDialog(activity);
return showOpenIDSignInDialog(signin_activity);
}
}

View File

@ -18,7 +18,6 @@ package sh.ftp.rocketninelabs.meditationassistant;
import android.content.Context;
import android.hardware.SensorManager;
import android.util.FloatMath;
import android.view.ViewConfiguration;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
@ -400,7 +399,7 @@ public class Scroller {
float dx = (float) (mFinalX - mStartX);
float dy = (float) (mFinalY - mStartY);
float hyp = FloatMath.sqrt(dx * dx + dy * dy);
float hyp = (float) Math.sqrt(dx * dx + dy * dy);
float ndx = dx / hyp;
float ndy = dy / hyp;
@ -417,7 +416,7 @@ public class Scroller {
mMode = FLING_MODE;
mFinished = false;
float velocity = FloatMath.sqrt(velocityX * velocityX + velocityY * velocityY);
float velocity = (float) Math.sqrt(velocityX * velocityX + velocityY * velocityY);
mVelocity = velocity;
final double l = Math.log(START_TENSION * velocity / ALPHA);

View File

@ -6,6 +6,6 @@
android:fromAlpha="0.0"
android:interpolator="@android:anim/decelerate_interpolator"
android:repeatCount="0"
android:toAlpha="1.0" />
android:toAlpha="1.0"/>
</set>

View File

@ -6,6 +6,6 @@
android:fromAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:repeatCount="0"
android:toAlpha="0.0" />
android:toAlpha="0.0"/>
</set>

View File

@ -9,7 +9,7 @@
android:pivotY="50%"
android:repeatCount="infinite"
android:startOffset="0"
android:toDegrees="359" />
android:toDegrees="359"/>
<rotate
android:duration="500"
android:fromDegrees="0"
@ -18,7 +18,7 @@
android:pivotY="50%"
android:repeatCount="infinite"
android:startOffset="0"
android:toDegrees="180" />
android:toDegrees="180"/>
<rotate
android:duration="575"
android:fromDegrees="0"
@ -27,7 +27,7 @@
android:pivotY="50%"
android:repeatCount="infinite"
android:startOffset="0"
android:toDegrees="-144" />
android:toDegrees="-144"/>
<scale
android:duration="450"
@ -37,28 +37,28 @@
android:interpolator="@android:anim/accelerate_interpolator"
android:repeatCount="infinite"
android:toXScale="1.0"
android:toYScale="1.0" />
android:toYScale="1.0"/>
<translate
android:duration="700"
android:fromXDelta="-200"
android:fromYDelta="-200"
android:interpolator="@android:anim/accelerate_interpolator" />
android:interpolator="@android:anim/accelerate_interpolator"/>
<translate
android:duration="4000"
android:interpolator="@android:anim/accelerate_interpolator"
android:toXDelta="200"
android:toYDelta="200" />
android:toYDelta="200"/>
<translate
android:duration="818"
android:fromXDelta="-30"
android:fromYDelta="2121"
android:interpolator="@android:anim/accelerate_interpolator" />
android:interpolator="@android:anim/accelerate_interpolator"/>
<translate
android:duration="2214"
android:interpolator="@android:anim/accelerate_interpolator"
android:toXDelta="414"
android:toYDelta="177" />
android:toYDelta="177"/>
<scale
android:duration="3777"
@ -68,6 +68,6 @@
android:interpolator="@android:anim/accelerate_interpolator"
android:repeatCount="infinite"
android:toXScale="0.0"
android:toYScale="0.0" />
android:toYScale="0.0"/>
</set>

View File

@ -16,5 +16,5 @@
-->
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ab_texture_tile_buddhism"
android:tileMode="repeat" />
android:src="@drawable/ab_texture_tile_buddhism"
android:tileMode="repeat"/>

View File

@ -17,7 +17,7 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_cab_done_pressed_buddhism" android:state_pressed="true" />
<item android:drawable="@drawable/btn_cab_done_focused_buddhism" android:state_enabled="true" android:state_focused="true" />
<item android:drawable="@drawable/btn_cab_done_default_buddhism" android:state_enabled="true" />
<item android:drawable="@drawable/btn_cab_done_pressed_buddhism" android:state_pressed="true"/>
<item android:drawable="@drawable/btn_cab_done_focused_buddhism" android:state_enabled="true" android:state_focused="true"/>
<item android:drawable="@drawable/btn_cab_done_default_buddhism" android:state_enabled="true"/>
</selector>

View File

@ -14,6 +14,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/buddhism_list_activated_holo" android:state_activated="true" />
<item android:drawable="@android:color/transparent" />
<item android:drawable="@drawable/buddhism_list_activated_holo" android:state_activated="true"/>
<item android:drawable="@android:color/transparent"/>
</selector>

View File

@ -17,28 +17,28 @@
<!-- Enabled states -->
<item android:drawable="@drawable/buddhism_btn_check_on_holo_light" android:state_checked="true" android:state_enabled="true" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_check_off_holo_light" android:state_checked="false" android:state_enabled="true" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_check_on_holo_light" android:state_checked="true" android:state_enabled="true" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_check_off_holo_light" android:state_checked="false" android:state_enabled="true" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_check_on_pressed_holo_light" android:state_checked="true" android:state_enabled="true" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_btn_check_off_pressed_holo_light" android:state_checked="false" android:state_enabled="true" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_btn_check_on_pressed_holo_light" android:state_checked="true" android:state_enabled="true" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_btn_check_off_pressed_holo_light" android:state_checked="false" android:state_enabled="true" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_btn_check_on_focused_holo_light" android:state_checked="true" android:state_enabled="true" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_check_off_focused_holo_light" android:state_checked="false" android:state_enabled="true" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_check_on_focused_holo_light" android:state_checked="true" android:state_enabled="true" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_check_off_focused_holo_light" android:state_checked="false" android:state_enabled="true" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_check_off_holo_light" android:state_checked="false" android:state_enabled="true" />
<item android:drawable="@drawable/buddhism_btn_check_on_holo_light" android:state_checked="true" android:state_enabled="true" />
<item android:drawable="@drawable/buddhism_btn_check_off_holo_light" android:state_checked="false" android:state_enabled="true"/>
<item android:drawable="@drawable/buddhism_btn_check_on_holo_light" android:state_checked="true" android:state_enabled="true"/>
<!-- Disabled states -->
<item android:drawable="@drawable/buddhism_btn_check_on_disabled_holo_light" android:state_checked="true" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_check_off_disabled_holo_light" android:state_checked="false" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_check_on_disabled_holo_light" android:state_checked="true" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_check_off_disabled_holo_light" android:state_checked="false" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_check_on_disabled_focused_holo_light" android:state_checked="true" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_check_off_disabled_focused_holo_light" android:state_checked="false" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_check_on_disabled_focused_holo_light" android:state_checked="true" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_check_off_disabled_focused_holo_light" android:state_checked="false" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_check_off_disabled_holo_light" android:state_checked="false" />
<item android:drawable="@drawable/buddhism_btn_check_on_disabled_holo_light" android:state_checked="true" />
<item android:drawable="@drawable/buddhism_btn_check_off_disabled_holo_light" android:state_checked="false"/>
<item android:drawable="@drawable/buddhism_btn_check_on_disabled_holo_light" android:state_checked="true"/>
</selector>

View File

@ -14,11 +14,11 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/buddhism_btn_default_normal_holo_light" android:state_enabled="true" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_default_disabled_holo_light" android:state_enabled="false" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_default_pressed_holo_light" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_btn_default_focused_holo_light" android:state_enabled="true" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_default_normal_holo_light" android:state_enabled="true" />
<item android:drawable="@drawable/buddhism_btn_default_disabled_focused_holo_light" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_default_disabled_holo_light" />
<item android:drawable="@drawable/buddhism_btn_default_normal_holo_light" android:state_enabled="true" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_default_disabled_holo_light" android:state_enabled="false" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_default_pressed_holo_light" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_btn_default_focused_holo_light" android:state_enabled="true" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_default_normal_holo_light" android:state_enabled="true"/>
<item android:drawable="@drawable/buddhism_btn_default_disabled_focused_holo_light" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_default_disabled_holo_light"/>
</selector>

View File

@ -14,27 +14,27 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/buddhism_btn_radio_on_holo_light" android:state_checked="true" android:state_enabled="true" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_radio_off_holo_light" android:state_checked="false" android:state_enabled="true" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_radio_on_holo_light" android:state_checked="true" android:state_enabled="true" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_radio_off_holo_light" android:state_checked="false" android:state_enabled="true" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_radio_on_pressed_holo_light" android:state_checked="true" android:state_enabled="true" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_btn_radio_off_pressed_holo_light" android:state_checked="false" android:state_enabled="true" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_btn_radio_on_pressed_holo_light" android:state_checked="true" android:state_enabled="true" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_btn_radio_off_pressed_holo_light" android:state_checked="false" android:state_enabled="true" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_btn_radio_on_focused_holo_light" android:state_checked="true" android:state_enabled="true" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_radio_off_focused_holo_light" android:state_checked="false" android:state_enabled="true" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_radio_on_focused_holo_light" android:state_checked="true" android:state_enabled="true" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_radio_off_focused_holo_light" android:state_checked="false" android:state_enabled="true" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_radio_off_holo_light" android:state_checked="false" android:state_enabled="true" />
<item android:drawable="@drawable/buddhism_btn_radio_on_holo_light" android:state_checked="true" android:state_enabled="true" />
<item android:drawable="@drawable/buddhism_btn_radio_off_holo_light" android:state_checked="false" android:state_enabled="true"/>
<item android:drawable="@drawable/buddhism_btn_radio_on_holo_light" android:state_checked="true" android:state_enabled="true"/>
<!-- Disabled states -->
<item android:drawable="@drawable/buddhism_btn_radio_on_disabled_holo_light" android:state_checked="true" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_radio_off_disabled_holo_light" android:state_checked="false" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_radio_on_disabled_holo_light" android:state_checked="true" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_radio_off_disabled_holo_light" android:state_checked="false" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_radio_on_disabled_focused_holo_light" android:state_checked="true" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_radio_off_disabled_focused_holo_light" android:state_checked="false" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_radio_on_disabled_focused_holo_light" android:state_checked="true" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_radio_off_disabled_focused_holo_light" android:state_checked="false" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_radio_off_disabled_holo_light" android:state_checked="false" />
<item android:drawable="@drawable/buddhism_btn_radio_on_disabled_holo_light" android:state_checked="true" />
<item android:drawable="@drawable/buddhism_btn_radio_off_disabled_holo_light" android:state_checked="false"/>
<item android:drawable="@drawable/buddhism_btn_radio_on_disabled_holo_light" android:state_checked="true"/>
</selector>

View File

@ -14,19 +14,19 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/buddhism_btn_toggle_on_normal_holo_light" android:state_checked="true" android:state_enabled="true" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_toggle_on_disabled_holo_light" android:state_checked="true" android:state_enabled="false" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_toggle_on_pressed_holo_light" android:state_checked="true" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_btn_toggle_on_focused_holo_light" android:state_checked="true" android:state_enabled="true" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_toggle_on_normal_holo_light" android:state_checked="true" android:state_enabled="true" />
<item android:drawable="@drawable/buddhism_btn_toggle_on_disabled_focused_holo_light" android:state_checked="true" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_toggle_on_disabled_holo_light" android:state_checked="true" />
<item android:drawable="@drawable/buddhism_btn_toggle_on_normal_holo_light" android:state_checked="true" android:state_enabled="true" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_toggle_on_disabled_holo_light" android:state_checked="true" android:state_enabled="false" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_toggle_on_pressed_holo_light" android:state_checked="true" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_btn_toggle_on_focused_holo_light" android:state_checked="true" android:state_enabled="true" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_toggle_on_normal_holo_light" android:state_checked="true" android:state_enabled="true"/>
<item android:drawable="@drawable/buddhism_btn_toggle_on_disabled_focused_holo_light" android:state_checked="true" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_toggle_on_disabled_holo_light" android:state_checked="true"/>
<item android:drawable="@drawable/buddhism_btn_toggle_off_normal_holo_light" android:state_enabled="true" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_toggle_off_disabled_holo_light" android:state_enabled="false" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_btn_toggle_off_pressed_holo_light" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_btn_toggle_off_focused_holo_light" android:state_enabled="true" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_toggle_off_normal_holo_light" android:state_enabled="true" />
<item android:drawable="@drawable/buddhism_btn_toggle_off_disabled_focused_holo_light" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_btn_toggle_off_disabled_holo_light" />
<item android:drawable="@drawable/buddhism_btn_toggle_off_normal_holo_light" android:state_enabled="true" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_toggle_off_disabled_holo_light" android:state_enabled="false" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_btn_toggle_off_pressed_holo_light" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_btn_toggle_off_focused_holo_light" android:state_enabled="true" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_toggle_off_normal_holo_light" android:state_enabled="true"/>
<item android:drawable="@drawable/buddhism_btn_toggle_off_disabled_focused_holo_light" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_btn_toggle_off_disabled_holo_light"/>
</selector>

View File

@ -14,11 +14,11 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/buddhism_textfield_default_holo_light" android:state_enabled="true" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_textfield_disabled_holo_light" android:state_enabled="false" android:state_window_focused="false" />
<item android:drawable="@drawable/buddhism_textfield_activated_holo_light" android:state_enabled="true" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_textfield_focused_holo_light" android:state_activated="true" android:state_enabled="true" />
<item android:drawable="@drawable/buddhism_textfield_default_holo_light" android:state_enabled="true" />
<item android:drawable="@drawable/buddhism_textfield_disabled_focused_holo_light" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_textfield_disabled_holo_light" />
<item android:drawable="@drawable/buddhism_textfield_default_holo_light" android:state_enabled="true" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_textfield_disabled_holo_light" android:state_enabled="false" android:state_window_focused="false"/>
<item android:drawable="@drawable/buddhism_textfield_activated_holo_light" android:state_enabled="true" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_textfield_focused_holo_light" android:state_activated="true" android:state_enabled="true"/>
<item android:drawable="@drawable/buddhism_textfield_default_holo_light" android:state_enabled="true"/>
<item android:drawable="@drawable/buddhism_textfield_disabled_focused_holo_light" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_textfield_disabled_holo_light"/>
</selector>

View File

@ -14,6 +14,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/buddhism_fastscroll_thumb_pressed_holo" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_fastscroll_thumb_default_holo" />
<item android:drawable="@drawable/buddhism_fastscroll_thumb_pressed_holo" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_fastscroll_thumb_default_holo"/>
</selector>

View File

@ -16,10 +16,10 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:drawable="@drawable/buddhism_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_list_selector_background_transition_holo_light" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_list_selector_background_transition_holo_light" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_list_focused_holo" android:state_focused="true" />
<item android:drawable="@android:color/transparent" />
<item android:drawable="@drawable/buddhism_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_list_selector_background_transition_holo_light" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_list_selector_background_transition_holo_light" android:state_focused="false" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_list_focused_holo" android:state_focused="true"/>
<item android:drawable="@android:color/transparent"/>
</selector>

View File

@ -14,6 +14,6 @@
-->
<transition xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/buddhism_list_pressed_holo_light" />
<item android:drawable="@drawable/buddhism_list_longpressed_holo" />
<item android:drawable="@drawable/buddhism_list_pressed_holo_light"/>
<item android:drawable="@drawable/buddhism_list_longpressed_holo"/>
</transition>

View File

@ -15,13 +15,13 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/transparent" android:state_window_focused="false" />
<item android:drawable="@android:color/transparent" android:state_window_focused="false"/>
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:drawable="@drawable/buddhism_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_list_selector_background_transition_holo_light" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_list_selector_background_transition_holo_light" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/buddhism_list_focused_holo" android:state_focused="true" />
<item android:drawable="@drawable/buddhism_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true"/>
<item android:drawable="@drawable/buddhism_list_selector_background_transition_holo_light" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_list_selector_background_transition_holo_light" android:state_focused="false" android:state_pressed="true"/>
<item android:drawable="@drawable/buddhism_list_focused_holo" android:state_focused="true"/>
</selector>