reports fix of fallback.

This commit is contained in:
GaidamakUA 2016-03-10 11:10:12 +02:00
parent 33c5ace0bf
commit 46fe672561
2 changed files with 286 additions and 189 deletions

View file

@ -1,6 +1,6 @@
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -11,268 +11,352 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.GridLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
app:columnCount="2">
android:orientation="vertical">
<LinearLayout
android:id="@+id/monthButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:gravity="center_vertical"
android:minHeight="60dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/calendarImageView"
android:layout_width="56dp"
android:layout_height="56dp"
android:scaleType="center"
android:src="@drawable/ic_action_data"/>
<Spinner
android:id="@+id/monthReportsSpinner"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="-8dp"
android:layout_marginRight="16dp"
android:layout_weight="1"
android:background="@null"
android:clickable="false"/>
<ImageView
android:id="@+id/monthDropDownIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="16dp"
android:src="@drawable/ic_action_arrow_drop_down"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
app:layout_columnSpan="2"
android:layout_marginLeft="56dp"
android:background="?attr/dashboard_divider"/>
<ImageView
android:id="@+id/calendarImageView"
android:layout_width="56dp"
android:layout_height="60dp"
android:scaleType="center"
android:src="@drawable/ic_action_data"/>
<Spinner
android:id="@+id/monthReportsSpinner"
app:layout_gravity="fill_horizontal|fill_vertical"
android:layout_marginRight="56dp"
android:gravity="center_vertical"/>
<View
android:layout_height="1dp"
app:layout_column="1"
android:background="?attr/dashboard_divider"/>
<ImageView
android:id="@+id/regionIconImageView"
android:layout_width="56dp"
android:layout_height="60dp"
android:scaleType="center"
android:src="@drawable/ic_world_globe_dark"/>
<LinearLayout
android:id="@+id/reportsButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_gravity="fill_vertical"
android:gravity="center"
android:orientation="vertical">
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:gravity="center_vertical"
android:minHeight="60dp"
android:orientation="horizontal">
<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"/>
<ImageView
android:id="@+id/regionIconImageView"
android:layout_width="56dp"
android:layout_height="56dp"
android:scaleType="center"
android:src="@drawable/ic_world_globe_dark"/>
<TextView
android:id="@android:id/text1"
android:layout_width="match_parent"
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:textColor="?android:textColorPrimary"
tools:text="Worldwide"/>
android:layout_marginRight="16dp"
android:layout_weight="1"
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"
android:textSize="@dimen/default_list_text_size"
tools:text="Worldwide"/>
</LinearLayout>
<ImageView
android:id="@+id/countryDropDownIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="16dp"
android:src="@drawable/ic_action_arrow_drop_down"/>
</LinearLayout>
</android.support.v7.widget.GridLayout>
</LinearLayout>
<include layout="@layout/card_bottom_divider"/>
<include layout="@layout/card_top_divider"/>
<android.support.v7.widget.GridLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
app:columnCount="2">
android:orientation="vertical">
<View
android:id="@+id/divider_to_hide"
android:layout_height="8dp"
app:layout_columnSpan="2"/>
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleHorizontal"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="8dp"
app:layout_columnSpan="2"
android:indeterminate="true"/>
android:layout_height="wrap_content">
<ImageView
android:id="@+id/numberOfContributorsIcon"
android:layout_width="56dp"
android:layout_height="52dp"
android:paddingBottom="8dp"
android:scaleType="center"
android:src="@drawable/ic_action_group2"/>
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="8dp"
android:indeterminate="true"/>
<LinearLayout
android:id="@+id/numberOfContributorsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_gravity="fill_vertical"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="8dp">
<TextView
android:id="@+id/numberOfContributorsTitle"
<LinearLayout
android:id="@+id/numberOfContributorsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/number_of_contributors"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="60dp"
android:orientation="horizontal">
<TextView
android:id="@+id/contributorsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0"
android:textColor="?android:textColorPrimary"/>
</LinearLayout>
<ImageView
android:id="@+id/numberOfContributorsIcon"
android:layout_width="56dp"
android:layout_height="56dp"
android:scaleType="center"
android:src="@drawable/ic_group"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:orientation="vertical">
<TextView
android:id="@+id/numberOfContributorsTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/number_of_contributors"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
<TextView
android:id="@+id/contributorsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
app:layout_column="1"
android:layout_marginLeft="56dp"
android:background="?attr/dashboard_divider"/>
<ImageView
android:id="@+id/numberOfEditsIcon"
android:layout_width="56dp"
android:layout_height="60dp"
android:scaleType="center"
android:src="@drawable/ic_map"/>
<LinearLayout
android:id="@+id/numberOfEditsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_gravity="fill_vertical"
android:gravity="center"
android:orientation="vertical">
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="60dp"
android:orientation="horizontal">
<TextView
android:id="@+id/numberOfEditsTitle"
<ImageView
android:id="@+id/numberOfEditsIcon"
android:layout_width="56dp"
android:layout_height="56dp"
android:scaleType="center"
android:src="@drawable/ic_map"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/number_of_edits"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
android:layout_marginRight="16dp"
android:orientation="vertical">
<TextView
android:id="@+id/numberOfEditsTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/number_of_edits"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
<TextView
android:id="@+id/editsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<TextView
android:id="@+id/editsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0"
android:textColor="?android:textColorPrimary"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
app:layout_column="1"
android:layout_marginLeft="56dp"
android:background="?attr/dashboard_divider"/>
<ImageView
android:id="@+id/donationsIcon"
android:layout_width="56dp"
android:layout_height="60dp"
android:scaleType="center"
android:src="@drawable/ic_action_bitcoin"/>
<LinearLayout
android:id="@+id/donationsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_gravity="fill_vertical"
android:gravity="center"
android:orientation="vertical">
android:gravity="center_vertical"
android:minHeight="60dp"
android:orientation="horizontal">
<TextView
android:id="@+id/donationsTitle"
<ImageView
android:id="@+id/donationsIcon"
android:layout_width="56dp"
android:layout_height="56dp"
android:scaleType="center"
android:src="@drawable/ic_action_bitcoin"/>
<LinearLayout
android:id="@+id/donationsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/donations"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
android:layout_marginRight="16dp"
android:orientation="vertical">
<TextView
android:id="@+id/donationsTitle"
android:layout_width="match_parent"
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"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<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_width="match_parent"
android:layout_height="1dp"
app:layout_column="1"
android:layout_marginLeft="56dp"
android:background="?attr/dashboard_divider"/>
<ImageView
android:id="@+id/numberOfRecipientsIcon"
android:layout_width="56dp"
android:layout_height="60dp"
android:scaleType="center"
android:src="@drawable/ic_group"/>
<LinearLayout
android:id="@+id/numberOfRecipientsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_gravity="fill_vertical"
android:gravity="center"
android:orientation="vertical">
android:gravity="center_vertical"
android:minHeight="60dp"
android:orientation="horizontal">
<TextView
android:id="@+id/numberOfRecipientsTitle"
<ImageView
android:id="@+id/numberOfRecipientsIcon"
android:layout_width="56dp"
android:layout_height="60dp"
android:scaleType="center"
android:src="@drawable/ic_group"/>
<LinearLayout
android:id="@+id/numberOfRecipientsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/number_of_recipients"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
android:layout_marginRight="16dp"
android:orientation="vertical">
<TextView
android:id="@+id/numberOfRecipientsTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
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"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<TextView
android:id="@+id/recipientsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="-"
android:textColor="?android:textColorPrimary"/>
</LinearLayout>
</android.support.v7.widget.GridLayout>
</LinearLayout>
<include layout="@layout/card_bottom_divider"/>
<LinearLayout
android:id="@+id/show_all"
<android.support.v7.widget.CardView
android:id="@+id/card_view"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="8dp"
android:background="?attr/bg_card"
android:gravity="center_vertical"
android:minHeight="48dp"
android:orientation="vertical"
android:padding="16dp">
card_view:cardBackgroundColor="?attr/bg_color"
card_view:cardCornerRadius="4dp">
<TextView
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/show_all"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/full_report"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:gravity="center_vertical"
android:minHeight="48dp"
android:orientation="vertical"
android:padding="16dp">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/osm_live_url_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left|center_vertical"
android:textColor="?attr/dashboard_general_button_text_color"
android:textSize="@dimen/default_desc_text_size"
app:textAllCapsCompat="false"
app:typeface="@string/font_roboto_medium"
tools:text="http://osmand.net/osm_live"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/full_report"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/osm_live_url_label"
style="@style/DashboardGeneralButton"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:gravity="left|center_vertical"
android:textSize="@dimen/default_desc_text_size"
osmand:textAllCapsCompat="false"
osmand:typeface="@string/font_roboto_medium"
tools:text="http://osmand.net/osm_live"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>

