|
1 | 1 | package lb.listviewvariants; |
2 | 2 |
|
3 | 3 | import android.app.Activity; |
| 4 | +import android.content.Intent; |
4 | 5 | import android.database.Cursor; |
5 | 6 | import android.graphics.Bitmap; |
6 | 7 | import android.media.ThumbnailUtils; |
|
11 | 12 | import android.text.TextUtils; |
12 | 13 | import android.util.TypedValue; |
13 | 14 | import android.view.LayoutInflater; |
| 15 | +import android.view.Menu; |
| 16 | +import android.view.MenuItem; |
14 | 17 | import android.view.View; |
15 | 18 | import android.view.ViewGroup; |
16 | 19 | import android.widget.TextView; |
@@ -104,6 +107,39 @@ private static class Contact |
104 | 107 | String photoId; |
105 | 108 | } |
106 | 109 |
|
| 110 | + @Override |
| 111 | + public boolean onCreateOptionsMenu(final Menu menu) |
| 112 | + { |
| 113 | + getMenuInflater().inflate(R.menu.activity_main,menu); |
| 114 | + return super.onCreateOptionsMenu(menu); |
| 115 | + } |
| 116 | + |
| 117 | + @SuppressWarnings("deprecation") |
| 118 | + @Override |
| 119 | + public boolean onOptionsItemSelected(final MenuItem item) |
| 120 | + { |
| 121 | + String url=null; |
| 122 | + switch(item.getItemId()) |
| 123 | + { |
| 124 | + case R.id.menuItem_all_my_apps: |
| 125 | + url="https://play.google.com/store/apps/developer?id=AndroidDeveloperLB"; |
| 126 | + break; |
| 127 | + case R.id.menuItem_all_my_repositories: |
| 128 | + url="https://github.com/AndroidDeveloperLB"; |
| 129 | + break; |
| 130 | + case R.id.menuItem_current_repository_website: |
| 131 | + url="https://github.com/AndroidDeveloperLB/AndroidJniBitmapOperations"; |
| 132 | + break; |
| 133 | + } |
| 134 | + if(url==null) |
| 135 | + return true; |
| 136 | + final Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(url)); |
| 137 | + intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY|Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); |
| 138 | + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_MULTIPLE_TASK); |
| 139 | + startActivity(intent); |
| 140 | + return true; |
| 141 | + } |
| 142 | + |
107 | 143 | // //////////////////////////////////////////////////////////// |
108 | 144 | // ContactsAdapter // |
109 | 145 | // ////////////////// |
@@ -231,6 +267,7 @@ public ArrayList<Contact> getOriginalList() |
231 | 267 | return mContacts; |
232 | 268 | } |
233 | 269 |
|
| 270 | + |
234 | 271 | } |
235 | 272 |
|
236 | 273 | // ///////////////////////////////////////////////////////////////////////////////////// |
|
0 commit comments