[new downloader][android] fix: Various UI fixes.

This commit is contained in:
Alexander Marchuk 2016-02-29 13:48:54 +03:00 committed by Sergey Yershov
parent 5ced980181
commit 0c283351ea
10 changed files with 25 additions and 26 deletions

View file

@ -4,7 +4,7 @@
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="12dp"/>
<corners android:radius="2dp"/>
</shape>
</item>
</ripple>

View file

@ -32,8 +32,8 @@
android:id="@+id/ll__location_determined"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
android:orientation="vertical"
android:gravity="center_horizontal">
<TextView
android:id="@+id/tv__country_name"
@ -46,8 +46,6 @@
<Button
android:id="@+id/btn__download_map"
style="@style/MwmWidget.Button.Accent"
android:layout_width="280dp"
android:layout_height="@dimen/height_block_base"
android:layout_marginTop="@dimen/margin_quarter"
android:text="@string/downloader_download_map"
android:textAppearance="@style/MwmTextAppearance.Body1"/>
@ -55,8 +53,6 @@
<Button
android:id="@+id/btn__select_other_map"
style="@style/MwmWidget.Button"
android:layout_width="280dp"
android:layout_height="@dimen/height_block_base"
android:layout_marginTop="@dimen/margin_base_plus"
android:text="@string/search_select_other_map"
android:textAppearance="@style/MwmTextAppearance.Body3"
@ -68,6 +64,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
android:visibility="gone">
<TextView
@ -80,7 +77,7 @@
<Button
android:id="@+id/btn__select_map"
style="@style/MwmWidget.Button"
style="@style/MwmWidget.Button.Accent"
android:layout_width="280dp"
android:layout_height="@dimen/height_block_base"
android:layout_marginTop="@dimen/margin_half"

View file

@ -51,8 +51,6 @@
<Button
android:id="@+id/btn__download_map"
style="@style/MwmWidget.Button.Accent"
android:layout_width="match_parent"
android:layout_height="@dimen/height_block_base"
android:layout_marginTop="@dimen/margin_half"
android:text="@string/downloader_download_map"
android:textAppearance="@style/MwmTextAppearance.Body1"/>
@ -63,6 +61,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
android:visibility="gone"
tools:visibility="visible">
<TextView
@ -75,9 +74,7 @@
<Button
android:id="@+id/btn__select_map"
style="@style/MwmWidget.Button"
android:layout_width="match_parent"
android:layout_height="@dimen/height_block_base"
style="@style/MwmWidget.Button.Accent"
android:layout_marginTop="@dimen/margin_half"
android:text="@string/search_select_map"
android:textAppearance="@style/MwmTextAppearance.Body1"/>
@ -85,8 +82,6 @@
<Button
android:id="@+id/btn__select_other_map"
style="@style/MwmWidget.Button"
android:layout_width="match_parent"
android:layout_height="@dimen/height_block_base"
android:layout_marginTop="@dimen/margin_base_plus"
android:text="@string/search_select_other_map"
android:textAppearance="@style/MwmTextAppearance.Body3"

View file

@ -47,14 +47,12 @@
<FrameLayout
android:id="@+id/downloader_controls_frame"
android:layout_width="200dp"
android:layout_width="@dimen/button_width"
android:layout_height="wrap_content"
android:clipChildren="false">
<Button
android:id="@+id/downloader_button"
style="@style/MwmWidget.Button.Accent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"/>
<com.mapswithme.maps.widget.WheelProgressView

View file

@ -43,6 +43,7 @@
<dimen name="search_progress_size">32dp</dimen>
<dimen name="panel_width">360dp</dimen>
<dimen name="button_width">240dp</dimen>
<!-- direction fragment -->
<dimen name="margin_direction_small">8dp</dimen>

View file

@ -21,6 +21,8 @@
</style>
<style name="MwmWidget.Button">
<item name="android:layout_width">@dimen/button_width</item>
<item name="android:layout_height">@dimen/height_block_base</item>
<item name="android:background">?buttonBackground</item>
<item name="android:textAllCaps">true</item>
</style>

View file

@ -74,18 +74,20 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
if (showFrame)
{
boolean hasParent = !TextUtils.isEmpty(mCurrentCountry.parentName);
UiUtils.showIf(showProgress, mProgress);
UiUtils.showIf(!showProgress, mButton);
UiUtils.showIf(!TextUtils.isEmpty(mCurrentCountry.parentName), mParent);
UiUtils.showIf(hasParent, mParent);
if (!TextUtils.isEmpty(mCurrentCountry.parentName))
if (hasParent)
mParent.setText(mCurrentCountry.parentName);
mTitle.setText(mCurrentCountry.name);
mSize.setText(StringUtils.getFileSizeString(mCurrentCountry.totalSize));
if (showProgress)
mProgress.setProgress((int)(mCurrentCountry.progress * 100 / mCurrentCountry.totalSize));
mProgress.setProgress((int)(mCurrentCountry.progress * 100L / mCurrentCountry.totalSize));
else
{
boolean failed = (mCurrentCountry.status == CountryItem.STATUS_FAILED);

View file

@ -5,20 +5,21 @@ import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
import com.mapswithme.util.UiUtils;
import java.util.ArrayList;
import java.util.List;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
import com.mapswithme.util.UiUtils;
/**
* FrameLayout which presses out the children which can not be fully fit by height.<br/>
* Child views should be marked with {@code @string/tag_height_limited} tag.
*/
public class HeightLimitedFrameLayout extends FrameLayout
{
private static final String TAG_LIMIT = MwmApplication.get().getString(R.string.tag_height_limited);
private String mTag;
private final List<View> mLimitedViews = new ArrayList<>();
public HeightLimitedFrameLayout(Context context, AttributeSet attrs)
@ -28,7 +29,10 @@ public class HeightLimitedFrameLayout extends FrameLayout
private void collectViews(View v)
{
if (TAG_LIMIT.equals(v.getTag()))
if (mTag == null)
mTag = MwmApplication.get().getString(R.string.tag_height_limited);
if (mTag.equals(v.getTag()))
{
mLimitedViews.add(v);
return;