mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Add missing Javadocs to License, Media, and Utils classes (#1965)
* Add missing Javadocs to License, Media, and Utils classes
This commit is contained in:
parent
f521e8886d
commit
809c0c32d7
6 changed files with 43 additions and 2 deletions
|
|
@ -50,6 +50,10 @@ public class License {
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the license name. If name is null, return license key.
|
||||||
|
* @return license name as string. if name null, license key as String
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
// hack
|
// hack
|
||||||
|
|
|
||||||
|
|
@ -414,10 +414,17 @@ public class Media implements Parcelable {
|
||||||
parcel.writeMap(descriptions);
|
parcel.writeMap(descriptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set requested deletion to true
|
||||||
|
*/
|
||||||
public void setRequestedDeletion(){
|
public void setRequestedDeletion(){
|
||||||
requestedDeletion = true;
|
requestedDeletion = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value of requested deletion
|
||||||
|
* @return boolean requestedDeletion
|
||||||
|
*/
|
||||||
public boolean getRequestedDeletion(){
|
public boolean getRequestedDeletion(){
|
||||||
return requestedDeletion;
|
return requestedDeletion;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,10 @@ public class Utils {
|
||||||
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("theme", false);
|
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("theme", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launches intent to rate app
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
public static void rateApp(Context context) {
|
public static void rateApp(Context context) {
|
||||||
final String appPackageName = BuildConfig.class.getPackage().getName();
|
final String appPackageName = BuildConfig.class.getPackage().getName();
|
||||||
try {
|
try {
|
||||||
|
|
@ -183,6 +187,11 @@ public class Utils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launches intent for web URL
|
||||||
|
* @param context
|
||||||
|
* @param url
|
||||||
|
*/
|
||||||
public static void handleWebUrl(Context context, Uri url) {
|
public static void handleWebUrl(Context context, Uri url) {
|
||||||
Timber.d("Launching web url %s", url.toString());
|
Timber.d("Launching web url %s", url.toString());
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, url);
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, url);
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,11 @@ public class NotificationUtils {
|
||||||
private static final String WIKIDATA_WIKI = "wikidatawiki";
|
private static final String WIKIDATA_WIKI = "wikidatawiki";
|
||||||
private static final String WIKIPEDIA_WIKI = "enwiki";
|
private static final String WIKIPEDIA_WIKI = "enwiki";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the wiki attribute corresponds to commonswiki
|
||||||
|
* @param document
|
||||||
|
* @return boolean representing whether the wiki attribute corresponds to commonswiki
|
||||||
|
*/
|
||||||
public static boolean isCommonsNotification(Node document) {
|
public static boolean isCommonsNotification(Node document) {
|
||||||
if (document == null || !document.hasAttributes()) {
|
if (document == null || !document.hasAttributes()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -35,7 +40,7 @@ public class NotificationUtils {
|
||||||
/**
|
/**
|
||||||
* Returns true if the wiki attribute corresponds to wikidatawiki
|
* Returns true if the wiki attribute corresponds to wikidatawiki
|
||||||
* @param document
|
* @param document
|
||||||
* @return
|
* @return boolean representing whether the wiki attribute corresponds to wikidatawiki
|
||||||
*/
|
*/
|
||||||
public static boolean isWikidataNotification(Node document) {
|
public static boolean isWikidataNotification(Node document) {
|
||||||
if (document == null || !document.hasAttributes()) {
|
if (document == null || !document.hasAttributes()) {
|
||||||
|
|
@ -58,6 +63,11 @@ public class NotificationUtils {
|
||||||
return WIKIPEDIA_WIKI.equals(element.getAttribute("wiki"));
|
return WIKIPEDIA_WIKI.equals(element.getAttribute("wiki"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns document notification type
|
||||||
|
* @param document
|
||||||
|
* @return the document's NotificationType
|
||||||
|
*/
|
||||||
public static NotificationType getNotificationType(Node document) {
|
public static NotificationType getNotificationType(Node document) {
|
||||||
Element element = (Element) document;
|
Element element = (Element) document;
|
||||||
String type = element.getAttribute("type");
|
String type = element.getAttribute("type");
|
||||||
|
|
@ -99,7 +109,7 @@ public class NotificationUtils {
|
||||||
* Currently the app is interested in showing notifications just from the following three wikis: commons, wikidata, wikipedia
|
* Currently the app is interested in showing notifications just from the following three wikis: commons, wikidata, wikipedia
|
||||||
* This function returns true only if the notification belongs to any of the above wikis and is of a known notification type
|
* This function returns true only if the notification belongs to any of the above wikis and is of a known notification type
|
||||||
* @param node
|
* @param node
|
||||||
* @return
|
* @return whether a notification is from one of Commons, Wikidata or Wikipedia
|
||||||
*/
|
*/
|
||||||
private static boolean isUsefulNotification(Node node) {
|
private static boolean isUsefulNotification(Node node) {
|
||||||
return (isCommonsNotification(node)
|
return (isCommonsNotification(node)
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,10 @@ class DescriptionsAdapter extends RecyclerView.Adapter<DescriptionsAdapter.ViewH
|
||||||
return descriptions.size() + 1;
|
return descriptions.size() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets descriptions
|
||||||
|
* @return List of descriptions
|
||||||
|
*/
|
||||||
List<Description> getDescriptions() {
|
List<Description> getDescriptions() {
|
||||||
return descriptions;
|
return descriptions;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,10 @@ public class ContributionUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a temporary directory and returns pathname
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private static String decideTempDestinationFileName() {
|
private static String decideTempDestinationFileName() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (new File(TEMP_EXTERNAL_DIRECTORY + File.separatorChar + i + "_tmp").exists()) {
|
while (new File(TEMP_EXTERNAL_DIRECTORY + File.separatorChar + i + "_tmp").exists()) {
|
||||||
|
|
@ -79,6 +83,9 @@ public class ContributionUtils {
|
||||||
return TEMP_EXTERNAL_DIRECTORY + File.separatorChar + timeStamp + multipleUploadRandomParameter + "_tmp";
|
return TEMP_EXTERNAL_DIRECTORY + File.separatorChar + timeStamp + multipleUploadRandomParameter + "_tmp";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empties files in Temporary Directory
|
||||||
|
*/
|
||||||
public static void emptyTemporaryDirectory() {
|
public static void emptyTemporaryDirectory() {
|
||||||
File dir = new File(TEMP_EXTERNAL_DIRECTORY);
|
File dir = new File(TEMP_EXTERNAL_DIRECTORY);
|
||||||
if (dir.isDirectory())
|
if (dir.isDirectory())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue