Android Open Source - taxitwin-app Taxi Twin Alert Dialog Fragment






From Project

Back to project page taxitwin-app.

License

The source code is released under:

GNU General Public License

If you think the Android project taxitwin-app listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package kimle.michal.android.taxitwin.dialog.alert;
/*from   w w w . java2  s  .  co m*/
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.Intent;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import android.os.Bundle;
import kimle.michal.android.taxitwin.R;
import kimle.michal.android.taxitwin.activity.MyTaxiTwinActivity;
import kimle.michal.android.taxitwin.application.TaxiTwinApplication;
import kimle.michal.android.taxitwin.contentprovider.TaxiTwinContentProvider;
import kimle.michal.android.taxitwin.enumerate.UserState;
import kimle.michal.android.taxitwin.gcm.GcmHandler;

public class TaxiTwinAlertDialogFragment extends DialogFragment {

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage(R.string.taxitwin_alert_message)
                .setTitle(R.string.taxitwin_alert_title)
                .setCancelable(false)
                .setPositiveButton(R.string.enter, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        Intent intent = new Intent(getActivity(), MyTaxiTwinActivity.class);
                        intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
                        getActivity().startActivity(intent);

                        getActivity().finish();
                        dismiss();
                    }
                })
                .setNegativeButton(R.string.leave, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        GcmHandler gcmHandler = new GcmHandler(getActivity());
                        gcmHandler.leaveTaxiTwin();
                        getActivity().getContentResolver().delete(TaxiTwinContentProvider.RIDES_URI, null, null);
                        TaxiTwinApplication.setUserState(UserState.SUBSCRIBED);

                        dismiss();
                    }
                });
        return builder.create();
    }
}




Java Source Code List

kimle.michal.android.taxitwin.activity.LauncherActivity.java
kimle.michal.android.taxitwin.activity.MainActivity.java
kimle.michal.android.taxitwin.activity.MyTaxiTwinActivity.java
kimle.michal.android.taxitwin.activity.OfferDetailActivity.java
kimle.michal.android.taxitwin.activity.ResponseDetailActivity.java
kimle.michal.android.taxitwin.activity.ResponsesActivity.java
kimle.michal.android.taxitwin.adapter.TaxiTwinPlacesAutoCompleteAdapter.java
kimle.michal.android.taxitwin.application.TaxiTwinApplication.java
kimle.michal.android.taxitwin.contentprovider.TaxiTwinContentProvider.java
kimle.michal.android.taxitwin.db.DbContract.java
kimle.michal.android.taxitwin.db.DbHelper.java
kimle.michal.android.taxitwin.dialog.alert.AddressAlertDialogFragment.java
kimle.michal.android.taxitwin.dialog.alert.GPSAlertDialogFragment.java
kimle.michal.android.taxitwin.dialog.alert.GooglePlayServicesAlertDialogFragment.java
kimle.michal.android.taxitwin.dialog.alert.InternetAlertDialogFragment.java
kimle.michal.android.taxitwin.dialog.alert.LeaveTaxiTwinAlertDialogFragment.java
kimle.michal.android.taxitwin.dialog.alert.ServicesAlertDialogFragment.java
kimle.michal.android.taxitwin.dialog.alert.TaxiTwinAlertDialogFragment.java
kimle.michal.android.taxitwin.dialog.alert.TaxiTwinNoLongerAlertDialogFragment.java
kimle.michal.android.taxitwin.dialog.error.GooglePlayServicesErrorDialogFragment.java
kimle.michal.android.taxitwin.dialog.error.OfferErrorDialogFragment.java
kimle.michal.android.taxitwin.dialog.error.PlaceErrorDialogFragment.java
kimle.michal.android.taxitwin.dialog.error.ResponseErrorDialogFragment.java
kimle.michal.android.taxitwin.entity.Place.java
kimle.michal.android.taxitwin.enumerate.UserState.java
kimle.michal.android.taxitwin.fragment.TaxiTwinListFragment.java
kimle.michal.android.taxitwin.fragment.TaxiTwinMapFragment.java
kimle.michal.android.taxitwin.gcm.GcmBroadcastReceiver.java
kimle.michal.android.taxitwin.gcm.GcmConnector.java
kimle.michal.android.taxitwin.gcm.GcmHandler.java
kimle.michal.android.taxitwin.gcm.GcmIntentService.java
kimle.michal.android.taxitwin.popup.SettingsPopup.java
kimle.michal.android.taxitwin.services.ServicesManagement.java
kimle.michal.android.taxitwin.view.TaxiTwinAutoCompleteTextView.java