Android Open Source - Thrift-box Delete Confirm Dialog






From Project

Back to project page Thrift-box.

License

The source code is released under:

GNU General Public License

If you think the Android project Thrift-box 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 ru.sash0k.thriftbox.fragments;
/*from   w ww .j a va 2s  .  c om*/
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.provider.BaseColumns;
import android.support.v4.app.DialogFragment;
import android.view.ContextThemeWrapper;

import ru.sash0k.thriftbox.MainActivity;
import ru.sash0k.thriftbox.R;
import ru.sash0k.thriftbox.Utils;
import ru.sash0k.thriftbox.database.DB;

/**
 * ?????? ?????????????? ?????????
 * Created by sash0k on 11.03.14.
 */
public class DeleteConfirmDialog extends DialogFragment {
    public static final String TAG = "DeleteConfirmDialog";
    private static final String divider = "  ";

    public static DeleteConfirmDialog newInstance(int id, String date, int category, long value) {
        DeleteConfirmDialog f = new DeleteConfirmDialog();
        Bundle arguments = new Bundle();
        arguments.putInt(BaseColumns._ID, id);
        arguments.putString(DB.DATE, date);
        arguments.putInt(DB.CATEGORY, category);
        arguments.putLong(DB.VALUE, value);
        f.setArguments(arguments);
        return f;
    }
    // ============================================================================

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final Context context = new ContextThemeWrapper(getActivity(), android.R.style.Theme_Holo_Light_Dialog_NoActionBar);
        String[] categories = context.getResources().getStringArray(R.array.categories);

        final Bundle args = getArguments();
        final int id = args.getInt(BaseColumns._ID);
        final String date = args.getString(DB.DATE);
        final int category = args.getInt(DB.CATEGORY);
        final String value = Utils.formatValue(args.getLong(DB.VALUE)) + Utils.ROUBLE + "?";
        final String title = getString(R.string.delete_label) + " " + value;
        final String msg = context.getString(R.string.delete_msg) +
                '\n'+ date + divider + categories[category] + divider + value;

        android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context)
                .setTitle(((MainActivity) getActivity()).parseRouble(title))
                .setMessage(((MainActivity) getActivity()).parseRouble(msg))
                .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        DB.deleteItem(context, id);
                        Utils.updateWidgets(context);
                    }
                })
                .setNegativeButton(android.R.string.no, null);
        return builder.create();
    }
    // ============================================================================

}




Java Source Code List

android.support.v4.preference.PreferenceFragment.java
android.support.v4.preference.PreferenceManagerCompat.java
android.widget_fixed.CursorFilter.java
android.widget_fixed.CursorTreeAdapter.java
com.github.mikephil.charting.charts.Chart.java
com.github.mikephil.charting.charts.PieChart.java
com.github.mikephil.charting.charts.PieRadarChartBase.java
com.github.mikephil.charting.data.ChartData.java
com.github.mikephil.charting.data.DataSet.java
com.github.mikephil.charting.data.Entry.java
com.github.mikephil.charting.data.PieDataSet.java
com.github.mikephil.charting.data.PieData.java
com.github.mikephil.charting.data.filter.Approximator.java
com.github.mikephil.charting.exception.DrawingDataSetNotCreatedException.java
com.github.mikephil.charting.interfaces.ChartInterface.java
com.github.mikephil.charting.interfaces.OnChartGestureListener.java
com.github.mikephil.charting.interfaces.OnChartValueSelectedListener.java
com.github.mikephil.charting.interfaces.OnDrawLineChartTouchListener.java
com.github.mikephil.charting.interfaces.OnDrawListener.java
com.github.mikephil.charting.listener.PieRadarChartTouchListener.java
com.github.mikephil.charting.matrix.Vector3.java
com.github.mikephil.charting.renderer.Transformer.java
com.github.mikephil.charting.utils.ColorFormatter.java
com.github.mikephil.charting.utils.ColorTemplate.java
com.github.mikephil.charting.utils.Highlight.java
com.github.mikephil.charting.utils.LabelBase.java
com.github.mikephil.charting.utils.LargeValueFormatter.java
com.github.mikephil.charting.utils.Legend.java
com.github.mikephil.charting.utils.LimitLine.java
com.github.mikephil.charting.utils.MarkerView.java
com.github.mikephil.charting.utils.PointD.java
com.github.mikephil.charting.utils.SelInfo.java
com.github.mikephil.charting.utils.Utils.java
com.github.mikephil.charting.utils.ValueFormatter.java
com.github.mikephil.charting.utils.XLabels.java
com.github.mikephil.charting.utils.YLabels.java
net.margaritov.preference.colorpicker.AlphaPatternDrawable.java
net.margaritov.preference.colorpicker.ColorPickerDialog.java
net.margaritov.preference.colorpicker.ColorPickerPanelView.java
net.margaritov.preference.colorpicker.ColorPickerPreference.java
net.margaritov.preference.colorpicker.ColorPickerView.java
ru.sash0k.thriftbox.AdapterExpenses.java
ru.sash0k.thriftbox.MainActivity.java
ru.sash0k.thriftbox.TypefaceSpan2.java
ru.sash0k.thriftbox.Utils.java
ru.sash0k.thriftbox.Widget.java
ru.sash0k.thriftbox.categories.Categories.java
ru.sash0k.thriftbox.categories.InterceptingHorizontalScrollView.java
ru.sash0k.thriftbox.database.DBProvider.java
ru.sash0k.thriftbox.database.DB.java
ru.sash0k.thriftbox.fragments.CommentDialog.java
ru.sash0k.thriftbox.fragments.DeleteConfirmDialog.java
ru.sash0k.thriftbox.fragments.ExpandableListFragment.java
ru.sash0k.thriftbox.fragments.ExpensesFragment.java
ru.sash0k.thriftbox.fragments.InputFragment.java
ru.sash0k.thriftbox.fragments.PieChartFragment.java
ru.sash0k.thriftbox.fragments.SettingsFragment.java