Fixed icons in Live Updates reports. Added GridLayout support library

This commit is contained in:
Alexey Kulish 2016-03-05 15:20:24 +03:00
parent 4b0eaca433
commit 13bb21240d
15 changed files with 394 additions and 21 deletions

View file

@ -358,6 +358,7 @@ dependencies {
compile project(path: ':OsmAnd-java', configuration: 'android')
compile project(':eclipse-compile:design')
compile project(':eclipse-compile:cardview')
compile project(':eclipse-compile:gridlayout')
// compile project(":eclipse-compile:recyclerview")
compile fileTree(include: ['*.jar'], exclude: ['QtAndroid-bundled.jar', 'QtAndroidAccessibility-bundled.jar', 'OsmAndCore_android.jar', 'OsmAndCore_wrapper.jar', 'android-support-multidex.jar'], dir: 'libs')
// compile "com.github.ksoichiro:android-observablescrollview:1.5.0"

View file

@ -15,3 +15,4 @@ dex.force.jumbo=true
android.library.reference.1=../eclipse-compile/appcompat
android.library.reference.2=../eclipse-compile/design
android.library.reference.3=../eclipse-compile/cardview
android.library.reference.4=../eclipse-compile/gridlayout

View file

@ -14,16 +14,16 @@
<include layout="@layout/card_top_divider"/>
<GridLayout
<android.support.v7.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:columnCount="2">
osmand:columnCount="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_columnSpan="2"
osmand:layout_columnSpan="2"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center_vertical"
@ -48,7 +48,7 @@
<View
android:layout_height="1dp"
android:layout_columnSpan="2"
osmand:layout_columnSpan="2"
android:background="?attr/dashboard_divider"/>
<ImageView
@ -60,13 +60,13 @@
<Spinner
android:id="@+id/montReportsSpinner"
android:layout_gravity="fill_horizontal|fill_vertical"
osmand:layout_gravity="fill_horizontal|fill_vertical"
android:layout_marginRight="56dp"
android:gravity="center_vertical"/>
<View
android:layout_height="1dp"
android:layout_column="1"
osmand:layout_column="1"
android:background="?attr/dashboard_divider"/>
<ImageView
@ -81,7 +81,7 @@
android:id="@+id/reportsButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
osmand:layout_gravity="fill_vertical"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="4dp">
@ -105,7 +105,7 @@
<View
android:id="@+id/divider_to_hide"
android:layout_height="1dp"
android:layout_columnSpan="2"
osmand:layout_columnSpan="2"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:background="?attr/dashboard_divider"/>
@ -115,7 +115,7 @@
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="9dp"
android:layout_columnSpan="2"
osmand:layout_columnSpan="2"
android:indeterminate="true"/>
<ImageView
@ -130,7 +130,7 @@
android:id="@+id/numberOfContributorsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
osmand:layout_gravity="fill_vertical"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="4dp">
@ -153,7 +153,7 @@
<View
android:layout_height="1dp"
android:layout_column="1"
osmand:layout_column="1"
android:background="?attr/dashboard_divider"/>
<ImageView
@ -161,13 +161,13 @@
android:layout_width="56dp"
android:layout_height="60dp"
android:scaleType="center"
android:src="@drawable/ic_world_globe_dark"/>
android:src="@drawable/ic_map"/>
<LinearLayout
android:id="@+id/numberOfEditsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
osmand:layout_gravity="fill_vertical"
android:gravity="center"
android:orientation="vertical">
@ -192,13 +192,13 @@
android:layout_width="56dp"
android:layout_height="60dp"
android:scaleType="center"
android:src="@drawable/ic_action_message"/>
android:src="@drawable/ic_action_bitcoin"/>
<LinearLayout
android:id="@+id/donationsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
osmand:layout_gravity="fill_vertical"
android:gravity="center"
android:orientation="vertical">
@ -220,7 +220,7 @@
<View
android:layout_height="1dp"
android:layout_column="1"
osmand:layout_column="1"
android:background="?attr/dashboard_divider"/>
<ImageView
@ -234,7 +234,7 @@
android:id="@+id/numberOfRecipientsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
osmand:layout_gravity="fill_vertical"
android:gravity="center"
android:orientation="vertical">
@ -254,7 +254,7 @@
android:textColor="?android:textColorPrimary"/>
</LinearLayout>
</GridLayout>
</android.support.v7.widget.GridLayout>
<include layout="@layout/card_bottom_divider"/>

View file

@ -136,7 +136,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
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(donationsIcon, R.drawable.ic_action_bitcoin);
setThemedDrawable(numberOfEditsIcon, R.drawable.ic_map);
@ -344,7 +344,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
numberOfContributorsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_group, 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));
donationsIcon.setImageDrawable(getPaintedContentIcon(R.drawable.ic_action_bitcoin, inactiveColor));
numberOfContributorsTitle.setTextColor(inactiveColor);
numberOfEditsTitle.setTextColor(inactiveColor);
@ -364,7 +364,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
numberOfContributorsIcon.setImageDrawable(getContentIcon(R.drawable.ic_group));
numberOfEditsIcon.setImageDrawable(getContentIcon(R.drawable.ic_map));
numberOfRecipientsIcon.setImageDrawable(getContentIcon(R.drawable.ic_group));
donationsIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_message));
donationsIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_bitcoin));
numberOfContributorsTitle.setTextColor(textColorSecondary);
numberOfEditsTitle.setTextColor(textColorSecondary);

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>android-support-v7-gridlayout</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v7.gridlayout">
<uses-sdk android:minSdkVersion="7"/>
<application />
</manifest>

View file

@ -0,0 +1,66 @@
Library Project including compatibility GridLayout.
This can be used by an Android project to provide
access to GridLayout on applications running on API 7+.
There is technically no source, but the src folder is necessary
to ensure that the build system works. The content is actually
located in libs/android-support-v7-gridlayout.jar.
The accompanying resources must also be included in the application.
USAGE:
Make sure you use <android.support.v7.widget.GridLayout> in your
layouts instead of <GridLayout>.
Same for <android.support.v7.widget.Space> instead of <Space>.
Additionally, all of GridLayout's attributes should be put in the
namespace of the app, as those attributes have been redefined in
the library so that it can run on older platforms that don't offer
those attributes in their namespace.
To know which attributes need the application namespace, look at
the two declare-styleable declared in res/values/attrs.xml
For instance:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" <==== the namespace used for the library project
android:layout_width="match_parent"
android:layout_height="match_parent"
app:columnCount="6" > <===== notice how we're using app:columnCount here, not android:columnCount!
<Button
android:id="@+id/button1"
app:layout_column="1" <=== again, note the app: namespace
app:layout_columnSpan="2"
app:layout_gravity="left"
app:layout_row="1"
android:text="Button" />
<CheckBox
android:id="@+id/checkBox1"
app:layout_column="4"
app:layout_gravity="left"
app:layout_row="2"
android:text="CheckBox" />
<Button
android:id="@+id/button2"
app:layout_column="5"
app:layout_gravity="left"
app:layout_row="3"
android:text="Button" />
<android.support.v7.widget.Space <=== space widgets also need the full support package path
android:layout_width="21dp" <=== use the android namespace for width, height etc -- only use app: for the grid layout library's new resources
android:layout_height="1dp"
app:layout_column="0"
app:layout_gravity="fill_horizontal"
app:layout_row="0" />

View file

@ -0,0 +1,26 @@
apply plugin: 'com.android.library'
dependencies {
compile files('libs/android-support-v7-gridlayout.jar')
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 23
}
sourceSets {
main {
manifest.srcFile "AndroidManifest.xml"
aidl.srcDirs = ["src"]
java.srcDirs = ["src"]
resources.srcDirs = ["src"]
renderscript.srcDirs = ["src"]
res.srcDirs = ["res"]
assets.srcDirs = ["assets"]
}
}
}

View file

@ -0,0 +1,15 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-23
android.library=true

View file

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="GridLayout">
<!--
support versions. All attributes not present in ViewGroup/View are
redefined in the support library namespace.
-->
<!--
The orientation property is not used during layout. It is only used to
allocate row and column parameters when they are not specified by its children's
layout parameters. GridLayout works like LinearLayout in this case;
putting all the components either in a single row or in a single column -
depending on the value of this flag. In the horizontal case, a columnCount
property may be additionally supplied to force new rows to be created when a
row is full. The rowCount attribute may be used similarly in the vertical case.
The default is horizontal.
-->
<attr name="orientation">
<!-- Defines an horizontal widget. -->
<enum name="horizontal" value="0" />
<!-- Defines a vertical widget. -->
<enum name="vertical" value="1" />
</attr>
<!-- The maximum number of rows to create when automatically positioning children. -->
<attr name="rowCount" format="integer" />
<!-- The maximum number of columns to create when automatically positioning children. -->
<attr name="columnCount" format="integer" />
<!--
When set to true, tells GridLayout to use default margins when none are specified
in a view's layout parameters.
The default value is false.
See {@link android.widget.GridLayout#setUseDefaultMargins(boolean)}.
-->
<attr name="useDefaultMargins" format="boolean" />
<!--
When set to alignMargins, causes alignment to take place between the outer
boundary of a view, as defined by its margins. When set to alignBounds,
causes alignment to take place between the edges of the view.
The default is alignMargins.
See {@link android.widget.GridLayout#setAlignmentMode(int)}.
-->
<attr name="alignmentMode">
<!--
Align the bounds of the children.
See {@link android.widget.GridLayout#ALIGN_BOUNDS}.
-->
<enum name="alignBounds" value="0" />
<!--
Align the margins of the children.
See {@link android.widget.GridLayout#ALIGN_MARGINS}.
-->
<enum name="alignMargins" value="1" />
</attr>
<!--
When set to true, forces row boundaries to appear in the same order
as row indices.
The default is true.
See {@link android.widget.GridLayout#setRowOrderPreserved(boolean)}.
-->
<attr name="rowOrderPreserved" format="boolean" />
<!--
When set to true, forces column boundaries to appear in the same order
as column indices.
The default is true.
See {@link android.widget.GridLayout#setColumnOrderPreserved(boolean)}.
-->
<attr name="columnOrderPreserved" format="boolean" />
</declare-styleable>
<declare-styleable name="GridLayout_Layout">
<!--
support versions. All attributes not present in MarginLayout are
redefined in the support library name space.
-->
<!-- START MarginLayout layoutparams -->
<attr name="android:layout_width" />
<attr name="android:layout_height" />
<!--
Specifies extra space on the left, top, right and bottom
sides of this view. This space is outside this view's bounds.
-->
<attr name="android:layout_margin" />
<!--
Specifies extra space on the left side of this view.
This space is outside this view's bounds.
-->
<attr name="android:layout_marginLeft" />
<!--
Specifies extra space on the top side of this view.
This space is outside this view's bounds.
-->
<attr name="android:layout_marginTop" />
<!--
Specifies extra space on the right side of this view.
This space is outside this view's bounds.
-->
<attr name="android:layout_marginRight" />
<!--
Specifies extra space on the bottom side of this view.
This space is outside this view's bounds.
-->
<attr name="android:layout_marginBottom" />
<!-- END MarginLayout layoutparams -->
<!--
The row boundary delimiting the top of the group of cells
occupied by this view.
-->
<attr name="layout_row" format="integer" />
<!--
The row span: the difference between the top and bottom
boundaries delimiting the group of cells occupied by this view.
The default is one.
See {@link android.widget.GridLayout.Spec}.
-->
<attr name="layout_rowSpan" format="integer" min="1" />
<!-- The relative proportion of vertical space that should be allocated to this view
during excess space distribution. -->
<attr name="layout_rowWeight" format="float" />
<!--
The column boundary delimiting the left of the group of cells
occupied by this view.
-->
<attr name="layout_column" format="integer" />
<!--
The column span: the difference between the right and left
boundaries delimiting the group of cells occupied by this view.
The default is one.
See {@link android.widget.GridLayout.Spec}.
-->
<attr name="layout_columnSpan" format="integer" min="1" />
<!-- The relative proportion of horizontal space that should be allocated to this view
during excess space distribution. -->
<attr name="layout_columnWeight" format="float" />
<!--
Gravity specifies how a component should be placed in its group of cells.
The default is LEFT | BASELINE.
See {@link android.widget.GridLayout.LayoutParams#setGravity(int)}.
-->
<attr name="layout_gravity">
<!-- Push object to the top of its container, not changing its size. -->
<flag name="top" value="0x30" />
<!-- Push object to the bottom of its container, not changing its size. -->
<flag name="bottom" value="0x50" />
<!-- Push object to the left of its container, not changing its size. -->
<flag name="left" value="0x03" />
<!-- Push object to the right of its container, not changing its size. -->
<flag name="right" value="0x05" />
<!-- Place object in the vertical center of its container, not changing its size. -->
<flag name="center_vertical" value="0x10" />
<!-- Grow the vertical size of the object if needed so it completely fills its container. -->
<flag name="fill_vertical" value="0x70" />
<!-- Place object in the horizontal center of its container, not changing its size. -->
<flag name="center_horizontal" value="0x01" />
<!-- Grow the horizontal size of the object if needed so it completely fills its container. -->
<flag name="fill_horizontal" value="0x07" />
<!-- Place the object in the center of its container in both the vertical and horizontal axis, not changing its size. -->
<flag name="center" value="0x11" />
<!-- Grow the horizontal and vertical size of the object if needed so it completely fills its container. -->
<flag name="fill" value="0x77" />
<!--
Additional option that can be set to have the top and/or bottom edges of
the child clipped to its container's bounds.
The clip will be based on the vertical gravity: a top gravity will clip the bottom
edge, a bottom gravity will clip the top edge, and neither will clip both edges.
-->
<flag name="clip_vertical" value="0x80" />
<!--
Additional option that can be set to have the left and/or right edges of
the child clipped to its container's bounds.
The clip will be based on the horizontal gravity: a left gravity will clip the right
edge, a right gravity will clip the left edge, and neither will clip both edges.
-->
<flag name="clip_horizontal" value="0x08" />
<!-- Push object to the beginning of its container, not changing its size. -->
<flag name="start" value="0x00800003" />
<!-- Push object to the end of its container, not changing its size. -->
<flag name="end" value="0x00800005" />
</attr>
</declare-styleable>
</resources>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- The default gap between components in a layout. -->
<dimen name="default_gap">8dip</dimen>
</resources>

View file

@ -0,0 +1,2 @@
This hidden file is there to ensure there is an src folder.
Once we support binary library this will go away.

View file

@ -1,4 +1,5 @@
include ':OsmAnd-java'
include ':eclipse-compile:gridlayout'
include ':eclipse-compile:cardview'
include ':eclipse-compile:design'
include ':eclipse-compile:appcompat'