Live updates: design fixes.
This commit is contained in:
parent
eb4048c6f6
commit
33d8725987
3 changed files with 115 additions and 41 deletions
|
@ -11,62 +11,108 @@
|
|||
<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:gravity="center_vertical"
|
||||
android:layout_marginRight="16dp"
|
||||
android:text="@string/select_month_and_country"/>
|
||||
|
||||
<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="Number of contributors"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contributorsTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android: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="Number of edits"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/editsTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1125"/>
|
||||
</LinearLayout>
|
||||
</GridLayout>
|
||||
|
||||
<include layout="@layout/shadow_bottom"/>
|
||||
|
|
24
OsmAnd/res/layout/reports_for_spinner_item.xml
Normal file
24
OsmAnd/res/layout/reports_for_spinner_item.xml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?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"
|
||||
android:background="@drawable/abc_spinner_mtrl_am_alpha"
|
||||
style="?android:attr/spinnerItemStyle">
|
||||
|
||||
<TextView
|
||||
android:text="Report for:"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/text1"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Worldwide"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue