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_selected="true"/>
|
||||
<item android:drawable="@color/list_item_light_pressed" android:state_pressed="true"/>
|
||||
|
||||
</selector>
|
|
@ -5,6 +5,7 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:theme="@style/FreeVersionBanner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/osmo_header_dark"
|
||||
|
|
|
@ -137,6 +137,11 @@
|
|||
<item name="colorAccent">@color/color_white</item>
|
||||
</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">
|
||||
<item name="list_divider">@color/list_divider_light</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 android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.StringRes;
|
||||
|
||||
|
||||
public class LocalIndexHelper {
|
||||
|
@ -38,11 +40,12 @@ public class LocalIndexHelper {
|
|||
}
|
||||
|
||||
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){
|
||||
return app.getResourceManager().getDateFormat().format(new Date(t));
|
||||
return android.text.format.DateFormat.getMediumDateFormat(app).format(new Date(t));
|
||||
}
|
||||
|
||||
public void updateDescription(LocalIndexInfo info){
|
||||
|
@ -208,21 +211,32 @@ public class LocalIndexHelper {
|
|||
public enum LocalIndexType {
|
||||
MAP_DATA(R.string.local_indexes_cat_map),
|
||||
TILES_DATA(R.string.local_indexes_cat_tile),
|
||||
SRTM_DATA(R.string.local_indexes_cat_srtm),
|
||||
WIKI_DATA(R.string.local_indexes_cat_wiki),
|
||||
VOICE_DATA(R.string.local_indexes_cat_voice),
|
||||
SRTM_DATA(R.string.local_indexes_cat_srtm, R.drawable.ic_plugin_srtm),
|
||||
WIKI_DATA(R.string.local_indexes_cat_wiki, R.drawable.ic_plugin_wikipedia),
|
||||
VOICE_DATA(R.string.local_indexes_cat_voice, R.drawable.ic_action_volume_up),
|
||||
TTS_VOICE_DATA(R.string.local_indexes_cat_tts);
|
||||
// AV_DATA(R.string.local_indexes_cat_av);;
|
||||
|
||||
private final int resId;
|
||||
|
||||
private LocalIndexType(int resId){
|
||||
@StringRes
|
||||
private final int resId;
|
||||
@DrawableRes
|
||||
private int iconResource;
|
||||
|
||||
private LocalIndexType(@StringRes int resId, @DrawableRes int iconResource){
|
||||
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){
|
||||
return ctx.getString(resId);
|
||||
}
|
||||
public int getIconResource() {
|
||||
return iconResource;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -76,16 +76,20 @@ public class DownloadActivity extends BaseDownloadActivity {
|
|||
updateDescriptionTextWithSize(this, downloadProgressLayout);
|
||||
int currentTab = 0;
|
||||
String tab = getIntent() == null || getIntent().getExtras() == null ? null : getIntent().getExtras().getString(TAB_TO_OPEN);
|
||||
switch (tab) {
|
||||
case DOWNLOAD_TAB:
|
||||
currentTab = DOWNLOAD_TAB_NUMBER;
|
||||
break;
|
||||
case LOCAL_TAB:
|
||||
currentTab = LOCAL_TAB_NUMBER;
|
||||
break;
|
||||
case UPDATES_TAB:
|
||||
currentTab = UPDATES_TAB_NUMBER;
|
||||
break;
|
||||
if (tab != null) {
|
||||
switch (tab) {
|
||||
case DOWNLOAD_TAB:
|
||||
currentTab = DOWNLOAD_TAB_NUMBER;
|
||||
break;
|
||||
case LOCAL_TAB:
|
||||
currentTab = LOCAL_TAB_NUMBER;
|
||||
break;
|
||||
case UPDATES_TAB:
|
||||
currentTab = UPDATES_TAB_NUMBER;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
currentTab = DOWNLOAD_TAB_NUMBER;
|
||||
}
|
||||
|
||||
viewPager = (ViewPager) findViewById(R.id.pager);
|
||||
|
|
|
@ -1032,7 +1032,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
if (child.isBackupedData()) {
|
||||
icon.setImageDrawable(backup);
|
||||
} else {
|
||||
icon.setImageDrawable(sdcard);
|
||||
icon.setImageDrawable(getContentIcon(ctx, child.getType().getIconResource()));
|
||||
}
|
||||
|
||||
nameTextView.setText(getNameToDisplay(child));
|
||||
|
@ -1050,6 +1050,12 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
nameTextView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
||||
}
|
||||
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() > 100) {
|
||||
builder.append(DownloadActivity.formatMb.format(new Object[]{(float) child.getSize() / (1 << 10)}));
|
||||
|
@ -1059,11 +1065,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
builder.append(" • ");
|
||||
}
|
||||
|
||||
final String mapDescription = getMapDescription(child.getFileName());
|
||||
if (mapDescription.length() > 0) {
|
||||
builder.append(mapDescription).append(" • ");
|
||||
}
|
||||
|
||||
if (child.getType() == LocalIndexType.TILES_DATA) {
|
||||
builder.append(ctx.getString(R.string.online_map));
|
||||
} else {
|
||||
|
@ -1092,6 +1093,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
icon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getContentIcon(DownloadActivity context, int resourceId) {
|
||||
return context.getMyApplication().getIconsCache().getContentIcon(resourceId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue