Now item button state updates after variable changes.
This commit is contained in:
parent
fc3f85e0fb
commit
1cb06e35cf
5 changed files with 13 additions and 25 deletions
|
@ -20,6 +20,7 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -36,6 +37,8 @@ import net.osmand.plus.download.items.WorldItemsFragment;
|
|||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.text.MessageFormat;
|
||||
|
@ -49,6 +52,7 @@ import java.util.Set;
|
|||
|
||||
|
||||
public class DownloadActivity extends BaseDownloadActivity implements DialogDismissListener {
|
||||
private static final Log LOG = PlatformUtil.getLog(DownloadActivity.class);
|
||||
private List<LocalIndexInfo> localIndexInfos = new ArrayList<>();
|
||||
|
||||
private String initialFilter = "";
|
||||
|
@ -158,7 +162,10 @@ public class DownloadActivity extends BaseDownloadActivity implements DialogDism
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
LOG.debug("onResume()");
|
||||
// TODO: 10/16/15 Review: seems like doing nothing
|
||||
getMyApplication().getAppCustomization().resumeActivity(DownloadActivity.class, this);
|
||||
updateFragments();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.osmand.plus.WorldRegion;
|
|||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivityType;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||
|
||||
import java.text.DateFormat;
|
||||
|
@ -54,20 +55,15 @@ public class ItemViewHolder extends TwoLineWithImagesViewHolder {
|
|||
textColorSecondary = typedValue.data;
|
||||
}
|
||||
|
||||
public void setSrtmDisabled(boolean srtmDisabled) {
|
||||
this.srtmDisabled = srtmDisabled;
|
||||
}
|
||||
|
||||
public void setNauticalPluginDisabled(boolean nauticalPluginDisabled) {
|
||||
this.nauticalPluginDisabled = nauticalPluginDisabled;
|
||||
}
|
||||
|
||||
public void setFreeVersion(boolean freeVersion) {
|
||||
this.freeVersion = freeVersion;
|
||||
public void initAppStatusVariables() {
|
||||
srtmDisabled = OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) == null;
|
||||
nauticalPluginDisabled = OsmandPlugin.getEnabledPlugin(NauticalMapsPlugin.class) == null;
|
||||
freeVersion = Version.isFreeVersion(context.getMyApplication());
|
||||
}
|
||||
|
||||
public void bindIndexItem(final IndexItem indexItem,
|
||||
boolean showTypeInTitle, boolean showTypeInDesc, int progress) {
|
||||
initAppStatusVariables();
|
||||
boolean disabled = false;
|
||||
rightButtonAction = RightButtonAction.UNKNOWN;
|
||||
rightImageButton.setClickable(false);
|
||||
|
|
|
@ -241,9 +241,6 @@ public class RegionItemsFragment extends OsmandExpandableListFragment
|
|||
} else {
|
||||
viewHolder = (ItemViewHolder) convertView.getTag();
|
||||
}
|
||||
viewHolder.setSrtmDisabled(srtmDisabled);
|
||||
viewHolder.setNauticalPluginDisabled(nauticalPluginDisabled);
|
||||
viewHolder.setFreeVersion(freeVersion);
|
||||
final Object child = getChild(groupPosition, childPosition);
|
||||
|
||||
if (child instanceof WorldRegion) {
|
||||
|
|
|
@ -224,9 +224,6 @@ public class SearchItemsFragment extends Fragment {
|
|||
} else {
|
||||
viewHolder = (ItemViewHolder) convertView.getTag();
|
||||
}
|
||||
viewHolder.setSrtmDisabled(srtmDisabled);
|
||||
viewHolder.setNauticalPluginDisabled(nauticalPluginDisabled);
|
||||
viewHolder.setFreeVersion(freeVersion);
|
||||
|
||||
if (item instanceof WorldRegion) {
|
||||
viewHolder.bindRegion((WorldRegion) item);
|
||||
|
|
|
@ -210,18 +210,12 @@ public class WorldItemsFragment extends OsmandExpandableListFragment
|
|||
|
||||
private Map<String, List<Object>> data = new LinkedHashMap<>();
|
||||
private List<String> sections = new LinkedList<>();
|
||||
private boolean srtmDisabled;
|
||||
private boolean nauticalPluginDisabled;
|
||||
private boolean freeVersion;
|
||||
|
||||
private class SimpleViewHolder {
|
||||
TextView textView;
|
||||
}
|
||||
|
||||
public WorldItemsAdapter(Context ctx) {
|
||||
srtmDisabled = OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) == null;
|
||||
nauticalPluginDisabled = OsmandPlugin.getEnabledPlugin(NauticalMapsPlugin.class) == null;
|
||||
freeVersion = Version.isFreeVersion(getMyApplication());
|
||||
TypedArray ta = ctx.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
|
||||
ta.recycle();
|
||||
}
|
||||
|
@ -302,9 +296,6 @@ public class WorldItemsFragment extends OsmandExpandableListFragment
|
|||
} else {
|
||||
viewHolder = (ItemViewHolder) convertView.getTag();
|
||||
}
|
||||
viewHolder.setSrtmDisabled(srtmDisabled);
|
||||
viewHolder.setNauticalPluginDisabled(nauticalPluginDisabled);
|
||||
viewHolder.setFreeVersion(freeVersion);
|
||||
viewHolder.bindIndexItem(item.getIndexItem(), false, false);
|
||||
} else if (groupPosition == voicePromptsIndex) {
|
||||
String item = (String)child;
|
||||
|
|
Loading…
Reference in a new issue