Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/org/adblockplus/android/Preferences.java

Issue 5046897395892224: Issue 1532 - Subscription summary added even if empty (Closed)
Patch Set: Created Nov. 6, 2014, 10:50 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 package org.adblockplus.android; 18 package org.adblockplus.android;
19 19
20 import java.io.IOException; 20 import java.io.IOException;
21 import java.io.InputStream; 21 import java.io.InputStream;
22 import java.io.OutputStream; 22 import java.io.OutputStream;
23 import java.util.Calendar; 23 import java.util.Calendar;
24 import java.util.Date; 24 import java.util.Date;
25 25
26 import org.apache.commons.lang.StringUtils;
26 import org.jraf.android.backport.switchwidget.SwitchPreference; 27 import org.jraf.android.backport.switchwidget.SwitchPreference;
27 28
28 import android.app.AlertDialog; 29 import android.app.AlertDialog;
29 import android.app.Dialog; 30 import android.app.Dialog;
30 import android.content.BroadcastReceiver; 31 import android.content.BroadcastReceiver;
31 import android.content.Context; 32 import android.content.Context;
32 import android.content.DialogInterface; 33 import android.content.DialogInterface;
33 import android.content.Intent; 34 import android.content.Intent;
34 import android.content.IntentFilter; 35 import android.content.IntentFilter;
35 import android.content.SharedPreferences; 36 import android.content.SharedPreferences;
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 * time of last change 532 * time of last change
532 */ 533 */
533 private void setSubscriptionStatus(final String text, final long time) 534 private void setSubscriptionStatus(final String text, final long time)
534 { 535 {
535 final ListPreference subscriptionList = (ListPreference) findPreference(getS tring(R.string.pref_subscription)); 536 final ListPreference subscriptionList = (ListPreference) findPreference(getS tring(R.string.pref_subscription));
536 final CharSequence summary = subscriptionList.getEntry(); 537 final CharSequence summary = subscriptionList.getEntry();
537 final StringBuilder builder = new StringBuilder(); 538 final StringBuilder builder = new StringBuilder();
538 if (summary != null) 539 if (summary != null)
539 { 540 {
540 builder.append(summary); 541 builder.append(summary);
541 if (text != "") 542 if (StringUtils.isNotEmpty(text))
542 { 543 {
543 builder.append(" ("); 544 builder.append(" (");
544 final int id = getResources().getIdentifier(text, "string", getPackageNa me()); 545 final int id = getResources().getIdentifier(text, "string", getPackageNa me());
545 if (id > 0) 546 if (id > 0)
546 builder.append(getString(id, text)); 547 builder.append(getString(id, text));
547 else 548 else
548 builder.append(text); 549 builder.append(text);
549 if (time > 0) 550 if (time > 0)
550 { 551 {
551 builder.append(": "); 552 builder.append(": ");
(...skipping 18 matching lines...) Expand all
570 subscriptionSummary = state.getString("subscriptionSummary"); 571 subscriptionSummary = state.getString("subscriptionSummary");
571 } 572 }
572 573
573 @Override 574 @Override
574 protected void onSaveInstanceState(final Bundle outState) 575 protected void onSaveInstanceState(final Bundle outState)
575 { 576 {
576 outState.putString("subscriptionSummary", subscriptionSummary); 577 outState.putString("subscriptionSummary", subscriptionSummary);
577 super.onSaveInstanceState(outState); 578 super.onSaveInstanceState(outState);
578 } 579 }
579 } 580 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld