use of com.afollestad.materialdialogs.MaterialDialog in project material-camera by afollestad.
the class BaseCameraFragment method onClick.
@Override
public void onClick(View view) {
final int id = view.getId();
if (id == R.id.facing) {
mInterface.toggleCameraPosition();
setImageRes(mButtonFacing, mInterface.getCurrentCameraPosition() == BaseCaptureActivity.CAMERA_POSITION_BACK ? mInterface.iconFrontCamera() : mInterface.iconRearCamera());
closeCamera();
openCamera();
setupFlashMode();
} else if (id == R.id.video) {
if (mIsRecording) {
stopRecordingVideo(false);
mIsRecording = false;
} else {
if (getArguments().getBoolean(CameraIntentKey.SHOW_PORTRAIT_WARNING, true) && Degrees.isPortrait(getActivity())) {
new MaterialDialog.Builder(getActivity()).title(R.string.mcam_portrait).content(R.string.mcam_portrait_warning).positiveText(R.string.mcam_yes).negativeText(android.R.string.cancel).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) {
mIsRecording = startRecordingVideo();
}
}).show();
} else {
mIsRecording = startRecordingVideo();
}
}
} else if (id == R.id.stillshot) {
takeStillshot();
} else if (id == R.id.flash) {
invalidateFlash(true);
}
}
use of com.afollestad.materialdialogs.MaterialDialog in project Timber by naman14.
the class SubStyleSelectorFragment method showPurchaseDialog.
private void showPurchaseDialog() {
MaterialDialog dialog = new MaterialDialog.Builder(getActivity()).title("Purchase").content("This now playing style is available after a one time purchase of any amount. Support development and unlock this style?").positiveText("Support development").neutralText("Restore purchases").onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
startActivity(new Intent(getActivity(), DonateActivity.class));
dialog.dismiss();
}
}).onNeutral(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
Intent intent = new Intent(getActivity(), DonateActivity.class);
intent.putExtra("title", "Restoring purchases..");
intent.setAction("restore");
startActivity(intent);
dialog.dismiss();
}
}).show();
}
use of com.afollestad.materialdialogs.MaterialDialog in project PocketHub by pockethub.
the class CommitDiffListFragment method showFileOptions.
private void showFileOptions(CharSequence line, final int position, final GitHubFile file) {
MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()).title(CommitUtils.getName(file));
final MaterialDialog[] dialogHolder = new MaterialDialog[1];
View view = getActivity().getLayoutInflater().inflate(R.layout.diff_line_dialog, null);
ViewFinder finder = new ViewFinder(view);
TextView diff = finder.textView(R.id.tv_diff);
diff.setText(line);
diffStyler.updateColors(line, diff);
finder.setText(R.id.tv_commit, getString(R.string.commit_prefix) + CommitUtils.abbreviate(commit));
finder.find(R.id.ll_view_area).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialogHolder[0].dismiss();
openFile(file);
}
});
finder.find(R.id.ll_comment_area).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialogHolder[0].dismiss();
startActivityForResult(CreateCommentActivity.createIntent(repository, commit.sha(), file.filename(), position), COMMENT_CREATE);
}
});
builder.customView(view, false).negativeText(R.string.cancel).onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
dialog.dismiss();
}
});
MaterialDialog dialog = builder.build();
dialogHolder[0] = dialog;
dialog.setCanceledOnTouchOutside(true);
dialog.show();
}
use of com.afollestad.materialdialogs.MaterialDialog in project PocketHub by pockethub.
the class LoginWebViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webView = new WebView(this);
webView.loadUrl(getIntent().getStringExtra(LoginActivity.INTENT_EXTRA_URL));
webView.setWebViewClient(new WebViewClient() {
MaterialDialog dialog = new MaterialDialog.Builder(LoginWebViewActivity.this).content(R.string.loading).progress(true, 0).build();
@Override
public void onPageStarted(android.webkit.WebView view, String url, Bitmap favicon) {
dialog.show();
}
@Override
public void onPageFinished(android.webkit.WebView view, String url) {
dialog.dismiss();
}
@Override
public boolean shouldOverrideUrlLoading(android.webkit.WebView view, String url) {
Uri uri = Uri.parse(url);
if (uri.getScheme().equals(getString(R.string.github_oauth_scheme))) {
Intent data = new Intent();
data.setData(uri);
setResult(RESULT_OK, data);
finish();
return true;
}
return super.shouldOverrideUrlLoading(view, url);
}
});
setContentView(webView);
}
use of com.afollestad.materialdialogs.MaterialDialog in project PocketHub by pockethub.
the class RefDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
Activity activity = getActivity();
Bundle arguments = getArguments();
final MaterialDialog.Builder dialogBuilder = createDialogBuilder().negativeText(R.string.cancel).onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
RefDialogFragment.this.onClick(dialog, BUTTON_NEGATIVE);
}
});
LayoutInflater inflater = activity.getLayoutInflater();
ListView view = (ListView) inflater.inflate(R.layout.dialog_list_view, null);
view.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
onClick(getDialog(), position);
}
});
ArrayList<GitReference> choices = getChoices();
int selected = arguments.getInt(ARG_SELECTED_CHOICE);
RefListAdapter adapter = new RefListAdapter(inflater, choices.toArray(new GitReference[choices.size()]), selected);
view.setAdapter(adapter);
if (selected >= 0) {
view.setSelection(selected);
}
dialogBuilder.customView(view, false);
return dialogBuilder.build();
}
Aggregations