Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Info menu with GitHub Link, make it directly accessible #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file modified .idea/caches/gradle_models.ser
Binary file not shown.
29 changes: 0 additions & 29 deletions .idea/codeStyles/Project.xml

This file was deleted.

105 changes: 56 additions & 49 deletions app/src/main/java/com/mauriciogior/openqrcode/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,22 +123,22 @@ public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
public boolean onActionItemClicked(final ActionMode actionMode, MenuItem menuItem) {
if (menuItem.getItemId() == R.id.action_remove) {
new AlertDialog.Builder(MainActivity.this)
.setTitle("Remove")
.setMessage("Are you sure you want to remove " + checkedItems.size() + " item" + (checkedItems.size() > 1 ? "s" : "") + "?")
.setPositiveButton("Remove", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int position) {
for (Integer i : checkedItems) {
String qrCode = (String) mArrayAdapter.getItem(i);
removeHistory(qrCode);
.setTitle("Remove")
.setMessage("Are you sure you want to remove " + checkedItems.size() + " item" + (checkedItems.size() > 1 ? "s" : "") + "?")
.setPositiveButton("Remove", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int position) {
for (Integer i : checkedItems) {
String qrCode = (String) mArrayAdapter.getItem(i);
removeHistory(qrCode);
}

actionMode.finish();
}

actionMode.finish();
}
})
.setNegativeButton("Cancel", null)
.create()
.show();
})
.setNegativeButton("Cancel", null)
.create()
.show();
return true;

} else if (menuItem.getItemId() == R.id.action_select_all) {
Expand Down Expand Up @@ -372,34 +372,34 @@ private void showAlertDialog(final String text, final boolean resumeCamera) {
pushHistory(text);

AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle("QR Code")
.setMessage(message)
.setPositiveButton("Copy", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
setClipboard(text);
}
})
.setNeutralButton("Share", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, text);
sendIntent.setType("text/plain");
startActivity(sendIntent);
}
})
.setNegativeButton("Cancel", null)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
if (resumeCamera) {
mScannerView.resumeCameraPreview(MainActivity.this);
.setTitle("QR Code")
.setMessage(message)
.setPositiveButton("Copy", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
setClipboard(text);
}
}
})
.show();
})
.setNeutralButton("Share", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, text);
sendIntent.setType("text/plain");
startActivity(sendIntent);
}
})
.setNegativeButton("Cancel", null)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
if (resumeCamera) {
mScannerView.resumeCameraPreview(MainActivity.this);
}
}
})
.show();

((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
}
Expand Down Expand Up @@ -431,13 +431,20 @@ public boolean onCreateOptionsMenu(Menu menu) {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_info) {
new AlertDialog.Builder(this)
.setTitle("Info")
.setMessage("Created by a pissed of developer from apps loaded with ads.\n\n" +
"Mauricio Giordano <[email protected]>\n\n" +
"Open source software under MIT License")
.setNegativeButton("Ok", null)
.show();
String text = "Created by a developer pissed off from apps loaded with ads.\n\n"
+ "Mauricio Giordano <[email protected]>\n\n"
+ "Open source software under MIT License.\n\n"
+ "GitHub: https://github.com/mauriciogior/open-qrcode";
final SpannableString message = new SpannableString(text);
Linkify.addLinks(message, Linkify.ALL);

AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle("About the app")
.setMessage(message)
.setNegativeButton("Ok", null)
.show();

((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());

} else if (item.getItemId() == R.id.action_flash_on) {
mMenu.findItem(R.id.action_flash_off).setVisible(true);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/menu/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
android:id="@+id/menu_info"
android:icon="@drawable/ic_info"
android:title="@string/title_info"
android:showAsAction="never"
android:showAsAction="always"
app:showAsAction="never" />

</menu>