From 8a0112b2ed0c65ca56cac1582d7e56242174c416 Mon Sep 17 00:00:00 2001 From: Jamorham Date: Sun, 30 Oct 2016 20:56:11 +0000 Subject: [PATCH] Inter-app settings screen and Accept Treatments option --- .../dexdrip/NSClientReceiver.java | 30 ++++++++------ .../ic_open_in_app_grey600_48dp.png | Bin 0 -> 774 bytes .../main/res/xml/pref_advanced_settings.xml | 38 ++++++++++++------ 3 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 app/src/main/res/drawable-xhdpi/ic_open_in_app_grey600_48dp.png diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/NSClientReceiver.java b/app/src/main/java/com/eveningoutpost/dexdrip/NSClientReceiver.java index cd1f6a9bfc..690e8655e3 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/NSClientReceiver.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/NSClientReceiver.java @@ -72,26 +72,30 @@ public void onReceive(Context context, Intent intent) { process_SGV_json(sgv_json); } } else { - Log.e(TAG, "Ignoring SGV data as we are not a follower"); + Log.d(TAG, "Ignoring SGV data as we are not a follower"); } break; case Intents.ACTION_NEW_TREATMENT: if (bundle == null) break; - final String treatment_json = bundle.getString("treatment", ""); - if (treatment_json.length() > 0) { - process_TREATMENT_json(treatment_json); - } - final String treatments_json = bundle.getString("treatments", ""); - if (treatments_json.length() > 0) { - try { - final JSONArray jsonArray = new JSONArray(treatments_json); - for (int i = 0; i < jsonArray.length(); i++) { - process_TREATMENT_json(jsonArray.getString(i)); + if (prefs.getBoolean("accept_nsclient_treatments", true)) { + final String treatment_json = bundle.getString("treatment", ""); + if (treatment_json.length() > 0) { + process_TREATMENT_json(treatment_json); + } + final String treatments_json = bundle.getString("treatments", ""); + if (treatments_json.length() > 0) { + try { + final JSONArray jsonArray = new JSONArray(treatments_json); + for (int i = 0; i < jsonArray.length(); i++) { + process_TREATMENT_json(jsonArray.getString(i)); + } + } catch (JSONException e) { + Log.e(TAG, "Json exception with sgvs: " + e.toString()); } - } catch (JSONException e) { - Log.e(TAG, "Json exception with sgvs: " + e.toString()); } + } else { + Log.d(TAG, "Ignoring nsclient treatment data due to preference"); } break; diff --git a/app/src/main/res/drawable-xhdpi/ic_open_in_app_grey600_48dp.png b/app/src/main/res/drawable-xhdpi/ic_open_in_app_grey600_48dp.png new file mode 100644 index 0000000000000000000000000000000000000000..4b84396c4eedd4b7857fb293b2d1da4b207ded89 GIT binary patch literal 774 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGoY)RhkE(}8pX7+2iB`GtXjX`-i#V@SoVw|8vwgdHW0eM~p&NINSkU@LNm zG5D#3L!%3`RQBl{uhZHq7HK%eG_%P!DSheCK9Z+Y+0NA8qV&md^J|;;51wC-Je6nk z{(g4k$0`Ov1o(M>=R)<2Sf6r&|VYFck*et#^Ih(t6=yPS=dfw?@@A zwf*1zvP|vdr1cE%{~ABPQ_jHtCRBPer=rdKUGHq3E_kAS!1BA4)W7{QA)#NjzAl(E zeSv26(y&&6xMgyag&!DJFKkmiucm%L`I{E6_q?@PQL=4&G3Y(GhF5 zPu`GYHoMjE{Bmt1S+Ke_FBtCqR(}6i@b`O(MK?g~=P|G6WPA4oq%>Ik`LW{($5GZD zR)1Dp;c#W$k@q98Q?QG(;P!{bmy|>VAFMmv@70xH=kV&o;vl6Nd=sqytZ3m#W9E^q zOR;S_$&k!zze(m`OvA=@`N-Y`tpn@Y;v*U4Sv-+ zuH3cGnysMb`uzQG_szNV&U;Zj<8ME>ZxH@MW9dBq+`xTjgZ{Y-?=Qal_5Wvb{rT@* z-B*~4)-}Xi$2h#4ls1l+q*T_7+ut^=d+p4i{$q3F*L|-T=RA2Q&C9bx rH}yC7eN*4!Rc~Lrx*)*1@6s#oA6~z1ZA2z8l`?p``njxgN@xNAaKcVD literal 0 HcmV?d00001 diff --git a/app/src/main/res/xml/pref_advanced_settings.xml b/app/src/main/res/xml/pref_advanced_settings.xml index 1f695a313f..d4a806313b 100644 --- a/app/src/main/res/xml/pref_advanced_settings.xml +++ b/app/src/main/res/xml/pref_advanced_settings.xml @@ -147,13 +147,32 @@ - + + + + + -