mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
8e47f82de6
16 changed files with 326 additions and 52 deletions
|
|
@ -24,8 +24,8 @@ import fr.free.nrw.commons.LicenseList;
|
|||
import fr.free.nrw.commons.Media;
|
||||
import fr.free.nrw.commons.MediaDataExtractor;
|
||||
import fr.free.nrw.commons.MediaWikiImageView;
|
||||
import fr.free.nrw.commons.PageTitle;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.Utils;
|
||||
import timber.log.Timber;
|
||||
|
||||
public class MediaDetailFragment extends Fragment {
|
||||
|
|
@ -86,7 +86,7 @@ public class MediaDetailFragment extends Fragment {
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
detailProvider = (MediaDetailPagerFragment.MediaDetailProvider)getActivity();
|
||||
|
||||
if(savedInstanceState != null) {
|
||||
if (savedInstanceState != null) {
|
||||
editable = savedInstanceState.getBoolean("editable");
|
||||
index = savedInstanceState.getInt("index");
|
||||
initialListTop = savedInstanceState.getInt("listTop");
|
||||
|
|
@ -269,12 +269,11 @@ public class MediaDetailFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
private View buildCatLabel(String cat) {
|
||||
final String catName = cat;
|
||||
private View buildCatLabel(final String catName) {
|
||||
final View item = getLayoutInflater(null).inflate(R.layout.detail_category_item, null, false);
|
||||
final TextView textView = (TextView)item.findViewById(R.id.mediaDetailCategoryItemText);
|
||||
|
||||
textView.setText(cat);
|
||||
textView.setText(catName);
|
||||
if (categoriesLoaded && categoriesPresent) {
|
||||
textView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
@ -282,7 +281,7 @@ public class MediaDetailFragment extends Fragment {
|
|||
String selectedCategoryTitle = "Category:" + catName;
|
||||
Intent viewIntent = new Intent();
|
||||
viewIntent.setAction(Intent.ACTION_VIEW);
|
||||
viewIntent.setData(Utils.uriForWikiPage(selectedCategoryTitle));
|
||||
viewIntent.setData(new PageTitle(selectedCategoryTitle).getCanonicalUri());
|
||||
startActivity(viewIntent);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class MediaDetailPagerFragment extends Fragment implements ViewPager.OnPa
|
|||
|
||||
final MediaDetailAdapter adapter = new MediaDetailAdapter(getChildFragmentManager());
|
||||
|
||||
if(savedInstanceState != null) {
|
||||
if (savedInstanceState != null) {
|
||||
final int pageNumber = savedInstanceState.getInt("current-page");
|
||||
// Adapter doesn't seem to be loading immediately.
|
||||
// Dear God, please forgive us for our sins
|
||||
|
|
@ -143,7 +143,7 @@ public class MediaDetailPagerFragment extends Fragment implements ViewPager.OnPa
|
|||
// View in browser
|
||||
Intent viewIntent = new Intent();
|
||||
viewIntent.setAction(Intent.ACTION_VIEW);
|
||||
viewIntent.setData(Uri.parse(m.getMobileDescriptionUrl()));
|
||||
viewIntent.setData(m.getFilePageTitle().getMobileUri());
|
||||
startActivity(viewIntent);
|
||||
return true;
|
||||
case R.id.menu_download_current_image:
|
||||
|
|
@ -224,14 +224,15 @@ public class MediaDetailPagerFragment extends Fragment implements ViewPager.OnPa
|
|||
ShareActionProvider mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menu.findItem(R.id.menu_share_current_image));
|
||||
// On some phones null is returned for some reason:
|
||||
// https://github.com/commons-app/apps-android-commons/issues/413
|
||||
if(mShareActionProvider != null) {
|
||||
if (mShareActionProvider != null) {
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain");
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, m.getDisplayTitle() + " \n" + m.getDescriptionUrl());
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT,
|
||||
m.getDisplayTitle() + " \n" + m.getFilePageTitle().getCanonicalUri());
|
||||
mShareActionProvider.setShareIntent(shareIntent);
|
||||
}
|
||||
|
||||
if(m instanceof Contribution) {
|
||||
if (m instanceof Contribution) {
|
||||
Contribution c = (Contribution)m;
|
||||
switch(c.getState()) {
|
||||
case Contribution.STATE_FAILED:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue