mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Merge pull request #1051 from neslihanturan/developUIFeaturedImages
Develop ui featured images
This commit is contained in:
commit
13e57286d5
18 changed files with 509 additions and 5 deletions
|
|
@ -91,6 +91,10 @@
|
||||||
android:name=".notification.NotificationActivity"
|
android:name=".notification.NotificationActivity"
|
||||||
android:label="@string/navigation_item_notification" />
|
android:label="@string/navigation_item_notification" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".featured.FeaturedImagesActivity"
|
||||||
|
android:label="@string/title_activity_featured_images" />
|
||||||
|
|
||||||
<service android:name=".upload.UploadService" />
|
<service android:name=".upload.UploadService" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import fr.free.nrw.commons.WelcomeActivity;
|
||||||
import fr.free.nrw.commons.auth.LoginActivity;
|
import fr.free.nrw.commons.auth.LoginActivity;
|
||||||
import fr.free.nrw.commons.auth.SignupActivity;
|
import fr.free.nrw.commons.auth.SignupActivity;
|
||||||
import fr.free.nrw.commons.contributions.ContributionsActivity;
|
import fr.free.nrw.commons.contributions.ContributionsActivity;
|
||||||
|
import fr.free.nrw.commons.featured.FeaturedImagesActivity;
|
||||||
import fr.free.nrw.commons.nearby.NearbyActivity;
|
import fr.free.nrw.commons.nearby.NearbyActivity;
|
||||||
import fr.free.nrw.commons.notification.NotificationActivity;
|
import fr.free.nrw.commons.notification.NotificationActivity;
|
||||||
import fr.free.nrw.commons.settings.SettingsActivity;
|
import fr.free.nrw.commons.settings.SettingsActivity;
|
||||||
|
|
@ -46,4 +47,7 @@ public abstract class ActivityBuilderModule {
|
||||||
|
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
abstract NotificationActivity bindNotificationActivity();
|
abstract NotificationActivity bindNotificationActivity();
|
||||||
|
|
||||||
|
@ContributesAndroidInjector
|
||||||
|
abstract FeaturedImagesActivity bindFeaturedImagesActivity();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import dagger.Module;
|
||||||
import dagger.android.ContributesAndroidInjector;
|
import dagger.android.ContributesAndroidInjector;
|
||||||
import fr.free.nrw.commons.category.CategorizationFragment;
|
import fr.free.nrw.commons.category.CategorizationFragment;
|
||||||
import fr.free.nrw.commons.contributions.ContributionsListFragment;
|
import fr.free.nrw.commons.contributions.ContributionsListFragment;
|
||||||
|
import fr.free.nrw.commons.featured.FeaturedImagesListFragment;
|
||||||
import fr.free.nrw.commons.media.MediaDetailFragment;
|
import fr.free.nrw.commons.media.MediaDetailFragment;
|
||||||
import fr.free.nrw.commons.media.MediaDetailPagerFragment;
|
import fr.free.nrw.commons.media.MediaDetailPagerFragment;
|
||||||
import fr.free.nrw.commons.nearby.NearbyListFragment;
|
import fr.free.nrw.commons.nearby.NearbyListFragment;
|
||||||
|
|
@ -43,4 +44,7 @@ public abstract class FragmentBuilderModule {
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
abstract SingleUploadFragment bindSingleUploadFragment();
|
abstract SingleUploadFragment bindSingleUploadFragment();
|
||||||
|
|
||||||
|
@ContributesAndroidInjector
|
||||||
|
abstract FeaturedImagesListFragment bindFeaturedImagesListFragment();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package fr.free.nrw.commons.featured;
|
||||||
|
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.Media;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object to hold FeaturedImage
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class FeaturedImage {
|
||||||
|
private Media image;
|
||||||
|
private String author;
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
public FeaturedImage(Media image, String author, String fileName) {
|
||||||
|
this.image = image;
|
||||||
|
this.author = author;
|
||||||
|
this.fileName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Media getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImage(Media image) {
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAuthor() {
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthor(String author) {
|
||||||
|
this.author = author;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileName() {
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileName(String fileName) {
|
||||||
|
this.fileName = fileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
package fr.free.nrw.commons.featured;
|
||||||
|
|
||||||
|
import android.database.DataSetObserver;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import fr.free.nrw.commons.Media;
|
||||||
|
import fr.free.nrw.commons.R;
|
||||||
|
import fr.free.nrw.commons.auth.AuthenticatedActivity;
|
||||||
|
import fr.free.nrw.commons.media.MediaDetailPagerFragment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This activity displays pic of the days of last xx days
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class FeaturedImagesActivity
|
||||||
|
extends AuthenticatedActivity
|
||||||
|
implements FragmentManager.OnBackStackChangedListener,
|
||||||
|
MediaDetailPagerFragment.MediaDetailProvider,
|
||||||
|
AdapterView.OnItemClickListener{
|
||||||
|
|
||||||
|
private FeaturedImagesListFragment featuredImagesListFragment;
|
||||||
|
private MediaDetailPagerFragment mediaDetails;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAuthCookieAcquired(String authCookie) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAuthFailure() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_featured_images);
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
|
// Activity can call methods in the fragment by acquiring a
|
||||||
|
// reference to the Fragment from FragmentManager, using findFragmentById()
|
||||||
|
FragmentManager supportFragmentManager = getSupportFragmentManager();
|
||||||
|
featuredImagesListFragment = (FeaturedImagesListFragment)supportFragmentManager
|
||||||
|
.findFragmentById(R.id.featuedListFragment);
|
||||||
|
|
||||||
|
supportFragmentManager.addOnBackStackChangedListener(this);
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
mediaDetails = (MediaDetailPagerFragment)supportFragmentManager
|
||||||
|
.findFragmentById(R.id.featuredFragmentContainer);
|
||||||
|
|
||||||
|
}
|
||||||
|
requestAuthToken();
|
||||||
|
initDrawer();
|
||||||
|
setTitle(getString(R.string.title_activity_featured_images));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackStackChanged() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||||
|
if (mediaDetails == null || !mediaDetails.isVisible()) {
|
||||||
|
// set isFeaturedImage true for featured images, to include author field on media detail
|
||||||
|
mediaDetails = new MediaDetailPagerFragment(false, true);
|
||||||
|
FragmentManager supportFragmentManager = getSupportFragmentManager();
|
||||||
|
supportFragmentManager
|
||||||
|
.beginTransaction()
|
||||||
|
.replace(R.id.featuredFragmentContainer, mediaDetails)
|
||||||
|
.addToBackStack(null)
|
||||||
|
.commit();
|
||||||
|
supportFragmentManager.executePendingTransactions();
|
||||||
|
}
|
||||||
|
mediaDetails.showImage(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Media getMediaAtPosition(int i) {
|
||||||
|
if (featuredImagesListFragment.getAdapter() == null) {
|
||||||
|
// not yet ready to return data
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return ((FeaturedImage)featuredImagesListFragment.getAdapter().getItem(i)).getImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTotalMediaCount() {
|
||||||
|
if (featuredImagesListFragment.getAdapter() == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return featuredImagesListFragment.getAdapter().getCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyDatasetChanged() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerDataSetObserver(DataSetObserver observer) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unregisterDataSetObserver(DataSetObserver observer) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
package fr.free.nrw.commons.featured;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.GridView;
|
||||||
|
import android.widget.ListAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import dagger.android.support.DaggerFragment;
|
||||||
|
import fr.free.nrw.commons.Media;
|
||||||
|
import fr.free.nrw.commons.R;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by root on 09.01.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class FeaturedImagesListFragment extends DaggerFragment {
|
||||||
|
private GridView gridView;
|
||||||
|
private MockGridViewAdapter gridAdapter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View v = inflater.inflate(R.layout.fragment_featured_images, container, false);
|
||||||
|
ButterKnife.bind(this, v);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
gridView = getView().findViewById(R.id.featuredImagesList);
|
||||||
|
gridView.setOnItemClickListener((AdapterView.OnItemClickListener) getActivity());
|
||||||
|
gridAdapter = new MockGridViewAdapter(this.getContext(), R.layout.layout_featured_images, getMockFeaturedImages());
|
||||||
|
gridView.setAdapter(gridAdapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<FeaturedImage> getMockFeaturedImages(){
|
||||||
|
ArrayList<FeaturedImage> featuredImages = new ArrayList<>();
|
||||||
|
for (int i=0; i<10; i++){
|
||||||
|
featuredImages.add(new FeaturedImage(new Media("test.jpg"), "username: test", "test file name"));
|
||||||
|
}
|
||||||
|
return featuredImages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListAdapter getAdapter() {
|
||||||
|
return gridView.getAdapter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package fr.free.nrw.commons.featured;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.MediaWikiImageView;
|
||||||
|
import fr.free.nrw.commons.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is created to only display UI implementation. Needs to be changed in real implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class MockGridViewAdapter extends ArrayAdapter {
|
||||||
|
private Context context;
|
||||||
|
private int layoutResourceId;
|
||||||
|
private ArrayList<FeaturedImage> data = new ArrayList();
|
||||||
|
|
||||||
|
public MockGridViewAdapter(Context context, int layoutResourceId, ArrayList<FeaturedImage> data) {
|
||||||
|
super(context, layoutResourceId, data);
|
||||||
|
this.layoutResourceId = layoutResourceId;
|
||||||
|
this.context = context;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
|
||||||
|
if (convertView == null) {
|
||||||
|
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
|
||||||
|
convertView = inflater.inflate(R.layout.layout_featured_images, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
FeaturedImage item = data.get(position);
|
||||||
|
MediaWikiImageView imageView = convertView.findViewById(R.id.featuredImageView);
|
||||||
|
TextView fileName = convertView.findViewById(R.id.featuredImageTitle);
|
||||||
|
TextView author = convertView.findViewById(R.id.featuredImageAuthor);
|
||||||
|
fileName.setText("Test file name");
|
||||||
|
author.setText("Uploaded by: Test user name");
|
||||||
|
imageView.setMedia(item.getImage());
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -40,14 +40,16 @@ import timber.log.Timber;
|
||||||
public class MediaDetailFragment extends DaggerFragment {
|
public class MediaDetailFragment extends DaggerFragment {
|
||||||
|
|
||||||
private boolean editable;
|
private boolean editable;
|
||||||
|
private boolean isFeaturedMedia;
|
||||||
private MediaDetailPagerFragment.MediaDetailProvider detailProvider;
|
private MediaDetailPagerFragment.MediaDetailProvider detailProvider;
|
||||||
private int index;
|
private int index;
|
||||||
|
|
||||||
public static MediaDetailFragment forMedia(int index, boolean editable) {
|
public static MediaDetailFragment forMedia(int index, boolean editable, boolean isFeaturedMedia) {
|
||||||
MediaDetailFragment mf = new MediaDetailFragment();
|
MediaDetailFragment mf = new MediaDetailFragment();
|
||||||
|
|
||||||
Bundle state = new Bundle();
|
Bundle state = new Bundle();
|
||||||
state.putBoolean("editable", editable);
|
state.putBoolean("editable", editable);
|
||||||
|
state.putBoolean("isFeaturedMedia", isFeaturedMedia);
|
||||||
state.putInt("index", index);
|
state.putInt("index", index);
|
||||||
state.putInt("listIndex", 0);
|
state.putInt("listIndex", 0);
|
||||||
state.putInt("listTop", 0);
|
state.putInt("listTop", 0);
|
||||||
|
|
@ -66,10 +68,12 @@ public class MediaDetailFragment extends DaggerFragment {
|
||||||
|
|
||||||
private TextView title;
|
private TextView title;
|
||||||
private TextView desc;
|
private TextView desc;
|
||||||
|
private TextView author;
|
||||||
private TextView license;
|
private TextView license;
|
||||||
private TextView coordinates;
|
private TextView coordinates;
|
||||||
private TextView uploadedDate;
|
private TextView uploadedDate;
|
||||||
private LinearLayout categoryContainer;
|
private LinearLayout categoryContainer;
|
||||||
|
private LinearLayout authorLayout;
|
||||||
private ScrollView scrollView;
|
private ScrollView scrollView;
|
||||||
private ArrayList<String> categoryNames;
|
private ArrayList<String> categoryNames;
|
||||||
private boolean categoriesLoaded = false;
|
private boolean categoriesLoaded = false;
|
||||||
|
|
@ -85,6 +89,7 @@ public class MediaDetailFragment extends DaggerFragment {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
outState.putInt("index", index);
|
outState.putInt("index", index);
|
||||||
outState.putBoolean("editable", editable);
|
outState.putBoolean("editable", editable);
|
||||||
|
outState.putBoolean("isFeaturedMedia", isFeaturedMedia);
|
||||||
|
|
||||||
getScrollPosition();
|
getScrollPosition();
|
||||||
outState.putInt("listTop", initialListTop);
|
outState.putInt("listTop", initialListTop);
|
||||||
|
|
@ -100,13 +105,16 @@ public class MediaDetailFragment extends DaggerFragment {
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
editable = savedInstanceState.getBoolean("editable");
|
editable = savedInstanceState.getBoolean("editable");
|
||||||
|
isFeaturedMedia = savedInstanceState.getBoolean("isFeaturedMedia");
|
||||||
index = savedInstanceState.getInt("index");
|
index = savedInstanceState.getInt("index");
|
||||||
initialListTop = savedInstanceState.getInt("listTop");
|
initialListTop = savedInstanceState.getInt("listTop");
|
||||||
} else {
|
} else {
|
||||||
editable = getArguments().getBoolean("editable");
|
editable = getArguments().getBoolean("editable");
|
||||||
|
isFeaturedMedia = getArguments().getBoolean("isFeaturedMedia");
|
||||||
index = getArguments().getInt("index");
|
index = getArguments().getInt("index");
|
||||||
initialListTop = 0;
|
initialListTop = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
categoryNames = new ArrayList<>();
|
categoryNames = new ArrayList<>();
|
||||||
categoryNames.add(getString(R.string.detail_panel_cats_loading));
|
categoryNames.add(getString(R.string.detail_panel_cats_loading));
|
||||||
|
|
||||||
|
|
@ -119,10 +127,18 @@ public class MediaDetailFragment extends DaggerFragment {
|
||||||
spacer = (MediaDetailSpacer) view.findViewById(R.id.mediaDetailSpacer);
|
spacer = (MediaDetailSpacer) view.findViewById(R.id.mediaDetailSpacer);
|
||||||
title = (TextView) view.findViewById(R.id.mediaDetailTitle);
|
title = (TextView) view.findViewById(R.id.mediaDetailTitle);
|
||||||
desc = (TextView) view.findViewById(R.id.mediaDetailDesc);
|
desc = (TextView) view.findViewById(R.id.mediaDetailDesc);
|
||||||
|
author = (TextView) view.findViewById(R.id.mediaDetailAuthor);
|
||||||
license = (TextView) view.findViewById(R.id.mediaDetailLicense);
|
license = (TextView) view.findViewById(R.id.mediaDetailLicense);
|
||||||
coordinates = (TextView) view.findViewById(R.id.mediaDetailCoordinates);
|
coordinates = (TextView) view.findViewById(R.id.mediaDetailCoordinates);
|
||||||
uploadedDate = (TextView) view.findViewById(R.id.mediaDetailuploadeddate);
|
uploadedDate = (TextView) view.findViewById(R.id.mediaDetailuploadeddate);
|
||||||
categoryContainer = (LinearLayout) view.findViewById(R.id.mediaDetailCategoryContainer);
|
categoryContainer = (LinearLayout) view.findViewById(R.id.mediaDetailCategoryContainer);
|
||||||
|
authorLayout = (LinearLayout) view.findViewById(R.id.authorLinearLayout);
|
||||||
|
|
||||||
|
if (isFeaturedMedia){
|
||||||
|
authorLayout.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
authorLayout.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
licenseList = new LicenseList(getActivity());
|
licenseList = new LicenseList(getActivity());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,14 +49,16 @@ public class MediaDetailPagerFragment extends DaggerFragment implements ViewPage
|
||||||
|
|
||||||
private ViewPager pager;
|
private ViewPager pager;
|
||||||
private Boolean editable;
|
private Boolean editable;
|
||||||
|
private boolean isFeaturedImage;
|
||||||
|
|
||||||
public MediaDetailPagerFragment() {
|
public MediaDetailPagerFragment() {
|
||||||
this(false);
|
this(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("ValidFragment")
|
@SuppressLint("ValidFragment")
|
||||||
public MediaDetailPagerFragment(Boolean editable) {
|
public MediaDetailPagerFragment(Boolean editable, boolean isFeaturedImage) {
|
||||||
this.editable = editable;
|
this.editable = editable;
|
||||||
|
this.isFeaturedImage = isFeaturedImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -90,6 +92,7 @@ public class MediaDetailPagerFragment extends DaggerFragment implements ViewPage
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
outState.putInt("current-page", pager.getCurrentItem());
|
outState.putInt("current-page", pager.getCurrentItem());
|
||||||
outState.putBoolean("editable", editable);
|
outState.putBoolean("editable", editable);
|
||||||
|
outState.putBoolean("isFeaturedImage", isFeaturedImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -97,6 +100,7 @@ public class MediaDetailPagerFragment extends DaggerFragment implements ViewPage
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
editable = savedInstanceState.getBoolean("editable");
|
editable = savedInstanceState.getBoolean("editable");
|
||||||
|
isFeaturedImage = savedInstanceState.getBoolean("isFeaturedImage");
|
||||||
}
|
}
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
}
|
}
|
||||||
|
|
@ -272,7 +276,7 @@ public class MediaDetailPagerFragment extends DaggerFragment implements ViewPage
|
||||||
// See bug https://code.google.com/p/android/issues/detail?id=27526
|
// See bug https://code.google.com/p/android/issues/detail?id=27526
|
||||||
pager.postDelayed(() -> getActivity().supportInvalidateOptionsMenu(), 5);
|
pager.postDelayed(() -> getActivity().supportInvalidateOptionsMenu(), 5);
|
||||||
}
|
}
|
||||||
return MediaDetailFragment.forMedia(i, editable);
|
return MediaDetailFragment.forMedia(i, editable, isFeaturedImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import fr.free.nrw.commons.WelcomeActivity;
|
||||||
import fr.free.nrw.commons.auth.AccountUtil;
|
import fr.free.nrw.commons.auth.AccountUtil;
|
||||||
import fr.free.nrw.commons.auth.LoginActivity;
|
import fr.free.nrw.commons.auth.LoginActivity;
|
||||||
import fr.free.nrw.commons.contributions.ContributionsActivity;
|
import fr.free.nrw.commons.contributions.ContributionsActivity;
|
||||||
|
import fr.free.nrw.commons.featured.FeaturedImagesActivity;
|
||||||
import fr.free.nrw.commons.nearby.NearbyActivity;
|
import fr.free.nrw.commons.nearby.NearbyActivity;
|
||||||
import fr.free.nrw.commons.notification.NotificationActivity;
|
import fr.free.nrw.commons.notification.NotificationActivity;
|
||||||
import fr.free.nrw.commons.settings.SettingsActivity;
|
import fr.free.nrw.commons.settings.SettingsActivity;
|
||||||
|
|
@ -148,6 +149,10 @@ public abstract class NavigationBaseActivity extends BaseActivity
|
||||||
drawerLayout.closeDrawer(navigationView);
|
drawerLayout.closeDrawer(navigationView);
|
||||||
startActivityWithFlags(this, NotificationActivity.class, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
startActivityWithFlags(this, NotificationActivity.class, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.action_featured_images:
|
||||||
|
drawerLayout.closeDrawer(navigationView);
|
||||||
|
startActivityWithFlags(this, FeaturedImagesActivity.class, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
Timber.e("Unknown option [%s] selected from the navigation menu", itemId);
|
Timber.e("Unknown option [%s] selected from the navigation menu", itemId);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ public class MultipleShareActivity extends AuthenticatedActivity
|
||||||
|
|
||||||
private void showDetail(int i) {
|
private void showDetail(int i) {
|
||||||
if (mediaDetails == null || !mediaDetails.isVisible()) {
|
if (mediaDetails == null || !mediaDetails.isVisible()) {
|
||||||
mediaDetails = new MediaDetailPagerFragment(true);
|
mediaDetails = new MediaDetailPagerFragment(true, false);
|
||||||
getSupportFragmentManager()
|
getSupportFragmentManager()
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(R.id.uploadsFragmentContainer, mediaDetails)
|
.replace(R.id.uploadsFragmentContainer, mediaDetails)
|
||||||
|
|
|
||||||
9
app/src/main/res/drawable/ic_star_black_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_star_black_24dp.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z"/>
|
||||||
|
</vector>
|
||||||
44
app/src/main/res/layout/activity_featured_images.xml
Normal file
44
app/src/main/res/layout/activity_featured_images.xml
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<include
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
layout="@layout/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/featuredFragmentContainer"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_below="@id/toolbar">
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/featuedListFragment"
|
||||||
|
android:name="fr.free.nrw.commons.featured.FeaturedImagesListFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:layout="@layout/fragment_contributions" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<android.support.design.widget.NavigationView
|
||||||
|
android:id="@+id/navigation_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
app:headerLayout="@layout/drawer_header"
|
||||||
|
app:menu="@menu/drawer"/>
|
||||||
|
|
||||||
|
</android.support.v4.widget.DrawerLayout>
|
||||||
40
app/src/main/res/layout/fragment_featured_images.xml
Normal file
40
app/src/main/res/layout/fragment_featured_images.xml
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/mainBackground"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/waiting_first_sync"
|
||||||
|
android:id="@+id/waitingMessage"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/loadingFeaturedImagesProgressBar"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<GridView
|
||||||
|
android:id="@+id/featuredImagesList"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:stretchMode="columnWidth"
|
||||||
|
android:columnWidth="240dp"
|
||||||
|
android:numColumns="auto_fit"
|
||||||
|
android:listSelector="@null"
|
||||||
|
android:fadingEdge="none"
|
||||||
|
android:fastScrollEnabled="true"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
@ -80,6 +80,39 @@
|
||||||
android:textSize="@dimen/description_text_size" />
|
android:textSize="@dimen/description_text_size" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<fr.free.nrw.commons.media.MediaDetailSpacer
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/small_gap" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/authorLinearLayout"
|
||||||
|
android:background="?attr/subBackground"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="@dimen/standard_gap">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="@dimen/tiny_gap"
|
||||||
|
android:text="@string/media_detail_author"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="@dimen/normal_text"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/mediaDetailAuthor"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:background="?attr/subBackground"
|
||||||
|
android:padding="@dimen/small_gap"
|
||||||
|
android:text="@string/media_detail_author_explanation"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="@dimen/description_text_size" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<fr.free.nrw.commons.media.MediaDetailSpacer
|
<fr.free.nrw.commons.media.MediaDetailSpacer
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/small_gap" />
|
android:layout_height="@dimen/small_gap" />
|
||||||
|
|
|
||||||
66
app/src/main/res/layout/layout_featured_images.xml
Normal file
66
app/src/main/res/layout/layout_featured_images.xml
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="2dp"
|
||||||
|
android:paddingBottom="0dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/featuredImagesSequenceNumber"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="98sp"
|
||||||
|
android:textColor="#33FFFFFF"
|
||||||
|
android:typeface="serif"
|
||||||
|
android:layout_gravity="end|bottom"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<fr.free.nrw.commons.MediaWikiImageView
|
||||||
|
android:id="@+id/featuredImageView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="240dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center|bottom"
|
||||||
|
android:background="#AA000000"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="@dimen/small_gap"
|
||||||
|
>
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/featuredProgress"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/ProgressBar"
|
||||||
|
android:indeterminateOnly="false"
|
||||||
|
android:max="100"
|
||||||
|
android:visibility="gone"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/featuredImageTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="#FFFFFFFF"
|
||||||
|
style="?android:textAppearanceLarge"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/featuredImageAuthor"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="#FFFFFFFF"
|
||||||
|
style="?android:textAppearanceMedium"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
@ -40,4 +40,10 @@
|
||||||
android:icon="@drawable/ic_notifications_black_24dp"
|
android:icon="@drawable/ic_notifications_black_24dp"
|
||||||
android:title="@string/navigation_item_notification"/>
|
android:title="@string/navigation_item_notification"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_featured_images"
|
||||||
|
android:icon="@drawable/ic_star_black_24dp"
|
||||||
|
android:title="@string/navigation_item_featured_images"/>
|
||||||
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@
|
||||||
<string name="categories_activity_title">Categories</string>
|
<string name="categories_activity_title">Categories</string>
|
||||||
<string name="title_activity_settings">Settings</string>
|
<string name="title_activity_settings">Settings</string>
|
||||||
<string name="title_activity_signup">Sign Up</string>
|
<string name="title_activity_signup">Sign Up</string>
|
||||||
|
<string name="title_activity_featured_images">Featured Images</string>
|
||||||
<string name="menu_about">About</string>
|
<string name="menu_about">About</string>
|
||||||
<string name="about_license">The Wikimedia Commons app is an open-source app created and maintained by grantees and volunteers of the Wikimedia community. The Wikimedia Foundation is not involved in the creation, development, or maintenance of the app. </string>
|
<string name="about_license">The Wikimedia Commons app is an open-source app created and maintained by grantees and volunteers of the Wikimedia community. The Wikimedia Foundation is not involved in the creation, development, or maintenance of the app. </string>
|
||||||
<string name="trademarked_name" translatable="false">Wikimedia Commons</string>
|
<string name="trademarked_name" translatable="false">Wikimedia Commons</string>
|
||||||
|
|
@ -150,6 +151,8 @@
|
||||||
<string name="media_detail_media_title">Title of the media</string>
|
<string name="media_detail_media_title">Title of the media</string>
|
||||||
<string name="media_detail_description">Description</string>
|
<string name="media_detail_description">Description</string>
|
||||||
<string name="media_detail_description_explanation">Description of the media goes here. This can potentially be fairly long, and will need to wrap across multiple lines. We hope it looks nice though.</string>
|
<string name="media_detail_description_explanation">Description of the media goes here. This can potentially be fairly long, and will need to wrap across multiple lines. We hope it looks nice though.</string>
|
||||||
|
<string name="media_detail_author">Author</string>
|
||||||
|
<string name="media_detail_author_explanation">Featured image author user name goes here.</string>
|
||||||
<string name="media_detail_uploaded_date">Uploaded date</string>
|
<string name="media_detail_uploaded_date">Uploaded date</string>
|
||||||
<string name="media_detail_license">License</string>
|
<string name="media_detail_license">License</string>
|
||||||
<string name="media_detail_coordinates">Coordinates</string>
|
<string name="media_detail_coordinates">Coordinates</string>
|
||||||
|
|
@ -195,6 +198,7 @@
|
||||||
<string name="navigation_item_logout">Logout</string>
|
<string name="navigation_item_logout">Logout</string>
|
||||||
<string name="navigation_item_info">Tutorial</string>
|
<string name="navigation_item_info">Tutorial</string>
|
||||||
<string name="navigation_item_notification">Notifications</string>
|
<string name="navigation_item_notification">Notifications</string>
|
||||||
|
<string name="navigation_item_featured_images">Featured</string>
|
||||||
<string name="nearby_needs_permissions">Nearby places cannot be displayed without location permissions</string>
|
<string name="nearby_needs_permissions">Nearby places cannot be displayed without location permissions</string>
|
||||||
<string name="no_description_found">no description found</string>
|
<string name="no_description_found">no description found</string>
|
||||||
<string name="nearby_info_menu_commons_article">Commons file page</string>
|
<string name="nearby_info_menu_commons_article">Commons file page</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue