mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Merge pull request #362 from veyndan/unqualify-imports
Replace fully qualified names with imports
This commit is contained in:
commit
048474b059
13 changed files with 43 additions and 36 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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<>();
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -31,10 +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 javax.xml.transform.stream.StreamResult;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
|
|
@ -99,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) {
|
||||||
|
|
@ -111,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);
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ 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;
|
||||||
|
|
@ -466,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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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");
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
|
|
@ -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");
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue