mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Added Help link in Alert Dialogue (#4315)
* READ MORE button added * Added link to tips * Fixed minor issues
This commit is contained in:
parent
5ddbc9e27a
commit
40b2619ccf
2 changed files with 60 additions and 23 deletions
|
|
@ -2,6 +2,7 @@ package fr.free.nrw.commons.profile.achievements;
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
@ -36,7 +37,6 @@ import javax.inject.Inject;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
import com.dinuscxj.progressbar.CircleProgressBar;
|
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
import fr.free.nrw.commons.Utils;
|
import fr.free.nrw.commons.Utils;
|
||||||
import fr.free.nrw.commons.auth.SessionManager;
|
import fr.free.nrw.commons.auth.SessionManager;
|
||||||
|
|
@ -46,12 +46,6 @@ import fr.free.nrw.commons.utils.ViewUtil;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Objects;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -62,6 +56,17 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment {
|
||||||
private static final double BADGE_IMAGE_WIDTH_RATIO = 0.4;
|
private static final double BADGE_IMAGE_WIDTH_RATIO = 0.4;
|
||||||
private static final double BADGE_IMAGE_HEIGHT_RATIO = 0.3;
|
private static final double BADGE_IMAGE_HEIGHT_RATIO = 0.3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Help link URLs
|
||||||
|
*/
|
||||||
|
private static final String IMAGES_UPLOADED_URL = "https://commons.wikimedia.org/wiki/Commons:Project_scope";
|
||||||
|
private static final String IMAGES_REVERT_URL = "https://commons.wikimedia.org/wiki/Commons:Deletion_policy#Reasons_for_deletion";
|
||||||
|
private static final String IMAGES_USED_URL = "https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Images";
|
||||||
|
private static final String IMAGES_NEARBY_PLACES_URL = "https://www.wikidata.org/wiki/Property:P18";
|
||||||
|
private static final String IMAGES_FEATURED_URL = "https://commons.wikimedia.org/wiki/Commons:Featured_pictures";
|
||||||
|
private static final String QUALITY_IMAGE_URL = "https://commons.wikimedia.org/wiki/Commons:Quality_images";
|
||||||
|
private static final String THANKS_URL = "https://www.mediawiki.org/wiki/Extension:Thanks";
|
||||||
|
|
||||||
private LevelController.LevelInfo levelInfo;
|
private LevelController.LevelInfo levelInfo;
|
||||||
|
|
||||||
@BindView(R.id.achievement_badge_image)
|
@BindView(R.id.achievement_badge_image)
|
||||||
|
|
@ -242,8 +247,9 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment {
|
||||||
*/
|
*/
|
||||||
@OnClick(R.id.achievement_info)
|
@OnClick(R.id.achievement_info)
|
||||||
public void showInfoDialog(){
|
public void showInfoDialog(){
|
||||||
launchAlert(getResources().getString(R.string.Achievements)
|
launchAlert(
|
||||||
,getResources().getString(R.string.achievements_info_message));
|
getResources().getString(R.string.Achievements),
|
||||||
|
getResources().getString(R.string.achievements_info_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -456,44 +462,58 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment {
|
||||||
|
|
||||||
@OnClick(R.id.images_upload_info)
|
@OnClick(R.id.images_upload_info)
|
||||||
public void showUploadInfo(){
|
public void showUploadInfo(){
|
||||||
launchAlert(getResources().getString(R.string.images_uploaded)
|
launchAlertWithHelpLink(
|
||||||
,getResources().getString(R.string.images_uploaded_explanation));
|
getResources().getString(R.string.images_uploaded),
|
||||||
|
getResources().getString(R.string.images_uploaded_explanation),
|
||||||
|
IMAGES_UPLOADED_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.images_reverted_info)
|
@OnClick(R.id.images_reverted_info)
|
||||||
public void showRevertedInfo(){
|
public void showRevertedInfo(){
|
||||||
launchAlert(getResources().getString(R.string.image_reverts)
|
launchAlertWithHelpLink(
|
||||||
,getResources().getString(R.string.images_reverted_explanation));
|
getResources().getString(R.string.image_reverts),
|
||||||
|
getResources().getString(R.string.images_reverted_explanation),
|
||||||
|
IMAGES_REVERT_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.images_used_by_wiki_info)
|
@OnClick(R.id.images_used_by_wiki_info)
|
||||||
public void showUsedByWikiInfo(){
|
public void showUsedByWikiInfo(){
|
||||||
launchAlert(getResources().getString(R.string.images_used_by_wiki)
|
launchAlertWithHelpLink(
|
||||||
,getResources().getString(R.string.images_used_explanation));
|
getResources().getString(R.string.images_used_by_wiki),
|
||||||
|
getResources().getString(R.string.images_used_explanation),
|
||||||
|
IMAGES_USED_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.images_nearby_info)
|
@OnClick(R.id.images_nearby_info)
|
||||||
public void showImagesViaNearbyInfo(){
|
public void showImagesViaNearbyInfo(){
|
||||||
launchAlert(getResources().getString(R.string.statistics_wikidata_edits)
|
launchAlertWithHelpLink(
|
||||||
,getResources().getString(R.string.images_via_nearby_explanation));
|
getResources().getString(R.string.statistics_wikidata_edits),
|
||||||
|
getResources().getString(R.string.images_via_nearby_explanation),
|
||||||
|
IMAGES_NEARBY_PLACES_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.images_featured_info)
|
@OnClick(R.id.images_featured_info)
|
||||||
public void showFeaturedImagesInfo(){
|
public void showFeaturedImagesInfo(){
|
||||||
launchAlert(getResources().getString(R.string.statistics_featured)
|
launchAlertWithHelpLink(
|
||||||
,getResources().getString(R.string.images_featured_explanation));
|
getResources().getString(R.string.statistics_featured),
|
||||||
|
getResources().getString(R.string.images_featured_explanation),
|
||||||
|
IMAGES_FEATURED_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.thanks_received_info)
|
@OnClick(R.id.thanks_received_info)
|
||||||
public void showThanksReceivedInfo(){
|
public void showThanksReceivedInfo(){
|
||||||
launchAlert(getResources().getString(R.string.statistics_thanks)
|
launchAlertWithHelpLink(
|
||||||
,getResources().getString(R.string.thanks_received_explanation));
|
getResources().getString(R.string.statistics_thanks),
|
||||||
|
getResources().getString(R.string.thanks_received_explanation),
|
||||||
|
THANKS_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.quality_images_info)
|
@OnClick(R.id.quality_images_info)
|
||||||
public void showQualityImagesInfo() {
|
public void showQualityImagesInfo() {
|
||||||
launchAlert(getResources().getString(R.string.statistics_quality)
|
launchAlertWithHelpLink(
|
||||||
, getResources().getString(R.string.quality_images_info));
|
getResources().getString(R.string.statistics_quality),
|
||||||
|
getResources().getString(R.string.quality_images_info),
|
||||||
|
QUALITY_IMAGE_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -511,6 +531,22 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment {
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch Alert with a READ MORE button and clicking it open a custom webpage
|
||||||
|
*/
|
||||||
|
private void launchAlertWithHelpLink(String title, String message, String helpLinkUrl){
|
||||||
|
new Builder(getActivity())
|
||||||
|
.setTitle(title)
|
||||||
|
.setMessage(message)
|
||||||
|
.setCancelable(true)
|
||||||
|
.setPositiveButton(android.R.string.ok, (dialog, id) -> dialog.cancel())
|
||||||
|
.setNegativeButton(R.string.read_help_link, (dialog ,id) ->{
|
||||||
|
Utils.handleWebUrl(requireContext(), Uri.parse(helpLinkUrl));;
|
||||||
|
})
|
||||||
|
.create()
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check to ensure that user is logged in
|
* check to ensure that user is logged in
|
||||||
* @return
|
* @return
|
||||||
|
|
|
||||||
|
|
@ -610,5 +610,6 @@ Upload your first media by tapping on the add button.</string>
|
||||||
<string name="media_detail_step_title">Media Details</string>
|
<string name="media_detail_step_title">Media Details</string>
|
||||||
<string name="menu_view_category_page">View category page</string>
|
<string name="menu_view_category_page">View category page</string>
|
||||||
<string name="menu_view_item_page">View item page</string>
|
<string name="menu_view_item_page">View item page</string>
|
||||||
|
<string name="read_help_link">Read more</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue