mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Inifilate contributions list fragment view
This commit is contained in:
parent
7d8a44b75f
commit
d59a258b91
4 changed files with 121 additions and 36 deletions
|
|
@ -8,18 +8,24 @@ import android.content.Loader;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.DataSetObserver;
|
import android.database.DataSetObserver;
|
||||||
|
import android.graphics.PorterDuff;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.BuildConfig;
|
||||||
import fr.free.nrw.commons.Media;
|
import fr.free.nrw.commons.Media;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
|
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
|
||||||
|
|
@ -49,10 +55,25 @@ public class ContributionsFragment
|
||||||
@Inject
|
@Inject
|
||||||
NotificationController notificationController;
|
NotificationController notificationController;
|
||||||
|
|
||||||
|
public TextView numberOfUploads;
|
||||||
|
public ProgressBar numberOfUploadsProgressBar;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
return super.onCreateView(inflater, container, savedInstanceState);
|
View view = inflater.inflate(R.layout.fragment_contributions, container, false);
|
||||||
|
numberOfUploads = view.findViewById(R.id.numOfUploads);
|
||||||
|
|
||||||
|
numberOfUploadsProgressBar = view.findViewById(R.id.progressBar);
|
||||||
|
numberOfUploadsProgressBar.setVisibility(View.VISIBLE);
|
||||||
|
numberOfUploadsProgressBar.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(getActivity(), R.color.white), PorterDuff.Mode.SRC_IN );
|
||||||
|
|
||||||
|
|
||||||
|
if(!BuildConfig.FLAVOR.equalsIgnoreCase("beta")){
|
||||||
|
setUploadCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View v = inflater.inflate(R.layout.fragment_contributions, container, false);
|
View v = inflater.inflate(R.layout.fragment_contributions_list, container, false);
|
||||||
ButterKnife.bind(this, v);
|
ButterKnife.bind(this, v);
|
||||||
|
|
||||||
contributionsList.setOnItemClickListener((AdapterView.OnItemClickListener) getActivity());
|
contributionsList.setOnItemClickListener((AdapterView.OnItemClickListener) getActivity());
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,64 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/mainBackground"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
>
|
android:orientation="vertical">
|
||||||
|
<!--
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<fr.free.nrw.commons.contributions.CustomNotificationsCardView
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/card_view_notifications"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/waiting_first_sync"
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/waitingMessage"
|
app:cardBackgroundColor="?attr/mainCardBackround"
|
||||||
android:layout_gravity="center"
|
>
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
android:layout_gravity="center"
|
||||||
android:id="@+id/loadingContributionsProgressBar"
|
android:id="@+id/customNotificationsProgressBar"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<GridView
|
</fr.free.nrw.commons.contributions.CustomNotificationsCardView>
|
||||||
android:id="@+id/contributionsList"
|
</RelativeLayout>
|
||||||
android:layout_height="match_parent"
|
-->
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:stretchMode="columnWidth"
|
<RelativeLayout
|
||||||
android:columnWidth="240dp"
|
android:layout_width="wrap_content"
|
||||||
android:numColumns="auto_fit"
|
android:layout_height="wrap_content"
|
||||||
android:listSelector="@null"
|
android:layout_gravity="center_vertical"
|
||||||
android:fadingEdge="none"
|
>
|
||||||
android:fastScrollEnabled="true"
|
|
||||||
|
<ProgressBar
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_margin="15dp"
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/numOfUploads"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_margin="15dp"
|
||||||
|
style="@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="#000"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/root_frame">
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
39
app/src/main/res/layout/fragment_contributions_list.xml
Normal file
39
app/src/main/res/layout/fragment_contributions_list.xml
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?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:id="@+id/loadingContributionsProgressBar"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<GridView
|
||||||
|
android:id="@+id/contributionsList"
|
||||||
|
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>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue