fix #1820
This commit is contained in:
parent
b2e8d70dd5
commit
58256a0ea1
8 changed files with 41 additions and 15 deletions
|
@ -6,6 +6,18 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/listMessageTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:padding="@dimen/list_content_padding"
|
||||
tools:text="Germany"
|
||||
android:gravity="center"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -38,7 +38,7 @@ public class DashRecentsFragment extends DashLocationFragment {
|
|||
private static final String ROW_NUMBER_TAG = TAG + "_row_number";
|
||||
static final DashFragmentData FRAGMENT_DATA =
|
||||
new DashFragmentData(TAG, DashRecentsFragment.class, TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 100, ROW_NUMBER_TAG);
|
||||
new DashboardOnMap.DefaultShouldShow(), 80, ROW_NUMBER_TAG);
|
||||
|
||||
@Override
|
||||
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
|
|
@ -33,7 +33,6 @@ import com.github.ksoichiro.android.observablescrollview.ScrollState;
|
|||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.osm.edit.OSMSettings;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnRowItemClick;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.osmand.plus.dashboard.tools;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.util.Log;
|
||||
|
|
|
@ -59,7 +59,6 @@ public class DownloadActivity extends BaseDownloadActivity {
|
|||
DownloadResources indexes = getDownloadThread().getIndexes();
|
||||
if (!indexes.isDownloadedFromInternet) {
|
||||
getDownloadThread().runReloadIndexFiles();
|
||||
|
||||
}
|
||||
|
||||
setContentView(R.layout.download);
|
||||
|
|
|
@ -36,7 +36,7 @@ public class IndexItem implements Comparable<IndexItem> {
|
|||
|
||||
|
||||
public IndexItem(String fileName, String description, long timestamp, String size, long contentSize,
|
||||
long containerSize, DownloadActivityType tp) {
|
||||
long containerSize, @NonNull DownloadActivityType tp) {
|
||||
this.fileName = fileName;
|
||||
this.description = description;
|
||||
this.timestamp = timestamp;
|
||||
|
|
|
@ -31,7 +31,6 @@ import android.widget.Toast;
|
|||
|
||||
public class ItemViewHolder {
|
||||
|
||||
|
||||
protected final TextView nameTextView;
|
||||
protected final TextView descrTextView;
|
||||
protected final ImageView leftImageView;
|
||||
|
@ -206,7 +205,7 @@ public class ItemViewHolder {
|
|||
rightImageButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(silentCancelDownload) {
|
||||
if (silentCancelDownload) {
|
||||
context.getDownloadThread().cancelDownload(indexItem);
|
||||
} else {
|
||||
context.makeSureUserCancelDownload(indexItem);
|
||||
|
|
|
@ -41,7 +41,13 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.update_index_frament, container, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
updateErrorMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayAdapter<?> getAdapter() {
|
||||
return listAdapter;
|
||||
|
@ -67,13 +73,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
|||
public void invalidateListView() {
|
||||
DownloadResources indexes = getMyActivity().getDownloadThread().getIndexes();
|
||||
List<IndexItem> indexItems = indexes.getItemsToUpdate();
|
||||
if (indexItems.size() == 0) {
|
||||
if (indexes.isDownloadedFromInternet) {
|
||||
indexItems.add(new IndexItem(getString(R.string.everything_up_to_date), "", 0, "", 0, 0, null));
|
||||
} else {
|
||||
indexItems.add(new IndexItem(getString(R.string.no_index_file_to_download), "", 0, "", 0, 0, null));
|
||||
}
|
||||
}
|
||||
|
||||
final OsmandRegions osmandRegions =
|
||||
getMyApplication().getResourceManager().getOsmandRegions();
|
||||
listAdapter = new UpdateIndexAdapter(getMyActivity(), R.layout.download_index_list_item, indexItems);
|
||||
|
@ -85,6 +85,24 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
|||
}
|
||||
});
|
||||
setListAdapter(listAdapter);
|
||||
updateErrorMessage();
|
||||
|
||||
}
|
||||
|
||||
private void updateErrorMessage() {
|
||||
final View view = getView();
|
||||
if (view == null) return;
|
||||
TextView listMessageTextView = (TextView) view.findViewById(R.id.listMessageTextView);
|
||||
|
||||
if (getListAdapter() != null && getListAdapter().getCount() == 0) {
|
||||
final DownloadResources indexes = getMyActivity().getDownloadThread().getIndexes();
|
||||
int messageId = indexes.isDownloadedFromInternet ? R.string.everything_up_to_date
|
||||
: R.string.no_index_file_to_download;
|
||||
listMessageTextView.setText(messageId);
|
||||
listMessageTextView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
listMessageTextView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUpdateAllButton() {
|
||||
|
|
Loading…
Reference in a new issue