Merge remote-tracking branch 'refs/remotes/commons-app/master'

This commit is contained in:
Josephine Lim 2017-03-03 01:02:51 +10:00
commit 031b1faa38
31 changed files with 339 additions and 99 deletions

View file

@ -1,4 +1,5 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: 'quality.gradle'
dependencies { dependencies {
compile ('com.github.nicolas-raoul:Quadtree:211b6fe59ac48f') { compile ('com.github.nicolas-raoul:Quadtree:211b6fe59ac48f') {

23
app/quality.gradle Normal file
View file

@ -0,0 +1,23 @@
apply plugin: 'checkstyle'
check.dependsOn 'checkstyle'
checkstyle {
toolVersion = '7.5.1'
}
task checkstyle(type: Checkstyle) {
configFile file("${project.rootDir}/script/style/checkstyle.xml")
source 'src'
include '**/*.java'
exclude '**/gen/**'
classpath = files()
reports {
html {
enabled true
destination "$project.buildDir/reports/checkstyle/checkstyle.html"
}
}
}

View file

@ -24,8 +24,8 @@ public class AboutActivity extends Activity {
privacyPolicyText = (TextView) findViewById(R.id.about_privacy_policy); privacyPolicyText = (TextView) findViewById(R.id.about_privacy_policy);
uploadsToText = (TextView) findViewById(R.id.about_uploads_to); uploadsToText = (TextView) findViewById(R.id.about_uploads_to);
uploadsToText.setText(fr.free.nrw.commons.CommonsApplication.EVENTLOG_WIKI); uploadsToText.setText(CommonsApplication.EVENTLOG_WIKI);
versionText.setText(fr.free.nrw.commons.CommonsApplication.APPLICATION_VERSION); versionText.setText(CommonsApplication.APPLICATION_VERSION);
// We can't use formatted strings directly because it breaks with // We can't use formatted strings directly because it breaks with
// our localization tools. Grab an HTML string and turn it into // our localization tools. Grab an HTML string and turn it into

View file

@ -122,7 +122,7 @@ public class CommonsApplication extends Application {
if (maxMem < 48L * 1024L * 1024L) { if (maxMem < 48L * 1024L * 1024L) {
// Cache only one bitmap if VM memory is too small (such as Nexus One); // Cache only one bitmap if VM memory is too small (such as Nexus One);
Log.d("Commons", "Skipping bitmap cache; max mem is: " + maxMem); Log.d("Commons", "Skipping bitmap cache; max mem is: " + maxMem);
imageCache = new LruCache<String, Bitmap>(1); imageCache = new LruCache<>(1);
} else { } else {
int cacheSize = (int) (maxMem / (1024 * 8)); int cacheSize = (int) (maxMem / (1024 * 8));
Log.d("Commons", "Bitmap cache size " + cacheSize + " from max mem " + maxMem); Log.d("Commons", "Bitmap cache size " + cacheSize + " from max mem " + maxMem);

View file

@ -11,7 +11,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
public class LicenseList { public class LicenseList {
Map<String, fr.free.nrw.commons.License> licenses = new HashMap<String, fr.free.nrw.commons.License>(); Map<String, License> licenses = new HashMap<>();
Resources res; Resources res;
private static String XMLNS_LICENSE = "https://www.mediawiki.org/wiki/Extension:UploadWizard/xmlns/licenses"; private static String XMLNS_LICENSE = "https://www.mediawiki.org/wiki/Extension:UploadWizard/xmlns/licenses";
@ -19,12 +19,12 @@ public class LicenseList {
public LicenseList(Activity activity) { public LicenseList(Activity activity) {
res = activity.getResources(); res = activity.getResources();
XmlPullParser parser = res.getXml(R.xml.wikimedia_licenses); XmlPullParser parser = res.getXml(R.xml.wikimedia_licenses);
while (fr.free.nrw.commons.Utils.xmlFastForward(parser, XMLNS_LICENSE, "license")) { while (Utils.xmlFastForward(parser, XMLNS_LICENSE, "license")) {
String id = parser.getAttributeValue(null, "id"); String id = parser.getAttributeValue(null, "id");
String template = parser.getAttributeValue(null, "template"); String template = parser.getAttributeValue(null, "template");
String url = parser.getAttributeValue(null, "url"); String url = parser.getAttributeValue(null, "url");
String name = nameForTemplate(template); String name = nameForTemplate(template);
fr.free.nrw.commons.License license = new fr.free.nrw.commons.License(id, template, url, name); License license = new License(id, template, url, name);
licenses.put(id, license); licenses.put(id, license);
} }
} }
@ -33,18 +33,18 @@ public class LicenseList {
return licenses.keySet(); return licenses.keySet();
} }
public Collection<fr.free.nrw.commons.License> values() { public Collection<License> values() {
return licenses.values(); return licenses.values();
} }
public fr.free.nrw.commons.License get(String key) { public License get(String key) {
return licenses.get(key); return licenses.get(key);
} }
public fr.free.nrw.commons.License licenseForTemplate(String template) { public License licenseForTemplate(String template) {
String ucTemplate = fr.free.nrw.commons.Utils.capitalize(template); String ucTemplate = Utils.capitalize(template);
for (fr.free.nrw.commons.License license : values()) { for (License license : values()) {
if (ucTemplate.equals(fr.free.nrw.commons.Utils.capitalize(license.getTemplate()))) { if (ucTemplate.equals(Utils.capitalize(license.getTemplate()))) {
return license; return license;
} }
} }

View file

@ -27,11 +27,11 @@ public class Media implements Parcelable {
}; };
protected Media() { protected Media() {
this.categories = new ArrayList<String>(); this.categories = new ArrayList<>();
this.descriptions = new HashMap<String, String>(); this.descriptions = new HashMap<>();
} }
private HashMap<String, Object> tags = new HashMap<String, Object>(); private HashMap<String, Object> tags = new HashMap<>();
public Object getTag(String key) { public Object getTag(String key) {
return tags.get(key); return tags.get(key);

View file

@ -46,8 +46,8 @@ public class MediaDataExtractor {
*/ */
public MediaDataExtractor(String filename, LicenseList licenseList) { public MediaDataExtractor(String filename, LicenseList licenseList) {
this.filename = filename; this.filename = filename;
categories = new ArrayList<String>(); categories = new ArrayList<>();
descriptions = new HashMap<String, String>(); descriptions = new HashMap<>();
fetched = false; fetched = false;
processed = false; processed = false;
this.licenseList = licenseList; this.licenseList = licenseList;
@ -251,7 +251,7 @@ public class MediaDataExtractor {
// Texts are wrapped in things like {{en|foo} or {{en|1=foo bar}}. // Texts are wrapped in things like {{en|foo} or {{en|1=foo bar}}.
// Text outside those wrappers is stuffed into a 'default' faux language key if present. // Text outside those wrappers is stuffed into a 'default' faux language key if present.
private Map<String, String> getMultilingualText(Node parentNode) throws IOException { private Map<String, String> getMultilingualText(Node parentNode) throws IOException {
Map<String, String> texts = new HashMap<String, String>(); Map<String, String> texts = new HashMap<>();
StringBuilder localText = new StringBuilder(); StringBuilder localText = new StringBuilder();
NodeList nodes = parentNode.getChildNodes(); NodeList nodes = parentNode.getChildNodes();

View file

@ -13,7 +13,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
public class SettingsActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener { public class SettingsActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
fr.free.nrw.commons.CommonsApplication app; CommonsApplication app;
private AppCompatDelegate mDelegate; private AppCompatDelegate mDelegate;
@ -23,7 +23,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
getDelegate().onCreate(savedInstanceState); getDelegate().onCreate(savedInstanceState);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences); addPreferencesFromResource(R.xml.preferences);
ListPreference licensePreference = (ListPreference) findPreference(fr.free.nrw.commons.Prefs.DEFAULT_LICENSE); ListPreference licensePreference = (ListPreference) findPreference(Prefs.DEFAULT_LICENSE);
// WARNING: ORDERING NEEDS TO MATCH FOR THE LICENSE NAMES AND DISPLAY VALUES // WARNING: ORDERING NEEDS TO MATCH FOR THE LICENSE NAMES AND DISPLAY VALUES
licensePreference.setEntries(new String[]{ licensePreference.setEntries(new String[]{
getString(R.string.license_name_cc0), getString(R.string.license_name_cc0),
@ -31,21 +31,21 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
getString(R.string.license_name_cc_by_sa) getString(R.string.license_name_cc_by_sa)
}); });
licensePreference.setEntryValues(new String[]{ licensePreference.setEntryValues(new String[]{
fr.free.nrw.commons.Prefs.Licenses.CC0, Prefs.Licenses.CC0,
fr.free.nrw.commons.Prefs.Licenses.CC_BY, Prefs.Licenses.CC_BY,
fr.free.nrw.commons.Prefs.Licenses.CC_BY_SA Prefs.Licenses.CC_BY_SA
}); });
licensePreference.setSummary(getString(fr.free.nrw.commons.Utils.licenseNameFor(licensePreference.getValue()))); licensePreference.setSummary(getString(Utils.licenseNameFor(licensePreference.getValue())));
licensePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { licensePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override @Override
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
preference.setSummary(getString(fr.free.nrw.commons.Utils.licenseNameFor((String)newValue))); preference.setSummary(getString(Utils.licenseNameFor((String)newValue)));
return true; return true;
} }
}); });
app = (fr.free.nrw.commons.CommonsApplication)getApplicationContext(); app = (CommonsApplication)getApplicationContext();
} }
@Override @Override

View file

@ -17,9 +17,6 @@ import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.StringWriter; import java.io.StringWriter;
@ -34,12 +31,13 @@ import java.util.TimeZone;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.dom.DOMSource;
import fr.free.nrw.commons.upload.ShareActivity; import javax.xml.transform.stream.StreamResult;
public class Utils { public class Utils {
@ -104,7 +102,7 @@ public class Utils {
} }
public static String getStringFromDOM(Node dom) { public static String getStringFromDOM(Node dom) {
javax.xml.transform.Transformer transformer = null; Transformer transformer = null;
try { try {
transformer = TransformerFactory.newInstance().newTransformer(); transformer = TransformerFactory.newInstance().newTransformer();
} catch (TransformerConfigurationException e) { } catch (TransformerConfigurationException e) {
@ -116,8 +114,8 @@ public class Utils {
} }
StringWriter outputStream = new StringWriter(); StringWriter outputStream = new StringWriter();
javax.xml.transform.dom.DOMSource domSource = new javax.xml.transform.dom.DOMSource(dom); DOMSource domSource = new DOMSource(dom);
javax.xml.transform.stream.StreamResult strResult = new javax.xml.transform.stream.StreamResult(outputStream); StreamResult strResult = new StreamResult(outputStream);
try { try {
transformer.transform(domSource, strResult); transformer.transform(domSource, strResult);

View file

@ -1,5 +1,6 @@
package fr.free.nrw.commons.auth; package fr.free.nrw.commons.auth;
import android.accounts.AccountManager;
import android.app.Service; import android.app.Service;
import android.content.Intent; import android.content.Intent;
import android.os.IBinder; import android.os.IBinder;
@ -10,7 +11,7 @@ public class WikiAccountAuthenticatorService extends Service{
@Override @Override
public IBinder onBind(Intent intent) { public IBinder onBind(Intent intent) {
if (!intent.getAction().equals(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT)) { if (!intent.getAction().equals(AccountManager.ACTION_AUTHENTICATOR_INTENT)) {
return null; return null;
} }

View file

@ -33,7 +33,7 @@ public class CacheController {
} }
public void cacheCategory() { public void cacheCategory() {
List<String> pointCatList = new ArrayList<String>(); List<String> pointCatList = new ArrayList<>();
if (MwVolleyApi.GpsCatExists.getGpsCatExists() == true) { if (MwVolleyApi.GpsCatExists.getGpsCatExists() == true) {
pointCatList.addAll(MwVolleyApi.getGpsCat()); pointCatList.addAll(MwVolleyApi.getGpsCat());
Log.d(TAG, "Categories being cached: " + pointCatList); Log.d(TAG, "Categories being cached: " + pointCatList);
@ -47,7 +47,7 @@ public class CacheController {
//Convert decLatitude and decLongitude to a coordinate offset range //Convert decLatitude and decLongitude to a coordinate offset range
convertCoordRange(); convertCoordRange();
pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus); pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus);
List<String> displayCatList = new ArrayList<String>(); List<String> displayCatList = new ArrayList<>();
Log.d(TAG, "Points found in quadtree: " + Arrays.asList(pointsFound)); Log.d(TAG, "Points found in quadtree: " + Arrays.asList(pointsFound));
if (pointsFound.length != 0) { if (pointsFound.length != 0) {

View file

@ -7,10 +7,8 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.CheckedTextView; import android.widget.CheckedTextView;
import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.TreeSet;
import fr.free.nrw.commons.R; import fr.free.nrw.commons.R;

View file

@ -2,7 +2,6 @@ package fr.free.nrw.commons.category;
import android.app.Activity; import android.app.Activity;
import android.content.ContentProviderClient; import android.content.ContentProviderClient;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.Cursor; import android.database.Cursor;
@ -21,11 +20,11 @@ import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.CheckedTextView; import android.widget.CheckedTextView;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ListView; import android.widget.ListView;
@ -39,7 +38,6 @@ import java.util.HashSet;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -52,8 +50,8 @@ import fr.free.nrw.commons.upload.MwVolleyApi;
* Displays the category suggestion and selection screen. Category search is initiated here. * Displays the category suggestion and selection screen. Category search is initiated here.
*/ */
public class CategorizationFragment extends Fragment { public class CategorizationFragment extends Fragment {
public static interface OnCategoriesSaveHandler { public interface OnCategoriesSaveHandler {
public void onCategoriesSave(ArrayList<String> categories); void onCategoriesSave(ArrayList<String> categories);
} }
ListView categoriesList; ListView categoriesList;
@ -69,14 +67,14 @@ public class CategorizationFragment extends Fragment {
protected HashMap<String, ArrayList<String>> categoriesCache; protected HashMap<String, ArrayList<String>> categoriesCache;
private ArrayList<String> selectedCategories = new ArrayList<String>(); private ArrayList<String> selectedCategories = new ArrayList<>();
// LHS guarantees ordered insertions, allowing for prioritized method A results // LHS guarantees ordered insertions, allowing for prioritized method A results
private final Set<String> results = new LinkedHashSet<String>(); private final Set<String> results = new LinkedHashSet<>();
PrefixUpdater prefixUpdaterSub; PrefixUpdater prefixUpdaterSub;
MethodAUpdater methodAUpdaterSub; MethodAUpdater methodAUpdaterSub;
private final ArrayList<String> titleCatItems = new ArrayList<String>(); private final ArrayList<String> titleCatItems = new ArrayList<>();
final CountDownLatch mergeLatch = new CountDownLatch(1); final CountDownLatch mergeLatch = new CountDownLatch(1);
private ContentProviderClient client; private ContentProviderClient client;
@ -164,7 +162,7 @@ public class CategorizationFragment extends Fragment {
* @return a list containing recent categories * @return a list containing recent categories
*/ */
protected ArrayList<String> recentCatQuery() { protected ArrayList<String> recentCatQuery() {
ArrayList<String> items = new ArrayList<String>(); ArrayList<String> items = new ArrayList<>();
try { try {
Cursor cursor = client.query( Cursor cursor = client.query(
@ -192,16 +190,16 @@ public class CategorizationFragment extends Fragment {
*/ */
protected ArrayList<String> mergeItems() { protected ArrayList<String> mergeItems() {
Set<String> mergedItems = new LinkedHashSet<String>(); Set<String> mergedItems = new LinkedHashSet<>();
Log.d(TAG, "Calling APIs for GPS cats, title cats and recent cats..."); Log.d(TAG, "Calling APIs for GPS cats, title cats and recent cats...");
List<String> gpsItems = new ArrayList<String>(); List<String> gpsItems = new ArrayList<>();
if (MwVolleyApi.GpsCatExists.getGpsCatExists()) { if (MwVolleyApi.GpsCatExists.getGpsCatExists()) {
gpsItems.addAll(MwVolleyApi.getGpsCat()); gpsItems.addAll(MwVolleyApi.getGpsCat());
} }
List<String> titleItems = new ArrayList<String>(titleCatQuery()); List<String> titleItems = new ArrayList<>(titleCatQuery());
List<String> recentItems = new ArrayList<String>(recentCatQuery()); List<String> recentItems = new ArrayList<>(recentCatQuery());
//Await results of titleItems, which is likely to come in last //Await results of titleItems, which is likely to come in last
try { try {
@ -219,7 +217,7 @@ public class CategorizationFragment extends Fragment {
Log.d(TAG, "Adding recent items: " + recentItems); Log.d(TAG, "Adding recent items: " + recentItems);
//Needs to be an ArrayList and not a List unless we want to modify a big portion of preexisting code //Needs to be an ArrayList and not a List unless we want to modify a big portion of preexisting code
ArrayList<String> mergedItemsList = new ArrayList<String>(mergedItems); ArrayList<String> mergedItemsList = new ArrayList<>(mergedItems);
Log.d(TAG, "Merged item list: " + mergedItemsList); Log.d(TAG, "Merged item list: " + mergedItemsList);
return mergedItemsList; return mergedItemsList;
@ -233,8 +231,8 @@ public class CategorizationFragment extends Fragment {
protected void setCatsAfterAsync(ArrayList<String> categories, String filter) { protected void setCatsAfterAsync(ArrayList<String> categories, String filter) {
if (getActivity() != null) { if (getActivity() != null) {
ArrayList<CategoryItem> items = new ArrayList<CategoryItem>(); ArrayList<CategoryItem> items = new ArrayList<>();
HashSet<String> existingKeys = new HashSet<String>(); HashSet<String> existingKeys = new HashSet<>();
for (CategoryItem item : categoriesAdapter.getItems()) { for (CategoryItem item : categoriesAdapter.getItems()) {
if (item.selected) { if (item.selected) {
items.add(item); items.add(item);
@ -282,7 +280,7 @@ public class CategorizationFragment extends Fragment {
prefixUpdaterSub = new PrefixUpdater(this) { prefixUpdaterSub = new PrefixUpdater(this) {
@Override @Override
protected ArrayList<String> doInBackground(Void... voids) { protected ArrayList<String> doInBackground(Void... voids) {
ArrayList<String> result = new ArrayList<String>(); ArrayList<String> result = new ArrayList<>();
try { try {
result = super.doInBackground(); result = super.doInBackground();
latch.await(); latch.await();
@ -302,7 +300,7 @@ public class CategorizationFragment extends Fragment {
Log.d(TAG, "Prefix result: " + result); Log.d(TAG, "Prefix result: " + result);
String filter = categoriesFilter.getText().toString(); String filter = categoriesFilter.getText().toString();
ArrayList<String> resultsList = new ArrayList<String>(results); ArrayList<String> resultsList = new ArrayList<>(results);
categoriesCache.put(filter, resultsList); categoriesCache.put(filter, resultsList);
Log.d(TAG, "Final results List: " + resultsList); Log.d(TAG, "Final results List: " + resultsList);
@ -424,8 +422,8 @@ public class CategorizationFragment extends Fragment {
ArrayList<CategoryItem> items; ArrayList<CategoryItem> items;
if(savedInstanceState == null) { if(savedInstanceState == null) {
items = new ArrayList<CategoryItem>(); items = new ArrayList<>();
categoriesCache = new HashMap<String, ArrayList<String>>(); categoriesCache = new HashMap<>();
} else { } else {
items = savedInstanceState.getParcelableArrayList("currentCategories"); items = savedInstanceState.getParcelableArrayList("currentCategories");
categoriesCache = (HashMap<String, ArrayList<String>>) savedInstanceState.getSerializable("categoriesCache"); categoriesCache = (HashMap<String, ArrayList<String>>) savedInstanceState.getSerializable("categoriesCache");
@ -469,7 +467,7 @@ public class CategorizationFragment extends Fragment {
} }
@Override @Override
public void onCreateOptionsMenu(Menu menu, android.view.MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear(); menu.clear();
inflater.inflate(R.menu.fragment_categorization, menu); inflater.inflate(R.menu.fragment_categorization, menu);
} }

View file

@ -1,7 +1,6 @@
package fr.free.nrw.commons.category; package fr.free.nrw.commons.category;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@ -83,7 +82,7 @@ public class MethodAUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
//otherwise if user has typed something in that isn't in cache, search API for matching categories //otherwise if user has typed something in that isn't in cache, search API for matching categories
MWApi api = CommonsApplication.createMWApi(); MWApi api = CommonsApplication.createMWApi();
ApiResult result; ApiResult result;
ArrayList<String> categories = new ArrayList<String>(); ArrayList<String> categories = new ArrayList<>();
//URL https://commons.wikimedia.org/w/api.php?action=query&format=xml&list=search&srwhat=text&srenablerewrites=1&srnamespace=14&srlimit=10&srsearch= //URL https://commons.wikimedia.org/w/api.php?action=query&format=xml&list=search&srwhat=text&srenablerewrites=1&srnamespace=14&srlimit=10&srsearch=
try { try {
@ -110,7 +109,7 @@ public class MethodAUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
} }
Log.d(TAG, "Found categories from Method A search, waiting for filter"); Log.d(TAG, "Found categories from Method A search, waiting for filter");
ArrayList<String> filteredItems = new ArrayList<String>(filterYears(categories)); ArrayList<String> filteredItems = new ArrayList<>(filterYears(categories));
return filteredItems; return filteredItems;
} }
} }

View file

@ -82,17 +82,17 @@ public class PrefixUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
protected ArrayList<String> doInBackground(Void... voids) { protected ArrayList<String> doInBackground(Void... voids) {
//If user hasn't typed anything in yet, get GPS and recent items //If user hasn't typed anything in yet, get GPS and recent items
if(TextUtils.isEmpty(filter)) { if(TextUtils.isEmpty(filter)) {
ArrayList<String> mergedItems = new ArrayList<String>(catFragment.mergeItems()); ArrayList<String> mergedItems = new ArrayList<>(catFragment.mergeItems());
Log.d(TAG, "Merged items, waiting for filter"); Log.d(TAG, "Merged items, waiting for filter");
ArrayList<String> filteredItems = new ArrayList<String>(filterYears(mergedItems)); ArrayList<String> filteredItems = new ArrayList<>(filterYears(mergedItems));
return filteredItems; return filteredItems;
} }
//if user types in something that is in cache, return cached category //if user types in something that is in cache, return cached category
if(catFragment.categoriesCache.containsKey(filter)) { if(catFragment.categoriesCache.containsKey(filter)) {
ArrayList<String> cachedItems = new ArrayList<String>(catFragment.categoriesCache.get(filter)); ArrayList<String> cachedItems = new ArrayList<>(catFragment.categoriesCache.get(filter));
Log.d(TAG, "Found cache items, waiting for filter"); Log.d(TAG, "Found cache items, waiting for filter");
ArrayList<String> filteredItems = new ArrayList<String>(filterYears(cachedItems)); ArrayList<String> filteredItems = new ArrayList<>(filterYears(cachedItems));
return filteredItems; return filteredItems;
} }
@ -100,7 +100,7 @@ public class PrefixUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
//URL: https://commons.wikimedia.org/w/api.php?action=query&list=allcategories&acprefix=filter&aclimit=25 //URL: https://commons.wikimedia.org/w/api.php?action=query&list=allcategories&acprefix=filter&aclimit=25
MWApi api = CommonsApplication.createMWApi(); MWApi api = CommonsApplication.createMWApi();
ApiResult result; ApiResult result;
ArrayList<String> categories = new ArrayList<String>(); ArrayList<String> categories = new ArrayList<>();
try { try {
result = api.action("query") result = api.action("query")
.param("list", "allcategories") .param("list", "allcategories")
@ -120,7 +120,7 @@ public class PrefixUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
} }
Log.d(TAG, "Found categories from Prefix search, waiting for filter"); Log.d(TAG, "Found categories from Prefix search, waiting for filter");
ArrayList<String> filteredItems = new ArrayList<String>(filterYears(categories)); ArrayList<String> filteredItems = new ArrayList<>(filterYears(categories));
return filteredItems; return filteredItems;
} }
} }

View file

@ -165,7 +165,7 @@ public class Contribution extends Media {
public void save() { public void save() {
try { try {
if(contentUri == null) { if(contentUri == null) {
contentUri = client.insert(fr.free.nrw.commons.contributions.ContributionsContentProvider.BASE_URI, this.toContentValues()); contentUri = client.insert(ContributionsContentProvider.BASE_URI, this.toContentValues());
} else { } else {
client.update(contentUri, toContentValues(), null, null); client.update(contentUri, toContentValues(), null, null);
} }
@ -234,7 +234,7 @@ public class Contribution extends Media {
//Check that cursor has a value to avoid CursorIndexOutOfBoundsException //Check that cursor has a value to avoid CursorIndexOutOfBoundsException
if (cursor.getCount() > 0) { if (cursor.getCount() > 0) {
c.contentUri = fr.free.nrw.commons.contributions.ContributionsContentProvider.uriForId(cursor.getInt(0)); c.contentUri = ContributionsContentProvider.uriForId(cursor.getInt(0));
c.filename = cursor.getString(1); c.filename = cursor.getString(1);
c.localUri = TextUtils.isEmpty(cursor.getString(2)) ? null : Uri.parse(cursor.getString(2)); c.localUri = TextUtils.isEmpty(cursor.getString(2)) ? null : Uri.parse(cursor.getString(2));
c.imageUrl = cursor.getString(3); c.imageUrl = cursor.getString(3);

View file

@ -76,12 +76,12 @@ public class ContributionController {
Uri imageData = data.getData(); Uri imageData = data.getData();
shareIntent.setType(activity.getContentResolver().getType(imageData)); shareIntent.setType(activity.getContentResolver().getType(imageData));
shareIntent.putExtra(Intent.EXTRA_STREAM, imageData); shareIntent.putExtra(Intent.EXTRA_STREAM, imageData);
shareIntent.putExtra(UploadService.EXTRA_SOURCE, fr.free.nrw.commons.contributions.Contribution.SOURCE_GALLERY); shareIntent.putExtra(UploadService.EXTRA_SOURCE, Contribution.SOURCE_GALLERY);
break; break;
case SELECT_FROM_CAMERA: case SELECT_FROM_CAMERA:
shareIntent.setType("image/jpeg"); //FIXME: Find out appropriate mime type shareIntent.setType("image/jpeg"); //FIXME: Find out appropriate mime type
shareIntent.putExtra(Intent.EXTRA_STREAM, lastGeneratedCaptureURI); shareIntent.putExtra(Intent.EXTRA_STREAM, lastGeneratedCaptureURI);
shareIntent.putExtra(UploadService.EXTRA_SOURCE, fr.free.nrw.commons.contributions.Contribution.SOURCE_CAMERA); shareIntent.putExtra(UploadService.EXTRA_SOURCE, Contribution.SOURCE_CAMERA);
break; break;
} }
Log.i("Image", "Image selected"); Log.i("Image", "Image selected");

View file

@ -45,7 +45,7 @@ public class ContributionsActivity
private MediaDetailPagerFragment mediaDetails; private MediaDetailPagerFragment mediaDetails;
private UploadService uploadService; private UploadService uploadService;
private boolean isUploadServiceConnected; private boolean isUploadServiceConnected;
private ArrayList<DataSetObserver> observersWaitingForLoad = new ArrayList<DataSetObserver>(); private ArrayList<DataSetObserver> observersWaitingForLoad = new ArrayList<>();
private String CONTRIBUTION_SELECTION = ""; private String CONTRIBUTION_SELECTION = "";
/* /*
This sorts in the following order: This sorts in the following order:

View file

@ -11,6 +11,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.FailReason; import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener; import com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener;
@ -51,7 +52,7 @@ class ContributionsListAdapter extends CursorAdapter {
mwImageView.setMedia(contribution, ((CommonsApplication) activity.getApplicationContext()).getImageLoader()); mwImageView.setMedia(contribution, ((CommonsApplication) activity.getApplicationContext()).getImageLoader());
// FIXME: For transparent images // FIXME: For transparent images
} else { } else {
com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage(actualUrl, views.imageView, contributionDisplayOptions, new SimpleImageLoadingListener() { ImageLoader.getInstance().displayImage(actualUrl, views.imageView, contributionDisplayOptions, new SimpleImageLoadingListener() {
@Override @Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {

View file

@ -92,7 +92,7 @@ public class ContributionsSyncAdapter extends AbstractThreadedSyncAdapter {
ArrayList<ApiResult> uploads = result.getNodes("/api/query/logevents/item"); ArrayList<ApiResult> uploads = result.getNodes("/api/query/logevents/item");
Log.d("Commons", uploads.size() + " results!"); Log.d("Commons", uploads.size() + " results!");
ArrayList<ContentValues> imageValues = new ArrayList<ContentValues>(); ArrayList<ContentValues> imageValues = new ArrayList<>();
for(ApiResult image: uploads) { for(ApiResult image: uploads) {
String filename = image.getString("@title"); String filename = image.getString("@title");
if(fileExists(contentProviderClient, filename)) { if(fileExists(contentProviderClient, filename)) {

View file

@ -32,7 +32,7 @@ public class CategoryImagesLoader extends AsyncTaskLoader<List<Media>>{
@Override @Override
public List<Media> loadInBackground() { public List<Media> loadInBackground() {
ArrayList<Media> mediaList = new ArrayList<Media>(); ArrayList<Media> mediaList = new ArrayList<>();
ApiResult result; ApiResult result;
try { try {
result = app.getApi().action("query") result = app.getApi().action("query")

View file

@ -39,7 +39,7 @@ public class MediaDetailFragment extends Fragment {
private boolean editable; private boolean editable;
private DisplayImageOptions displayOptions; private DisplayImageOptions displayOptions;
private fr.free.nrw.commons.media.MediaDetailPagerFragment.MediaDetailProvider detailProvider; private MediaDetailPagerFragment.MediaDetailProvider detailProvider;
private int index; private int index;
public static MediaDetailFragment forMedia(int index) { public static MediaDetailFragment forMedia(int index) {
@ -64,7 +64,7 @@ public class MediaDetailFragment extends Fragment {
//private EditText title; //private EditText title;
private ProgressBar loadingProgress; private ProgressBar loadingProgress;
private ImageView loadingFailed; private ImageView loadingFailed;
private fr.free.nrw.commons.media.MediaDetailSpacer spacer; private MediaDetailSpacer spacer;
private int initialListTop = 0; private int initialListTop = 0;
private TextView title; private TextView title;
@ -97,7 +97,7 @@ public class MediaDetailFragment extends Fragment {
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
detailProvider = (fr.free.nrw.commons.media.MediaDetailPagerFragment.MediaDetailProvider)getActivity(); detailProvider = (MediaDetailPagerFragment.MediaDetailProvider)getActivity();
if(savedInstanceState != null) { if(savedInstanceState != null) {
editable = savedInstanceState.getBoolean("editable"); editable = savedInstanceState.getBoolean("editable");
@ -108,7 +108,7 @@ public class MediaDetailFragment extends Fragment {
index = getArguments().getInt("index"); index = getArguments().getInt("index");
initialListTop = 0; initialListTop = 0;
} }
categoryNames = new ArrayList<String>(); categoryNames = new ArrayList<>();
categoryNames.add(getString(R.string.detail_panel_cats_loading)); categoryNames.add(getString(R.string.detail_panel_cats_loading));
final View view = inflater.inflate(R.layout.fragment_media_detail, container, false); final View view = inflater.inflate(R.layout.fragment_media_detail, container, false);
@ -119,7 +119,7 @@ public class MediaDetailFragment extends Fragment {
scrollView = (ScrollView) view.findViewById(R.id.mediaDetailScrollView); scrollView = (ScrollView) view.findViewById(R.id.mediaDetailScrollView);
// Detail consists of a list view with main pane in header view, plus category list. // Detail consists of a list view with main pane in header view, plus category list.
spacer = (fr.free.nrw.commons.media.MediaDetailSpacer) view.findViewById(R.id.mediaDetailSpacer); spacer = (MediaDetailSpacer) view.findViewById(R.id.mediaDetailSpacer);
title = (TextView) view.findViewById(R.id.mediaDetailTitle); title = (TextView) view.findViewById(R.id.mediaDetailTitle);
desc = (TextView) view.findViewById(R.id.mediaDetailDesc); desc = (TextView) view.findViewById(R.id.mediaDetailDesc);
license = (TextView) view.findViewById(R.id.mediaDetailLicense); license = (TextView) view.findViewById(R.id.mediaDetailLicense);

View file

@ -46,11 +46,11 @@ public class MediaDetailPagerFragment extends Fragment implements ViewPager.OnPa
} }
public interface MediaDetailProvider { public interface MediaDetailProvider {
public Media getMediaAtPosition(int i); Media getMediaAtPosition(int i);
public int getTotalMediaCount(); int getTotalMediaCount();
public void notifyDatasetChanged(); void notifyDatasetChanged();
public void registerDataSetObserver(DataSetObserver observer); void registerDataSetObserver(DataSetObserver observer);
public void unregisterDataSetObserver(DataSetObserver observer); void unregisterDataSetObserver(DataSetObserver observer);
} }
//FragmentStatePagerAdapter allows user to swipe across collection of images (no. of images undetermined) //FragmentStatePagerAdapter allows user to swipe across collection of images (no. of images undetermined)
@ -71,7 +71,7 @@ public class MediaDetailPagerFragment extends Fragment implements ViewPager.OnPa
} }
}, 5); }, 5);
} }
return fr.free.nrw.commons.media.MediaDetailFragment.forMedia(i, editable); return MediaDetailFragment.forMedia(i, editable);
} }
@Override @Override

View file

@ -21,7 +21,7 @@ public class ModifierSequence {
public ModifierSequence(Uri mediaUri) { public ModifierSequence(Uri mediaUri) {
this.mediaUri = mediaUri; this.mediaUri = mediaUri;
modifiers = new ArrayList<PageModifier>(); modifiers = new ArrayList<>();
} }
public ModifierSequence(Uri mediaUri, JSONObject data) { public ModifierSequence(Uri mediaUri, JSONObject data) {

View file

@ -21,7 +21,7 @@ public class NearbyPlaces {
} }
else { else {
try { try {
places = new ArrayList<Place>(); places = new ArrayList<>();
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy); StrictMode.setThreadPolicy(policy);

View file

@ -24,7 +24,7 @@ import fr.free.nrw.commons.contributions.ContributionsActivity;
*/ */
public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> { public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {
private static final String TAG = fr.free.nrw.commons.upload.ExistingFileAsync.class.getName(); private static final String TAG = ExistingFileAsync.class.getName();
private String fileSHA1; private String fileSHA1;
private Context context; private Context context;

View file

@ -249,7 +249,7 @@ public class MultipleShareActivity
if(intent.getAction().equals(Intent.ACTION_SEND_MULTIPLE)) { if(intent.getAction().equals(Intent.ACTION_SEND_MULTIPLE)) {
if(photosList == null) { if(photosList == null) {
photosList = new ArrayList<Contribution>(); photosList = new ArrayList<>();
ArrayList<Uri> urisList = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); ArrayList<Uri> urisList = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
for(int i=0; i < urisList.size(); i++) { for(int i=0; i < urisList.size(); i++) {
Contribution up = new Contribution(); Contribution up = new Contribution();

View file

@ -11,6 +11,7 @@ import android.text.TextWatcher;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -36,7 +37,7 @@ import fr.free.nrw.commons.media.MediaDetailPagerFragment;
public class MultipleUploadListFragment extends Fragment { public class MultipleUploadListFragment extends Fragment {
public interface OnMultipleUploadInitiatedHandler { public interface OnMultipleUploadInitiatedHandler {
public void OnMultipleUploadInitiated(); void OnMultipleUploadInitiated();
} }
private GridView photosGrid; private GridView photosGrid;
@ -200,7 +201,7 @@ public class MultipleUploadListFragment extends Fragment {
} }
@Override @Override
public void onCreateOptionsMenu(Menu menu, android.view.MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
menu.clear(); menu.clear();
inflater.inflate(R.menu.fragment_multiple_upload_list, menu); inflater.inflate(R.menu.fragment_multiple_upload_list, menu);

View file

@ -42,7 +42,7 @@ public class MwVolleyApi {
public MwVolleyApi(Context context) { public MwVolleyApi(Context context) {
this.context = context; this.context = context;
categorySet = new HashSet<String>(); categorySet = new HashSet<>();
} }
public static List<String> getGpsCat() { public static List<String> getGpsCat() {
@ -50,7 +50,7 @@ public class MwVolleyApi {
} }
public static void setGpsCat(List cachedList) { public static void setGpsCat(List cachedList) {
categoryList = new ArrayList<String>(); categoryList = new ArrayList<>();
categoryList.addAll(cachedList); categoryList.addAll(cachedList);
Log.d(TAG, "Setting GPS cats from cache: " + categoryList.toString()); Log.d(TAG, "Setting GPS cats from cache: " + categoryList.toString());
} }
@ -236,7 +236,7 @@ public class MwVolleyApi {
} }
} }
categoryList = new ArrayList<String>(categorySet); categoryList = new ArrayList<>(categorySet);
builder.replace(builder.length() - 1, builder.length(), ""); builder.replace(builder.length() - 1, builder.length(), "");
return builder.toString(); return builder.toString();
} }

View file

@ -21,10 +21,8 @@ import android.widget.Toast;
import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoader;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

222
script/style/checkstyle.xml Normal file
View file

@ -0,0 +1,222 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
Modified from https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml.
Modifications are:
- doubled each value in Indentation
Checkstyle configuration that checks the Google coding conventions from Google Java Style
that can be found at https://google.github.io/styleguide/javaguide.html.
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).
To completely disable a check, just comment it out or delete it from the file.
Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
-->
<module name = "Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java, properties, xml"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="TreeWalker">
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format" value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message" value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
</module>
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="LineLength">
<property name="max" value="100"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<module name="NeedBraces"/>
<module name="LeftCurly">
<property name="maxLineLength" value="100"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_DO"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
<property name="option" value="alone"/>
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<module name="OneStatementPerLine"/>
<module name="MultipleVariableDeclarations"/>
<module name="ArrayTypeStyle"/>
<module name="MissingSwitchDefault"/>
<module name="FallThrough"/>
<module name="UpperEll"/>
<module name="ModifierOrder"/>
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapDot"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapComma"/>
<property name="tokens" value="COMMA"/>
<property name="option" value="EOL"/>
</module>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypeName">
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="CatchParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LocalVariableName">
<property name="tokens" value="VARIABLE_DEF"/>
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ClassTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="InterfaceTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="NoFinalizer"/>
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="8"/>
<property name="lineWrappingIndentation" value="8"/>
<property name="arrayInitIndent" value="4"/>
</module>
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/>
<module name="CustomImportOrder">
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/>
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
</module>
<module name="MethodParamPad"/>
<module name="ParenPad"/>
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationMostCases"/>
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationVariables"/>
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="JavadocTagContinuationIndentation"/>
<module name="SummaryJavadoc">
<property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<module name="JavadocParagraph"/>
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingThrowsTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="minLineCount" value="2"/>
<property name="allowedAnnotations" value="Override, Test"/>
<property name="allowThrowsTagsForSubclasses" value="true"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern"
value="Method name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="false"/>
</module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="expected"/>
</module>
<module name="CommentsIndentation"/>
</module>
</module>