refactor, fix map screen between fragments
This commit is contained in:
parent
ff570d4b81
commit
edbba11ed7
7 changed files with 119 additions and 132 deletions
|
@ -126,6 +126,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/actionModeBackground">
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/actionModeBackground">
|
||||
|
@ -121,7 +122,7 @@
|
|||
android:minHeight="@dimen/toolbar_height"
|
||||
osmand:layout_collapseMode="pin"
|
||||
osmand:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed"
|
||||
osmand:title="@string/shared_string_import">
|
||||
osmand:title="@string/import_duplicates_title">
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
|
|
|
@ -237,7 +237,9 @@ public class SettingsHelper {
|
|||
}
|
||||
|
||||
SettingsItem item = (SettingsItem) other;
|
||||
return item.getType() == getType() && item.getName().equals(getName());
|
||||
return item.getType() == getType()
|
||||
&& item.getName().equals(getName())
|
||||
&& item.getFileName().equals(getFileName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,7 +264,17 @@ public class SettingsHelper {
|
|||
}
|
||||
|
||||
@NonNull
|
||||
public abstract List<T> excludeDuplicateItems();
|
||||
public List<T> excludeDuplicateItems() {
|
||||
if (!items.isEmpty()) {
|
||||
for (T item : items) {
|
||||
if (isDuplicate(item)) {
|
||||
duplicateItems.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
items.removeAll(duplicateItems);
|
||||
return duplicateItems;
|
||||
}
|
||||
|
||||
public abstract boolean isDuplicate(@NonNull T item);
|
||||
|
||||
|
@ -805,7 +817,7 @@ public class SettingsHelper {
|
|||
@Override
|
||||
public void readFromStream(@NonNull InputStream inputStream) throws IOException, IllegalArgumentException {
|
||||
OutputStream output;
|
||||
if (!file.exists() || file.exists() && shouldReplace) {
|
||||
if (!file.exists() || shouldReplace) {
|
||||
output = new FileOutputStream(file);
|
||||
} else {
|
||||
output = new FileOutputStream(renameFile(file));
|
||||
|
@ -870,18 +882,6 @@ public class SettingsHelper {
|
|||
return actionRegistry.generateUniqueName(item, app);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public List<QuickAction> excludeDuplicateItems() {
|
||||
for (QuickAction item : items) {
|
||||
if (isDuplicate(item)) {
|
||||
duplicateItems.add(item);
|
||||
}
|
||||
}
|
||||
items.removeAll(duplicateItems);
|
||||
return duplicateItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if (!items.isEmpty() || !duplicateItems.isEmpty()) {
|
||||
|
@ -1061,21 +1061,6 @@ public class SettingsHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public List<PoiUIFilter> excludeDuplicateItems() {
|
||||
if (!items.isEmpty()) {
|
||||
for (PoiUIFilter item : items) {
|
||||
if (isDuplicate(item)) {
|
||||
duplicateItems.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
items.removeAll(duplicateItems);
|
||||
return duplicateItems;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public PoiUIFilter renameItem(@NonNull PoiUIFilter item) {
|
||||
|
@ -1261,21 +1246,6 @@ public class SettingsHelper {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public List<ITileSource> excludeDuplicateItems() {
|
||||
for (String name : existingItemsNames) {
|
||||
for (ITileSource tileSource : items) {
|
||||
if (name.equals(tileSource.getName())) {
|
||||
duplicateItems.add(tileSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
items.removeAll(duplicateItems);
|
||||
return duplicateItems;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ITileSource renameItem(@NonNull ITileSource item) {
|
||||
|
@ -1510,28 +1480,9 @@ public class SettingsHelper {
|
|||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public List<AvoidRoadInfo> excludeDuplicateItems() {
|
||||
for (AvoidRoadInfo item : items) {
|
||||
if (isDuplicate(item)) {
|
||||
duplicateItems.add(item);
|
||||
}
|
||||
}
|
||||
items.removeAll(duplicateItems);
|
||||
return duplicateItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDuplicate(@NonNull AvoidRoadInfo item) {
|
||||
for (AvoidRoadInfo existingItem : existingItems) {
|
||||
if (item.latitude == existingItem.latitude
|
||||
&& item.longitude == existingItem.longitude
|
||||
&& item.name.equals(existingItem.name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return existingItems.contains(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1541,7 +1492,7 @@ public class SettingsHelper {
|
|||
|
||||
@NonNull
|
||||
@Override
|
||||
public AvoidRoadInfo renameItem(AvoidRoadInfo item) {
|
||||
public AvoidRoadInfo renameItem(@NonNull AvoidRoadInfo item) {
|
||||
int number = 0;
|
||||
while (true) {
|
||||
number++;
|
||||
|
@ -1831,7 +1782,7 @@ public class SettingsHelper {
|
|||
|| item != null && !collecting && !item.shouldReadOnCollecting()) {
|
||||
try {
|
||||
for (SettingsItem settingsItem : items) {
|
||||
if (item.getFileName().equals(settingsItem.getFileName())) {
|
||||
if (item.equals(settingsItem)) {
|
||||
item.setShouldReplace(settingsItem.shouldReplace);
|
||||
item.getReader().readFromStream(ois);
|
||||
}
|
||||
|
|
|
@ -140,6 +140,7 @@ import net.osmand.plus.settings.BaseSettingsFragment;
|
|||
import net.osmand.plus.settings.BaseSettingsFragment.SettingsScreenType;
|
||||
import net.osmand.plus.settings.ConfigureProfileFragment;
|
||||
import net.osmand.plus.settings.DataStorageFragment;
|
||||
import net.osmand.plus.settings.ImportSettingsFragment;
|
||||
import net.osmand.plus.settings.ProfileAppearanceFragment;
|
||||
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
|
||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||
|
@ -732,6 +733,11 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
if ( quickActionListFragment != null && quickActionListFragment.isVisible()) {
|
||||
this.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN, null);
|
||||
}
|
||||
ImportSettingsFragment importSettingsFragment = getImportSettingsFragment();
|
||||
if (importSettingsFragment != null) {
|
||||
importSettingsFragment.showExitDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
@ -2447,6 +2453,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
return getFragment(QuickActionListFragment.TAG);
|
||||
}
|
||||
|
||||
public ImportSettingsFragment getImportSettingsFragment() {
|
||||
return getFragment(ImportSettingsFragment.TAG);
|
||||
}
|
||||
|
||||
public void backToConfigureProfileFragment() {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
int backStackEntryCount = fragmentManager.getBackStackEntryCount();
|
||||
|
|
|
@ -402,5 +402,20 @@ public class AvoidSpecificRoads {
|
|||
public double longitude;
|
||||
public String name;
|
||||
public String appModeKey;
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
|
||||
AvoidRoadInfo other = (AvoidRoadInfo) obj;
|
||||
return Math.abs(latitude - other.latitude) < 0.00001
|
||||
&& Math.abs(longitude - other.longitude) < 0.00001
|
||||
&& name.equals(other.name);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,13 @@
|
|||
package net.osmand.plus.settings;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.AppBarLayout;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v4.widget.NestedScrollView;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
@ -16,6 +18,7 @@ import android.view.ViewGroup;
|
|||
import android.view.ViewTreeObserver;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.plus.AppInitializer;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
|
@ -24,7 +27,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.SettingsHelper;
|
||||
import net.osmand.plus.SettingsHelper.SettingsItem;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.quickaction.QuickAction;
|
||||
|
@ -37,9 +40,9 @@ import java.util.List;
|
|||
import static net.osmand.plus.settings.ImportSettingsFragment.getDuplicatesData;
|
||||
|
||||
|
||||
public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implements View.OnClickListener {
|
||||
public class ImportDuplicatesFragment extends BaseOsmAndFragment implements View.OnClickListener {
|
||||
|
||||
public static final String TAG = ImportSettingsFragment.class.getSimpleName();
|
||||
public static final String TAG = ImportDuplicatesFragment.class.getSimpleName();
|
||||
private OsmandApplication app;
|
||||
private RecyclerView list;
|
||||
private LinearLayout buttonsContainer;
|
||||
|
@ -55,26 +58,28 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
|
|||
fragment.setDuplicatesList(duplicatesList);
|
||||
fragment.setSettingsItems(settingsItems);
|
||||
fragment.setFile(file);
|
||||
fragment.show(fm, TAG);
|
||||
fm.beginTransaction().replace(R.id.fragmentContainer, fragment, TAG).addToBackStack(null).commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
app = getMyApplication();
|
||||
nightMode = !getSettings().isLightContent();
|
||||
app = requireMyApplication();
|
||||
nightMode = !app.getSettings().isLightContent();
|
||||
if (settingsItems == null) {
|
||||
settingsItems = app.getSettingsHelper().getSettingsItems();
|
||||
if (settingsItems != null) {
|
||||
duplicatesList = getDuplicatesData(settingsItems);
|
||||
} else {
|
||||
dismiss();
|
||||
// fm.beginTransaction().remove(this).commit();
|
||||
|
||||
// dismiss();
|
||||
}
|
||||
}
|
||||
if (file == null) {
|
||||
file = app.getSettingsHelper().getSettingsFile();
|
||||
if (file == null) {
|
||||
dismiss();
|
||||
// dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +89,8 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
inflater = UiUtilities.getInflater(app, nightMode);
|
||||
View root = inflater.inflate(R.layout.fragment_import_duplicates, container, false);
|
||||
setupToolbar((Toolbar) root.findViewById(R.id.toolbar));
|
||||
AppBarLayout appBar = root.findViewById(R.id.appbar);
|
||||
setupToolbar((Toolbar) root.findViewById(R.id.toolbar), appBar);
|
||||
ComplexButton replaceAllBtn = root.findViewById(R.id.replace_all_btn);
|
||||
ComplexButton keepBothBtn = root.findViewById(R.id.keep_both_btn);
|
||||
buttonsContainer = root.findViewById(R.id.buttons_container);
|
||||
|
@ -118,29 +124,18 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
|
|||
}
|
||||
}
|
||||
});
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
AndroidUtils.addStatusBarPadding21v(app, root);
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
return new Dialog(requireActivity(), getTheme()) {
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
FragmentManager fm = getFragmentManager();
|
||||
if (fm != null) {
|
||||
ImportSettingsFragment.showInstance(fm, null, file);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
DuplicatesSettingsAdapter adapter = new DuplicatesSettingsAdapter(getMyApplication(), prepareDuplicates(), nightMode);
|
||||
DuplicatesSettingsAdapter adapter = new DuplicatesSettingsAdapter(app, prepareDuplicates(), nightMode);
|
||||
list.setLayoutManager(new LinearLayoutManager(getMyApplication()));
|
||||
list.setAdapter(adapter);
|
||||
}
|
||||
|
@ -220,6 +215,11 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
return nightMode ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
|
||||
}
|
||||
|
||||
private void importItems(boolean shouldReplace) {
|
||||
for (SettingsItem item : settingsItems) {
|
||||
item.setShouldReplace(shouldReplace);
|
||||
|
@ -240,10 +240,18 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
|
|||
}
|
||||
}
|
||||
});
|
||||
dismiss();
|
||||
FragmentManager fm = getFragmentManager();
|
||||
if (fm != null) {
|
||||
fm.popBackStackImmediate();
|
||||
Fragment fragment = fm.findFragmentByTag(ImportSettingsFragment.TAG);
|
||||
if (fragment != null) {
|
||||
fm.beginTransaction().remove(fragment).commit();
|
||||
fm.popBackStackImmediate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupToolbar(Toolbar toolbar) {
|
||||
private void setupToolbar(Toolbar toolbar, AppBarLayout appBarLayout) {
|
||||
toolbar.setNavigationIcon(getPaintedContentIcon(R.drawable.ic_arrow_back,
|
||||
nightMode
|
||||
? getResources().getColor(R.color.active_buttons_and_links_text_dark)
|
||||
|
@ -254,12 +262,12 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement
|
|||
public void onClick(View v) {
|
||||
FragmentManager fm = getFragmentManager();
|
||||
if (fm != null) {
|
||||
fm.popBackStackImmediate();
|
||||
ImportSettingsFragment.showInstance(fm, null, file);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
toolbar.setTitle(getString(R.string.import_duplicates_title));
|
||||
ViewCompat.setElevation(appBarLayout, 5.0f);
|
||||
}
|
||||
|
||||
public void setDuplicatesList(List<? super Object> duplicatesList) {
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package net.osmand.plus.settings;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.AppBarLayout;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -14,6 +16,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.ExpandableListView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.map.TileSourceManager;
|
||||
import net.osmand.plus.AppInitializer;
|
||||
|
@ -24,7 +27,7 @@ import net.osmand.plus.SQLiteTileSource;
|
|||
import net.osmand.plus.SettingsHelper;
|
||||
import net.osmand.plus.SettingsHelper.SettingsItem;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.profiles.AdditionalDataWrapper;
|
||||
|
@ -35,7 +38,7 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ImportSettingsFragment extends BaseOsmAndDialogFragment
|
||||
public class ImportSettingsFragment extends BaseOsmAndFragment
|
||||
implements View.OnClickListener {
|
||||
|
||||
public static final String TAG = ImportSettingsFragment.class.getSimpleName();
|
||||
|
@ -52,25 +55,19 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
|
|||
ImportSettingsFragment fragment = new ImportSettingsFragment();
|
||||
fragment.setSettingsItems(settingsItems);
|
||||
fragment.setFile(file);
|
||||
fragment.show(fm, TAG);
|
||||
fm.beginTransaction().replace(R.id.fragmentContainer, fragment, TAG).addToBackStack(null).commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
app = getMyApplication();
|
||||
nightMode = !getSettings().isLightContent();
|
||||
app = requireMyApplication();
|
||||
nightMode = !app.getSettings().isLightContent();
|
||||
if (settingsItems == null) {
|
||||
settingsItems = app.getSettingsHelper().getSettingsItems();
|
||||
if (settingsItems == null) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
if (file == null) {
|
||||
file = app.getSettingsHelper().getSettingsFile();
|
||||
if (file == null) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,33 +76,26 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
inflater = UiUtilities.getInflater(app, nightMode);
|
||||
View root = inflater.inflate(R.layout.fragment_import, container, false);
|
||||
setupToolbar((Toolbar) root.findViewById(R.id.toolbar));
|
||||
AppBarLayout appBar = root.findViewById(R.id.appbar);
|
||||
setupToolbar((Toolbar) root.findViewById(R.id.toolbar), appBar);
|
||||
TextViewEx continueBtn = root.findViewById(R.id.continue_button);
|
||||
selectBtn = root.findViewById(R.id.select_button);
|
||||
expandableList = root.findViewById(R.id.list);
|
||||
continueBtn.setOnClickListener(this);
|
||||
selectBtn.setOnClickListener(this);
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
AndroidUtils.addStatusBarPadding21v(app, root);
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
adapter = new ExportImportSettingsAdapter(getMyApplication(), getSettingsToOperate(), nightMode, true);
|
||||
adapter = new ExportImportSettingsAdapter(app, getSettingsToOperate(), nightMode, true);
|
||||
expandableList.setAdapter(adapter);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
return new Dialog(requireActivity(), getTheme()) {
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
showExitDialog();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
|
@ -146,10 +136,12 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
|
|||
}
|
||||
}
|
||||
});
|
||||
dismiss();
|
||||
FragmentManager fm = getFragmentManager();
|
||||
if (fm != null) {
|
||||
fm.popBackStackImmediate();
|
||||
}
|
||||
} else {
|
||||
ImportDuplicatesFragment.showInstance(getFragmentManager(), duplicateItems, settingsItems, file);
|
||||
dismiss();
|
||||
ImportDuplicatesFragment.showInstance(requireActivity().getSupportFragmentManager(), duplicateItems, settingsItems, file);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,22 +203,22 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
|
|||
|| object instanceof SQLiteTileSource) {
|
||||
tileSourceTemplates.add((ITileSource) object);
|
||||
} else if (object instanceof File) {
|
||||
settingsItems.add(new SettingsHelper.FileSettingsItem(getMyApplication(), (File) object));
|
||||
settingsItems.add(new SettingsHelper.FileSettingsItem(app, (File) object));
|
||||
} else if (object instanceof AvoidRoadInfo) {
|
||||
avoidRoads.add((AvoidRoadInfo) object);
|
||||
}
|
||||
}
|
||||
if (!quickActions.isEmpty()) {
|
||||
settingsItems.add(new SettingsHelper.QuickActionSettingsItem(getMyApplication(), quickActions));
|
||||
settingsItems.add(new SettingsHelper.QuickActionSettingsItem(app, quickActions));
|
||||
}
|
||||
if (!poiUIFilters.isEmpty()) {
|
||||
settingsItems.add(new SettingsHelper.PoiUiFilterSettingsItem(getMyApplication(), poiUIFilters));
|
||||
settingsItems.add(new SettingsHelper.PoiUiFilterSettingsItem(app, poiUIFilters));
|
||||
}
|
||||
if (!tileSourceTemplates.isEmpty()) {
|
||||
settingsItems.add(new SettingsHelper.MapSourcesSettingsItem(getMyApplication(), tileSourceTemplates));
|
||||
settingsItems.add(new SettingsHelper.MapSourcesSettingsItem(app, tileSourceTemplates));
|
||||
}
|
||||
if (!avoidRoads.isEmpty()) {
|
||||
settingsItems.add(new SettingsHelper.AvoidRoadsSettingsItem(getMyApplication(), avoidRoads));
|
||||
settingsItems.add(new SettingsHelper.AvoidRoadsSettingsItem(app, avoidRoads));
|
||||
}
|
||||
return settingsItems;
|
||||
}
|
||||
|
@ -303,6 +295,11 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
|
|||
return settingsToOperate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
return nightMode ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
|
||||
}
|
||||
|
||||
public void showExitDialog() {
|
||||
Context themedContext = UiUtilities.getThemedContext(getActivity(), nightMode);
|
||||
AlertDialog.Builder dismissDialog = new AlertDialog.Builder(themedContext);
|
||||
|
@ -312,13 +309,16 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
|
|||
dismissDialog.setPositiveButton(R.string.shared_string_exit, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dismiss();
|
||||
FragmentManager fm = getFragmentManager();
|
||||
if (fm != null) {
|
||||
fm.popBackStackImmediate();
|
||||
}
|
||||
}
|
||||
});
|
||||
dismissDialog.show();
|
||||
}
|
||||
|
||||
private void setupToolbar(Toolbar toolbar) {
|
||||
private void setupToolbar(Toolbar toolbar, AppBarLayout appBarLayout) {
|
||||
toolbar.setNavigationIcon(getPaintedContentIcon(R.drawable.ic_action_close, nightMode
|
||||
? getResources().getColor(R.color.active_buttons_and_links_text_dark)
|
||||
: getResources().getColor(R.color.active_buttons_and_links_text_light)));
|
||||
|
@ -329,6 +329,7 @@ public class ImportSettingsFragment extends BaseOsmAndDialogFragment
|
|||
showExitDialog();
|
||||
}
|
||||
});
|
||||
ViewCompat.setElevation(appBarLayout, 5.0f);
|
||||
}
|
||||
|
||||
public void setFile(File file) {
|
||||
|
|
Loading…
Reference in a new issue