Search in sources :

Example 1 with Lens

use of com.mattprecious.telescope.Lens in project u2020 by JakeWharton.

the class TelescopeViewContainer method showTelescopeDialog.

public void showTelescopeDialog(final Activity activity) {
    LayoutInflater inflater = LayoutInflater.from(activity);
    TelescopeLayout content = (TelescopeLayout) inflater.inflate(R.layout.telescope_tutorial_dialog, null);
    final AlertDialog dialog = new AlertDialog.Builder(activity).setView(content).setCancelable(false).create();
    content.setLens(new Lens() {

        @Override
        public void onCapture(File file) {
            dialog.dismiss();
            Context toastContext = new ContextThemeWrapper(activity, android.R.style.Theme_DeviceDefault_Dialog);
            LayoutInflater toastInflater = LayoutInflater.from(toastContext);
            Toast toast = Toast.makeText(toastContext, "", Toast.LENGTH_SHORT);
            View toastView = toastInflater.inflate(R.layout.telescope_tutorial_toast, null);
            toast.setView(toastView);
            toast.setGravity(Gravity.CENTER, 0, 0);
            toast.show();
        }
    });
    dialog.show();
}
Also used : TelescopeLayout(com.mattprecious.telescope.TelescopeLayout) AlertDialog(android.support.v7.app.AlertDialog) Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) Toast(android.widget.Toast) LayoutInflater(android.view.LayoutInflater) Lens(com.mattprecious.telescope.Lens) BugReportLens(com.jakewharton.u2020.ui.bugreport.BugReportLens) File(java.io.File) BindView(butterknife.BindView) View(android.view.View)

Aggregations

Context (android.content.Context)1 AlertDialog (android.support.v7.app.AlertDialog)1 ContextThemeWrapper (android.view.ContextThemeWrapper)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 Toast (android.widget.Toast)1 BindView (butterknife.BindView)1 BugReportLens (com.jakewharton.u2020.ui.bugreport.BugReportLens)1 Lens (com.mattprecious.telescope.Lens)1 TelescopeLayout (com.mattprecious.telescope.TelescopeLayout)1 File (java.io.File)1