From 882e4f5c348bed450bccaf3ab77a936ea9ce8c7c Mon Sep 17 00:00:00 2001 From: gumartinm Date: Thu, 21 Jun 2012 10:22:43 +0200 Subject: [PATCH] Trying to custom my action bar after logged in. WIP --- Android/MobiAdsReloaded/AndroidManifest.xml | 20 +++- .../MobiAdsReloaded/gen/de/android/mobiads/R.java | 20 ++-- .../res/drawable-hdpi/ic_menu_login.png | Bin 0 -> 1656 bytes .../drawable-hdpi/ic_menu_settings_holo_light.png | Bin 0 -> 1227 bytes .../res/drawable-ldpi/ic_menu_login.png | Bin 0 -> 1512 bytes .../res/drawable-mdpi/ic_menu_login.png | Bin 0 -> 1114 bytes .../drawable-mdpi/ic_menu_settings_holo_light.png | Bin 0 -> 866 bytes .../res/drawable-xhdpi/ic_menu_login.png | Bin 0 -> 2178 bytes .../drawable-xhdpi/ic_menu_settings_holo_light.png | Bin 0 -> 1622 bytes Android/MobiAdsReloaded/res/menu/menuads.xml | 52 ++------- .../MobiAdsReloaded/res/menu/selectedmenuads.xml | 4 +- Android/MobiAdsReloaded/res/values/strings.xml | 2 + .../de/android/mobiads/MobiAdsLoginActivity.java | 120 ++++++++++----------- .../src/de/android/mobiads/MobiAdsPreferences.java | 85 +++++++++------ .../src/de/android/mobiads/MobiAdsSettings.java | 75 +++++++++++++ .../de/android/mobiads/MobiAdsTabsActivity.java | 8 +- .../src/de/android/mobiads/list/MobiAdsLatest.java | 2 +- .../de/android/mobiads/list/MobiAdsLatestList.java | 2 +- .../src/de/android/mobiads/list/MobiAdsList.java | 97 ++++++++++------- 19 files changed, 292 insertions(+), 195 deletions(-) create mode 100644 Android/MobiAdsReloaded/res/drawable-hdpi/ic_menu_login.png create mode 100644 Android/MobiAdsReloaded/res/drawable-hdpi/ic_menu_settings_holo_light.png create mode 100644 Android/MobiAdsReloaded/res/drawable-ldpi/ic_menu_login.png create mode 100644 Android/MobiAdsReloaded/res/drawable-mdpi/ic_menu_login.png create mode 100644 Android/MobiAdsReloaded/res/drawable-mdpi/ic_menu_settings_holo_light.png create mode 100644 Android/MobiAdsReloaded/res/drawable-xhdpi/ic_menu_login.png create mode 100644 Android/MobiAdsReloaded/res/drawable-xhdpi/ic_menu_settings_holo_light.png create mode 100644 Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsSettings.java diff --git a/Android/MobiAdsReloaded/AndroidManifest.xml b/Android/MobiAdsReloaded/AndroidManifest.xml index 8140b7f..8a7185f 100644 --- a/Android/MobiAdsReloaded/AndroidManifest.xml +++ b/Android/MobiAdsReloaded/AndroidManifest.xml @@ -30,14 +30,30 @@ android:theme="@android:style/Theme.Holo" android:screenOrientation="portrait" android:configChanges="touchscreen|keyboard" - android:launchMode="standard" - android:uiOptions="splitActionBarWhenNarrow" > + android:uiOptions="splitActionBarWhenNarrow" + android:launchMode="standard"> + + + + + + + + + PIU@62xDwdm2g$9k6#DoHhF(fK6-eOENF~%6LV>nJXWGuW?B&DElqoItOd&Dud75)( z_P5r*|GoA)2l&4a<2u&~HQ^g?CX^uXC`KSSZ2Y7If=_0Qx%Mw~krSY`?&MrFVisJ4 z7{-9zx9R+69-ye@1^@;_Kx*d=FGsVLSzgy-rVUU24v!Uj2XH~1Sa7^AU!an3W&oRM z3F3pRy*roAd*1CZT4|M{&GN8(;cXijKI0zBp9D<_ss~tf#H_pA5nuV%>{o18ix8j& zpac+-r}+Blt~0R%qesY?j70<(WpQkAYA-$1)b@G$DZ|u0g&?6ofIS7_v#!~>a01MaFw*#=m=k785obSCNGvT1Oha#sV{!bhL^`$_Ef2?` zLrw%})<~O;jHjXiOb`+{X1tNmBmul?p1bX%dKormy_tMTL9We0Lm^|r-D1Lv0ssJ| zlszthB_G<)HJ#E+)iTJ`F^UQBa%7tVe&FXSmP|{V-ppls>dHxgc|ouy(pFXwpf;yR zx~05kgo0)WO*N%W3;?Hn3_TO6;wcF5!Vm_32`gt)FeV&n73u(z<53S68PTQyKlE^R zcYc(HOm7PfaKG;9w|b+*UtR;mx{qJn8G_TxN`Sk@kiFHjVMNHF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j!%EjYOUW z*N^=tkU%5FQjYz9;I$WM>uPFlZJ@+bnPdh!ikiXzAgxhB%$PKp()gF6(xS-8fZZuq vl#OL(=avbgQJASj1{r`Q$t2V>ffz#$Boj%;lEh>e*$}`J?~7}8JIwwE+B=pY literal 0 HcmV?d00001 diff --git a/Android/MobiAdsReloaded/res/drawable-mdpi/ic_menu_login.png b/Android/MobiAdsReloaded/res/drawable-mdpi/ic_menu_login.png new file mode 100644 index 0000000000000000000000000000000000000000..122ba33b7c888a676567b1331c5932406b3ea3d9 GIT binary patch literal 1114 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE0wix1Z>k4UOiAAEE)4(M`_JqL@;D1TB8!2v z2N=7Z%(epwmK8Xr18D^?ZvQoBE&~H|lBbJfh{y4%Q_lOxgo+%ue}3;f+Y26pa{>#D zuQYiiPs#9F!^^mOtC_Elhqzm>*}LAi_5t6I&DCCxur(ceDp zeSQ7;#hbbHJeLY89GzvMXJ1+M=B>iRBxzPfg{F#)|60EOR+riAd&wn4K0q+Eh<$#w z`Q10`Ze7-1|35TGj+5o!0wpV{xL14Z#Md4P+Rt^F&EQK`xz(|GvHueO>@z>_*Q;%D z;DJid`4mf*<5E)+xV&yye%Ru8{mfRT>-Le)uV>HRCi$R4=7svt)@%7I7;nj)coM4m z)UT}g4&PF@d7Ob0d(|{0|0m2US**w6u*g<$Rnxv}m+Jo<|MBz4gm9m)O-d@lDyz2a zYB&}39wVOyE*tP;5RAXj36#okZup&JfY?pKW!>`GhaurZKRP2YvPI9Sdm zVPn!Znd%AL|CUF3MP{yEpCI_)cKNhC_OQR(k{PY;+FBNwZ_Rkcm}9IfBwClf=)dOb zS4+SB5#g7x`JJ-k_2Zh#c}i)!`OVZEkDU0kGo|MJ#S2xAA32%?4<;9UdFfHMiSdvV z%ctGa^CZi~cUw)myDjoaM3-&WS+g?wN538Sd z@>|W93y0{-olV0#^=>a*T78j8S<>{8DmIkXtML(*%QhGCY*>aUt z0Vz|31f5pe*w2(d`%OzoAbYRVI~IXlA4g^nx6^G&mH#%+yLQe}KHE>}?Qed?QpVZ# z3IS|K1OBAH`@COWY;vsntN{JlT3*r}zZ%wR7;ax=DIsGyMdPQ5;a;9{pR#-Z8o4$Z zGkj=zv@H5w#6F=tGq|o~&fh8GSHFMZ!8beyn6+QO|Co5R^MPyN`z*D0YyrE&ex?)FK#IZ0z|c_Fz);u7BE-nZ%Ea8t)L7TR!pgv4 ziC@u46b-rgDVb@NxHViAK2-|TAPKS|I6tkVJh3R1!7(L2DOJHUH!(dmC^a#qvhZZ8 Q4Nwt-r>mdKI;Vst0A&r~QUCw| literal 0 HcmV?d00001 diff --git a/Android/MobiAdsReloaded/res/drawable-mdpi/ic_menu_settings_holo_light.png b/Android/MobiAdsReloaded/res/drawable-mdpi/ic_menu_settings_holo_light.png new file mode 100644 index 0000000000000000000000000000000000000000..f32a37e4474bb4a14b41b304f7ae01bec84c3b0a GIT binary patch literal 866 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE0wix1Z>k4UOiAAEE)4(M`_JqL@;D1TB8!2v z2N=7Z%(epwmK8Xr18D^?ZvQoBE>K&Rr;B5V$ML&Y{5wKZC60eQUwzNmxL3q=X|D+D zO(mr+0oMZYHb)o7?v)E_C#jaH^cFo->)GY&_+M-*M^{wD#0$q(M1FDS-l((ai0{sc z25e1fi>lvO#*2TS^SbA0MeMcRRt59kfBrM?`CnW8|38J@c-Nd0sQhqI($?|nqCj2l zMLN7fy%QE3NJC1|ao5?*;jZThU@BggHoFD+HC|NH=Z*v@0!?rSGkmnYPw@-}9DxH7$59X0L74>6KpCq#A3Sdn_ye*3KB;&ablv7VE^u2r0j?W;V)=(FRdR=veL zkz0}>%`5M{wlx27;Bj3jSC!tj+rt08EV+KA_s};hZr9``S|_;P&nUa}Hcj+c>BkA; zF)vH~X9jn?O7mj$oW#cE6?p&dvW@rGc*e%Q-kY^Hvj110BHy8xPZl<9o+EKkR?j?r z>vP)|;@@xF-(y>P`~Cj8LB0NS3)a4VTYRFdH8!n8+F6&`+;7dITYv9O72K2Ce!s0P zN~|qnqG(;go!)(48^U!=W*ad1Nkmzg_FrW^kjuSRnEkcUqz|f`VsD-H8T_a(@?*Zf z{M?O97K>xRo=I4Rs9+b&V`SjEt;I%&km~bqy@63=Ed| z6`e%Ukei>9nO2Eg!&Tu^r9cgmARB`7(@M${i&7aJQ}UBi6+Ckj(^G>|f$?8>GSvpC Oh{4m<&t;ucLK6VTCwA`u literal 0 HcmV?d00001 diff --git a/Android/MobiAdsReloaded/res/drawable-xhdpi/ic_menu_login.png b/Android/MobiAdsReloaded/res/drawable-xhdpi/ic_menu_login.png new file mode 100644 index 0000000000000000000000000000000000000000..5095ed97245fe08063e7f64b86d893dd2d67bc68 GIT binary patch literal 2178 zcmZ{lXE@sn8^-@gNHuDlB6dQJS`ATZhon}F*ivon)l}@3^BPI48Z}z9s@m9;LvgH00C<&tkVI}e*^&? zIN;sxdf?o?I7=+BpPoDP{9rm1ZbgVXpw+*!7$BPbSzZb^3pybBU;SindIJDorZv{g zC3tqZ*zV$4chUa+Z?hX(VGF~tzI2KAs2CHQ5Nj7M(bPwk=8B=V>R3lzIG2V~fdDaY znu$OlnnURKYaiI87KqdxqSA^)?u|dP^SmWgW5aFTe@P@M8#Rae^&!e5+n721rH3s% z&GC3J&wRSEx3bTOn$z#^s##Cco#8lx(By@UePP)cPMnu0T!R;FBbxBeM%LHd#exud zp7cUJcR5*1Y6(vXI6M@LJR{LBWOOPV0M%Axp4O8pp8r8*Ixb02XA+gjvpxxpMK6Hf zmfrPK3I?J1jIR<=Eqf9A>gC`4=c(;I=EsZ?4LtZ`@|`=u%RY=&!>#OnyG5-+AxI@N znvl@bzx8;O(~<%T^cdjNv>^1 zK|#Y(22!e@NL3sx!Ie)P1F#-j+-UCP+IYt!7N*QmibZYZH_;f} zeM$18a2wOVa%3cv28Ll6_y?uW5Poiqb>fsZ^DS?M$7-b64N9C8*+{GN76g^vpF}hq zs(b;@BM%ussnk5hooMyFZ?{ec2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bNIe52Qc$6>{eJ?XVg4b3asNM% zm?#E52uS>Ca1INMzU&hj0GRoQ`3AtPLw$k*oC19O<01wEj1G(lnwMssiKe*vZ* B;N1WK literal 0 HcmV?d00001 diff --git a/Android/MobiAdsReloaded/res/drawable-xhdpi/ic_menu_settings_holo_light.png b/Android/MobiAdsReloaded/res/drawable-xhdpi/ic_menu_settings_holo_light.png new file mode 100644 index 0000000000000000000000000000000000000000..aa33c3880b991ccc9a62710abe117798e1f50e53 GIT binary patch literal 1622 zcmV-c2C4apP)ht(u000GENkll}fXxV_u z=R`We>!dVkU`VHZ21H14nTwroy2xvGd&WzCUvZNPCbVckMSYG>TjsJMeqZsdhdpR- zot?OK?{m{^@-y>9`cj#`aR-e%$0u#@qI-N;75vs1=n6_t^JDX6a&ge!bn;9~yw_Da z##=QY_@7yCzHyxz>?`(5!gDSY*@CQ92D*i(nK7T08VSdl*dAm4pi=@Owx2Q&+G8M+ zd%Km5vm878X5tUpF2h9M zT>gKO22`Cd5=qTf&-q+ryVp4sejsi1fk+~kI?rr*t@&hlj9N%0kP~L0@;#PGP4y*9 zy}MyRjF%i`-kcx<-SX>LhU@&w8q*u_xmfN%&miGiVxT+twvS8Q>PiLSb$24E#Od9m zFmRj()MkCEZ&cS3oeAIz4!GFnp%NUD+$@SYB0kB9ocw1}jXFN$m58%R_+~8 z*Sp2J;4OFiwm&t9k0ko|gs+<`7m3{KcF&n2r^}M%&(^aC9PA0O* za^Z-+#)APoJuc+B0fC9LY%wa68gaKT z8W&S7nMK`CaicGI5BRHZ+F*Z`j>qYH(||oboky$z}Ir1%L}d+1*1Oa-Z1AAi``-ryrE~ky%j4b1>IyI!~J2Mh-BX3 zK36-_$2@MmQDlB#u5Z{ISZM`5^nt1j?{i(a+Z9v&Meh%t;&H2OQ|kzAfL8|4Ey`@B zC!AHSnC07--QoMPT03eDzCH~zv0WDXxsJX#%(er*<1VjiG3rgJ?}VAe!#?A0I%0{~ zPkqpGueKZYrVLNRSZ20GF7k#Sc|>gnwh!Jgps@$l`3ckQ)WA=?kd&~eDC$jV+zSe* zUf5Tpy;BZ9DU&iOlk$Hc{{foU%Qj=A4bcDq03~!qSaf7zbY(hYa%Ew3WdJfTF)=ML zG%YeVR4_R@Gc`IhGc7PTIxsK~Bd)ms001R)MObuXVRU6WZEs|0W_bWIFflPLFf=VP zHdHV - - - - - - - - - - - + android:checkable="false" + android:enabled="false" + android:showAsAction="ifRoom|withText"/> \ No newline at end of file diff --git a/Android/MobiAdsReloaded/res/menu/selectedmenuads.xml b/Android/MobiAdsReloaded/res/menu/selectedmenuads.xml index e9c31cf..72d3cf7 100644 --- a/Android/MobiAdsReloaded/res/menu/selectedmenuads.xml +++ b/Android/MobiAdsReloaded/res/menu/selectedmenuads.xml @@ -1,7 +1,7 @@ - UTF-8 description Remove + Settings + Login You have no downloaded ads. \ No newline at end of file diff --git a/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsLoginActivity.java b/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsLoginActivity.java index 5000294..f4b617d 100644 --- a/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsLoginActivity.java +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsLoginActivity.java @@ -52,67 +52,65 @@ public class MobiAdsLoginActivity extends Activity { HttpEntity httpEntity = null; HttpResponse httpResponse = null; final List formParams = new ArrayList(2); - - Cookie.setCookie("prueba"); - -// httpClient.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, getResources().getString(R.string.encoded_web_service)); -// httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, getResources().getString(R.string.user_agent_web_service)); -// httpClient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); -// //TODO: RESTful Web Service must use JSON instead of signin array :( -// formParams.add(new BasicNameValuePair("signin[username]", username.getText().toString())); -// formParams.add(new BasicNameValuePair("signin[password]", password.getText().toString())); -// try { -// httpEntity = new UrlEncodedFormEntity(formParams, getResources().getString(R.string.encoded_web_service)); -// httpPost.setEntity(httpEntity); -// httpResponse = httpClient.execute(httpPost); -// } catch (UnsupportedEncodingException e) { -// Log.e(TAG, "Error while encoding POST parameters.", e); -// return; -// } catch (ClientProtocolException e) { -// Log.e(TAG, "Error while executing HTTP client connection.", e); -// createErrorDialog(R.string.error_dialog_connection_error); -// return; -// } catch (IOException e) { -// Log.e(TAG, "Error while executing HTTP client connection.", e); -// createErrorDialog(R.string.error_dialog_connection_error); -// return; -// } finally { -// httpClient.getConnectionManager().shutdown(); -// } -// -// if (httpResponse != null) { -// switch (httpResponse.getStatusLine().getStatusCode()) { -// case HttpStatus.SC_OK: -// String cookie = httpResponse.getLastHeader(SETCOOKIEFIELD).getValue(); -// if (cookie != null) { -// cookie = cookie.split(";")[0]; -// //Go to the next activity -// StrictMode.setThreadPolicy(currentPolicy); -// Cookie.setCookie(cookie); -// this.finish(); -// } else { -// Log.e(TAG, "There must be a weird issue with the server because... There is not cookie!!!!"); -// createErrorDialog(R.string.error_dialog_connection_error); -// } -// break; -// case HttpStatus.SC_UNAUTHORIZED: -// //Username or password is incorrect -// createErrorDialog(R.string.error_dialog_userpwd_error); -// break; -// case HttpStatus.SC_BAD_REQUEST: -// //What the heck are you doing? -// createErrorDialog(R.string.error_dialog_userpwd_error); -// break; -// default: -// Log.e(TAG, "Error while retrieving the HTTP status line."); -// createErrorDialog(R.string.error_dialog_connection_error); -// break; -// } -// } -// else { -// Log.e(TAG, "No response? This should never have happened."); -// createErrorDialog(R.string.error_dialog_connection_error); -// } + + httpClient.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, getResources().getString(R.string.encoded_web_service)); + httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, getResources().getString(R.string.user_agent_web_service)); + httpClient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); + //TODO: RESTful Web Service must use JSON instead of signin array :( + formParams.add(new BasicNameValuePair("signin[username]", username.getText().toString())); + formParams.add(new BasicNameValuePair("signin[password]", password.getText().toString())); + try { + httpEntity = new UrlEncodedFormEntity(formParams, getResources().getString(R.string.encoded_web_service)); + httpPost.setEntity(httpEntity); + httpResponse = httpClient.execute(httpPost); + } catch (UnsupportedEncodingException e) { + Log.e(TAG, "Error while encoding POST parameters.", e); + return; + } catch (ClientProtocolException e) { + Log.e(TAG, "Error while executing HTTP client connection.", e); + createErrorDialog(R.string.error_dialog_connection_error); + return; + } catch (IOException e) { + Log.e(TAG, "Error while executing HTTP client connection.", e); + createErrorDialog(R.string.error_dialog_connection_error); + return; + } finally { + httpClient.getConnectionManager().shutdown(); + } + + if (httpResponse != null) { + switch (httpResponse.getStatusLine().getStatusCode()) { + case HttpStatus.SC_OK: + String cookie = httpResponse.getLastHeader(SETCOOKIEFIELD).getValue(); + if (cookie != null) { + cookie = cookie.split(";")[0]; + //Go to the next activity + StrictMode.setThreadPolicy(currentPolicy); + Cookie.setCookie(cookie); + this.finish(); + } else { + Log.e(TAG, "There must be a weird issue with the server because... There is not cookie!!!!"); + createErrorDialog(R.string.error_dialog_connection_error); + } + break; + case HttpStatus.SC_UNAUTHORIZED: + //Username or password is incorrect + createErrorDialog(R.string.error_dialog_userpwd_error); + break; + case HttpStatus.SC_BAD_REQUEST: + //What the heck are you doing? + createErrorDialog(R.string.error_dialog_userpwd_error); + break; + default: + Log.e(TAG, "Error while retrieving the HTTP status line."); + createErrorDialog(R.string.error_dialog_connection_error); + break; + } + } + else { + Log.e(TAG, "No response? This should never have happened."); + createErrorDialog(R.string.error_dialog_connection_error); + } } public void onClickLocalAds(View v) { diff --git a/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsPreferences.java b/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsPreferences.java index e717474..a999c4d 100644 --- a/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsPreferences.java +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsPreferences.java @@ -1,55 +1,76 @@ package de.android.mobiads; +import android.app.Activity; import android.app.ActivityManager; import android.app.ActivityManager.RunningServiceInfo; +import android.app.FragmentManager; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.PreferenceFragment; +import de.android.mobiads.list.MobiAdsList.MobiAdsListFragment; -public class MobiAdsPreferences extends PreferenceFragment { +public class MobiAdsPreferences extends Activity { @Override - public void onCreate(Bundle savedInstanceState) { + protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // Load the preferences from an XML resource - addPreferencesFromResource(R.xml.preferences); + FragmentManager fm = getFragmentManager(); + + // Create the list fragment and add it as our sole content. + if (fm.findFragmentById(android.R.id.content) == null) { + MobiAdsListFragment list = new MobiAdsListFragment(); + fm.beginTransaction().add(android.R.id.content, list).commit(); + } + + } - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); + public static class MobiAdsPreferencesFragment extends PreferenceFragment { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Load the preferences from an XML resource + addPreferencesFromResource(R.xml.preferences); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); - CheckBoxPreference checkBoxPreference = (CheckBoxPreference) findPreference("service_started"); - checkBoxPreference.setChecked(isMyServiceRunning()); - checkBoxPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + CheckBoxPreference checkBoxPreference = (CheckBoxPreference) findPreference("service_started"); + checkBoxPreference.setChecked(isMyServiceRunning()); + checkBoxPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { - CheckBoxPreference checkBoxPreference = (CheckBoxPreference) preference; - if (checkBoxPreference.isChecked()) { - Intent intent = new Intent(getActivity(), MobiAdsService.class); - intent.putExtra("cookie", Cookie.getCookie()); - getActivity().startService(intent); + @Override + public boolean onPreferenceClick(Preference preference) { + CheckBoxPreference checkBoxPreference = (CheckBoxPreference) preference; + if (checkBoxPreference.isChecked()) { + Intent intent = new Intent(getActivity(), MobiAdsService.class); + intent.putExtra("cookie", Cookie.getCookie()); + getActivity().startService(intent); + } + else { + getActivity().stopService(new Intent(getActivity(), MobiAdsService.class)); + } + return false; } - else { - getActivity().stopService(new Intent(getActivity(), MobiAdsService.class)); + }); + } + + private boolean isMyServiceRunning() { + ActivityManager manager = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE); + for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { + if (MobiAdsService.class.getName().equals(service.service.getClassName())) { + return true; } - return false; } - }); - } - - private boolean isMyServiceRunning() { - ActivityManager manager = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE); - for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { - if (MobiAdsService.class.getName().equals(service.service.getClassName())) { - return true; - } - } - return false; - } + return false; + } + } } diff --git a/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsSettings.java b/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsSettings.java new file mode 100644 index 0000000..edaa4bb --- /dev/null +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsSettings.java @@ -0,0 +1,75 @@ +package de.android.mobiads; + +import android.app.Activity; +import android.app.ActivityManager; +import android.app.ActivityManager.RunningServiceInfo; +import android.app.FragmentManager; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.preference.CheckBoxPreference; +import android.preference.Preference; +import android.preference.PreferenceFragment; + +public class MobiAdsSettings extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + FragmentManager fm = getFragmentManager(); + + // Create the list fragment and add it as our sole content. + if (fm.findFragmentById(android.R.id.content) == null) { + MobiAdsSettingsFragment list = new MobiAdsSettingsFragment(); + fm.beginTransaction().add(android.R.id.content, list).commit(); + } + + + } + + public static class MobiAdsSettingsFragment extends PreferenceFragment { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Load the preferences from an XML resource + addPreferencesFromResource(R.xml.preferences); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + + CheckBoxPreference checkBoxPreference = (CheckBoxPreference) findPreference("service_started"); + checkBoxPreference.setChecked(isMyServiceRunning()); + checkBoxPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + + @Override + public boolean onPreferenceClick(Preference preference) { + CheckBoxPreference checkBoxPreference = (CheckBoxPreference) preference; + if (checkBoxPreference.isChecked()) { + Intent intent = new Intent(getActivity(), MobiAdsService.class); + intent.putExtra("cookie", Cookie.getCookie()); + getActivity().startService(intent); + } + else { + getActivity().stopService(new Intent(getActivity(), MobiAdsService.class)); + } + return false; + } + }); + } + + private boolean isMyServiceRunning() { + ActivityManager manager = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE); + for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { + if (MobiAdsService.class.getName().equals(service.service.getClassName())) { + return true; + } + } + return false; + } + } +} diff --git a/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsTabsActivity.java b/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsTabsActivity.java index d40cdec..fb3c27b 100644 --- a/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsTabsActivity.java +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/MobiAdsTabsActivity.java @@ -36,8 +36,8 @@ public class MobiAdsTabsActivity extends Activity { if (Cookie.getCookie() != null || isMyServiceRunning()) { bar.addTab(bar.newTab() .setText("Control Panel") - .setTabListener(new TabListener( - this, "controlpanel", MobiAdsPreferences.class))); + .setTabListener(new TabListener( + this, "controlpanel", MobiAdsPreferences.MobiAdsPreferencesFragment.class))); } bar.addTab(bar.newTab() @@ -63,8 +63,8 @@ public class MobiAdsTabsActivity extends Activity { if ((Cookie.getCookie() != null) && (getActionBar().getTabCount() == 2)) { getActionBar().addTab(getActionBar().newTab() .setText("Control Panel") - .setTabListener(new TabListener( - this, "controlpanel", MobiAdsPreferences.class)), 1); + .setTabListener(new TabListener( + this, "controlpanel", MobiAdsPreferences.MobiAdsPreferencesFragment.class)), 1); } } diff --git a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatest.java b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatest.java index 767a3e7..8160366 100644 --- a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatest.java +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatest.java @@ -94,7 +94,7 @@ public class MobiAdsLatest extends Activity { public boolean onActionItemClicked(ActionMode mode, MenuItem item) { // Respond to clicks on the actions in the CAB switch (item.getItemId()) { - case R.id.menuadsremove: + case R.id.selectedmenu_remove: SparseBooleanArray itemsPositions = getListView().getCheckedItemPositions(); Collection aux = new ArrayList(mAdapter.getCount()); for (int i=0; i< itemsPositions.size(); i++) { diff --git a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java index 3796d71..6fad3e0 100644 --- a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java @@ -95,7 +95,7 @@ public class MobiAdsLatestList extends ListActivity implements LoaderManager.Loa public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { - case R.id.menuadsremove: + case R.id.selectedmenu_remove: removeAd(info.position); return true; default: diff --git a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java index a33a35e..9b0b868 100644 --- a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java @@ -17,6 +17,7 @@ import android.app.LoaderManager; import android.app.Notification; import android.app.NotificationManager; import android.content.AsyncTaskLoader; +import android.content.ComponentName; import android.content.ContentValues; import android.content.Context; import android.content.Intent; @@ -43,21 +44,25 @@ import android.widget.ListView; import android.widget.SearchView; import android.widget.SearchView.OnQueryTextListener; import android.widget.TextView; +import de.android.mobiads.Cookie; import de.android.mobiads.MobiAdsService; import de.android.mobiads.R; import de.android.mobiads.provider.Indexer; public class MobiAdsList extends Activity { + Menu mMenu; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - final ActionBar bar = getActionBar(); + final ActionBar actionBar = getActionBar(); - bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); - bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); - bar.setTitle(getResources().getString(R.string.header_bar)); + actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); + actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); + actionBar.setTitle(getResources().getString(R.string.header_bar)); + //actionBar.setDisplayHomeAsUpEnabled(true); + FragmentManager fm = getFragmentManager(); @@ -73,12 +78,31 @@ public class MobiAdsList extends Activity { @Override public boolean onOptionsItemSelected(MenuItem item) { - return super.onOptionsItemSelected(item); + super.onOptionsItemSelected(item); + Intent intent = null; + switch (item.getItemId()) { + case R.id.menuads_settings: + intent = new Intent("android.intent.action.MOBIADS"). + setComponent(new ComponentName("de.android.mobiads", "de.android.mobiads.MobiAdsSettings")); + this.startActivity(intent); + return true; + case R.id.menuads_login: + intent = new Intent("android.intent.action.MOBIADS"). + setComponent(new ComponentName("de.android.mobiads", "de.android.mobiads.MobiAdsLoginActivity")); + this.startActivity(intent); + return true; + default: + return false; + } } @Override - public boolean onPrepareOptionsMenu(Menu menu) { - return super.onPrepareOptionsMenu(menu); + public boolean onPrepareOptionsMenu(Menu menu) { + super.onPrepareOptionsMenu(menu); + MenuItem item = menu.findItem(R.id.menuads_settings); + item.getIcon().setAlpha(70); + mMenu = menu; + return true; } @Override @@ -89,6 +113,28 @@ public class MobiAdsList extends Activity { return true; } + + public void onOptionsMenuClosed(Menu menu) { + super.onOptionsMenuClosed(menu); + } + + //Si doy al boton pa tras pasa por onCreateOptionsMenu y onPrepareOptionsMenu + //Si doy al boton home solo pasa por onResume + //:/ + @Override + protected void onResume() { + super.onResume(); + +// if (Cookie.getCookie() != null) { +// MenuItem item = mMenu.findItem(R.id.menuads_settings); +// item.getIcon().setAlpha(255); +// item = mMenu.findItem(R.id.menuads_settings); +// item.setEnabled(true); +// item = mMenu.findItem(R.id.menuads_login); +// item.setEnabled(false); +// item.setVisible(false); +// } + } /** @@ -269,7 +315,7 @@ public class MobiAdsList extends Activity { public boolean onActionItemClicked(ActionMode mode, MenuItem item) { // Respond to clicks on the actions in the CAB switch (item.getItemId()) { - case R.id.selectedmenuads: + case R.id.selectedmenu_remove: SparseBooleanArray itemsPositions = getListView().getCheckedItemPositions(); Collection aux = new ArrayList(mAdapter.getCount()); for (int i=0; i< itemsPositions.size(); i++) { @@ -328,7 +374,7 @@ public class MobiAdsList extends Activity { setEmptyText("No downloaded Ads."); // We have a menu item to show in action bar. - setHasOptionsMenu(false); + setHasOptionsMenu(true); mAdapter = new AdsEntryAdapter(getActivity(), R.layout.ads_entry_list_item); @@ -374,46 +420,17 @@ public class MobiAdsList extends Activity { /** * When setHasOptionsMenu(true) we populate the action bar with this menu. It is merged to the - * current action bar menu (if there is no) + * current action bar menu (if there is no one) */ @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // Place an action bar item for searching. MenuItem item = menu.add("Search"); item.setIcon(android.R.drawable.ic_menu_search); - item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); + item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); SearchView sv = new SearchView(getActivity()); sv.setOnQueryTextListener(this); item.setActionView(sv); - - item = menu.add("Login"); - item.setIcon(android.R.drawable.ic_lock_power_off); - item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - item = menu.add("Login"); - item.setIcon(android.R.drawable.ic_lock_power_off); - item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - item = menu.add("Login"); - item.setIcon(android.R.drawable.ic_lock_power_off); - item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - item = menu.add("Login"); - item.setIcon(android.R.drawable.ic_lock_power_off); - item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - item = menu.add("Login"); - item.setIcon(android.R.drawable.ic_lock_power_off); - item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - item = menu.add("Login"); - item.setIcon(android.R.drawable.ic_menu_upload); - item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - item = menu.add("Login"); - item.setIcon(android.R.drawable.ic_lock_power_off); - item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - } @Override -- 2.1.4