List of usage examples for android.app AlertDialog setTitle
@Override public void setTitle(CharSequence title)
From source file:id.ridon.keude.Keude.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_update_repo: updateRepos();/* ww w. j a va2 s . c o m*/ return true; case R.id.action_manage_repos: Intent i = new Intent(this, ManageReposActivity.class); startActivityForResult(i, REQUEST_MANAGEREPOS); return true; case R.id.action_settings: Intent prefs = new Intent(getBaseContext(), PreferencesActivity.class); startActivityForResult(prefs, REQUEST_PREFS); return true; case R.id.action_swap: startActivity(new Intent(this, SwapActivity.class)); return true; case R.id.action_search: onSearchRequested(); return true; case R.id.action_bluetooth_apk: /* * If Bluetooth has not been enabled/turned on, then enabling * device discoverability will automatically enable Bluetooth */ Intent discoverBt = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); discoverBt.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 121); startActivityForResult(discoverBt, REQUEST_ENABLE_BLUETOOTH); // if this is successful, the Bluetooth transfer is started return true; case R.id.action_about: View view = null; if (Build.VERSION.SDK_INT >= 11) { LayoutInflater li = LayoutInflater.from(this); view = li.inflate(R.layout.about, null); } else { view = View.inflate(new ContextThemeWrapper(this, R.style.AboutDialogLight), R.layout.about, null); } // Fill in the version... try { PackageInfo pi = getPackageManager().getPackageInfo(getApplicationContext().getPackageName(), 0); ((TextView) view.findViewById(R.id.version)).setText(pi.versionName); } catch (Exception e) { } Builder p = null; if (Build.VERSION.SDK_INT >= 11) { p = new AlertDialog.Builder(this).setView(view); } else { p = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AboutDialogLight)).setView(view); } final AlertDialog alrt = p.create(); alrt.setIcon(R.drawable.ic_launcher); alrt.setTitle(getString(R.string.about_title)); alrt.setButton(AlertDialog.BUTTON_NEUTRAL, getString(R.string.about_website), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { Uri uri = Uri.parse("https://f-droid.org"); startActivity(new Intent(Intent.ACTION_VIEW, uri)); } }); alrt.setButton(AlertDialog.BUTTON_NEGATIVE, getString(R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { } }); alrt.show(); return true; } return super.onOptionsItemSelected(item); }
From source file:net.networksaremadeofstring.cyllell.ViewRoles_Fragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { list = (ListView) this.getActivity().findViewById(R.id.rolesListView); settings = this.getActivity().getSharedPreferences("Cyllell", 0); try {/* w w w .j a va2 s .co m*/ Cut = new Cuts(getActivity()); } catch (Exception e) { e.printStackTrace(); } dialog = new ProgressDialog(getActivity()); dialog.setTitle("Contacting Chef"); dialog.setMessage("Please wait: Prepping Authentication protocols"); dialog.setIndeterminate(true); if (listOfRoles.size() < 1) { dialog.show(); } updateListNotify = new Handler() { public void handleMessage(Message msg) { int tag = msg.getData().getInt("tag", 999999); if (msg.what == 0) { if (tag != 999999) { listOfRoles.get(tag).SetSpinnerVisible(); } } else if (msg.what == 1) { //Get rid of the lock CutInProgress = false; //the notifyDataSetChanged() will handle the rest } else if (msg.what == 99) { if (tag != 999999) { Toast.makeText(ViewRoles_Fragment.this.getActivity(), "An error occured during that operation.", Toast.LENGTH_LONG).show(); listOfRoles.get(tag).SetErrorState(); } } RoleAdapter.notifyDataSetChanged(); } }; final Handler handler = new Handler() { public void handleMessage(Message msg) { //Once we've checked the data is good to use start processing it if (msg.what == 0) { OnClickListener listener = new OnClickListener() { public void onClick(View v) { GetMoreDetails((Integer) v.getTag()); } }; OnLongClickListener listenerLong = new OnLongClickListener() { public boolean onLongClick(View v) { selectForCAB((Integer) v.getTag()); return true; } }; RoleAdapter = new RoleListAdaptor(getActivity(), listOfRoles, listener, listenerLong); list = (ListView) getView().findViewById(R.id.rolesListView); if (list != null) { if (RoleAdapter != null) { list.setAdapter(RoleAdapter); } else { //Log.e("CookbookAdapter","CookbookAdapter is null"); } } else { //Log.e("List","List is null"); } dialog.dismiss(); } else if (msg.what == 200) { dialog.setMessage("Sending request to Chef..."); } else if (msg.what == 201) { dialog.setMessage("Parsing JSON....."); } else if (msg.what == 202) { dialog.setMessage("Populating UI!"); } else { //Close the Progress dialog dialog.dismiss(); //Alert the user that something went terribly wrong AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create(); alertDialog.setTitle("API Error"); alertDialog.setMessage("There was an error communicating with the API:\n" + msg.getData().getString("exception")); alertDialog.setButton2("Back", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //getActivity().finish(); } }); alertDialog.setIcon(R.drawable.icon); alertDialog.show(); } } }; Thread dataPreload = new Thread() { public void run() { if (listOfRoles.size() > 0) { handler.sendEmptyMessage(0); } else { try { handler.sendEmptyMessage(200); Roles = Cut.GetRoles(); handler.sendEmptyMessage(201); JSONArray Keys = Roles.names(); for (int i = 0; i < Keys.length(); i++) { listOfRoles.add(new Role(Keys.getString(i), Roles.getString(Keys.getString(i)) .replaceFirst("^(https://|http://).*/roles/", ""))); } handler.sendEmptyMessage(202); handler.sendEmptyMessage(0); } catch (Exception e) { Message msg = new Message(); Bundle data = new Bundle(); data.putString("exception", e.getMessage()); msg.setData(data); msg.what = 1; handler.sendMessage(msg); } } return; } }; dataPreload.start(); return inflater.inflate(R.layout.roles_landing, container, false); }
From source file:com.wellsandwhistles.android.redditsp.reddit.prepared.RedditPreparedPost.java
public static void onActionMenuItemSelected(final RedditPreparedPost post, final AppCompatActivity activity, final Action action) { switch (action) { case UPVOTE://from www . j av a 2s .co m post.action(activity, RedditAPI.ACTION_UPVOTE); break; case DOWNVOTE: post.action(activity, RedditAPI.ACTION_DOWNVOTE); break; case UNVOTE: post.action(activity, RedditAPI.ACTION_UNVOTE); break; case SAVE: post.action(activity, RedditAPI.ACTION_SAVE); break; case UNSAVE: post.action(activity, RedditAPI.ACTION_UNSAVE); break; case HIDE: post.action(activity, RedditAPI.ACTION_HIDE); break; case UNHIDE: post.action(activity, RedditAPI.ACTION_UNHIDE); break; case EDIT: final Intent editIntent = new Intent(activity, CommentEditActivity.class); editIntent.putExtra("commentIdAndType", post.src.getIdAndType()); editIntent.putExtra("commentText", StringEscapeUtils.unescapeHtml4(post.src.getRawSelfText())); editIntent.putExtra("isSelfPost", true); activity.startActivity(editIntent); break; case DELETE: new AlertDialog.Builder(activity).setTitle(R.string.accounts_delete).setMessage(R.string.delete_confirm) .setPositiveButton(R.string.action_delete, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { post.action(activity, RedditAPI.ACTION_DELETE); } }).setNegativeButton(R.string.dialog_cancel, null).show(); break; case REPORT: new AlertDialog.Builder(activity).setTitle(R.string.action_report) .setMessage(R.string.action_report_sure) .setPositiveButton(R.string.action_report, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { post.action(activity, RedditAPI.ACTION_REPORT); // TODO update the view to show the result // TODO don't forget, this also hides } }).setNegativeButton(R.string.dialog_cancel, null).show(); break; case EXTERNAL: { final Intent intent = new Intent(Intent.ACTION_VIEW); String url = (activity instanceof WebViewActivity) ? ((WebViewActivity) activity).getCurrentUrl() : post.src.getUrl(); intent.setData(Uri.parse(url)); activity.startActivity(intent); break; } case SELFTEXT_LINKS: { final HashSet<String> linksInComment = LinkHandler .computeAllLinks(StringEscapeUtils.unescapeHtml4(post.src.getRawSelfText())); if (linksInComment.isEmpty()) { General.quickToast(activity, R.string.error_toast_no_urls_in_self); } else { final String[] linksArr = linksInComment.toArray(new String[linksInComment.size()]); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setItems(linksArr, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { LinkHandler.onLinkClicked(activity, linksArr[which], false, post.src.getSrc()); dialog.dismiss(); } }); final AlertDialog alert = builder.create(); alert.setTitle(R.string.action_selftext_links); alert.setCanceledOnTouchOutside(true); alert.show(); } break; } case SAVE_IMAGE: { ((BaseActivity) activity).requestPermissionWithCallback(Manifest.permission.WRITE_EXTERNAL_STORAGE, new SaveImageCallback(activity, post.src.getUrl())); break; } case SHARE: { final Intent mailer = new Intent(Intent.ACTION_SEND); mailer.setType("text/plain"); mailer.putExtra(Intent.EXTRA_SUBJECT, post.src.getTitle()); mailer.putExtra(Intent.EXTRA_TEXT, post.src.getUrl()); activity.startActivity(Intent.createChooser(mailer, activity.getString(R.string.action_share))); break; } case SHARE_COMMENTS: { final boolean shareAsPermalink = PrefsUtility.pref_behaviour_share_permalink(activity, PreferenceManager.getDefaultSharedPreferences(activity)); final Intent mailer = new Intent(Intent.ACTION_SEND); mailer.setType("text/plain"); mailer.putExtra(Intent.EXTRA_SUBJECT, "Comments for " + post.src.getTitle()); if (shareAsPermalink) { mailer.putExtra(Intent.EXTRA_TEXT, Constants.Reddit.getNonAPIUri(post.src.getPermalink()).toString()); } else { mailer.putExtra(Intent.EXTRA_TEXT, Constants.Reddit .getNonAPIUri(Constants.Reddit.PATH_COMMENTS + post.src.getIdAlone()).toString()); } activity.startActivity( Intent.createChooser(mailer, activity.getString(R.string.action_share_comments))); break; } case SHARE_IMAGE: { ((BaseActivity) activity).requestPermissionWithCallback(Manifest.permission.WRITE_EXTERNAL_STORAGE, new ShareImageCallback(activity, post.src.getUrl())); break; } case COPY: { ClipboardManager manager = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); manager.setText(post.src.getUrl()); break; } case GOTO_SUBREDDIT: { try { final Intent intent = new Intent(activity, PostListingActivity.class); intent.setData(SubredditPostListURL.getSubreddit(post.src.getSubreddit()).generateJsonUri()); activity.startActivityForResult(intent, 1); } catch (RedditSubreddit.InvalidSubredditNameException e) { Toast.makeText(activity, R.string.invalid_subreddit_name, Toast.LENGTH_LONG).show(); } break; } case USER_PROFILE: LinkHandler.onLinkClicked(activity, new UserProfileURL(post.src.getAuthor()).toString()); break; case PROPERTIES: PostPropertiesDialog.newInstance(post.src.getSrc()).show(activity.getSupportFragmentManager(), null); break; case COMMENTS: ((PostSelectionListener) activity).onPostCommentsSelected(post); new Thread() { @Override public void run() { post.markAsRead(activity); } }.start(); break; case LINK: ((PostSelectionListener) activity).onPostSelected(post); break; case COMMENTS_SWITCH: if (!(activity instanceof MainActivity)) activity.finish(); ((PostSelectionListener) activity).onPostCommentsSelected(post); break; case LINK_SWITCH: if (!(activity instanceof MainActivity)) activity.finish(); ((PostSelectionListener) activity).onPostSelected(post); break; case ACTION_MENU: showActionMenu(activity, post); break; case REPLY: final Intent intent = new Intent(activity, CommentReplyActivity.class); intent.putExtra(CommentReplyActivity.PARENT_ID_AND_TYPE_KEY, post.src.getIdAndType()); intent.putExtra(CommentReplyActivity.PARENT_MARKDOWN_KEY, post.src.getUnescapedSelfText()); activity.startActivity(intent); break; case BACK: activity.onBackPressed(); break; case PIN: try { String subredditCanonicalName = RedditSubreddit.getCanonicalName(post.src.getSubreddit()); List<String> pinnedSubreddits = PrefsUtility.pref_pinned_subreddits(activity, PreferenceManager.getDefaultSharedPreferences(activity)); if (!pinnedSubreddits.contains(subredditCanonicalName)) { PrefsUtility.pref_pinned_subreddits_add(activity, PreferenceManager.getDefaultSharedPreferences(activity), subredditCanonicalName); } else { Toast.makeText(activity, R.string.mainmenu_toast_pinned, Toast.LENGTH_SHORT).show(); } } catch (RedditSubreddit.InvalidSubredditNameException e) { throw new RuntimeException(e); } break; case UNPIN: try { String subredditCanonicalName = RedditSubreddit.getCanonicalName(post.src.getSubreddit()); List<String> pinnedSubreddits = PrefsUtility.pref_pinned_subreddits(activity, PreferenceManager.getDefaultSharedPreferences(activity)); if (pinnedSubreddits.contains(subredditCanonicalName)) { PrefsUtility.pref_pinned_subreddits_remove(activity, PreferenceManager.getDefaultSharedPreferences(activity), subredditCanonicalName); } else { Toast.makeText(activity, R.string.mainmenu_toast_not_pinned, Toast.LENGTH_SHORT).show(); } } catch (RedditSubreddit.InvalidSubredditNameException e) { throw new RuntimeException(e); } break; case BLOCK: try { String subredditCanonicalName = RedditSubreddit.getCanonicalName(post.src.getSubreddit()); List<String> blockedSubreddits = PrefsUtility.pref_blocked_subreddits(activity, PreferenceManager.getDefaultSharedPreferences(activity)); if (!blockedSubreddits.contains(subredditCanonicalName)) { PrefsUtility.pref_blocked_subreddits_add(activity, PreferenceManager.getDefaultSharedPreferences(activity), subredditCanonicalName); } else { Toast.makeText(activity, R.string.mainmenu_toast_blocked, Toast.LENGTH_SHORT).show(); } } catch (RedditSubreddit.InvalidSubredditNameException e) { throw new RuntimeException(e); } break; case UNBLOCK: try { String subredditCanonicalName = RedditSubreddit.getCanonicalName(post.src.getSubreddit()); List<String> blockedSubreddits = PrefsUtility.pref_blocked_subreddits(activity, PreferenceManager.getDefaultSharedPreferences(activity)); if (blockedSubreddits.contains(subredditCanonicalName)) { PrefsUtility.pref_blocked_subreddits_remove(activity, PreferenceManager.getDefaultSharedPreferences(activity), subredditCanonicalName); } else { Toast.makeText(activity, R.string.mainmenu_toast_not_blocked, Toast.LENGTH_SHORT).show(); } } catch (RedditSubreddit.InvalidSubredditNameException e) { throw new RuntimeException(e); } break; case SUBSCRIBE: try { String subredditCanonicalName = RedditSubreddit.getCanonicalName(post.src.getSubreddit()); RedditSubredditSubscriptionManager subMan = RedditSubredditSubscriptionManager .getSingleton(activity, RedditAccountManager.getInstance(activity).getDefaultAccount()); if (subMan.getSubscriptionState( subredditCanonicalName) == RedditSubredditSubscriptionManager.SubredditSubscriptionState.NOT_SUBSCRIBED) { subMan.subscribe(subredditCanonicalName, activity); Toast.makeText(activity, R.string.options_subscribing, Toast.LENGTH_SHORT).show(); } else { Toast.makeText(activity, R.string.mainmenu_toast_subscribed, Toast.LENGTH_SHORT).show(); } } catch (RedditSubreddit.InvalidSubredditNameException e) { throw new RuntimeException(e); } break; case UNSUBSCRIBE: try { String subredditCanonicalName = RedditSubreddit.getCanonicalName(post.src.getSubreddit()); RedditSubredditSubscriptionManager subMan = RedditSubredditSubscriptionManager .getSingleton(activity, RedditAccountManager.getInstance(activity).getDefaultAccount()); if (subMan.getSubscriptionState( subredditCanonicalName) == RedditSubredditSubscriptionManager.SubredditSubscriptionState.SUBSCRIBED) { subMan.unsubscribe(subredditCanonicalName, activity); Toast.makeText(activity, R.string.options_unsubscribing, Toast.LENGTH_SHORT).show(); } else { Toast.makeText(activity, R.string.mainmenu_toast_not_subscribed, Toast.LENGTH_SHORT).show(); } } catch (RedditSubreddit.InvalidSubredditNameException e) { throw new RuntimeException(e); } break; } }
From source file:eu.betaas.betaasandroidapp.NavigationDrawerFragment.java
@Override public void onGatewayInstallFailure(Gateway gateway, String cause) { AlertDialog alertDialog = new AlertDialog.Builder(this.getActivity()).create(); alertDialog.setTitle("Alert"); alertDialog.setMessage("[" + gateway.getName() + "] : " + cause); alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss();// w w w. jav a 2 s. com } }); alertDialog.show(); }
From source file:eu.betaas.betaasandroidapp.NavigationDrawerFragment.java
@Override public void onGatewayUpdateFailure(Gateway gateway, String cause) { AlertDialog alertDialog = new AlertDialog.Builder(this.getActivity()).create(); alertDialog.setTitle("Alert"); alertDialog.setMessage("[" + gateway.getName() + "] : " + cause); alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss();/* ww w . j av a 2 s .c o m*/ } }); alertDialog.show(); }
From source file:eu.betaas.betaasandroidapp.NavigationDrawerFragment.java
@Override public void onGatewayRemoveFailure(Gateway gateway, String cause) { AlertDialog alertDialog = new AlertDialog.Builder(this.getActivity()).create(); alertDialog.setTitle("Alert"); alertDialog.setMessage("[" + gateway.getName() + "] : " + cause); alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss();//from w ww . j a v a 2s .c o m } }); alertDialog.show(); }
From source file:za.co.neilson.alarm.AlarmActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.alarm_activity); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle("E-care"); setSupportActionBar(toolbar);/*from ww w.ja v a 2 s . c o m*/ db = new SQLiteHandler(getApplicationContext()); session = new SessionManager(getApplicationContext()); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); NavigationView view = (NavigationView) findViewById(R.id.navigation_view); view.getMenu().getItem(3).setChecked(true); view.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { Toast.makeText(AlarmActivity.this, menuItem.getItemId() + " pressed", Toast.LENGTH_LONG).show(); Log.d(R.id.nav_1 + "", menuItem.getItemId() + " "); Intent intent = new Intent(); switch (menuItem.getItemId()) { case R.id.nav_1: intent.setClass(AlarmActivity.this, Case_history_review.class); startActivity(intent); break; case R.id.nav_2: intent.setClass(AlarmActivity.this, ShowAppointmentList.class); //intent .putExtra("name", "Hello B Activity"); startActivity(intent); break; case R.id.nav_3: intent.setClass(AlarmActivity.this, Appointmentcreate.class); //intent .putExtra("name", "Hello B Activity"); startActivity(intent); break; case R.id.nav_4: intent.setClass(AlarmActivity.this, AlarmActivity.class); //intent .putExtra("name", "Hello B Activity"); startActivity(intent); break; case R.id.nav_5: intent.setClass(AlarmActivity.this, PatientReport.class); //intent .putExtra("name", "Hello B Activity"); startActivity(intent); break; case R.id.nav_6: //logout AlertDialog.Builder builder = new AlertDialog.Builder(AlarmActivity.this); //Uncomment the below code to Set the message and title from the strings.xml file //builder.setMessage(R.string.dialog_message) .setTitle(R.string.dialog_title); //Setting message manually and performing action on button click builder.setMessage("Do you want to close this application ?").setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { session.setLogin(false); db.deleteUsers(); final Intent intent_logout = new Intent(AlarmActivity.this, LoginActivity.class); startActivity(intent_logout); finish(); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Action for 'NO' Button dialog.cancel(); } }); //Creating dialog box AlertDialog alert = builder.create(); //Setting the title manually alert.setTitle("AlertDialogExample"); alert.show(); break; } menuItem.setChecked(true); drawerLayout.closeDrawers(); return true; } }); ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close) { @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); } @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); } }; HashMap<String, String> dbuser = db.getUserDetails(); View header = view.getHeaderView(0); TextView headerName = (TextView) header.findViewById(R.id.drawer_name); String username = dbuser.get("name"); headerName.setText(username); ImageLoader imageLoader = AppController.getInstance().getImageLoader(); CirculaireNetworkImageView headerphoto = (CirculaireNetworkImageView) header .findViewById(R.id.drawer_thumbnail); headerphoto.setImageUrl("http://192.168.43.216/test/" + dbuser.get("image"), imageLoader); drawerLayout.setDrawerListener(actionBarDrawerToggle); actionBarDrawerToggle.syncState(); mathAlarmListView = (ListView) findViewById(android.R.id.list); mathAlarmListView.setLongClickable(true); mathAlarmListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position, long id) { view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); final Alarm alarm = (Alarm) alarmListAdapter.getItem(position); Builder dialog = new AlertDialog.Builder(AlarmActivity.this); dialog.setTitle("Delete"); dialog.setMessage("Delete this alarm?"); dialog.setPositiveButton("Ok", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Database.init(AlarmActivity.this); Database.deleteEntry(alarm); AlarmActivity.this.callMathAlarmScheduleService(); updateAlarmList(); } }); dialog.setNegativeButton("Cancel", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); dialog.show(); return true; } }); callMathAlarmScheduleService(); alarmListAdapter = new AlarmListAdapter(this); this.mathAlarmListView.setAdapter(alarmListAdapter); mathAlarmListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View v, int position, long id) { v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); Alarm alarm = (Alarm) alarmListAdapter.getItem(position); Intent intent = new Intent(AlarmActivity.this, AlarmPreferencesActivity.class); intent.putExtra("alarm", alarm); startActivity(intent); } }); }
From source file:ti.modules.titanium.ui.widget.TiUIDialog.java
@Override public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) { Log.d(TAG, "Property: " + key + " old: " + oldValue + " new: " + newValue, Log.DEBUG_MODE); AlertDialog dialog = dialogWrapper.getDialog(); if (key.equals(TiC.PROPERTY_TITLE)) { if (dialog != null) { dialog.setTitle((String) newValue); }//from w ww.ja v a 2 s.c o m } else if (key.equals(TiC.PROPERTY_MESSAGE)) { if (dialog != null) { dialog.setMessage((String) newValue); } } else if (key.equals(TiC.PROPERTY_BUTTON_NAMES)) { if (dialog != null) { dialog.dismiss(); dialog = null; } processButtons(TiConvert.toStringArray((Object[]) newValue)); } else if (key.equals(TiC.PROPERTY_OK) && !proxy.hasProperty(TiC.PROPERTY_BUTTON_NAMES)) { if (dialog != null) { dialog.dismiss(); dialog = null; } processButtons(new String[] { TiConvert.toString(newValue) }); } else if (key.equals(TiC.PROPERTY_OPTIONS)) { if (dialog != null) { dialog.dismiss(); dialog = null; } getBuilder().setView(null); int selectedIndex = -1; if (proxy.hasProperty(TiC.PROPERTY_SELECTED_INDEX)) { selectedIndex = TiConvert.toInt(proxy.getProperty(TiC.PROPERTY_SELECTED_INDEX)); } processOptions(TiConvert.toStringArray((Object[]) newValue), selectedIndex); } else if (key.equals(TiC.PROPERTY_SELECTED_INDEX)) { if (dialog != null) { dialog.dismiss(); dialog = null; } getBuilder().setView(null); if (proxy.hasProperty(TiC.PROPERTY_OPTIONS)) { processOptions(TiConvert.toStringArray((Object[]) proxy.getProperty(TiC.PROPERTY_OPTIONS)), TiConvert.toInt(newValue)); } } else if (key.equals(TiC.PROPERTY_ANDROID_VIEW)) { if (dialog != null) { dialog.dismiss(); dialog = null; } if (newValue != null) { processView((TiViewProxy) newValue); } else { proxy.setProperty(TiC.PROPERTY_ANDROID_VIEW, null); } } else if (key.equals(TiC.PROPERTY_PERSISTENT) && newValue != null) { dialogWrapper.setPersistent(TiConvert.toBoolean(newValue)); } else if (key.indexOf("accessibility") == 0) { if (dialog != null) { ListView listView = dialog.getListView(); if (listView != null) { if (key.equals(TiC.PROPERTY_ACCESSIBILITY_HIDDEN)) { int importance = ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO; if (newValue != null && TiConvert.toBoolean(newValue)) { importance = ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO; } ViewCompat.setImportantForAccessibility(listView, importance); } else { listView.setContentDescription(composeContentDescription()); } } } } else { super.propertyChanged(key, oldValue, newValue, proxy); } }
From source file:fm.smart.r1.activity.CreateExampleActivity.java
public void onWindowFocusChanged(boolean bool) { super.onWindowFocusChanged(bool); Log.d("DEBUG", "onWindowFocusChanged"); if (CreateExampleActivity.create_example_result != null) { synchronized (CreateExampleActivity.create_example_result) { final AlertDialog dialog = new AlertDialog.Builder(this).create(); final boolean success = CreateExampleActivity.create_example_result.success(); dialog.setTitle(CreateExampleActivity.create_example_result.getTitle()); dialog.setMessage(CreateExampleActivity.create_example_result.getMessage()); CreateExampleActivity.create_example_result = null; dialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO avoid moving to item view if previous thread was // interrupted? create_example.isInterrupted() but need // user to be aware if we // have created example already - progress dialog is set // cancelable, so back button will work? maybe should // avoid encouraging cancel // on POST operations ... not sure what to do if no // response from server - guess we will time out // eventually ... if (success) { // want to go back to individual item screen now ... ItemListActivity.loadItem(CreateExampleActivity.this, item_id); }//from www . jav a2s . c o m } }); dialog.show(); } } }
From source file:es.uja.photofirma.android.CameraActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.camera_activity); logger.appendLog(100, "login usuario satisfactorio"); //Definicin de elementos visuales involucrados lycpt = (ImageView) findViewById(R.id.cameraActivityCameraPhotoTap); lyerr = (LinearLayout) findViewById(R.id.cameraActivityErrorHeader); lysuc = (LinearLayout) findViewById(R.id.cameraActivitySuccessHeaderTextView); lycan = (LinearLayout) findViewById(R.id.cameraActivityCancelHeader); lyinf = (LinearLayout) findViewById(R.id.cameraActivityInfoHeader); lyupl = (LinearLayout) findViewById(R.id.cameraActivityUploadingHeader); lyudone = (LinearLayout) findViewById(R.id.cameraActivitySuccesUploadHeader); lyuerr = (LinearLayout) findViewById(R.id.cameraActivityErrorUploadHeader); errorText = (TextView) findViewById(R.id.cameraActivityErrorTextView); //gestor de servicios de telefonia, para la obtencin del IMEI del terminal telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager == null) { imeiNumber = getString(R.string.no_imei_available); } else {/*w w w. java 2 s.co m*/ imeiNumber = telephonyManager.getDeviceId(); } //Deteccin de los parametros necesarios tras un login exitoso if (getIntent().hasExtra("userName") && getIntent().hasExtra("userId") && getIntent().hasExtra("userEmail")) { userName = getIntent().getExtras().getString("userName"); userId = getIntent().getExtras().getInt("userId"); userEmail = getIntent().getExtras().getString("userEmail"); } else { Toast.makeText(getApplicationContext(), getString(R.string.no_user_data_found), Toast.LENGTH_LONG) .show(); } final AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Aviso de privacidad"); alertDialog.setMessage(getString(R.string.privacy_alert)); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { alertDialog.dismiss(); } }); alertDialog.show(); SharedPreferences prefs = getSharedPreferences("prefsfile", Context.MODE_PRIVATE); String myPrefServerIp = prefs.getString("prefIpAddress", "10.0.3.2"); URL_CONTENT_UPLOAD = "https://" + myPrefServerIp + "/photo@firmaServices/content_upload.php"; }