mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 05:13:53 +01:00
Deletion button being disabled (#1403)
* used CDATA * Improvements in Notification Activity (#1374) * Improvements in Notification Activity * Update NotificationActivity.java * Share feature (#1338) * added share app feature in About * added share app feature in About * a small fix * Use custom tabs for nearby web views (#1347) * Localisation updates from https://translatewiki.net. * Fix for issue #1380 Improved Notification UI (#1387) * Links added to TextView about_upload_to in aboutActivity (#1326) * Added the link in about_upload_to textfield * Merge conflicts resolved * Removed the extra textView * Fix re-enabling delete button if the action is canceled. * Keep delete button enabled until a reason is given.
This commit is contained in:
parent
482b06ccf0
commit
9a3b6fc964
50 changed files with 488 additions and 76 deletions
|
|
@ -6,11 +6,15 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.util.Log;
|
||||
import android.support.customtabs.CustomTabsIntent;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
|
|
@ -62,6 +66,18 @@ public class AboutActivity extends NavigationBaseActivity {
|
|||
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
|
||||
faqText.setText(content);
|
||||
versionText.setText(BuildConfig.VERSION_NAME);
|
||||
TextView rate_us = findViewById(R.id.about_rate_us);
|
||||
TextView privacy_policy = findViewById(R.id.about_privacy_policy);
|
||||
TextView translate = findViewById(R.id.about_translate);
|
||||
TextView credits = findViewById(R.id.about_credits);
|
||||
TextView faq = findViewById(R.id.about_faq);
|
||||
|
||||
rate_us.setText(Html.fromHtml(getString(R.string.about_rate_us)));
|
||||
privacy_policy.setText(Html.fromHtml(getString(R.string.about_privacy_policy)));
|
||||
translate.setText(Html.fromHtml(getString(R.string.about_translate)));
|
||||
credits.setText(Html.fromHtml(getString(R.string.about_credits)));
|
||||
faq.setText(Html.fromHtml(getString(R.string.about_faq)));
|
||||
|
||||
initDrawer();
|
||||
}
|
||||
|
||||
|
|
@ -108,6 +124,28 @@ public class AboutActivity extends NavigationBaseActivity {
|
|||
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Frequently-Asked-Questions\\"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.menu_about, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.share_app_icon:
|
||||
Intent sendIntent = new Intent();
|
||||
sendIntent.setAction(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, "http://play.google.com/store/apps/details?id=fr.free.nrw.commons");
|
||||
sendIntent.setType("text/plain");
|
||||
startActivity(Intent.createChooser(sendIntent, "Share app via..."));
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.about_translate)
|
||||
public void launchTranslate(View view) {
|
||||
final ArrayAdapter<String> languageAdapter = new ArrayAdapter<String>(AboutActivity.this,
|
||||
|
|
|
|||
|
|
@ -304,9 +304,10 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
|||
coordinates.setOnClickListener(v -> openMap(media.getCoordinates()));
|
||||
}
|
||||
if (delete.getVisibility() == View.VISIBLE) {
|
||||
enableDeleteButton(true);
|
||||
|
||||
delete.setOnClickListener(v -> {
|
||||
delete.setEnabled(false);
|
||||
delete.setTextColor(getResources().getColor(R.color.deleteButtonLight));
|
||||
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
|
||||
alert.setMessage("Why should this file be deleted?");
|
||||
final EditText input = new EditText(getActivity());
|
||||
|
|
@ -317,6 +318,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
|||
String reason = input.getText().toString();
|
||||
DeleteTask deleteTask = new DeleteTask(getActivity(), media, reason);
|
||||
deleteTask.execute();
|
||||
enableDeleteButton(false);
|
||||
}
|
||||
});
|
||||
alert.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
|
|
@ -358,6 +360,15 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void enableDeleteButton(boolean visibility) {
|
||||
delete.setEnabled(visibility);
|
||||
if(visibility) {
|
||||
delete.setTextColor(getResources().getColor(R.color.primaryTextColor));
|
||||
} else {
|
||||
delete.setTextColor(getResources().getColor(R.color.deleteButtonLight));
|
||||
}
|
||||
}
|
||||
|
||||
private void rebuildCatList() {
|
||||
categoryContainer.removeAllViews();
|
||||
// @fixme add the category items
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ import javax.inject.Named;
|
|||
|
||||
import dagger.android.support.DaggerFragment;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.Utils;
|
||||
import fr.free.nrw.commons.contributions.ContributionController;
|
||||
import fr.free.nrw.commons.utils.UriDeserializer;
|
||||
import fr.free.nrw.commons.utils.ViewUtil;
|
||||
|
|
@ -747,8 +748,7 @@ public class NearbyMapFragment extends DaggerFragment {
|
|||
}
|
||||
|
||||
private void openWebView(Uri link) {
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, link);
|
||||
startActivity(browserIntent);
|
||||
Utils.handleWebUrl(getContext(), link);
|
||||
}
|
||||
|
||||
private void animateFAB(boolean isFabOpen) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.Utils;
|
||||
import fr.free.nrw.commons.contributions.ContributionController;
|
||||
import fr.free.nrw.commons.di.ApplicationlessInjection;
|
||||
import timber.log.Timber;
|
||||
|
|
@ -200,8 +201,7 @@ public class PlaceRenderer extends Renderer<Place> {
|
|||
}
|
||||
|
||||
private void openWebView(Uri link) {
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, link);
|
||||
view.getContext().startActivity(browserIntent);
|
||||
Utils.handleWebUrl(getContext(), link);
|
||||
}
|
||||
|
||||
private boolean showMenu() {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.widget.DividerItemDecoration;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
|
@ -15,6 +16,7 @@ import android.widget.RelativeLayout;
|
|||
|
||||
import com.pedrogomez.renderers.RVRendererAdapter;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -25,6 +27,7 @@ import butterknife.ButterKnife;
|
|||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.Utils;
|
||||
import fr.free.nrw.commons.theme.NavigationBaseActivity;
|
||||
import fr.free.nrw.commons.utils.NetworkUtils;
|
||||
import fr.free.nrw.commons.utils.ViewUtil;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
|
|
@ -62,9 +65,23 @@ public class NotificationActivity extends NavigationBaseActivity {
|
|||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
DividerItemDecoration itemDecor = new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL);
|
||||
recyclerView.addItemDecoration(itemDecor);
|
||||
addNotifications();
|
||||
refresh();
|
||||
}
|
||||
|
||||
private void refresh() {
|
||||
if (!NetworkUtils.isInternetConnectionEstablished(this)) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
Snackbar.make(relativeLayout , R.string.no_internet, Snackbar.LENGTH_INDEFINITE)
|
||||
.setAction(R.string.retry, view -> {
|
||||
refresh();
|
||||
}).show();
|
||||
}else {
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
addNotifications();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void addNotifications() {
|
||||
Timber.d("Add notifications");
|
||||
|
|
@ -124,4 +141,4 @@ public class NotificationActivity extends NavigationBaseActivity {
|
|||
.commit();
|
||||
mNotificationWorkerFragment.setNotificationList(notificationList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ public class NotificationRenderer extends Renderer<Notification> {
|
|||
@Override
|
||||
public void render() {
|
||||
Notification notification = getContent();
|
||||
StringBuilder str = new StringBuilder(notification.notificationText.trim());
|
||||
str.append(" ");
|
||||
String str = notification.notificationText.trim();
|
||||
str = str.concat(" ");
|
||||
title.setText(str);
|
||||
time.setText(notification.date);
|
||||
switch (notification.notificationType) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue