Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-01-13 15:10:09 +01:00
commit b48f06c6fc
4 changed files with 125 additions and 42 deletions

View file

@ -11,62 +11,113 @@
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:columnCount="2"
android:background="?attr/bg_color">
android:paddingLeft="16dp">
<TextView
android:layout_height="48dp"
android:layout_columnSpan="2"
android:text="@string/select_month_and_country"/>
android:layout_marginRight="16dp"
android:gravity="center_vertical"
android:text="@string/select_month_and_country"
android:textColor="?android:textColorPrimary"/>
<View
android:layout_columnSpan="2"
android:layout_height="1dp"
android:layout_columnSpan="2"
android:background="?attr/dashboard_divider"/>
<ImageView
android:id="@+id/calendarImageView"
android:layout_height="60dp"
android:src="@drawable/ic_action_data"/>
<!-- 24 is magic number + margin 16 = 42-->
<Spinner
android:id="@+id/montReportsSpinner"
android:layout_gravity="fill_horizontal"/>
android:layout_gravity="fill_horizontal|fill_vertical"
android:layout_marginLeft="8dp"
android:layout_marginRight="42dp"
android:gravity="center_vertical"/>
<View
android:layout_height="1dp"
android:layout_column="1"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<ImageView
android:id="@+id/regionIconImageView"
android:src="@drawable/ic_world_globe_dark"
android:layout_rowSpan="2"/>
<TextView
android:text="Report for:"/>
<Spinner
android:id="@+id/regionReportsSpinner"
android:layout_gravity="fill_horizontal"/>
<View
android:layout_columnSpan="2"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<ImageView
android:id="@+id/numberOfContributorsIcon"
android:src="@drawable/ic_group"
android:layout_rowSpan="2"/>
<TextView
android:text="Number of contributors"/>
<TextView
android:id="@+id/contributorsTextView"
android:text="65"/>
<View
android:layout_column="1"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<ImageView
android:id="@+id/regionIconImageView"
android:layout_height="60dp"
android:src="@drawable/ic_world_globe_dark"/>
<Spinner
android:id="@+id/regionReportsSpinner"
android:layout_gravity="fill_horizontal|fill_vertical"
android:layout_marginLeft="8dp"
android:layout_marginRight="42dp"
android:gravity="center_vertical"/>
<View
android:layout_height="1dp"
android:layout_columnSpan="2"
android:background="?attr/dashboard_divider"/>
<ImageView
android:id="@+id/numberOfContributorsIcon"
android:layout_height="60dp"
android:src="@drawable/ic_group"/>
<LinearLayout
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/number_of_contributors"
android:textSize="@dimen/default_sub_text_size"/>
<TextView
android:id="@+id/contributorsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:textColorPrimary"
tools:text="65"/>
</LinearLayout>
<View
android:layout_height="1dp"
android:layout_column="1"
android:background="?attr/dashboard_divider"/>
<ImageView
android:id="@+id/numberOfEditsIcon"
android:src="@drawable/ic_group"
android:layout_rowSpan="2"/>
<TextView
android:text="Number of edits"/>
<TextView
android:id="@+id/editsTextView"
android:text="1125"/>
android:layout_height="60dp"
android:src="@drawable/ic_group"/>
<LinearLayout
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/number_of_edits"
android:textSize="@dimen/default_sub_text_size"/>
<TextView
android:id="@+id/editsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:textColorPrimary"
tools:text="1125"/>
</LinearLayout>
</GridLayout>
<include layout="@layout/shadow_bottom"/>

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:paddingRight="0dp"
style="?android:attr/spinnerItemStyle">
<TextView
android:text="@string/reports_for"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/default_sub_text_size"/>
<TextView
android:textColor="?android:textColorPrimary"
android:id="@android:id/text1"
android:layout_gravity="fill_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Worldwide"/>
</LinearLayout>

View file

@ -2155,4 +2155,7 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="morning">Morning</string>
<string name="Night">Night</string>
<string name="select_month_and_country">Select month and country</string>
<string name="number_of_contributors">Number of contributors</string>
<string name="number_of_edits">Number of edits</string>
<string name="reports_for">Report for:</string>
</resources>

View file

@ -51,8 +51,8 @@ public class ReportsFragment extends BaseOsmAndFragment {
regionReportsSpinner = (Spinner) view.findViewById(R.id.regionReportsSpinner);
ArrayAdapter<String> regionsForReportsAdapter =
new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item,
new String[]{"Worldwide"});
new ArrayAdapter<String>(getActivity(), R.layout.reports_for_spinner_item,
android.R.id.text1, new String[]{"Worldwide"});
regionsForReportsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
regionReportsSpinner.setAdapter(regionsForReportsAdapter);
@ -90,8 +90,12 @@ public class ReportsFragment extends BaseOsmAndFragment {
new GetJsonAsyncTask.OnResponseListener<Protocol.TotalChangesByMonthResponse>() {
@Override
public void onResponse(Protocol.TotalChangesByMonthResponse response) {
contributorsTextView.setText(String.valueOf(response.users));
editsTextView.setText(String.valueOf(response.changes));
if (contributorsTextView != null) {
contributorsTextView.setText(String.valueOf(response.users));
}
if (editsTextView != null) {
editsTextView.setText(String.valueOf(response.changes));
}
}
};
requestData(monthUrlString, regionUrlString, onResponseListener);