Remove unnecessary call to listener and fix possible crash

This commit is contained in:
Vitaliy 2020-03-05 18:06:10 +02:00
parent 2e89b0f3ab
commit 2c7430e567
3 changed files with 10 additions and 7 deletions

View file

@ -18,6 +18,7 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.github.ksoichiro.android.observablescrollview.ObservableListView;
import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks;
@ -252,7 +253,10 @@ public class MapMultiSelectionMenuFragment extends Fragment implements MultiSele
if (menu.getMapActivity().getContextMenu().isVisible()) {
menu.getMapActivity().getContextMenu().hide();
} else {
menu.getMapActivity().getSupportFragmentManager().popBackStack();
FragmentManager fragmentManager = menu.getMapActivity().getSupportFragmentManager();
if (!fragmentManager.isStateSaved()) {
fragmentManager.popBackStack();
}
}
}
}

View file

@ -78,7 +78,6 @@ public class ExportProfileBottomSheet extends BasePreferenceBottomSheet {
app = requiredMyApplication();
profile = getAppMode();
dataList = getAdditionalData();
exportListener = getSettingsExportListener();
if (savedInstanceState != null) {
includeAdditionalData = savedInstanceState.getBoolean(INCLUDE_ADDITIONAL_DATA_KEY);
exportingProfile = savedInstanceState.getBoolean(EXPORTING_PROFILE_KEY);
@ -335,7 +334,7 @@ public class ExportProfileBottomSheet extends BasePreferenceBottomSheet {
showExportProgressDialog();
File tempDir = getTempDir();
String fileName = profile.toHumanString();
app.getSettingsHelper().exportSettings(tempDir, fileName, exportListener, prepareSettingsItemsForExport());
app.getSettingsHelper().exportSettings(tempDir, fileName, getSettingsExportListener(), prepareSettingsItemsForExport());
}
}
@ -379,7 +378,7 @@ public class ExportProfileBottomSheet extends BasePreferenceBottomSheet {
boolean fileExporting = app.getSettingsHelper().isFileExporting(file);
if (fileExporting) {
showExportProgressDialog();
app.getSettingsHelper().updateExportListener(file, exportListener);
app.getSettingsHelper().updateExportListener(file, getSettingsExportListener());
} else if (file.exists()) {
dismissExportProgressDialog();
shareProfile(file, profile);

View file

@ -116,7 +116,6 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
profile = new ApplicationProfileObject();
exportListener = getSettingsExportListener();
ApplicationMode baseModeForNewProfile = null;
if (getArguments() != null) {
Bundle arguments = getArguments();
@ -769,7 +768,8 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
if (!tempDir.exists()) {
tempDir.mkdirs();
}
app.getSettingsHelper().exportSettings(tempDir, mode.getStringKey(), exportListener, new SettingsHelper.ProfileSettingsItem(app, mode));
app.getSettingsHelper().exportSettings(tempDir, mode.getStringKey(),
getSettingsExportListener(), new SettingsHelper.ProfileSettingsItem(app, mode));
}
}
@ -790,7 +790,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
boolean fileExporting = app.getSettingsHelper().isFileExporting(file);
if (fileExporting) {
showNewProfileSavingDialog(null);
app.getSettingsHelper().updateExportListener(file, exportListener);
app.getSettingsHelper().updateExportListener(file, getSettingsExportListener());
} else if (file.exists()) {
dismissProfileSavingDialog();
customProfileSaved();