// Path: app/src/main/java/com/chernandezgil/farmacias/data/source/local/RecentSuggestionsProvider.java
// public class RecentSuggestionsProvider extends android.content.SearchRecentSuggestionsProvider {
//     public final static String AUTHORITY = "com.chernandezgil.farmacias.data.source.local.RecentSuggestionsProvider";
//     public final static int MODE = DATABASE_MODE_QUERIES;
// 
// 
//     private UriMatcher matcher;
//     private static final int SUGGESTIONS_CODE = 5;
//     public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + AUTHORITY);
//  //   public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath()
// 
//     public RecentSuggestionsProvider() {
//         matcher = new UriMatcher(UriMatcher.NO_MATCH);
//         matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY,SUGGESTIONS_CODE);
// 
// 
//         setupSuggestions(AUTHORITY,MODE);
//     }
// 
//     @Override
//     public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
// 
//         int code = matcher.match(uri);
//         switch (code) {
//             case SUGGESTIONS_CODE:
//                 if (selectionArgs == null || selectionArgs.length == 0 || selectionArgs[0].trim().length() == 0)
//                 {
//                     return super.query(uri, projection, selection, selectionArgs, sortOrder);
//                 }
//                 else
//                 {
//                     return super.query(uri, projection, selection, selectionArgs, sortOrder);
// 
// 
//                 }
// 
// 
//             default: return super.query(uri, projection, selection, selectionArgs, sortOrder);
//         }
//         //Cursor c= super.query(uri, projection, selection, selectionArgs, sortOrder);
//         //return c;
//     }
// 
//     @Override
//     public int delete(Uri uri, String selection, String[] selectionArgs) {
//         return super.delete(uri, selection, selectionArgs);
//     }
// }


import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.widget.Toast;
import com.chernandezgil.farmacias.R;
import com.chernandezgil.farmacias.data.source.local.RecentSuggestionsProvider;
package com.chernandezgil.farmacias.customwidget.dialog;



/**
 * Created by Carlos on 20/12/2016.
 */

public class DialogBorrarHistorialBusqueda extends DialogFragment {


    public DialogBorrarHistorialBusqueda() {
    }


    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog dialog = new AlertDialog.Builder(getActivity())
                .setTitle(getString(R.string.borrar_historial_confirmar_accion))
                .setMessage(getString(R.string.borrar_historial_mensaje))
                .setIcon(R.drawable.alert_box)
                .setNegativeButton(getString(R.string.borrar_historial_no_text), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                }).setPositiveButton(getString(R.string.borrar_historial_yes_text), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // RecentSuggestionsProvider.BASE_CONTENT_URI.buildUpon().appendPath("suggestions") segun
                        // el codigo de la clase para los insert hay que agregar suggestions
// Path: app/src/main/java/com/chernandezgil/farmacias/data/source/local/RecentSuggestionsProvider.java
// public class RecentSuggestionsProvider extends android.content.SearchRecentSuggestionsProvider {
//     public final static String AUTHORITY = "com.chernandezgil.farmacias.data.source.local.RecentSuggestionsProvider";
//     public final static int MODE = DATABASE_MODE_QUERIES;
// 
// 
//     private UriMatcher matcher;
//     private static final int SUGGESTIONS_CODE = 5;
//     public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + AUTHORITY);
//  //   public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath()
// 
//     public RecentSuggestionsProvider() {
//         matcher = new UriMatcher(UriMatcher.NO_MATCH);
//         matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY,SUGGESTIONS_CODE);
// 
// 
//         setupSuggestions(AUTHORITY,MODE);
//     }
// 
//     @Override
//     public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
// 
//         int code = matcher.match(uri);
//         switch (code) {
//             case SUGGESTIONS_CODE:
//                 if (selectionArgs == null || selectionArgs.length == 0 || selectionArgs[0].trim().length() == 0)
//                 {
//                     return super.query(uri, projection, selection, selectionArgs, sortOrder);
//                 }
//                 else
//                 {
//                     return super.query(uri, projection, selection, selectionArgs, sortOrder);
// 
// 
//                 }
// 
// 
//             default: return super.query(uri, projection, selection, selectionArgs, sortOrder);
//         }
//         //Cursor c= super.query(uri, projection, selection, selectionArgs, sortOrder);
//         //return c;
//     }
// 
//     @Override
//     public int delete(Uri uri, String selection, String[] selectionArgs) {
//         return super.delete(uri, selection, selectionArgs);
//     }
// }


// Path: app/src/main/java/com/chernandezgil/farmacias/customwidget/dialog/DialogBorrarHistorialBusqueda.java
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.widget.Toast;
import com.chernandezgil.farmacias.R;
import com.chernandezgil.farmacias.data.source.local.RecentSuggestionsProvider;

package com.chernandezgil.farmacias.customwidget.dialog;



/**
 * Created by Carlos on 20/12/2016.
 */

public class DialogBorrarHistorialBusqueda extends DialogFragment {


    public DialogBorrarHistorialBusqueda() {
    }


    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog dialog = new AlertDialog.Builder(getActivity())
                .setTitle(getString(R.string.borrar_historial_confirmar_accion))
                .setMessage(getString(R.string.borrar_historial_mensaje))
                .setIcon(R.drawable.alert_box)
                .setNegativeButton(getString(R.string.borrar_historial_no_text), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                }).setPositiveButton(getString(R.string.borrar_historial_yes_text), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // RecentSuggestionsProvider.BASE_CONTENT_URI.buildUpon().appendPath("suggestions") segun
                        // el codigo de la clase para los insert hay que agregar suggestions
                        Uri uri = RecentSuggestionsProvider.BASE_CONTENT_URI.buildUpon().appendPath("suggestions").build();