List of usage examples for android.app Dialog requestWindowFeature
public final boolean requestWindowFeature(int featureId)
From source file:com.openerp.addons.idea.product.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.Dash_Board: Dash_Board detail = new Dash_Board(); FragmentListener frag = (FragmentListener) getActivity(); frag.startDetailFragment(detail); return true; case R.id.Search_product: final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.product_search_custom_dialog); // dialog.setTitle("Product Search"); dialog.setOnCancelListener(new OnCancelListener() { @Override/*from w w w . j a v a 2 s. c om*/ public void onCancel(DialogInterface dialog) { dialog.dismiss(); } }); AutoCompleteTextView autotext = (AutoCompleteTextView) dialog .findViewById(R.id.autoCompleteTextView_product_search); final ArrayAdapter adapter = new ArrayAdapter(getActivity(), android.R.layout.simple_list_item_1, OEHelper.datatemplate); TextView txv = (TextView) dialog.findViewById(R.id.textView1); Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Georgia.ttf"); autotext.setTypeface(font, Typeface.BOLD); autotext.setAdapter(adapter); txv.setTypeface(font, Typeface.BOLD); autotext.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String name = adapter.getItem(arg2).toString(); callmethod_for_position_productdetail(OEHelper.datatemplate.indexOf(name)); dialog.dismiss(); } }); dialog.show(); return true; } return true; }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display the list of browser bookmarks. Allow user to load bookmarked web * site.//from w w w.ja v a 2s . c om * * @param context */ public static void displayBookmarks(final Launcher context) { final ArrayList<BookmarkInfo> bookmarks = loadBookmarks(context); if (bookmarks.size() > 0) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.bookmarks_list); ListView listView = (ListView) dialog.findViewById(R.id.list); Collections.sort(bookmarks, new Comparator<BookmarkInfo>() { @Override public int compare(BookmarkInfo lhs, BookmarkInfo rhs) { return lhs.getTitle().toLowerCase().compareTo(rhs.getTitle().toLowerCase()); } }); listView.setAdapter(new BookmarkAdapter(context, bookmarks)); listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { BookmarkInfo bookmark = (BookmarkInfo) parent.getAdapter().getItem(position); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(bookmark.getUrl())); context.startActivity(browserIntent); context.showCover(false); dialog.dismiss(); Analytics.logEvent(Analytics.INVOKE_BOOKMARK); } }); listView.setDrawingCacheEnabled(true); listView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_BOOKMARKS); } else { displayAlert(context, context.getString(R.string.dialog_no_browser_bookmarks)); } }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display a grid of all installed apps + virtual apps. Allow user to launch * apps.// www . jav a2s. com * * @param context * @param applications */ public static void displayAllApps(final Launcher context, final ArrayList<ApplicationInfo> applications) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.apps_grid); final GridView gridView = (GridView) dialog.findViewById(R.id.grid); gridView.setAdapter(new AllItemAdapter(context, getApplications(context, applications, false))); gridView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ItemInfo itemInfo = (ItemInfo) parent.getAdapter().getItem(position); itemInfo.invoke(context); context.showCover(false); dialog.dismiss(); if (itemInfo instanceof ApplicationInfo) { ApplicationInfo applicationInfo = (ApplicationInfo) itemInfo; RecentAppsTable.persistRecentApp(context, applicationInfo); } } }); gridView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> gridView, View view, int pos, long arg3) { ItemInfo itemInfo = (ItemInfo) gridView.getAdapter().getItem(pos); if (itemInfo instanceof ApplicationInfo) { Uri packageURI = Uri.parse("package:" + itemInfo.getIntent().getComponent().getPackageName()); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); context.startActivity(uninstallIntent); context.showCover(false); dialog.dismiss(); Analytics.logEvent(Analytics.UNINSTALL_APP); } return false; } }); gridView.setDrawingCacheEnabled(true); gridView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_ALL_APPS); }
From source file:edu.berkeley.boinc.ProjectDetailsFragment.java
private void showConfirmationDialog(final int operation) { final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_confirm); Button confirm = (Button) dialog.findViewById(R.id.confirm); TextView tvTitle = (TextView) dialog.findViewById(R.id.title); TextView tvMessage = (TextView) dialog.findViewById(R.id.message); // operation dependend texts if (operation == RpcClient.PROJECT_DETACH) { tvTitle.setText(R.string.projects_confirm_detach_title); tvMessage.setText(getString(R.string.projects_confirm_detach_message) + " " + project.project_name + " " + getString(R.string.projects_confirm_detach_message2)); confirm.setText(R.string.projects_confirm_detach_confirm); } else if (operation == RpcClient.PROJECT_RESET) { tvTitle.setText(R.string.projects_confirm_reset_title); tvMessage.setText(getString(R.string.projects_confirm_reset_message) + " " + project.project_name + getString(R.string.projects_confirm_reset_message2)); confirm.setText(R.string.projects_confirm_reset_confirm); }//from w w w. ja v a 2s .c o m confirm.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new ProjectOperationAsync().execute(operation); dialog.dismiss(); } }); Button cancel = (Button) dialog.findViewById(R.id.cancel); cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
From source file:com.cettco.buycar.activity.OrderDetailActivity.java
private void initDialog() { final Dialog dialog = new Dialog(OrderDetailActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setContentView(R.layout.popup_accept); dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); dialog.show();/* www.j ava 2 s .c o m*/ Button cancelBtn = (Button) dialog.findViewById(R.id.popup_accept_cancel_btn); cancelBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub } }); Button payBtn = (Button) dialog.findViewById(R.id.popup_accept_pay_btn); payBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub } }); }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display dialog to allow user to add an app to a row. The user can add the * app to an existing row or a new row./* ww w. j a v a 2 s .co m*/ * * @param context * @param applications */ public static void displayAddApps(final Launcher context, final ArrayList<ApplicationInfo> applications) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.add_apps_grid); final EditText nameEditText = (EditText) dialog.findViewById(R.id.rowName); final RadioButton currentRadioButton = (RadioButton) dialog.findViewById(R.id.currentRadio); currentRadioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // hide the row name edit field if the current row radio button // is selected nameEditText.setVisibility(View.GONE); } }); final RadioButton newRadioButton = (RadioButton) dialog.findViewById(R.id.newRadio); newRadioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // show the row name edit field if the new radio button is // selected nameEditText.setVisibility(View.VISIBLE); nameEditText.requestFocus(); } }); final GridView gridView = (GridView) dialog.findViewById(R.id.grid); gridView.setAdapter(new AllItemAdapter(context, getApplications(context, applications, true))); gridView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // if the new row radio button is selected, the user must enter // a name for the new row String name = nameEditText.getText().toString().trim(); if (newRadioButton.isChecked() && name.length() == 0) { nameEditText.requestFocus(); displayAlert(context, context.getString(R.string.dialog_new_row_name_alert)); return; } ItemInfo itemInfo = (ItemInfo) parent.getAdapter().getItem(position); boolean currentRow = !newRadioButton.isChecked(); context.addItem(itemInfo, currentRow ? null : name); context.showCover(false); dialog.dismiss(); if (currentRow) { Analytics.logEvent(Analytics.DIALOG_ADD_APP); } else { Analytics.logEvent(Analytics.ADD_APP_WITH_ROW); } } }); gridView.setDrawingCacheEnabled(true); gridView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_ADD_APP); }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display dialog to the user for the Spotlight web apps: * https://www.google.com/tv/spotlight-gallery.html Allow the user to add a * web app to an existing row or a new row. * // www. ja va 2 s .c o m * @param context */ public static void displayAddSpotlight(final Launcher context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.add_apps_grid); final EditText nameEditText = (EditText) dialog.findViewById(R.id.rowName); final RadioButton currentRadioButton = (RadioButton) dialog.findViewById(R.id.currentRadio); currentRadioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // hide the row name edit field if the current row radio button // is selected nameEditText.setVisibility(View.GONE); } }); final RadioButton newRadioButton = (RadioButton) dialog.findViewById(R.id.newRadio); newRadioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // show the row name edit field if the new radio button is // selected nameEditText.setVisibility(View.VISIBLE); nameEditText.requestFocus(); } }); final GridView gridView = (GridView) dialog.findViewById(R.id.grid); final ArrayList<SpotlightInfo> spotlights = SpotlightTable.getAllSpotlights(context); gridView.setAdapter(new AllSpotlightAdapter(context, spotlights)); gridView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // if the new row radio button is selected, the user must enter // a name for the new row String name = nameEditText.getText().toString().trim(); if (newRadioButton.isChecked() && name.length() == 0) { nameEditText.requestFocus(); displayAlert(context, context.getString(R.string.dialog_new_row_name_alert)); return; } ItemInfo itemInfo = (ItemInfo) parent.getAdapter().getItem(position); boolean currentRow = !newRadioButton.isChecked(); context.addItem(itemInfo, currentRow ? null : name); context.showCover(false); dialog.dismiss(); if (currentRow) { Analytics.logEvent(Analytics.ADD_SPOTLIGHT_WEB_APP); } else { Analytics.logEvent(Analytics.ADD_SPOTLIGHT_WEB_APP_WITH_ROW); } } }); gridView.setDrawingCacheEnabled(true); gridView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_ADD_SPOTLIGHT_WEB_APP); }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Prompt the user to rate the app.// w ww . j av a2 s . c om * * @param context */ public static void displayRating(final Launcher context) { SharedPreferences prefs = context.getSharedPreferences(Launcher.PREFERENCES_NAME, Activity.MODE_PRIVATE); if (prefs.getBoolean(DONT_SHOW_RATING_AGAIN, false)) { return; } final SharedPreferences.Editor editor = prefs.edit(); // Get date of first launch Long date_firstLaunch = prefs.getLong(DATE_FIRST_LAUNCHED, 0); if (date_firstLaunch == 0) { date_firstLaunch = System.currentTimeMillis(); editor.putLong(DATE_FIRST_LAUNCHED, date_firstLaunch); } // Wait at least n days before opening if (System.currentTimeMillis() >= date_firstLaunch + (DAYS_UNTIL_PROMPT * 24 * 60 * 60 * 1000)) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.confirmation); TextView confirmationTextView = (TextView) dialog.findViewById(R.id.confirmationText); confirmationTextView.setText(context.getString(R.string.rating_message)); Button buttonYes = (Button) dialog.findViewById(R.id.button1); buttonYes.setText(context.getString(R.string.dialog_yes)); buttonYes.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.entertailion.android.launcher")); context.startActivity(intent); if (editor != null) { editor.putBoolean(DONT_SHOW_RATING_AGAIN, true); editor.commit(); } Analytics.logEvent(Analytics.RATING_YES); context.showCover(false); dialog.dismiss(); } }); Button buttonNo = (Button) dialog.findViewById(R.id.button2); buttonNo.setText(context.getString(R.string.dialog_no)); buttonNo.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (editor != null) { editor.putBoolean(DONT_SHOW_RATING_AGAIN, true); editor.commit(); } Analytics.logEvent(Analytics.RATING_NO); context.showCover(false); dialog.dismiss(); } }); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); } editor.commit(); }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display about dialog to user when invoked from menu option. * //from w w w .j a va 2 s . c o m * @param context */ public static void displayAbout(final Launcher context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.about); Typeface lightTypeface = ((LauncherApplication) context.getApplicationContext()).getLightTypeface(context); TextView aboutTextView = (TextView) dialog.findViewById(R.id.about_text1); aboutTextView.setTypeface(lightTypeface); aboutTextView.setText(context.getString(R.string.about_version_title, Utils.getVersion(context))); aboutTextView.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { context.showCover(false); dialog.dismiss(); Intent intent = new Intent(context, EasterEggActivity.class); context.startActivity(intent); Analytics.logEvent(Analytics.EASTER_EGG); return true; } }); TextView copyrightTextView = (TextView) dialog.findViewById(R.id.copyright_text); copyrightTextView.setTypeface(lightTypeface); TextView feedbackTextView = (TextView) dialog.findViewById(R.id.feedback_text); feedbackTextView.setTypeface(lightTypeface); ((Button) dialog.findViewById(R.id.button_web)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(context.getString(R.string.about_button_web_url))); context.startActivity(intent); Analytics.logEvent(Analytics.ABOUT_WEB_SITE); context.showCover(false); dialog.dismiss(); } }); ((Button) dialog.findViewById(R.id.button_privacy_policy)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(context.getString(R.string.about_button_privacy_policy_url))); context.startActivity(intent); Analytics.logEvent(Analytics.ABOUT_PRIVACY_POLICY); context.showCover(false); dialog.dismiss(); } }); ((Button) dialog.findViewById(R.id.button_more_apps)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(context.getString(R.string.about_button_more_apps_url))); context.startActivity(intent); Analytics.logEvent(Analytics.ABOUT_MORE_APPS); context.showCover(false); dialog.dismiss(); } }); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_ABOUT); }
From source file:com.tingtingapps.securesms.ConversationListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { final View view = inflater.inflate(R.layout.conversation_list_fragment, container, false); reminderView = (ReminderView) view.findViewById(R.id.reminder); list = (RecyclerView) view.findViewById(R.id.list); fab = (FloatingActionButton) view.findViewById(R.id.fab); list.setHasFixedSize(true);/* w w w . j a va 2 s . co m*/ list.setLayoutManager(new LinearLayoutManager(getActivity())); Calendar calendar = Calendar.getInstance(); int day = calendar.get(Calendar.DAY_OF_WEEK); int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); SharedPreferences sp1 = getActivity().getSharedPreferences("myPrefs", Activity.MODE_PRIVATE); int dayShowPopup = sp1.getInt("dayShowPopup", 0); /* //test data day = 7; dayShowPopup = 15; dayOfMonth = 26;*/ if (day == 7 && dayOfMonth != dayShowPopup) { SharedPreferences sp2 = getActivity().getSharedPreferences("myPrefs", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = sp2.edit(); editor.putInt("dayShowPopup", dayOfMonth); editor.commit(); final Dialog dialogRating = new Dialog(getActivity()); dialogRating.requestWindowFeature(Window.FEATURE_NO_TITLE); dialogRating.setContentView(R.layout.dlg_rating_sharing_donating); int height = 850; dialogRating.getWindow().setLayout(LinearLayout.LayoutParams.FILL_PARENT, height); dialogRating.setCancelable(true); dialogRating.show(); Button btnRate = (Button) dialogRating.findViewById(R.id.btn_rate); btnRate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Context context = getActivity().getApplicationContext(); String packageName = context.getPackageName(); Intent intentRateApp = new Intent(Intent.ACTION_VIEW); intentRateApp.setData(Uri.parse("market://details?id=" + packageName)); startActivity(intentRateApp); } }); /*Button btnRemoveAds = (Button) dialogRating.findViewById(R.id.btn_remove_ads); btnRemoveAds.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intentInAppBilling = new Intent(getActivity(), InAppBillingActivity.class); startActivity(intentInAppBilling); } });*/ Button btnShare = (Button) dialogRating.findViewById(R.id.btn_share); btnShare.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = getString(R.string.socail_share_body); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.socail_share_title)); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, getString(R.string.socail_share_via))); } }); Button btnClose = (Button) dialogRating.findViewById(R.id.btn_close); btnClose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialogRating.dismiss(); } }); } return view; }