Local fragment design fix
This commit is contained in:
parent
52e826f867
commit
edf1c31ed6
6 changed files with 54 additions and 26 deletions
|
@ -3,5 +3,4 @@
|
||||||
<item android:drawable="@color/list_item_light_pressed" android:state_focused="true"/>
|
<item android:drawable="@color/list_item_light_pressed" android:state_focused="true"/>
|
||||||
<item android:drawable="@color/list_item_light_pressed" android:state_selected="true"/>
|
<item android:drawable="@color/list_item_light_pressed" android:state_selected="true"/>
|
||||||
<item android:drawable="@color/list_item_light_pressed" android:state_pressed="true"/>
|
<item android:drawable="@color/list_item_light_pressed" android:state_pressed="true"/>
|
||||||
|
|
||||||
</selector>
|
</selector>
|
|
@ -5,6 +5,7 @@
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:theme="@style/FreeVersionBanner"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/osmo_header_dark"
|
android:background="@color/osmo_header_dark"
|
||||||
|
|
|
@ -137,6 +137,11 @@
|
||||||
<item name="colorAccent">@color/color_white</item>
|
<item name="colorAccent">@color/color_white</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="FreeVersionBanner" parent="OsmandDarkTheme">
|
||||||
|
<item name="android:textColorSecondary">@color/color_white</item>
|
||||||
|
<item name="colorAccent">@color/map_widget_blue</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
||||||
<item name="list_divider">@color/list_divider_light</item>
|
<item name="list_divider">@color/list_divider_light</item>
|
||||||
<item name="expandable_category_color">?android:attr/colorBackground</item>
|
<item name="expandable_category_color">?android:attr/colorBackground</item>
|
||||||
|
|
|
@ -20,6 +20,8 @@ import net.osmand.plus.voice.MediaCommandPlayerImpl;
|
||||||
import net.osmand.plus.voice.TTSCommandPlayerImpl;
|
import net.osmand.plus.voice.TTSCommandPlayerImpl;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.support.annotation.DrawableRes;
|
||||||
|
import android.support.annotation.StringRes;
|
||||||
|
|
||||||
|
|
||||||
public class LocalIndexHelper {
|
public class LocalIndexHelper {
|
||||||
|
@ -38,11 +40,12 @@ public class LocalIndexHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInstalledDateEdition(long t, TimeZone timeZone){
|
public String getInstalledDateEdition(long t, TimeZone timeZone){
|
||||||
return app.getString(R.string.local_index_installed) + ": " + app.getResourceManager().getDateFormat().format(new Date(t));
|
return app.getString(R.string.local_index_installed) + ": " + android.text.format.DateFormat.getMediumDateFormat(app)
|
||||||
|
.format(new Date(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInstalledDate(long t, TimeZone timeZone){
|
public String getInstalledDate(long t, TimeZone timeZone){
|
||||||
return app.getResourceManager().getDateFormat().format(new Date(t));
|
return android.text.format.DateFormat.getMediumDateFormat(app).format(new Date(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDescription(LocalIndexInfo info){
|
public void updateDescription(LocalIndexInfo info){
|
||||||
|
@ -208,21 +211,32 @@ public class LocalIndexHelper {
|
||||||
public enum LocalIndexType {
|
public enum LocalIndexType {
|
||||||
MAP_DATA(R.string.local_indexes_cat_map),
|
MAP_DATA(R.string.local_indexes_cat_map),
|
||||||
TILES_DATA(R.string.local_indexes_cat_tile),
|
TILES_DATA(R.string.local_indexes_cat_tile),
|
||||||
SRTM_DATA(R.string.local_indexes_cat_srtm),
|
SRTM_DATA(R.string.local_indexes_cat_srtm, R.drawable.ic_plugin_srtm),
|
||||||
WIKI_DATA(R.string.local_indexes_cat_wiki),
|
WIKI_DATA(R.string.local_indexes_cat_wiki, R.drawable.ic_plugin_wikipedia),
|
||||||
VOICE_DATA(R.string.local_indexes_cat_voice),
|
VOICE_DATA(R.string.local_indexes_cat_voice, R.drawable.ic_action_volume_up),
|
||||||
TTS_VOICE_DATA(R.string.local_indexes_cat_tts);
|
TTS_VOICE_DATA(R.string.local_indexes_cat_tts);
|
||||||
// AV_DATA(R.string.local_indexes_cat_av);;
|
// AV_DATA(R.string.local_indexes_cat_av);;
|
||||||
|
|
||||||
|
@StringRes
|
||||||
private final int resId;
|
private final int resId;
|
||||||
|
@DrawableRes
|
||||||
|
private int iconResource;
|
||||||
|
|
||||||
private LocalIndexType(int resId){
|
private LocalIndexType(@StringRes int resId, @DrawableRes int iconResource){
|
||||||
this.resId = resId;
|
this.resId = resId;
|
||||||
|
this.iconResource = iconResource;
|
||||||
|
}
|
||||||
|
|
||||||
|
private LocalIndexType(@StringRes int resId){
|
||||||
|
this.resId = resId;
|
||||||
|
this.iconResource = R.drawable.ic_map;
|
||||||
}
|
}
|
||||||
public String getHumanString(Context ctx){
|
public String getHumanString(Context ctx){
|
||||||
return ctx.getString(resId);
|
return ctx.getString(resId);
|
||||||
}
|
}
|
||||||
|
public int getIconResource() {
|
||||||
|
return iconResource;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ public class DownloadActivity extends BaseDownloadActivity {
|
||||||
updateDescriptionTextWithSize(this, downloadProgressLayout);
|
updateDescriptionTextWithSize(this, downloadProgressLayout);
|
||||||
int currentTab = 0;
|
int currentTab = 0;
|
||||||
String tab = getIntent() == null || getIntent().getExtras() == null ? null : getIntent().getExtras().getString(TAB_TO_OPEN);
|
String tab = getIntent() == null || getIntent().getExtras() == null ? null : getIntent().getExtras().getString(TAB_TO_OPEN);
|
||||||
|
if (tab != null) {
|
||||||
switch (tab) {
|
switch (tab) {
|
||||||
case DOWNLOAD_TAB:
|
case DOWNLOAD_TAB:
|
||||||
currentTab = DOWNLOAD_TAB_NUMBER;
|
currentTab = DOWNLOAD_TAB_NUMBER;
|
||||||
|
@ -87,6 +88,9 @@ public class DownloadActivity extends BaseDownloadActivity {
|
||||||
currentTab = UPDATES_TAB_NUMBER;
|
currentTab = UPDATES_TAB_NUMBER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
currentTab = DOWNLOAD_TAB_NUMBER;
|
||||||
|
}
|
||||||
|
|
||||||
viewPager = (ViewPager) findViewById(R.id.pager);
|
viewPager = (ViewPager) findViewById(R.id.pager);
|
||||||
PagerSlidingTabStrip mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs);
|
PagerSlidingTabStrip mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs);
|
||||||
|
|
|
@ -1032,7 +1032,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
if (child.isBackupedData()) {
|
if (child.isBackupedData()) {
|
||||||
icon.setImageDrawable(backup);
|
icon.setImageDrawable(backup);
|
||||||
} else {
|
} else {
|
||||||
icon.setImageDrawable(sdcard);
|
icon.setImageDrawable(getContentIcon(ctx, child.getType().getIconResource()));
|
||||||
}
|
}
|
||||||
|
|
||||||
nameTextView.setText(getNameToDisplay(child));
|
nameTextView.setText(getNameToDisplay(child));
|
||||||
|
@ -1050,6 +1050,12 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
nameTextView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
nameTextView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
||||||
}
|
}
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
final String mapDescription = getMapDescription(child.getFileName());
|
||||||
|
if (mapDescription.length() > 0) {
|
||||||
|
builder.append(mapDescription).append(" • ");
|
||||||
|
}
|
||||||
|
|
||||||
if (child.getSize() >= 0) {
|
if (child.getSize() >= 0) {
|
||||||
if (child.getSize() > 100) {
|
if (child.getSize() > 100) {
|
||||||
builder.append(DownloadActivity.formatMb.format(new Object[]{(float) child.getSize() / (1 << 10)}));
|
builder.append(DownloadActivity.formatMb.format(new Object[]{(float) child.getSize() / (1 << 10)}));
|
||||||
|
@ -1059,11 +1065,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
builder.append(" • ");
|
builder.append(" • ");
|
||||||
}
|
}
|
||||||
|
|
||||||
final String mapDescription = getMapDescription(child.getFileName());
|
|
||||||
if (mapDescription.length() > 0) {
|
|
||||||
builder.append(mapDescription).append(" • ");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (child.getType() == LocalIndexType.TILES_DATA) {
|
if (child.getType() == LocalIndexType.TILES_DATA) {
|
||||||
builder.append(ctx.getString(R.string.online_map));
|
builder.append(ctx.getString(R.string.online_map));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1092,6 +1093,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
icon.setVisibility(View.VISIBLE);
|
icon.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Drawable getContentIcon(DownloadActivity context, int resourceId) {
|
||||||
|
return context.getMyApplication().getIconsCache().getContentIcon(resourceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue