Updated local indexes view
This commit is contained in:
parent
cdd9e45e7f
commit
706f32e5d5
3 changed files with 46 additions and 12 deletions
|
@ -6,18 +6,26 @@
|
|||
android:background="?attr/expandable_list_item_background"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:paddingTop="4dp">
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_local_index"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical"/>
|
||||
android:visibility="gone"
|
||||
android:layout_marginRight="@dimen/local_index_check_right_margin"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:src="@drawable/ic_sdcard"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
||||
android:focusable="false"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
|
@ -45,7 +53,6 @@
|
|||
style="@style/ListText.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:gravity="right"
|
||||
tools:text="@string/app_version"/>
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
<dimen name="list_header_bottom_margin">8dp</dimen>
|
||||
<dimen name="bottom_tool_bar_size">48dp</dimen>
|
||||
<dimen name="favorites_icon_right_margin">18dp</dimen>
|
||||
<dimen name="local_index_check_right_margin">10dp</dimen>
|
||||
<dimen name="favorites_icon_top_margin">13dp</dimen>
|
||||
<dimen name="dialog_elements_vertical_margin">16dp</dimen>
|
||||
<dimen name="dialog_content_margin">24dp</dimen>
|
||||
|
|
|
@ -60,6 +60,7 @@ import android.widget.CheckBox;
|
|||
import android.widget.EditText;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -87,6 +88,10 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
private TextView descriptionText;
|
||||
private ProgressBar sizeProgress;
|
||||
|
||||
Drawable backup;
|
||||
Drawable sdcard;
|
||||
Drawable planet;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.local_index, container, false);
|
||||
|
@ -102,6 +107,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
descriptionText = (TextView) view.findViewById(R.id.memory_size);
|
||||
sizeProgress = (ProgressBar) view.findViewById(R.id.memory_progress);
|
||||
updateDescriptionTextWithSize();
|
||||
colorDrawables();
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -123,7 +129,19 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
|
||||
private void colorDrawables(){
|
||||
boolean light = getMyApplication().getSettings().isLightContent();
|
||||
backup = getActivity().getResources().getDrawable(R.drawable.ic_type_archive);
|
||||
backup.mutate();
|
||||
if (light) {
|
||||
backup.setColorFilter(0xff727272, PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
sdcard = getActivity().getResources().getDrawable(R.drawable.ic_sdcard);
|
||||
sdcard.mutate();
|
||||
sdcard.setColorFilter(getActivity().getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
@ -936,6 +954,15 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
openPopUpMenu(v, child);
|
||||
}
|
||||
});
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
if (child.isBackupedData()) {
|
||||
icon.setImageDrawable(backup);
|
||||
} else {
|
||||
icon.setImageDrawable(sdcard);
|
||||
}
|
||||
|
||||
|
||||
|
||||
viewName.setText(getNameToDisplay(child));
|
||||
if (child.isNotSupported()) {
|
||||
viewName.setTextColor(warningColor);
|
||||
|
@ -976,6 +1003,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
final CheckBox checkbox = (CheckBox) v.findViewById(R.id.check_local_index);
|
||||
checkbox.setVisibility(selectionMode ? View.VISIBLE : View.GONE);
|
||||
if (selectionMode) {
|
||||
icon.setVisibility(View.GONE);
|
||||
checkbox.setChecked(selectedItems.contains(child));
|
||||
checkbox.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
|
@ -988,6 +1016,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -999,11 +1029,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||
final boolean restore = info.isBackupedData();
|
||||
Drawable backup = getActivity().getResources().getDrawable(R.drawable.ic_type_archive);
|
||||
backup.mutate();
|
||||
if (light) {
|
||||
backup.setColorFilter(0xff727272, PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
|
||||
MenuItem item = optionsMenu.getMenu().add(restore? R.string.local_index_mi_restore : R.string.local_index_mi_backup)
|
||||
.setIcon(backup);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
|
|
Loading…
Reference in a new issue