Update reports
This commit is contained in:
parent
bfd98ab7a3
commit
487790e47a
7 changed files with 557 additions and 157 deletions
|
@ -27,27 +27,6 @@
|
||||||
<string name="hint_tag">Tag</string>
|
<string name="hint_tag">Tag</string>
|
||||||
<string name="hint_value">Value</string>
|
<string name="hint_value">Value</string>
|
||||||
<!-- DEVELOPMENT -->
|
<!-- DEVELOPMENT -->
|
||||||
<string name="osm_live_subscription">OSM Live subscription</string>
|
|
||||||
<string name="osm_live_subscribe_btn">Subscribe</string>
|
|
||||||
<string name="osm_live_default_price">€1,49</string>
|
<string name="osm_live_default_price">€1,49</string>
|
||||||
<string name="osm_live_email_desc">We need it to provide you information about contributions</string>
|
|
||||||
<string name="osm_live_user_public_name">Public Name</string>
|
|
||||||
<string name="osm_live_hide_user_name">Don\'t show my name in reports</string>
|
|
||||||
<string name="osm_live_support_region">Support region</string>
|
|
||||||
<string name="osm_live_month_cost">Month cost</string>
|
|
||||||
<string name="osm_live_month_cost_desc">Monthly payment</string>
|
|
||||||
<string name="osm_live_active">Active</string>
|
|
||||||
<string name="osm_live_not_active">Inactive</string>
|
|
||||||
<string name="osm_live_enter_email">Please enter valid E-mail address</string>
|
|
||||||
<string name="osm_live_enter_user_name">Please enter Public Name</string>
|
|
||||||
<string name="osm_live_thanks">Thank you for subscribing to live updates!</string>
|
|
||||||
<string name="osm_live_region_desc">Part your donation will be sent to OSM users who submit changes to the map in that region</string>
|
|
||||||
<string name="osm_live_subscription_settings">Subscription settings</string>
|
|
||||||
<string name="osm_live_ask_for_purchase">Please purchase OSM Live subscription first</string>
|
|
||||||
|
|
||||||
<string name="osm_live_header">This subscription enables hourly updates for all maps around the world.
|
|
||||||
Major part of the income goes back to OSM community and is paid out per each OSM contribution.
|
|
||||||
In case you love OsmAnd and OSM and want to support it, this is a perfect way to do it.</string>
|
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,87 +1,128 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context="net.osmand.plus.liveupdates.ReportsFragment">
|
tools:context="net.osmand.plus.liveupdates.ReportsFragment" >
|
||||||
|
|
||||||
<include layout="@layout/card_top_divider"/>
|
<include layout="@layout/card_top_divider" />
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<GridLayout
|
<GridLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/bg_color"
|
android:background="?attr/bg_color"
|
||||||
android:columnCount="2">
|
android:columnCount="2" >
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:layout_height="48dp"
|
|
||||||
android:layout_columnSpan="2"
|
android:layout_columnSpan="2"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
android:gravity="center_vertical"
|
android:minHeight="48dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
android:text="@string/select_month_and_country"
|
android:text="@string/select_month_and_country"
|
||||||
android:textColor="?android:textColorPrimary"/>
|
android:textColor="?android:textColorPrimary" />
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.ButtonEx
|
||||||
|
android:id="@+id/show_all"
|
||||||
|
style="@style/DashboardGeneralButton"
|
||||||
|
android:text="@string/shared_string_all"
|
||||||
|
osmand:textAllCapsCompat="true"
|
||||||
|
osmand:typeface="@string/font_roboto_medium" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_columnSpan="2"
|
android:layout_columnSpan="2"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/calendarImageView"
|
android:id="@+id/calendarImageView"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:src="@drawable/ic_action_data"/>
|
android:src="@drawable/ic_action_data" />
|
||||||
|
|
||||||
<!-- 40 is magic number + margin 16 = 56-->
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/montReportsSpinner"
|
android:id="@+id/montReportsSpinner"
|
||||||
android:layout_gravity="fill_horizontal|fill_vertical"
|
android:layout_gravity="fill_horizontal|fill_vertical"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="56dp"
|
android:layout_marginRight="56dp"
|
||||||
android:gravity="center_vertical"/>
|
android:gravity="center_vertical" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_column="1"
|
android:layout_column="1"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/regionIconImageView"
|
android:id="@+id/regionIconImageView"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:src="@drawable/ic_world_globe_dark"/>
|
android:src="@drawable/ic_world_globe_dark" />
|
||||||
|
|
||||||
<include
|
<LinearLayout
|
||||||
android:id="@+id/reportsButton"
|
android:id="@+id/reportsButton"
|
||||||
layout="@layout/reports_for_spinner_item"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="fill_vertical"
|
android:layout_gravity="fill_vertical"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="56dp"/>
|
android:background="?attr/expandable_list_item_background"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/reports_for"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_sub_text_size" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@android:id/text1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="fill_horizontal"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
tools:text="Worldwide" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_columnSpan="2"
|
android:layout_columnSpan="2"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progress"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="8dp"
|
||||||
|
android:layout_columnSpan="2" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/numberOfContributorsIcon"
|
android:id="@+id/numberOfContributorsIcon"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:src="@drawable/ic_group"/>
|
android:src="@drawable/ic_group" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_gravity="center_vertical"
|
android:id="@+id/numberOfContributorsLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="fill_vertical"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="16dp"
|
android:background="?attr/expandable_list_item_background"
|
||||||
android:orientation="vertical">
|
android:gravity="center"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/numberOfContributorsTitle"
|
android:id="@+id/numberOfContributorsTitle"
|
||||||
|
@ -89,32 +130,36 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/number_of_contributors"
|
android:text="@string/number_of_contributors"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_sub_text_size"/>
|
android:textSize="@dimen/default_sub_text_size" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/contributorsTextView"
|
android:id="@+id/contributorsTextView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="0"
|
android:text="0"
|
||||||
android:textColor="?android:textColorPrimary"/>
|
android:textColor="?android:textColorPrimary" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_column="1"
|
android:layout_column="1"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/numberOfEditsIcon"
|
android:id="@+id/numberOfEditsIcon"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:src="@drawable/ic_group"/>
|
android:src="@drawable/ic_world_globe_dark" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_gravity="center_vertical"
|
android:id="@+id/numberOfEditsLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="fill_vertical"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="16dp"
|
android:background="?attr/expandable_list_item_background"
|
||||||
android:orientation="vertical">
|
android:gravity="center"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/numberOfEditsTitle"
|
android:id="@+id/numberOfEditsTitle"
|
||||||
|
@ -122,29 +167,84 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/number_of_edits"
|
android:text="@string/number_of_edits"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_sub_text_size"/>
|
android:textSize="@dimen/default_sub_text_size" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/editsTextView"
|
android:id="@+id/editsTextView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="0"
|
android:text="0"
|
||||||
android:textColor="?android:textColorPrimary"/>
|
android:textColor="?android:textColorPrimary" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</GridLayout>
|
|
||||||
<!-- 48 + 1 + 60 + 1 + 60 = 170-->
|
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/progress"
|
|
||||||
style="?android:attr/progressBarStyleHorizontal"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="8dp"
|
|
||||||
android:layout_gravity="top"
|
|
||||||
android:layout_marginTop="167dp"
|
|
||||||
android:indeterminate="true"
|
|
||||||
android:padding="0dp"
|
|
||||||
tools:progress="50"/>
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<include layout="@layout/card_bottom_divider"/>
|
<ImageView
|
||||||
|
android:id="@+id/donationsIcon"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:src="@drawable/ic_action_message" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/donationsLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="fill_vertical"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/donationsTitle"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/donations"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_sub_text_size" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/donationsTextView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="-"
|
||||||
|
android:textColor="?android:textColorPrimary" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:background="?attr/dashboard_divider" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/numberOfRecipientsIcon"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:src="@drawable/ic_group" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/numberOfRecipientsLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="fill_vertical"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/numberOfRecipientsTitle"
|
||||||
|
android:text="@string/number_of_recipients"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_sub_text_size" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/recipientsTextView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="-"
|
||||||
|
android:textColor="?android:textColorPrimary" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<include layout="@layout/card_bottom_divider" />
|
||||||
|
</GridLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
56
OsmAnd/res/layout/fragment_simple_list.xml
Normal file
56
OsmAnd/res/layout/fragment_simple_list.xml
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:background="?attr/pstsTabBackground"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/closeButton"
|
||||||
|
style="@style/Widget.AppCompat.Button.Borderless"
|
||||||
|
android:layout_width="52dp"
|
||||||
|
android:layout_height="52dp"
|
||||||
|
android:src="@drawable/ic_action_mode_back"/>
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/titleTextView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:textColor="@color/color_white"
|
||||||
|
android:textSize="@dimen/default_list_text_size_large"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:typeface="@string/font_roboto_regular"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<ProgressBar
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/progress"
|
||||||
|
android:indeterminate="true"/>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@android:id/list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:divider="?attr/dashboard_divider"
|
||||||
|
android:dividerHeight="1dp"
|
||||||
|
android:drawSelectorOnTop="true"/>
|
||||||
|
|
||||||
|
<include layout="@layout/card_bottom_divider"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -9,6 +9,31 @@
|
||||||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||||
-->
|
-->
|
||||||
|
<string name="donations">Donations</string>
|
||||||
|
<string name="number_of_recipients">Number of recipients</string>
|
||||||
|
<string name="osm_user_stat">Changes %1$s, rank %2$s, total changes %3$s</string>
|
||||||
|
<string name="osm_editors_ranking">OSM Editors ranking</string>
|
||||||
|
<string name="osm_live_subscription">OSM Live subscription</string>
|
||||||
|
<string name="osm_live_subscribe_btn">Subscribe</string>
|
||||||
|
<string name="osm_live_email_desc">We need it to provide you information about contributions</string>
|
||||||
|
<string name="osm_live_user_public_name">Public Name</string>
|
||||||
|
<string name="osm_live_hide_user_name">Don\'t show my name in reports</string>
|
||||||
|
<string name="osm_live_support_region">Support region</string>
|
||||||
|
<string name="osm_live_month_cost">Month cost</string>
|
||||||
|
<string name="osm_live_month_cost_desc">Monthly payment</string>
|
||||||
|
<string name="osm_live_active">Active</string>
|
||||||
|
<string name="osm_live_not_active">Inactive</string>
|
||||||
|
<string name="osm_live_enter_email">Please enter valid E-mail address</string>
|
||||||
|
<string name="osm_live_enter_user_name">Please enter Public Name</string>
|
||||||
|
<string name="osm_live_thanks">Thank you for subscribing to live updates!</string>
|
||||||
|
<string name="osm_live_region_desc">Part your donation will be sent to OSM users who submit changes to the map in that region</string>
|
||||||
|
<string name="osm_live_subscription_settings">Subscription settings</string>
|
||||||
|
<string name="osm_live_ask_for_purchase">Please purchase OSM Live subscription first</string>
|
||||||
|
|
||||||
|
<string name="osm_live_header">This subscription enables hourly updates for all maps around the world.
|
||||||
|
Major part of the income goes back to OSM community and is paid out per each OSM contribution.
|
||||||
|
In case you love OsmAnd and OSM and want to support it, this is a perfect way to do it.</string>
|
||||||
|
|
||||||
<string name="select_map_marker">Select Map marker</string>
|
<string name="select_map_marker">Select Map marker</string>
|
||||||
<string name="map_markers_other">Other markers</string>
|
<string name="map_markers_other">Other markers</string>
|
||||||
<string name="upload_anonymously">Upload anonymously</string>
|
<string name="upload_anonymously">Upload anonymously</string>
|
||||||
|
|
|
@ -11,6 +11,28 @@ public final class Protocol {
|
||||||
public RankingByMonth[] rows;
|
public RankingByMonth[] rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class RankingUserByMonthResponse {
|
||||||
|
public String month;
|
||||||
|
public UserRankingByMonth[] rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class RecipientsByMonth {
|
||||||
|
public String month;
|
||||||
|
public String message;
|
||||||
|
public float regionBtc;
|
||||||
|
public int regionCount;
|
||||||
|
public float regionPercentage;
|
||||||
|
public float btc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class UserRankingByMonth {
|
||||||
|
public String user ;
|
||||||
|
public int changes;
|
||||||
|
public int globalchanges;
|
||||||
|
public int rank;
|
||||||
|
public int grank;
|
||||||
|
}
|
||||||
|
|
||||||
// {"rank":"8","countUsers":"713","minChanges":"14","maxChanges":"18","avgChanges":"15.9845722300140252"}
|
// {"rank":"8","countUsers":"713","minChanges":"14","maxChanges":"18","avgChanges":"15.9845722300140252"}
|
||||||
public static class RankingByMonth {
|
public static class RankingByMonth {
|
||||||
public int rank;
|
public int rank;
|
||||||
|
@ -26,4 +48,5 @@ public final class Protocol {
|
||||||
public int users;
|
public int users;
|
||||||
public int changes;
|
public int changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,23 @@
|
||||||
package net.osmand.plus.liveupdates;
|
package net.osmand.plus.liveupdates;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.osm.io.NetworkUtils;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
|
import net.osmand.plus.liveupdates.CountrySelectionFragment.CountryItem;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.AttrRes;
|
import android.support.annotation.AttrRes;
|
||||||
|
@ -10,6 +25,7 @@ import android.support.annotation.ColorInt;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
@ -21,45 +37,49 @@ import android.widget.TextView;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
|
||||||
import net.osmand.osm.io.NetworkUtils;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
|
||||||
import net.osmand.plus.liveupdates.CountrySelectionFragment.CountryItem;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class ReportsFragment extends BaseOsmAndFragment implements CountrySelectionFragment.OnFragmentInteractionListener {
|
public class ReportsFragment extends BaseOsmAndFragment implements CountrySelectionFragment.OnFragmentInteractionListener {
|
||||||
public static final String TITLE = "Report";
|
public static final String TITLE = "Report";
|
||||||
public static final String TOTAL_CHANGES_BY_MONTH_URL_PATTERN = "http://download.osmand.net/" +
|
public static final String DOMAIN = "http://download.osmand.net/";
|
||||||
|
public static final String TOTAL_CHANGES_BY_MONTH_URL_PATTERN = DOMAIN +
|
||||||
"reports/query_report.php?report=total_changes_by_month&month=%s®ion=%s";
|
"reports/query_report.php?report=total_changes_by_month&month=%s®ion=%s";
|
||||||
|
public static final String USERS_RANKING_BY_MONTH = DOMAIN +
|
||||||
|
"reports/query_report.php?report=ranking_users_by_month&month=%s®ion=%s";
|
||||||
|
public static final String RECIPIENTS_BY_MONTH = DOMAIN +
|
||||||
|
"reports/query_report.php?report=recipients_by_month&month=%s®ion=%s";
|
||||||
|
|
||||||
|
|
||||||
private static final Log LOG = PlatformUtil.getLog(ReportsFragment.class);
|
private static final Log LOG = PlatformUtil.getLog(ReportsFragment.class);
|
||||||
|
|
||||||
private TextView contributorsTextView;
|
private TextView contributorsTextView;
|
||||||
private TextView editsTextView;
|
private TextView editsTextView;
|
||||||
|
private TextView donationsTextView;
|
||||||
|
private TextView recipientsTextView;
|
||||||
|
|
||||||
private Spinner montReportsSpinner;
|
private Spinner montReportsSpinner;
|
||||||
private MonthsForReportsAdapter monthsForReportsAdapter;
|
private MonthsForReportsAdapter monthsForReportsAdapter;
|
||||||
|
|
||||||
private CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment();
|
private CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment();
|
||||||
|
private UsersReportFragment userReportFragment = new UsersReportFragment();
|
||||||
private TextView countryNameTextView;
|
private TextView countryNameTextView;
|
||||||
private CountryItem selectedCountryItem;
|
private CountryItem selectedCountryItem;
|
||||||
|
|
||||||
private ImageView numberOfContributorsIcon;
|
private ImageView numberOfContributorsIcon;
|
||||||
private ImageView numberOfEditsIcon;
|
private ImageView numberOfEditsIcon;
|
||||||
|
private ImageView donationsIcon;
|
||||||
|
private ImageView numberOfRecipientsIcon;
|
||||||
private TextView numberOfContributorsTitle;
|
private TextView numberOfContributorsTitle;
|
||||||
private TextView numberOfEditsTitle;
|
private TextView numberOfEditsTitle;
|
||||||
|
private TextView numberOfRecipientsTitle;
|
||||||
|
private TextView donationsTitle;
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
private int inactiveColor;
|
private int inactiveColor;
|
||||||
private int textColorPrimary;
|
private int textColorPrimary;
|
||||||
private int textColorSecondary;
|
private int textColorSecondary;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
@ -68,6 +88,15 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
monthsForReportsAdapter = new MonthsForReportsAdapter(getActivity());
|
monthsForReportsAdapter = new MonthsForReportsAdapter(getActivity());
|
||||||
montReportsSpinner.setAdapter(monthsForReportsAdapter);
|
montReportsSpinner.setAdapter(monthsForReportsAdapter);
|
||||||
|
|
||||||
|
view.findViewById(R.id.show_all).setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://osmand.net/osm_live"));
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
View regionReportsButton = view.findViewById(R.id.reportsButton);
|
View regionReportsButton = view.findViewById(R.id.reportsButton);
|
||||||
regionReportsButton.setOnClickListener(new View.OnClickListener() {
|
regionReportsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,25 +104,55 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
countrySelectionFragment.show(getChildFragmentManager(), "CountriesSearchSelectionFragment");
|
countrySelectionFragment.show(getChildFragmentManager(), "CountriesSearchSelectionFragment");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
OnClickListener listener = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int monthItemPosition = montReportsSpinner.getSelectedItemPosition();
|
||||||
|
String monthUrlString = monthsForReportsAdapter.getQueryString(monthItemPosition);
|
||||||
|
String countryUrlString = selectedCountryItem.getDownloadName();
|
||||||
|
if (countryUrlString.length() > 0) {
|
||||||
|
Bundle bl = new Bundle();
|
||||||
|
bl.putString(UsersReportFragment.URL_REQUEST,
|
||||||
|
String.format(USERS_RANKING_BY_MONTH, monthUrlString, countryUrlString));
|
||||||
|
userReportFragment.setArguments(bl);
|
||||||
|
userReportFragment.show(getChildFragmentManager(), "NumberOfEditsFramgnet");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
view.findViewById(R.id.numberOfContributorsLayout).setOnClickListener(listener);
|
||||||
|
view.findViewById(R.id.numberOfEditsLayout).setOnClickListener(listener);;
|
||||||
|
|
||||||
countrySelectionFragment.initCountries(getMyApplication());
|
countrySelectionFragment.initCountries(getMyApplication());
|
||||||
selectedCountryItem = countrySelectionFragment.getCountryItems().get(0);
|
selectedCountryItem = countrySelectionFragment.getCountryItems().get(0);
|
||||||
|
|
||||||
|
|
||||||
countryNameTextView = (TextView) regionReportsButton.findViewById(android.R.id.text1);
|
countryNameTextView = (TextView) regionReportsButton.findViewById(android.R.id.text1);
|
||||||
countryNameTextView.setText(selectedCountryItem.getLocalName());
|
countryNameTextView.setText(selectedCountryItem.getLocalName());
|
||||||
|
|
||||||
setThemedDrawable(view, R.id.calendarImageView, R.drawable.ic_action_data);
|
setThemedDrawable(view, R.id.calendarImageView, R.drawable.ic_action_data);
|
||||||
setThemedDrawable(view, R.id.regionIconImageView, R.drawable.ic_world_globe_dark);
|
setThemedDrawable(view, R.id.regionIconImageView, R.drawable.ic_world_globe_dark);
|
||||||
|
|
||||||
numberOfContributorsIcon = (ImageView) view.findViewById(R.id.numberOfContributorsIcon);
|
numberOfContributorsIcon = (ImageView) view.findViewById(R.id.numberOfContributorsIcon);
|
||||||
setThemedDrawable(numberOfContributorsIcon, R.drawable.ic_group);
|
|
||||||
numberOfEditsIcon = (ImageView) view.findViewById(R.id.numberOfEditsIcon);
|
numberOfEditsIcon = (ImageView) view.findViewById(R.id.numberOfEditsIcon);
|
||||||
|
numberOfRecipientsIcon = (ImageView) view.findViewById(R.id.numberOfRecipientsIcon);
|
||||||
|
donationsIcon = (ImageView) view.findViewById(R.id.donationsIcon);
|
||||||
|
setThemedDrawable(numberOfContributorsIcon, R.drawable.ic_group);
|
||||||
|
setThemedDrawable(numberOfRecipientsIcon, R.drawable.ic_group);
|
||||||
|
setThemedDrawable(donationsIcon, R.drawable.ic_action_message);
|
||||||
setThemedDrawable(numberOfEditsIcon, R.drawable.ic_map);
|
setThemedDrawable(numberOfEditsIcon, R.drawable.ic_map);
|
||||||
|
|
||||||
|
|
||||||
numberOfContributorsTitle = (TextView) view.findViewById(R.id.numberOfContributorsTitle);
|
numberOfContributorsTitle = (TextView) view.findViewById(R.id.numberOfContributorsTitle);
|
||||||
numberOfEditsTitle = (TextView) view.findViewById(R.id.numberOfEditsTitle);
|
numberOfEditsTitle = (TextView) view.findViewById(R.id.numberOfEditsTitle);
|
||||||
|
donationsTitle = (TextView) view.findViewById(R.id.donationsTitle);
|
||||||
|
numberOfRecipientsTitle = (TextView) view.findViewById(R.id.numberOfRecipientsTitle);
|
||||||
|
|
||||||
progressBar = (ProgressBar) view.findViewById(R.id.progress);
|
progressBar = (ProgressBar) view.findViewById(R.id.progress);
|
||||||
|
|
||||||
contributorsTextView = (TextView) view.findViewById(R.id.contributorsTextView);
|
contributorsTextView = (TextView) view.findViewById(R.id.contributorsTextView);
|
||||||
editsTextView = (TextView) view.findViewById(R.id.editsTextView);
|
editsTextView = (TextView) view.findViewById(R.id.editsTextView);
|
||||||
|
donationsTextView = (TextView) view.findViewById(R.id.donationsTextView);
|
||||||
|
recipientsTextView = (TextView) view.findViewById(R.id.recipientsTextView);
|
||||||
|
|
||||||
requestAndUpdateUi();
|
requestAndUpdateUi();
|
||||||
|
|
||||||
|
@ -161,6 +220,34 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
totalChangesByMontAsyncTask.setOnErrorListener(onErrorListener);
|
totalChangesByMontAsyncTask.setOnErrorListener(onErrorListener);
|
||||||
String finalUrl = String.format(TOTAL_CHANGES_BY_MONTH_URL_PATTERN, monthUrlString, regionUrlString);
|
String finalUrl = String.format(TOTAL_CHANGES_BY_MONTH_URL_PATTERN, monthUrlString, regionUrlString);
|
||||||
totalChangesByMontAsyncTask.execute(finalUrl);
|
totalChangesByMontAsyncTask.execute(finalUrl);
|
||||||
|
|
||||||
|
GetJsonAsyncTask<Protocol.RecipientsByMonth> recChangesByMontAsyncTask =
|
||||||
|
new GetJsonAsyncTask<>(Protocol.RecipientsByMonth.class);
|
||||||
|
GetJsonAsyncTask.OnResponseListener<Protocol.RecipientsByMonth> recResponseListener =
|
||||||
|
new GetJsonAsyncTask.OnResponseListener<Protocol.RecipientsByMonth>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Protocol.RecipientsByMonth response) {
|
||||||
|
if (response != null) {
|
||||||
|
if (recipientsTextView != null) {
|
||||||
|
recipientsTextView.setText(String.valueOf(response.regionCount));
|
||||||
|
}
|
||||||
|
if (donationsTextView != null) {
|
||||||
|
donationsTextView.setText(String.format("%.3f", response.regionBtc*1000.0) + " mBTC");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
disableProgress();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
recChangesByMontAsyncTask.setOnResponseListener(recResponseListener);
|
||||||
|
|
||||||
|
if (recipientsTextView != null) {
|
||||||
|
recipientsTextView.setText("-");
|
||||||
|
}
|
||||||
|
if (donationsTextView != null) {
|
||||||
|
donationsTextView.setText("-");
|
||||||
|
}
|
||||||
|
String recfinalUrl = String.format(RECIPIENTS_BY_MONTH, monthUrlString, regionUrlString);
|
||||||
|
recChangesByMontAsyncTask.execute(recfinalUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -228,8 +315,10 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(P protocol) {
|
protected void onPostExecute(P protocol) {
|
||||||
if (protocol != null) {
|
if (protocol != null) {
|
||||||
|
if(onResponseListener != null) {
|
||||||
onResponseListener.onResponse(protocol);
|
onResponseListener.onResponse(protocol);
|
||||||
} else {
|
}
|
||||||
|
} else if (onErrorListener != null) {
|
||||||
onErrorListener.onError(error);
|
onErrorListener.onError(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,21 +343,39 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
||||||
private void enableProgress() {
|
private void enableProgress() {
|
||||||
numberOfContributorsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_group, inactiveColor));
|
numberOfContributorsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_group, inactiveColor));
|
||||||
numberOfEditsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_map, inactiveColor));
|
numberOfEditsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_map, inactiveColor));
|
||||||
|
numberOfRecipientsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_group, inactiveColor));
|
||||||
|
donationsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_action_message, inactiveColor));
|
||||||
|
|
||||||
numberOfContributorsTitle.setTextColor(inactiveColor);
|
numberOfContributorsTitle.setTextColor(inactiveColor);
|
||||||
numberOfEditsTitle.setTextColor(inactiveColor);
|
numberOfEditsTitle.setTextColor(inactiveColor);
|
||||||
|
numberOfRecipientsTitle.setTextColor(inactiveColor);
|
||||||
|
donationsTitle.setTextColor(inactiveColor);
|
||||||
|
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
contributorsTextView.setTextColor(inactiveColor);
|
contributorsTextView.setTextColor(inactiveColor);
|
||||||
|
donationsTextView.setTextColor(inactiveColor);
|
||||||
|
recipientsTextView.setTextColor(inactiveColor);
|
||||||
editsTextView.setTextColor(inactiveColor);
|
editsTextView.setTextColor(inactiveColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableProgress() {
|
private void disableProgress() {
|
||||||
numberOfContributorsIcon.setImageDrawable(getContentIcon(R.drawable.ic_group));
|
numberOfContributorsIcon.setImageDrawable(getContentIcon(R.drawable.ic_group));
|
||||||
numberOfEditsIcon.setImageDrawable(getContentIcon(R.drawable.ic_map));
|
numberOfEditsIcon.setImageDrawable(getContentIcon(R.drawable.ic_map));
|
||||||
|
numberOfRecipientsIcon.setImageDrawable(getContentIcon(R.drawable.ic_group));
|
||||||
|
donationsIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_message));
|
||||||
|
|
||||||
numberOfContributorsTitle.setTextColor(textColorSecondary);
|
numberOfContributorsTitle.setTextColor(textColorSecondary);
|
||||||
numberOfEditsTitle.setTextColor(textColorSecondary);
|
numberOfEditsTitle.setTextColor(textColorSecondary);
|
||||||
|
numberOfRecipientsTitle.setTextColor(textColorSecondary);
|
||||||
|
donationsTitle.setTextColor(textColorSecondary);
|
||||||
|
|
||||||
progressBar.setVisibility(View.INVISIBLE);
|
progressBar.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
contributorsTextView.setTextColor(textColorPrimary);
|
contributorsTextView.setTextColor(textColorPrimary);
|
||||||
editsTextView.setTextColor(textColorPrimary);
|
editsTextView.setTextColor(textColorPrimary);
|
||||||
|
donationsTextView.setTextColor(textColorPrimary);
|
||||||
|
recipientsTextView.setTextColor(textColorPrimary);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ColorInt
|
@ColorInt
|
||||||
|
|
110
OsmAnd/src/net/osmand/plus/liveupdates/UsersReportFragment.java
Normal file
110
OsmAnd/src/net/osmand/plus/liveupdates/UsersReportFragment.java
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
package net.osmand.plus.liveupdates;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||||
|
import net.osmand.plus.liveupdates.Protocol.RankingUserByMonthResponse;
|
||||||
|
import net.osmand.plus.liveupdates.Protocol.UserRankingByMonth;
|
||||||
|
import net.osmand.plus.liveupdates.ReportsFragment.GetJsonAsyncTask;
|
||||||
|
import net.osmand.plus.liveupdates.ReportsFragment.GetJsonAsyncTask.OnResponseListener;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.ColorInt;
|
||||||
|
import android.support.annotation.DrawableRes;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class UsersReportFragment extends BaseOsmAndDialogFragment {
|
||||||
|
|
||||||
|
public static final String URL_REQUEST = "URL_REQUEST";
|
||||||
|
public static final String REGION_NAME = "REGION_NAME";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
final View view = inflater.inflate(R.layout.fragment_simple_list, container, false);
|
||||||
|
ListView listView = (ListView) view.findViewById(android.R.id.list);
|
||||||
|
final ArrayAdapter<UserRankingByMonth> adapter = new ListAdapter(getListItemIcon());
|
||||||
|
String url = getArguments().getString(URL_REQUEST);
|
||||||
|
//String reg = getArguments().getString(REGION_NAME);
|
||||||
|
view.findViewById(R.id.progress).setVisibility(View.VISIBLE);
|
||||||
|
((TextView)view.findViewById(R.id.titleTextView)).setText(R.string.osm_editors_ranking);
|
||||||
|
GetJsonAsyncTask<RankingUserByMonthResponse> task = new GetJsonAsyncTask<>(RankingUserByMonthResponse.class);
|
||||||
|
task.setOnResponseListener(new OnResponseListener<Protocol.RankingUserByMonthResponse>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(RankingUserByMonthResponse response) {
|
||||||
|
adapter.addAll(Arrays.asList(response.rows));
|
||||||
|
view.findViewById(R.id.progress).setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
task.execute(url);
|
||||||
|
listView.setAdapter(adapter);
|
||||||
|
|
||||||
|
ImageButton clearButton = (ImageButton) view.findViewById(R.id.closeButton);
|
||||||
|
//setThemedDrawable(clearButton, R.drawable.ic_action_remove_dark);
|
||||||
|
clearButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DrawableRes
|
||||||
|
protected int getListItemIcon() {
|
||||||
|
return R.drawable.ic_person;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ListAdapter extends ArrayAdapter<UserRankingByMonth> {
|
||||||
|
private final Drawable drawableLeft;
|
||||||
|
@ColorInt
|
||||||
|
private final int textColor;
|
||||||
|
private final int textSecondaryColor;
|
||||||
|
|
||||||
|
public ListAdapter(@DrawableRes int drawableLeftId) {
|
||||||
|
super(getMyActivity(), android.R.layout.simple_list_item_2);
|
||||||
|
this.drawableLeft = drawableLeftId == -1 ? null : getContentIcon(drawableLeftId);
|
||||||
|
TypedValue typedValue = new TypedValue();
|
||||||
|
Resources.Theme theme = getActivity().getTheme();
|
||||||
|
theme.resolveAttribute(android.R.attr.textColorPrimary, typedValue, true);
|
||||||
|
textColor = typedValue.data;
|
||||||
|
theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
|
||||||
|
textSecondaryColor = typedValue.data;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
UserRankingByMonth item = getItem(position);
|
||||||
|
View v = convertView;
|
||||||
|
if (v == null) {
|
||||||
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
|
v = inflater.inflate(android.R.layout.simple_list_item_2, parent, false);
|
||||||
|
}
|
||||||
|
TextView text1 = (TextView) v.findViewById(android.R.id.text1);
|
||||||
|
TextView text2 = (TextView) v.findViewById(android.R.id.text2);
|
||||||
|
text1.setText(item.user);
|
||||||
|
text2.setText(getString(R.string.osm_user_stat,
|
||||||
|
String.valueOf(item.changes), String.valueOf(item.rank), String.valueOf(item.globalchanges)));
|
||||||
|
text1.setTextColor(textColor);
|
||||||
|
text2.setTextColor(textSecondaryColor);
|
||||||
|
text1.setCompoundDrawablesWithIntrinsicBounds(drawableLeft, null, null, null);
|
||||||
|
text1.setCompoundDrawablePadding(getResources().getDimensionPixelSize(R.dimen.list_content_padding));
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue