|
19 | 19 | import java.util.List; |
20 | 20 | import java.util.Random; |
21 | 21 | import android.app.Activity; |
| 22 | +import android.content.Intent; |
| 23 | +import android.net.Uri; |
22 | 24 | import android.os.Bundle; |
23 | 25 | import android.text.util.Rfc822Tokenizer; |
| 26 | +import android.view.Menu; |
| 27 | +import android.view.MenuItem; |
24 | 28 | import android.view.View; |
25 | 29 | import android.view.View.OnClickListener; |
26 | 30 | import android.view.ViewTreeObserver.OnPreDrawListener; |
@@ -145,4 +149,36 @@ public boolean onPreDraw() |
145 | 149 | }; |
146 | 150 | view.getViewTreeObserver().addOnPreDrawListener(preDrawListener); |
147 | 151 | } |
| 152 | + |
| 153 | + @Override |
| 154 | + public boolean onCreateOptionsMenu(final Menu menu) |
| 155 | + { |
| 156 | + getMenuInflater().inflate(R.menu.activity_main,menu); |
| 157 | + return super.onCreateOptionsMenu(menu); |
| 158 | + } |
| 159 | + |
| 160 | + @Override |
| 161 | + public boolean onOptionsItemSelected(final MenuItem item) |
| 162 | + { |
| 163 | + String url=null; |
| 164 | + switch(item.getItemId()) |
| 165 | + { |
| 166 | + case R.id.menuItem_all_my_apps: |
| 167 | + url="https://play.google.com/store/apps/developer?id=Liran+Barsisa"; |
| 168 | + break; |
| 169 | + case R.id.menuItem_all_my_repositories: |
| 170 | + url="https://github.com/AndroidDeveloperLB"; |
| 171 | + break; |
| 172 | + case R.id.menuItem_current_repository_website: |
| 173 | + url="https://github.com/AndroidDeveloperLB/ChipsLibrary"; |
| 174 | + break; |
| 175 | + } |
| 176 | + if(url==null) |
| 177 | + return true; |
| 178 | + final Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(url)); |
| 179 | + intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY|Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); |
| 180 | + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_MULTIPLE_TASK); |
| 181 | + startActivity(intent); |
| 182 | + return true; |
| 183 | + } |
148 | 184 | } |
0 commit comments