View file

@ -75,7 +75,6 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
private TextView numberOfRecipientsTitle;
private TextView donationsTitle;
private ProgressBar progressBar;
private View dividerToHide;
private int inactiveColor;
private int textColorPrimary;
@ -86,9 +85,25 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_reports, container, false);
monthReportsSpinner = (Spinner) view.findViewById(R.id.monthReportsSpinner);
final View monthButton = view.findViewById(R.id.monthButton);
monthReportsSpinner.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
event.offsetLocation(AndroidUtils.dpToPx(getActivity(), 48f), 0);
monthButton.onTouchEvent(event);
return true;
}
});
monthsForReportsAdapter = new MonthsForReportsAdapter(getActivity());
monthReportsSpinner.setAdapter(monthsForReportsAdapter);
monthButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
monthReportsSpinner.performClick();
}
});
view.findViewById(R.id.show_all).setOnClickListener(new OnClickListener() {
@Override
@ -132,7 +147,9 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
countryNameTextView.setText(selectedCountryItem.getLocalName());
setThemedDrawable(view, R.id.calendarImageView, R.drawable.ic_action_data);
setThemedDrawable(view, R.id.monthDropDownIcon, R.drawable.ic_action_arrow_drop_down);
setThemedDrawable(view, R.id.regionIconImageView, R.drawable.ic_world_globe_dark);
setThemedDrawable(view, R.id.countryDropDownIcon, R.drawable.ic_action_arrow_drop_down);
numberOfContributorsIcon = (ImageView) view.findViewById(R.id.numberOfContributorsIcon);
numberOfEditsIcon = (ImageView) view.findViewById(R.id.numberOfEditsIcon);
@ -156,8 +173,6 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
donationsTextView = (TextView) view.findViewById(R.id.donationsTextView);
recipientsTextView = (TextView) view.findViewById(R.id.recipientsTextView);
dividerToHide = view.findViewById(R.id.divider_to_hide);
requestAndUpdateUi();
AdapterView.OnItemSelectedListener onItemSelectedListener = new AdapterView.OnItemSelectedListener() {
@ -356,7 +371,6 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
donationsTitle.setTextColor(inactiveColor);
progressBar.setVisibility(View.VISIBLE);
dividerToHide.setVisibility(View.GONE);
contributorsTextView.setTextColor(inactiveColor);
donationsTextView.setTextColor(inactiveColor);
@ -375,8 +389,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
numberOfRecipientsTitle.setTextColor(textColorSecondary);
donationsTitle.setTextColor(textColorSecondary);
progressBar.setVisibility(View.GONE);
dividerToHide.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.INVISIBLE);
contributorsTextView.setTextColor(textColorPrimary);
editsTextView.setTextColor(textColorPrimary);