diff --git a/OsmAnd/res/layout/download_item_list_section.xml b/OsmAnd/res/layout/download_item_list_section.xml
index a60c8efe1b..2fca263ea1 100644
--- a/OsmAnd/res/layout/download_item_list_section.xml
+++ b/OsmAnd/res/layout/download_item_list_section.xml
@@ -1,24 +1,38 @@
+
+
+ osmand:typeface="@string/font_roboto_medium"
+ tools:text="600Mb"
+ tools:visibility="visible"
+ android:visibility="gone"/>
\ No newline at end of file
diff --git a/OsmAnd/res/layout/local_index.xml b/OsmAnd/res/layout/local_index.xml
index 963893a909..ef7a56e594 100644
--- a/OsmAnd/res/layout/local_index.xml
+++ b/OsmAnd/res/layout/local_index.xml
@@ -5,47 +5,6 @@
android:layout_height="fill_parent"
android:orientation="vertical">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:progressDrawable="?attr/size_progress_bar"
+ tools:progress="50"/>
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
index f51d545fec..901d0502bc 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
@@ -62,6 +62,9 @@ public class DownloadActivity extends BaseDownloadActivity {
}
setContentView(R.layout.download);
+ final View downloadProgressLayout = findViewById(R.id.downloadProgressLayout);
+ downloadProgressLayout.setVisibility(View.VISIBLE);
+ updateDescriptionTextWithSize(this, downloadProgressLayout);
int currentTab = 0;
String tab = getIntent() == null || getIntent().getExtras() == null ? null : getIntent().getExtras().getString(TAB_TO_OPEN);
if (tab != null) {
@@ -245,12 +248,6 @@ public class DownloadActivity extends BaseDownloadActivity {
initFreeVersionBanner();
updateFreeVersionBanner();
updateBannerInProgress();
- downloadProgressLayout.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- new ActiveDownloadsDialogFragment().show(ctx.getSupportFragmentManager(), "dialog");
- }
- });
}
public void updateBannerInProgress() {
@@ -258,8 +255,8 @@ public class DownloadActivity extends BaseDownloadActivity {
final boolean isFinished = basicProgressAsyncTask == null
|| basicProgressAsyncTask.getStatus() == AsyncTask.Status.FINISHED;
if (isFinished) {
- downloadProgressLayout.setVisibility(View.GONE);
- updateFreeVersionBanner();
+ downloadProgressLayout.setOnClickListener(null);
+ updateDescriptionTextWithSize(ctx, downloadProgressLayout);
} else {
boolean indeterminate = basicProgressAsyncTask.isIndeterminate();
String message = basicProgressAsyncTask.getDescription();
@@ -267,7 +264,12 @@ public class DownloadActivity extends BaseDownloadActivity {
setMinimizedFreeVersionBanner(true);
updateAvailableDownloads();
- downloadProgressLayout.setVisibility(View.VISIBLE);
+ downloadProgressLayout.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ new ActiveDownloadsDialogFragment().show(ctx.getSupportFragmentManager(), "dialog");
+ }
+ });
progressBar.setIndeterminate(indeterminate);
if (indeterminate) {
leftTextView.setText(message);
@@ -346,11 +348,12 @@ public class DownloadActivity extends BaseDownloadActivity {
@SuppressWarnings("deprecation")
- public void updateDescriptionTextWithSize(View view){
- TextView descriptionText = (TextView) view.findViewById(R.id.sizeFreeTextView);
- ProgressBar sizeProgress = (ProgressBar) view.findViewById(R.id.memoryLeftProgressBar);
+ public static void updateDescriptionTextWithSize(DownloadActivity activity, View view){
+ TextView descriptionText = (TextView) view.findViewById(R.id.rightTextView);
+ TextView messageTextView = (TextView) view.findViewById(R.id.leftTextView);
+ ProgressBar sizeProgress = (ProgressBar) view.findViewById(R.id.progressBar);
- File dir = getMyApplication().getAppPath("").getParentFile();
+ File dir = activity.getMyApplication().getAppPath("").getParentFile();
String size = formatGb.format(new Object[]{0});
int percent = 0;
if(dir.canRead()){
@@ -358,14 +361,13 @@ public class DownloadActivity extends BaseDownloadActivity {
size = formatGb.format(new Object[]{(float) (fs.getAvailableBlocks()) * fs.getBlockSize() / (1 << 30) });
percent = 100 - (int) (fs.getAvailableBlocks() * 100 / fs.getBlockCount());
}
+ sizeProgress.setIndeterminate(false);
sizeProgress.setProgress(percent);
- String text = getString(R.string.free, size);
- int l = text.indexOf('.');
- if(l == -1) {
- l = text.length();
- }
+ String text = activity.getString(R.string.free, size);
descriptionText.setText(text);
descriptionText.setMovementMethod(LinkMovementMethod.getInstance());
+
+ messageTextView.setText(R.string.device_memory);
}
}
diff --git a/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java
index 81873cbc80..e67e401420 100644
--- a/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java
+++ b/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java
@@ -379,7 +379,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
View v = convertView;
String section = getGroup(groupPosition);
if (v == null) {
- LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ LayoutInflater inflater = LayoutInflater.from(ctx);
v = inflater.inflate(R.layout.download_item_list_section, parent, false);
}
TextView nameView = ((TextView) v.findViewById(R.id.section_name));
diff --git a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java
index d197346cbc..43d0ebacf3 100644
--- a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java
@@ -5,6 +5,7 @@ import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
@@ -15,6 +16,7 @@ import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.view.ActionMode;
import android.support.v7.widget.PopupMenu;
+import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
@@ -104,7 +106,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
listView.setAdapter(listAdapter);
expandAllGroups();
setListView(listView);
- ((DownloadActivity) getActivity()).updateDescriptionTextWithSize(view);
colorDrawables();
return view;
}
@@ -459,7 +460,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
@Override
public void downloadHasFinished() {
- ((DownloadActivity) getActivity()).updateDescriptionTextWithSize(getView());
reloadData();
}
@@ -664,7 +664,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
@Override
public void onDestroyActionMode(ActionMode mode) {
selectionMode = false;
- ((DownloadActivity) getActivity()).updateDescriptionTextWithSize(getView());
listAdapter.cancelFilter();
expandAllGroups();
listAdapter.notifyDataSetChanged();
@@ -1021,8 +1020,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
View v = convertView;
LocalIndexInfo group = getGroup(groupPosition);
if (v == null) {
- LayoutInflater inflater = (LayoutInflater) getDownloadActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- v = inflater.inflate(R.layout.local_index_list_category, parent, false);
+ LayoutInflater inflater = LayoutInflater.from(ctx);
+ v = inflater.inflate(R.layout.download_item_list_section, parent, false);
}
StringBuilder name = new StringBuilder(group.getType().getHumanString(getDownloadActivity()));
if (group.getSubfolder() != null) {
@@ -1031,8 +1030,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
if (group.isBackupedData()) {
name.append(" - ").append(getString(R.string.local_indexes_cat_backup));
}
- TextView nameView = ((TextView) v.findViewById(R.id.category_name));
- TextView sizeView = ((TextView) v.findViewById(R.id.category_size));
+ TextView nameView = ((TextView) v.findViewById(R.id.section_name));
+ TextView sizeView = ((TextView) v.findViewById(R.id.section_description));
List list = data.get(group);
int size = 0;
for (LocalIndexInfo aList : list) {
@@ -1054,14 +1053,15 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
}
sizeView.setText(sz);
+ sizeView.setVisibility(View.VISIBLE);
nameView.setText(name.toString());
- if (!group.isBackupedData()) {
- nameView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
- } else {
- nameView.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
- }
v.setOnClickListener(null);
+
+ TypedValue typedValue = new TypedValue();
+ Resources.Theme theme = ctx.getTheme();
+ theme.resolveAttribute(R.attr.ctx_menu_info_view_bg, typedValue, true);
+ v.setBackgroundColor(typedValue.data);
return v;
}