diff --git a/OsmAnd/res/layout/fragment_reports.xml b/OsmAnd/res/layout/fragment_reports.xml index b900f162e6..84e6564ccb 100644 --- a/OsmAnd/res/layout/fragment_reports.xml +++ b/OsmAnd/res/layout/fragment_reports.xml @@ -274,6 +274,61 @@ android:layout_marginLeft="56dp" android:background="?attr/dashboard_divider"/> + + + + + + + + + + + + + + + + + + + Move Point Add to a GPX track OSM Recipients + Total Donations diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java index 904f2b3833..1e7ff0d3bd 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java @@ -18,6 +18,7 @@ import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.Spinner; import android.widget.TextView; @@ -72,11 +73,15 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect private ImageView numberOfEditsIcon; private ImageView donationsIcon; private ImageView numberOfRecipientsIcon; + private ImageView donationsTotalIcon; + private TextView donationsTotalTitle; + private TextView donationsTotalTextView; private TextView numberOfContributorsTitle; private TextView numberOfEditsTitle; private TextView numberOfRecipientsTitle; private TextView donationsTitle; private ProgressBar progressBar; + private LinearLayout donationsTotalLayout; private int inactiveColor; private int textColorPrimary; @@ -159,9 +164,11 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect numberOfEditsIcon = (ImageView) view.findViewById(R.id.numberOfEditsIcon); numberOfRecipientsIcon = (ImageView) view.findViewById(R.id.numberOfRecipientsIcon); donationsIcon = (ImageView) view.findViewById(R.id.donationsIcon); + donationsTotalIcon = (ImageView) view.findViewById(R.id.donationsTotalIcon); setThemedDrawable(numberOfContributorsIcon, R.drawable.ic_action_group2); setThemedDrawable(numberOfRecipientsIcon, R.drawable.ic_group); setThemedDrawable(donationsIcon, R.drawable.ic_action_bitcoin); + setThemedDrawable(donationsTotalIcon, R.drawable.ic_action_bitcoin); setThemedDrawable(numberOfEditsIcon, R.drawable.ic_map); @@ -169,6 +176,10 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect numberOfEditsTitle = (TextView) view.findViewById(R.id.numberOfEditsTitle); donationsTitle = (TextView) view.findViewById(R.id.donationsTitle); numberOfRecipientsTitle = (TextView) view.findViewById(R.id.numberOfRecipientsTitle); + donationsTotalLayout = (LinearLayout) view.findViewById(R.id.donationsTotal); + donationsTotalTitle = (TextView) view.findViewById(R.id.donationsTotalTitle); + donationsTotalTextView = (TextView) view.findViewById(R.id.donationsTotalTextView); + progressBar = (ProgressBar) view.findViewById(R.id.progress); @@ -207,7 +218,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect tryUpdateData(monthUrlString, countryUrlString); } - private void tryUpdateData(String monthUrlString, String regionUrlString) { + private void tryUpdateData(String monthUrlString, final String regionUrlString) { GetJsonAsyncTask.OnResponseListener onResponseListener = new GetJsonAsyncTask.OnResponseListener() { @Override @@ -255,7 +266,13 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect recipientsTextView.setText(String.valueOf(response.regionCount)); } if (donationsTextView != null) { - donationsTextView.setText(String.format("%.3f", response.regionBtc*1000.0) + " mBTC"); + donationsTextView.setText(String.format("%.3f", response.regionBtc*1000f) + " mBTC"); + } + if (donationsTotalLayout != null && + donationsTotalTextView != null) { + boolean world = regionUrlString.isEmpty(); + donationsTotalLayout.setVisibility(world ? View.VISIBLE : View.GONE); + donationsTotalTextView.setText(String.format("%.3f", response.btc*1000f) + " mBTC"); } } disableProgress(); @@ -269,6 +286,9 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect if (donationsTextView != null) { donationsTextView.setText("-"); } + if (donationsTotalTextView != null) { + donationsTotalTextView.setText("-"); + } String recfinalUrl = String.format(RECIPIENTS_BY_MONTH, monthUrlString, regionUrlString); recChangesByMontAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, recfinalUrl); } @@ -368,16 +388,19 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect numberOfEditsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_map, inactiveColor)); numberOfRecipientsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_group, inactiveColor)); donationsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_action_bitcoin, inactiveColor)); + donationsTotalIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_action_bitcoin, inactiveColor)); numberOfContributorsTitle.setTextColor(inactiveColor); numberOfEditsTitle.setTextColor(inactiveColor); numberOfRecipientsTitle.setTextColor(inactiveColor); donationsTitle.setTextColor(inactiveColor); + donationsTotalTitle.setTextColor(inactiveColor); progressBar.setVisibility(View.VISIBLE); contributorsTextView.setTextColor(inactiveColor); donationsTextView.setTextColor(inactiveColor); + donationsTotalTextView.setTextColor(inactiveColor); recipientsTextView.setTextColor(inactiveColor); editsTextView.setTextColor(inactiveColor); } @@ -387,17 +410,20 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect numberOfEditsIcon.setImageDrawable(getContentIcon(R.drawable.ic_map)); numberOfRecipientsIcon.setImageDrawable(getContentIcon(R.drawable.ic_group)); donationsIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_bitcoin)); + donationsTotalIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_bitcoin)); numberOfContributorsTitle.setTextColor(textColorSecondary); numberOfEditsTitle.setTextColor(textColorSecondary); numberOfRecipientsTitle.setTextColor(textColorSecondary); donationsTitle.setTextColor(textColorSecondary); + donationsTotalTitle.setTextColor(textColorSecondary); progressBar.setVisibility(View.INVISIBLE); contributorsTextView.setTextColor(textColorPrimary); editsTextView.setTextColor(textColorPrimary); donationsTextView.setTextColor(textColorPrimary); + donationsTotalTextView.setTextColor(textColorPrimary); recipientsTextView.setTextColor(textColorPrimary); }