mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Merge branch 'master' of https://github.com/commons-app/apps-android-commons
This commit is contained in:
commit
6e9ea26023
7 changed files with 91 additions and 16 deletions
|
|
@ -1,12 +1,15 @@
|
||||||
package fr.free.nrw.commons;
|
package fr.free.nrw.commons;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.support.customtabs.CustomTabsIntent;
|
import android.support.customtabs.CustomTabsIntent;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
@ -14,6 +17,8 @@ import butterknife.OnClick;
|
||||||
import fr.free.nrw.commons.theme.NavigationBaseActivity;
|
import fr.free.nrw.commons.theme.NavigationBaseActivity;
|
||||||
import fr.free.nrw.commons.ui.widget.HtmlTextView;
|
import fr.free.nrw.commons.ui.widget.HtmlTextView;
|
||||||
|
|
||||||
|
import static android.widget.Toast.LENGTH_SHORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents about screen of this app
|
* Represents about screen of this app
|
||||||
*/
|
*/
|
||||||
|
|
@ -27,12 +32,12 @@ public class AboutActivity extends NavigationBaseActivity {
|
||||||
* @param savedInstanceState Data bundle
|
* @param savedInstanceState Data bundle
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressLint("StringFormatInvalid")
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_about);
|
setContentView(R.layout.activity_about);
|
||||||
|
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
String aboutText = getString(R.string.about_license);
|
String aboutText = getString(R.string.about_license);
|
||||||
aboutLicenseText.setHtmlText(aboutText);
|
aboutLicenseText.setHtmlText(aboutText);
|
||||||
|
|
||||||
|
|
@ -42,35 +47,66 @@ public class AboutActivity extends NavigationBaseActivity {
|
||||||
|
|
||||||
@OnClick(R.id.facebook_launch_icon)
|
@OnClick(R.id.facebook_launch_icon)
|
||||||
public void launchFacebook(View view) {
|
public void launchFacebook(View view) {
|
||||||
|
|
||||||
Intent intent;
|
Intent intent;
|
||||||
try {
|
try {
|
||||||
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/" + "1921335171459985"));
|
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/" + "1921335171459985"));
|
||||||
intent.setPackage("com.facebook.katana");
|
intent.setPackage("com.facebook.katana");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Utils.handleWebUrl(this,Uri.parse("https://www.facebook.com/" + "1921335171459985"));
|
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + "1921335171459985\\"));
|
||||||
|
if(intent.resolveActivity(this.getPackageManager()) != null){
|
||||||
|
Utils.handleWebUrl(this,Uri.parse("https://www.facebook.com/" + "1921335171459985"));
|
||||||
|
} else {
|
||||||
|
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.github_launch_icon)
|
@OnClick(R.id.github_launch_icon)
|
||||||
public void launchGithub(View view) {
|
public void launchGithub(View view) {
|
||||||
Utils.handleWebUrl(this,Uri.parse("https://commons-app.github.io/\\"));
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/commons-app/apps-android-commons\\"));
|
||||||
|
//check if web browser available
|
||||||
|
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
|
||||||
|
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons\\"));
|
||||||
|
} else {
|
||||||
|
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.website_launch_icon)
|
@OnClick(R.id.website_launch_icon)
|
||||||
public void launchWebsite(View view) {
|
public void launchWebsite(View view) {
|
||||||
Utils.handleWebUrl(this,Uri.parse("https://commons-app.github.io/\\"));
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://commons-app.github.io/\\"));
|
||||||
|
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
|
||||||
|
Utils.handleWebUrl(this,Uri.parse("https://commons-app.github.io/\\"));
|
||||||
|
} else {
|
||||||
|
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@OnClick(R.id.about_credits)
|
@OnClick(R.id.about_credits)
|
||||||
public void launchCredits(View view) {
|
public void launchCredits(View view) {
|
||||||
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/blob/master/CREDITS/\\"));
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/commons-app/apps-android-commons/blob/master/CREDITS/\\"));
|
||||||
|
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
|
||||||
|
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/blob/master/CREDITS/\\"));
|
||||||
|
} else {
|
||||||
|
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.about_privacy_policy)
|
@OnClick(R.id.about_privacy_policy)
|
||||||
public void launchPrivacyPolicy(View view) {
|
public void launchPrivacyPolicy(View view) {
|
||||||
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
|
||||||
|
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
|
||||||
|
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
|
||||||
|
} else {
|
||||||
|
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -37,6 +37,8 @@ import fr.free.nrw.commons.location.LatLng;
|
||||||
import fr.free.nrw.commons.ui.widget.CompatTextView;
|
import fr.free.nrw.commons.ui.widget.CompatTextView;
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
|
import static android.widget.Toast.LENGTH_SHORT;
|
||||||
|
|
||||||
public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
||||||
|
|
||||||
private boolean editable;
|
private boolean editable;
|
||||||
|
|
@ -305,7 +307,13 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
||||||
Intent viewIntent = new Intent();
|
Intent viewIntent = new Intent();
|
||||||
viewIntent.setAction(Intent.ACTION_VIEW);
|
viewIntent.setAction(Intent.ACTION_VIEW);
|
||||||
viewIntent.setData(new PageTitle(selectedCategoryTitle).getCanonicalUri());
|
viewIntent.setData(new PageTitle(selectedCategoryTitle).getCanonicalUri());
|
||||||
startActivity(viewIntent);
|
//check if web browser available
|
||||||
|
if(viewIntent.resolveActivity(getActivity().getPackageManager()) != null){
|
||||||
|
startActivity(viewIntent);
|
||||||
|
} else {
|
||||||
|
Toast toast = Toast.makeText(getContext(), getString(R.string.no_web_browser), LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
|
|
@ -385,7 +393,14 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
||||||
|
|
||||||
private void openWebBrowser(String url) {
|
private void openWebBrowser(String url) {
|
||||||
Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||||
startActivity(browser);
|
//check if web browser available
|
||||||
|
if (browser.resolveActivity(getActivity().getPackageManager()) != null) {
|
||||||
|
startActivity(browser);
|
||||||
|
} else {
|
||||||
|
Toast toast = Toast.makeText(getContext(), getString(R.string.no_web_browser), LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openMap(LatLng coordinates) {
|
private void openMap(LatLng coordinates) {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ 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.Toast;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
@ -40,6 +41,7 @@ import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
|
||||||
import static android.content.Context.DOWNLOAD_SERVICE;
|
import static android.content.Context.DOWNLOAD_SERVICE;
|
||||||
import static android.content.Intent.ACTION_VIEW;
|
import static android.content.Intent.ACTION_VIEW;
|
||||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||||
|
import static android.widget.Toast.LENGTH_SHORT;
|
||||||
|
|
||||||
public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment implements ViewPager.OnPageChangeListener {
|
public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment implements ViewPager.OnPageChangeListener {
|
||||||
|
|
||||||
|
|
@ -118,7 +120,14 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
||||||
Intent viewIntent = new Intent();
|
Intent viewIntent = new Intent();
|
||||||
viewIntent.setAction(ACTION_VIEW);
|
viewIntent.setAction(ACTION_VIEW);
|
||||||
viewIntent.setData(m.getFilePageTitle().getMobileUri());
|
viewIntent.setData(m.getFilePageTitle().getMobileUri());
|
||||||
startActivity(viewIntent);
|
//check if web browser available
|
||||||
|
if(viewIntent.resolveActivity(getActivity().getPackageManager()) != null){
|
||||||
|
startActivity(viewIntent);
|
||||||
|
} else {
|
||||||
|
Toast toast = Toast.makeText(getContext(), getString(R.string.no_web_browser), LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_download_current_image:
|
case R.id.menu_download_current_image:
|
||||||
// Download
|
// Download
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import android.os.Bundle;
|
||||||
import android.support.v7.widget.DividerItemDecoration;
|
import android.support.v7.widget.DividerItemDecoration;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.pedrogomez.renderers.RVRendererAdapter;
|
import com.pedrogomez.renderers.RVRendererAdapter;
|
||||||
|
|
||||||
|
|
@ -25,6 +26,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
|
import static android.widget.Toast.LENGTH_SHORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 18.12.2017.
|
* Created by root on 18.12.2017.
|
||||||
*/
|
*/
|
||||||
|
|
@ -71,7 +74,14 @@ public class NotificationActivity extends NavigationBaseActivity {
|
||||||
if (url == null || url.equals("")) {
|
if (url == null || url.equals("")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||||
|
//check if web browser available
|
||||||
|
if(browser.resolveActivity(this.getPackageManager()) != null){
|
||||||
|
startActivity(browser);
|
||||||
|
} else {
|
||||||
|
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAdapter(List<Notification> notificationList) {
|
private void setAdapter(List<Notification> notificationList) {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
@ -65,9 +66,6 @@ public class SingleUploadFragment extends CommonsDaggerSupportFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
inflater.inflate(R.menu.activity_share, menu);
|
inflater.inflate(R.menu.activity_share, menu);
|
||||||
if (titleEdit != null) {
|
|
||||||
menu.findItem(R.id.menu_upload_single).setEnabled(titleEdit.getText().length() != 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -76,6 +74,11 @@ public class SingleUploadFragment extends CommonsDaggerSupportFragment {
|
||||||
//What happens when the 'submit' icon is tapped
|
//What happens when the 'submit' icon is tapped
|
||||||
case R.id.menu_upload_single:
|
case R.id.menu_upload_single:
|
||||||
|
|
||||||
|
if (titleEdit.getText().toString().isEmpty()) {
|
||||||
|
Toast.makeText(getContext(), R.string.add_title_toast, Toast.LENGTH_LONG).show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
String title = titleEdit.getText().toString();
|
String title = titleEdit.getText().toString();
|
||||||
String desc = descEdit.getText().toString();
|
String desc = descEdit.getText().toString();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
<item android:id="@+id/menu_upload_single"
|
<item android:id="@+id/menu_upload_single"
|
||||||
android:title="@string/menu_upload_single"
|
android:title="@string/menu_upload_single"
|
||||||
android:icon="@drawable/ic_send_white_24dp"
|
android:icon="@drawable/ic_send_white_24dp"
|
||||||
android:enabled="false"
|
android:enabled="true"
|
||||||
app:showAsAction="always" />
|
app:showAsAction="always" />
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
<string name="menu_share">Share</string>
|
<string name="menu_share">Share</string>
|
||||||
<string name="menu_open_in_browser">View in Browser</string>
|
<string name="menu_open_in_browser">View in Browser</string>
|
||||||
<string name="share_title_hint">Title</string>
|
<string name="share_title_hint">Title</string>
|
||||||
|
<string name="add_title_toast">Please give a Title to proceed</string>
|
||||||
<string name="share_description_hint">Description</string>
|
<string name="share_description_hint">Description</string>
|
||||||
<string name="login_failed_network">Unable to login - network failure</string>
|
<string name="login_failed_network">Unable to login - network failure</string>
|
||||||
<string name="login_failed_username">Unable to login - please check your username</string>
|
<string name="login_failed_username">Unable to login - please check your username</string>
|
||||||
|
|
@ -224,6 +225,7 @@
|
||||||
<string name="login_to_your_account">Login to your account</string>
|
<string name="login_to_your_account">Login to your account</string>
|
||||||
<string name="send_log_file">Send log file</string>
|
<string name="send_log_file">Send log file</string>
|
||||||
<string name="send_log_file_description">Send log file to developers via email</string>
|
<string name="send_log_file_description">Send log file to developers via email</string>
|
||||||
|
<string name="no_web_browser">No web browser found to open URL</string>
|
||||||
<string name="null_url">Error! URL not found</string>
|
<string name="null_url">Error! URL not found</string>
|
||||||
|
|
||||||
<string name="nearby_location_has_not_changed">Location has not changed.</string>
|
<string name="nearby_location_has_not_changed">Location has not changed.</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue