Cleanup code

This commit is contained in:
Alexey Kulish 2016-10-19 22:34:08 +03:00
parent 883e3b86d2
commit cbcad9a8bd
2 changed files with 52 additions and 39 deletions

View file

@ -77,6 +77,7 @@ import net.osmand.plus.base.FailSafeFuntions;
import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.dialogs.ErrorBottomSheetDialog;
import net.osmand.plus.dialogs.OtherDialogs;
import net.osmand.plus.dialogs.RateUsBottomSheetDialog;
import net.osmand.plus.dialogs.WhatsNewDialogFragment;
import net.osmand.plus.download.DownloadActivity;
@ -642,7 +643,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
.add(R.id.fragmentContainer, new FirstUsageWelcomeFragment(),
FirstUsageWelcomeFragment.TAG).commitAllowingStateLoss();
} else {
//showXMasDialog();
//OtherDialogs.showXMasDialog(this);
}
FirstUsageWelcomeFragment.SHOW = false;
}
@ -1509,44 +1510,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
mapInfoLayer.removeTopToolbarController(controller);
}
private void showXMasDialog() {
final AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.XmasDialogTheme);
View titleView = getLayoutInflater().inflate(R.layout.xmas_dialog_title, null);
builder.setCustomTitle(titleView);
builder.setCancelable(true);
builder.setNegativeButton(getString(R.string.shared_string_cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.setPositiveButton(getString(R.string.shared_string_show), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//showQuickSearch();
}
});
builder.setView(getLayoutInflater().inflate(R.layout.xmas_dialog, null));
AlertDialog dialog = builder.create();
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
// Customize POSITIVE, NEGATIVE and NEUTRAL buttons.
Button positiveButton = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE);
positiveButton.setTextColor(getResources().getColor(R.color.color_white));
positiveButton.invalidate();
Button negativeButton = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_NEGATIVE);
negativeButton.setTextColor(getResources().getColor(R.color.color_white));
negativeButton.invalidate();
}
});
dialog.show();
}
public enum ShowQuickSearchMode {
NEW,
NEW_IF_EXPIRED,

View file

@ -0,0 +1,50 @@
package net.osmand.plus.dialogs;
import android.app.Activity;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.Button;
import net.osmand.plus.R;
public class OtherDialogs {
public static void showXMasDialog(final Activity activity) {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.XmasDialogTheme);
View titleView = activity.getLayoutInflater().inflate(R.layout.xmas_dialog_title, null);
builder.setCustomTitle(titleView);
builder.setCancelable(true);
builder.setNegativeButton(activity.getString(R.string.shared_string_cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.setPositiveButton(activity.getString(R.string.shared_string_show), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//showQuickSearch();
}
});
builder.setView(activity.getLayoutInflater().inflate(R.layout.xmas_dialog, null));
AlertDialog dialog = builder.create();
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
// Customize POSITIVE, NEGATIVE and NEUTRAL buttons.
Button positiveButton = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE);
positiveButton.setTextColor(activity.getResources().getColor(R.color.color_white));
positiveButton.invalidate();
Button negativeButton = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_NEGATIVE);
negativeButton.setTextColor(activity.getResources().getColor(R.color.color_white));
negativeButton.invalidate();
}
});
dialog.show();
}
}