|
3 | 3 | import java.io.File;
|
4 | 4 | import java.io.FileOutputStream;
|
5 | 5 | import java.io.InputStream;
|
| 6 | +import java.math.BigInteger; |
| 7 | +import java.security.SecureRandom; |
6 | 8 | import java.util.ArrayList;
|
7 | 9 |
|
8 | 10 | import us.nineworlds.serenity.GDMReceiver;
|
9 | 11 | import android.app.Activity;
|
10 | 12 | import android.app.AlertDialog;
|
11 | 13 | import android.app.Dialog;
|
| 14 | +import android.app.PendingIntent; |
12 | 15 | import android.content.BroadcastReceiver;
|
13 | 16 | import android.content.DialogInterface;
|
14 | 17 | import android.content.Intent;
|
|
20 | 23 | import android.net.Uri;
|
21 | 24 | import android.os.Bundle;
|
22 | 25 | import android.os.Environment;
|
| 26 | +import android.speech.RecognizerIntent; |
23 | 27 | import android.speech.tts.TextToSpeech;
|
24 | 28 | import android.support.v4.content.LocalBroadcastManager;
|
25 | 29 | import android.view.Menu;
|
@@ -337,6 +341,20 @@ public void onClick(DialogInterface dialog, int id) {
|
337 | 341 | d.show();
|
338 | 342 | }
|
339 | 343 |
|
| 344 | + public void installShortcut(MenuItem item) { |
| 345 | + Intent.ShortcutIconResource icon = Intent.ShortcutIconResource.fromContext(this, R.drawable.ic_launcher); |
| 346 | + |
| 347 | + Intent launchIntent = new Intent(this, ShortcutActivity.class); |
| 348 | + |
| 349 | + final Intent intent = new Intent(); |
| 350 | + intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, launchIntent); |
| 351 | + intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name)); |
| 352 | + intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this, R.drawable.ic_launcher)); |
| 353 | + intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); |
| 354 | + |
| 355 | + sendBroadcast(intent); |
| 356 | + } |
| 357 | + |
340 | 358 | public void showAbout(MenuItem item) {
|
341 | 359 | AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this)
|
342 | 360 | .setTitle(R.string.app_name)
|
|
0 commit comments