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

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

Issue 5606010064470016: Issue 1539 - Remove static Context variable (Closed)
Patch Set: Created Nov. 6, 2014, 12:20 p.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
(...skipping 11 matching lines...) Expand all
22 import android.content.pm.PackageInfo; 22 import android.content.pm.PackageInfo;
23 import android.content.pm.PackageManager.NameNotFoundException; 23 import android.content.pm.PackageManager.NameNotFoundException;
24 import android.os.Bundle; 24 import android.os.Bundle;
25 import android.text.Html; 25 import android.text.Html;
26 import android.text.method.LinkMovementMethod; 26 import android.text.method.LinkMovementMethod;
27 import android.view.Window; 27 import android.view.Window;
28 import android.widget.TextView; 28 import android.widget.TextView;
29 29
30 public class AboutDialog extends Dialog 30 public class AboutDialog extends Dialog
31 { 31 {
32 private static Context context = null;
33
34 public AboutDialog(final Context context) 32 public AboutDialog(final Context context)
35 { 33 {
36 super(context); 34 super(context);
37 AboutDialog.context = context;
38 } 35 }
39 36
40 @Override 37 @Override
41 public void onCreate(final Bundle savedInstanceState) 38 public void onCreate(final Bundle savedInstanceState)
42 { 39 {
43 requestWindowFeature(Window.FEATURE_NO_TITLE); 40 requestWindowFeature(Window.FEATURE_NO_TITLE);
44 setContentView(R.layout.about); 41 setContentView(R.layout.about);
45 42
43 final Context context = this.getContext();
46 // Get package version code and name 44 // Get package version code and name
47 String versionName = "--"; 45 String versionName = "--";
48 int versionCode = -1; 46 int versionCode = -1;
49 try 47 try
50 { 48 {
51 final PackageInfo pi = context.getPackageManager().getPackageInfo(context. getPackageName(), 0); 49 final PackageInfo pi = context.getPackageManager().getPackageInfo(context. getPackageName(), 0);
52 versionName = pi.versionName; 50 versionName = pi.versionName;
53 versionCode = pi.versionCode; 51 versionCode = pi.versionCode;
54 } 52 }
55 catch (final NameNotFoundException ex) 53 catch (final NameNotFoundException ex)
(...skipping 17 matching lines...) Expand all
73 info.append("</p>"); 71 info.append("</p>");
74 AdblockPlus.appendRawTextFile(context, info, R.raw.info); 72 AdblockPlus.appendRawTextFile(context, info, R.raw.info);
75 AdblockPlus.appendRawTextFile(context, info, R.raw.legal); 73 AdblockPlus.appendRawTextFile(context, info, R.raw.legal);
76 74
77 // Show text 75 // Show text
78 final TextView tv = (TextView) findViewById(R.id.about_text); 76 final TextView tv = (TextView) findViewById(R.id.about_text);
79 tv.setText(Html.fromHtml(info.toString())); 77 tv.setText(Html.fromHtml(info.toString()));
80 tv.setMovementMethod(LinkMovementMethod.getInstance()); 78 tv.setMovementMethod(LinkMovementMethod.getInstance());
81 } 79 }
82 } 80 }
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