List of usage examples for android.app Dialog requestWindowFeature
public final boolean requestWindowFeature(int featureId)
From source file:ua.mkh.settings.full.MainActivity.java
private void openDialog() { final Dialog dialog = new Dialog(MainActivity.this, android.R.style.Theme_Translucent); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_menu); dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation; Button ButtonInfo = (Button) dialog.getWindow().findViewById(R.id.button1); ButtonMenuCancel = (Button) dialog.getWindow().findViewById(R.id.ButtonMenuCancel); ButtonMenuSettings = (Button) dialog.getWindow().findViewById(R.id.ButtonMenuSettings); ButtonMenuSettings.setTypeface(typefaceRoman); ButtonMenuCancel.setTypeface(typefaceMedium); ButtonInfo.setTypeface(typefaceRoman); ButtonInfo.setText(R.string.menu_info_main); ButtonMenuCancel.setOnClickListener(new OnClickListener() { @Override//ww w . j av a 2s . c o m public void onClick(View v) { dialog.dismiss(); } }); ButtonMenuSettings.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { launchIntent(); } }); dialog.show(); }
From source file:ua.mkh.settings.full.MainActivity.java
public void update_app() { final Dialog dialog = new Dialog(MainActivity.this, android.R.style.Theme_Translucent); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_inform); // set the custom dialog components - text, image and button Button dialogButtone = (Button) dialog.findViewById(R.id.dialogButtonOK); TextView text1 = (TextView) dialog.findViewById(R.id.text); TextView textB = (TextView) dialog.findViewById(R.id.textBold); text1.setText(R.string.update_version); textB.setText(R.string.attention);//from w w w .j a va 2 s .co m dialogButtone.setTypeface(typefaceRoman); text1.setTypeface(typefaceRoman); textB.setTypeface(typefaceBold); // if button is clicked, close the custom dialog dialogButtone.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("yastore://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { //startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://khaydarov-studio.bl.ee/fineSettings/"))); } overridePendingTransition(center_to_left, center_to_left2); dialog.dismiss(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }); dialog.show(); }
From source file:ua.mkh.settings.full.MainActivity.java
public void send_email() { final Dialog Activation = new Dialog(MainActivity.this, android.R.style.Theme_Translucent); Activation.requestWindowFeature(Window.FEATURE_NO_TITLE); Activation.setContentView(R.layout.dialog_inform); // set the custom dialog components - text, image and button Button dialogButton12 = (Button) Activation.findViewById(R.id.dialogButtonOK); TextView textf = (TextView) Activation.findViewById(R.id.textBold); TextView textverf = (TextView) Activation.findViewById(R.id.text); dialogButton12.setTypeface(typefaceRoman); textf.setTypeface(typefaceBold);/*from www . j a v a 2s .c o m*/ textverf.setTypeface(typefaceRoman); textverf.setText(R.string.activation); // if button is clicked, close the custom dialog dialogButton12.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (YA != null && G != null) { Intent i2 = new Intent(Intent.ACTION_SEND); i2.setType("text/rfc822"); i2.putExtra(Intent.EXTRA_EMAIL, new String[] { "maxim.khaydarov@yandex.ru" }); i2.putExtra(Intent.EXTRA_SUBJECT, "Activation"); i2.putExtra(Intent.EXTRA_TEXT, "2: " + codes(YA) + "\n" + "1: " + codes(G)); Editor e = mSettings.edit(); e.putBoolean(APP_PREFERENCES_ACTIVATION, true); e.commit(); // ? try { startActivity(Intent.createChooser(i2, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(MainActivity.this, "No email clients installed.", Toast.LENGTH_SHORT).show(); Editor e1 = mSettings.edit(); e1.putBoolean(APP_PREFERENCES_ACTIVATION, false); e1.commit(); // ? } } Editor e = mSettings.edit(); e.putBoolean(APP_PREFERENCES_ACTIVATION, true); e.commit(); // ? Activation.dismiss(); } }); Activation.show(); }
From source file:ua.mkh.settings.full.MainActivity.java
private void zimowets() { try {//from w w w .j av a 2 s . c o m //possibleEmail += "************* Get Registered Yandex Account *************nn"; Account[] accounts = AccountManager.get(this).getAccountsByType("com.yandex.passport"); for (Account account : accounts) { YA = account.name; if (account.name.contains("zimowets.leha") || account.name.contains("elmin0101")) { //do somethin final Dialog dialog = new Dialog(MainActivity.this, android.R.style.Theme_Translucent); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_inform); // set the custom dialog components - text, image and button Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); TextView text = (TextView) dialog.findViewById(R.id.text); TextView textB = (TextView) dialog.findViewById(R.id.textBold); text.setText(R.string.zimowets_block); textB.setText(R.string.attention); dialogButton.setTypeface(typefaceRoman); text.setTypeface(typefaceRoman); textB.setTypeface(typefaceBold); // if button is clicked, close the custom dialog dialogButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }); dialog.show(); } } Account[] accounts2 = AccountManager.get(this).getAccountsByType("com.google"); for (Account account : accounts2) { G = account.name; //textView2.setText(account.name); account_name = account.name; } } catch (Exception e) { } }
From source file:com.zen.androidhtmleditor.AHEActivity.java
@SuppressLint("NewApi") @Override/*w ww . j a v a 2 s .c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); setContentView(R.layout.main); SystemBarTintManager tintManager = new SystemBarTintManager(this); // enable status bar tint tintManager.setStatusBarTintEnabled(true); tintManager.setTintColor(Color.parseColor("#4acab4")); SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); Settings.init(settings); //Uncomment this for non Market installs. This will allow version checking. //new Version(this,getVersionName(this,DeveloperToolsActivity.class),"http://androidhtmleditor.com/version.php").execute(); deviceId = Secure.getString(this.getContentResolver(), Secure.ANDROID_ID); getOverflowMenu(); getActionBar().setIcon(R.drawable.icon_white); tabactivity = (TabActivity) this; tabHost = tabactivity.getTabHost(); hsv = (HorizontalScrollView) tabactivity.findViewById(R.id.topmenu); mLicenseCheckerCallback = new MyLicenseCheckerCallback(); mChecker = new LicenseChecker(this, new ServerManagedPolicy(this, new AESObfuscator(SALT, getPackageName(), deviceId)), BASE64_PUBLIC_KEY // Your public licensing key. ); mHandler = new Handler(); // doCheck(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (LinearLayout) findViewById(R.id.l1); // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getActionBar().setTitle("File(s)"); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getActionBar().setTitle("Server"); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); Button button1 = (Button) findViewById(R.id.button1); button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { onButtonClickEvent(v); } }); Button disconnect_button = (Button) findViewById(R.id.disconnect_button); disconnect_button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { disconnect(); } }); /* Button button2 = (Button)findViewById(R.id.button2); button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { hsv.setVisibility(View.GONE); v.setVisibility(View.GONE); RelativeLayout rl = (RelativeLayout)v.getParent(); Button button1 = (Button)findViewById(R.id.button1); button1.setVisibility(View.VISIBLE); Button button3 = (Button)findViewById(R.id.button3); button3.setVisibility(View.VISIBLE); ImageView logo = (ImageView)findViewById(R.id.logo); logo.setVisibility(View.VISIBLE); TextView slogan = (TextView)findViewById(R.id.appSlogan); slogan.setVisibility(View.VISIBLE); ScrollView frontLayout = (ScrollView)findViewById(R.id.front); frontLayout.setVisibility(View.VISIBLE); TextView appTitle = (TextView)findViewById(R.id.appTitle); appTitle.setVisibility(View.VISIBLE); Button backButton = (Button)rl.findViewById(R.id.backButton); backButton.setVisibility(View.GONE); arrayAdapter.clear(); arrayAdapter.notifyDataSetChanged(); TextView pathInfo = (TextView)rl.findViewById(R.id.path); pathInfo.setText(""); folderPath = ""; //new MyFetchTask("zenstudio.com.au", "zenstudi", ".-x$%Wmd5b#C","folder",folderPath).execute(); connectedTo = -1; Toast.makeText(AHEActivity.this, "Disconnected", Toast.LENGTH_SHORT).show(); } });*/ Button button3 = (Button) findViewById(R.id.button3); button3.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent SettingsIntent = new Intent(AHEActivity.this, Settings.class); startActivity(SettingsIntent); } }); /*Button backButton = (Button)findViewById(R.id.backButton); backButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String[] pathBits = folderPath.split("/"); folderPath = ""; for(int i=0;i<pathBits.length-1;i++){ folderPath += pathBits[i]+"/"; } arrayAdapter.clear(); //connectedTo SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); String currentServers = settings.getString("Accounts", ""); if(currentServers.equals("")){}else{ Gson gson = new Gson(); SearchResponse response = gson.fromJson(currentServers, SearchResponse.class); List<Result> results = response.data; Result l = results.get(connectedTo); if(l.serverName!="" && l.userName!="" && l.port.trim()!=""){ if(l.sftp.equals("0") || l.sftp.equals("1") || l.sftp.equals("2")){ new MyFetchTask(l.serverName, l.userName, l.passWord,"folder",folderPath,l.sftp,l.port).execute(); }else if(l.sftp.equals("3")){ new FetchSSLTask(l.serverName, l.userName, l.passWord,"folder",folderPath,l.sftp,l.port).execute(); } } } } });*/ TextView pathInfo = (TextView) findViewById(R.id.path); pathInfo.setText(folderPath); lstTest = (ListView) findViewById(R.id.list); // lstTest.setDividerHeight(10); lstTest.setPadding(0, 5, 0, 5); alrts = new ArrayList<String[]>(); arrayAdapter = new FetchAdapter(AHEActivity.this, R.layout.listitems, alrts); lstTest.setAdapter(arrayAdapter); lstTest.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) { final View d = v; final CharSequence[] items = { "Delete", "Rename", "Chmod", "Download" }; TextView t = (TextView) v.findViewById(R.id.fileFolderName); final String oldName = t.getText().toString(); final int position = pos; AlertDialog.Builder builder = new AlertDialog.Builder(AHEActivity.this); builder.setTitle("Choose Action"); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if (item == 0) { AlertDialog.Builder dbuilder = new AlertDialog.Builder(AHEActivity.this); dbuilder.setMessage("Delete this file?").setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { deleteFile(d); dialog.cancel(); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog dalert = dbuilder.create(); dalert.show(); } else if (item == 1) { final Dialog renameDialog = new Dialog(AHEActivity.this); renameDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); renameDialog.setContentView(R.layout.renamediag); renameDialog.setCancelable(true); Button closeServer = (Button) renameDialog.findViewById(R.id.closeServer); closeServer.setOnClickListener(new OnClickListener() { public void onClick(View v) { renameDialog.cancel(); } }); Button saveServer = (Button) renameDialog.findViewById(R.id.saveServer); saveServer.setOnClickListener(new OnClickListener() { public void onClick(View v) { EditText themeUrl = (EditText) renameDialog.findViewById(R.id.themeLink); String newName = themeUrl.getText().toString(); //connectedTo SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); String currentServers = settings.getString("Accounts", ""); if (currentServers.equals("")) { } else { Gson gson = new Gson(); SearchResponse response = gson.fromJson(currentServers, SearchResponse.class); List<Result> results = response.data; Result l = results.get(connectedTo); if (l.serverName != "" && l.userName != "" && l.port.trim() != "") { new RenameTask(l.serverName, l.userName, l.passWord, oldName, newName, folderPath, l.sftp, l.port, position).execute(); renameDialog.cancel(); } } } }); renameDialog.show(); } else if (item == 2) { final Dialog chmodDialog = new Dialog(AHEActivity.this); chmodDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); chmodDialog.setContentView(R.layout.chmoddiag); chmodDialog.setCancelable(true); Button closeServer = (Button) chmodDialog.findViewById(R.id.closeServer); closeServer.setOnClickListener(new OnClickListener() { public void onClick(View v) { chmodDialog.cancel(); } }); Button saveServer = (Button) chmodDialog.findViewById(R.id.saveServer); saveServer.setOnClickListener(new OnClickListener() { public void onClick(View v) { EditText themeUrl = (EditText) chmodDialog.findViewById(R.id.themeLink); String perms = themeUrl.getText().toString(); //connectedTo SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); String currentServers = settings.getString("Accounts", ""); if (currentServers.equals("")) { } else { Gson gson = new Gson(); SearchResponse response = gson.fromJson(currentServers, SearchResponse.class); List<Result> results = response.data; Result l = results.get(connectedTo); if (l.serverName != "" && l.userName != "" && l.port.trim() != "") { if (l.sftp.equals("0") || l.sftp.equals("1") || l.sftp.equals("2")) { new ChmodTask(l.serverName, l.userName, l.passWord, oldName, perms, folderPath, l.sftp, l.port, position).execute(); } else { Toast.makeText(AHEActivity.this, "CHMOD could not be performed on your server via sftp", Toast.LENGTH_SHORT).show(); } chmodDialog.cancel(); } } } }); chmodDialog.show(); } else if (item == 3) { //Make new class to download a file SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); String currentServers = settings.getString("Accounts", ""); if (currentServers.equals("")) { } else { Gson gson = new Gson(); SearchResponse response = gson.fromJson(currentServers, SearchResponse.class); List<Result> results = response.data; Result l = results.get(connectedTo); if (l.serverName != "" && l.userName != "" && l.port.trim() != "") { if (l.sftp.equals("0") || l.sftp.equals("1") || l.sftp.equals("2")) { new DlTask(l.serverName, l.userName, l.passWord, oldName, l.sftp, l.port) .execute(); } } } } //Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show(); } }); AlertDialog alert = builder.create(); alert.show(); return true; } }); lstTest.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> av, View v, int pos, long id) { loadFileFolder(v); } }); }
From source file:net.kjmaster.cookiemom.booth.add.AddBoothDialogFragment.java
private void showDateTimeDialog() { // Create the dialog final Dialog mDateTimeDialog = new Dialog(getActivity()); // Inflate the root layout final RelativeLayout mDateTimeDialogView = (RelativeLayout) getActivity().getLayoutInflater() .inflate(R.layout.ui_date_time_dialog, null); // Grab widget instance final DateTimePicker mDateTimePicker = (DateTimePicker) mDateTimeDialogView .findViewById(R.id.DateTimePicker); // Check is system is set to use 24h time (this doesn't seem to work as expected though) final String timeS = android.provider.Settings.System.getString(getActivity().getContentResolver(), android.provider.Settings.System.TIME_12_24); final boolean is24h = !(timeS == null || timeS.equals("12")); // Update demo TextViews when the "OK" button is clicked mDateTimeDialogView.findViewById(R.id.SetDateTime).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mDateTimePicker.clearFocus(); // TODO Auto-generated method stub String eventDate = SimpleDateFormat.getDateInstance(DateFormat.LONG) .format(new Date(mDateTimePicker.getDateTimeMillis())); ((TextView) getActivity().findViewById(R.id.Date)).setText(eventDate); if (mDateTimePicker.is24HourView()) { ((TextView) getActivity().findViewById(R.id.Time)).setText( mDateTimePicker.get(Calendar.HOUR_OF_DAY) + ":" + mDateTimePicker.get(Calendar.MINUTE)); } else { NumberFormat fmt = NumberFormat.getNumberInstance(); fmt.setMinimumIntegerDigits(2); ((TextView) getActivity().findViewById(R.id.Time)) .setText(fmt.format(mDateTimePicker.get(Calendar.HOUR)) + ":" + fmt.format(mDateTimePicker.get(Calendar.MINUTE)) + " " + (mDateTimePicker.get(Calendar.AM_PM) == Calendar.AM ? "AM" : "PM")); }// w ww .j a v a 2 s. c o m hiddenDateTime.setText(String.valueOf(mDateTimePicker.getDateTimeMillis())); mDateTimeDialog.dismiss(); } }); // Cancel the dialog when the "Cancel" button is clicked mDateTimeDialogView.findViewById(R.id.CancelDialog).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub mDateTimeDialog.cancel(); } }); // Reset Date and Time pickers when the "Reset" button is clicked mDateTimeDialogView.findViewById(R.id.ResetDateTime).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub mDateTimePicker.reset(); } }); // Setup TimePicker mDateTimePicker.setIs24HourView(is24h); // No title on the dialog window mDateTimeDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // Set the dialog content view mDateTimeDialog.setContentView(mDateTimeDialogView); // Display the dialog mDateTimeDialog.show(); }
From source file:com.sentaroh.android.SMBSync2.ActivityMain.java
@SuppressLint("InflateParams") private void aboutSMBSync() { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.about_dialog); final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.about_dialog_title_view); final TextView title = (TextView) dialog.findViewById(R.id.about_dialog_title); title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color); title.setTextColor(mGp.themeColorList.text_color_dialog_title); title.setText(getString(R.string.msgs_dlg_title_about) + "(Ver " + packageVersionName + ")"); // get our tabHost from the xml final TabHost tab_host = (TabHost) dialog.findViewById(R.id.about_tab_host); tab_host.setup();/*from w w w. j a v a 2s .c o m*/ final TabWidget tab_widget = (TabWidget) dialog.findViewById(android.R.id.tabs); if (Build.VERSION.SDK_INT >= 11) { tab_widget.setStripEnabled(false); tab_widget.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE); } CustomTabContentView tabViewProf = new CustomTabContentView(this, getString(R.string.msgs_about_dlg_func_btn)); tab_host.addTab(tab_host.newTabSpec("func").setIndicator(tabViewProf).setContent(android.R.id.tabcontent)); CustomTabContentView tabViewHist = new CustomTabContentView(this, getString(R.string.msgs_about_dlg_change_btn)); tab_host.addTab( tab_host.newTabSpec("change").setIndicator(tabViewHist).setContent(android.R.id.tabcontent)); LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout ll_func = (LinearLayout) vi.inflate(R.layout.about_dialog_func, null); LinearLayout ll_change = (LinearLayout) vi.inflate(R.layout.about_dialog_change, null); final WebView func_view = (WebView) ll_func.findViewById(R.id.about_dialog_function); func_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_dlg_title_about_func_desc)); func_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); func_view.getSettings().setBuiltInZoomControls(true); final WebView change_view = (WebView) ll_change.findViewById(R.id.about_dialog_change_history); change_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_dlg_title_about_change_desc)); change_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); change_view.getSettings().setBuiltInZoomControls(true); final CustomViewPagerAdapter mAboutViewPagerAdapter = new CustomViewPagerAdapter(this, new WebView[] { func_view, change_view }); final CustomViewPager mAboutViewPager = (CustomViewPager) dialog.findViewById(R.id.about_view_pager); // mMainViewPager.setBackgroundColor(mThemeColorList.window_color_background); mAboutViewPager.setAdapter(mAboutViewPagerAdapter); mAboutViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { // util.addDebugMsg(2,"I","onPageSelected entered, pos="+position); tab_widget.setCurrentTab(position); tab_host.setCurrentTab(position); } @Override public void onPageScrollStateChanged(int state) { // util.addDebugMsg(2,"I","onPageScrollStateChanged entered, state="+state); } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { // util.addDebugMsg(2,"I","onPageScrolled entered, pos="+position); } }); tab_host.setOnTabChangedListener(new OnTabChangeListener() { @Override public void onTabChanged(String tabId) { util.addDebugMsg(2, "I", "onTabchanged entered. tab=" + tabId); mAboutViewPager.setCurrentItem(tab_host.getCurrentTab()); } }); final Button btnOk = (Button) dialog.findViewById(R.id.about_dialog_btn_ok); CommonDialog.setDlgBoxSizeLimit(dialog, true); // OK? btnOk.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnOk.performClick(); } }); dialog.show(); }
From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java
private void aboutSMBSync() { // common ??//from w w w. j a va2 s . c o m final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.about_dialog); ((TextView) dialog.findViewById(R.id.about_dialog_title)) .setText(getString(R.string.msgs_dlg_title_about) + "(Ver " + packageVersionName + ")"); final WebView func_view = (WebView) dialog.findViewById(R.id.about_dialog_function); // func_view.loadDataWithBaseURL("file:///android_asset/", // getString(R.string.msgs_dlg_title_about_func_desc),"text/html","UTF-8",""); func_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_dlg_title_about_func_desc)); func_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); func_view.getSettings().setBuiltInZoomControls(true); final WebView change_view = (WebView) dialog.findViewById(R.id.about_dialog_change_history); change_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_dlg_title_about_change_desc)); change_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); change_view.getSettings().setBuiltInZoomControls(true); final Button btnFunc = (Button) dialog.findViewById(R.id.about_dialog_btn_show_func); final Button btnChange = (Button) dialog.findViewById(R.id.about_dialog_btn_show_change); final Button btnOk = (Button) dialog.findViewById(R.id.about_dialog_btn_ok); func_view.setVisibility(TextView.VISIBLE); change_view.setVisibility(TextView.GONE); btnChange.setBackgroundResource(R.drawable.button_bg_color_selector); btnFunc.setBackgroundResource(R.drawable.button_bg_color_selector); btnChange.setTextColor(Color.DKGRAY); btnFunc.setTextColor(Color.GREEN); btnFunc.setEnabled(false); // btnOk.setTextColor(Color.DKGRAY); // btnOk.setTextColor(Color.GREEN); // btnOk.setBackgroundResource(R.drawable.button_back_ground_color_selector); CommonDialog.setDlgBoxSizeLimit(dialog, true); // func? btnFunc.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { change_view.setVisibility(TextView.GONE); func_view.setVisibility(TextView.VISIBLE); CommonDialog.setDlgBoxSizeLimit(dialog, true); // func_view.setEnabled(true); // change_view.setEnabled(false); btnFunc.setTextColor(Color.GREEN); btnChange.setTextColor(Color.DKGRAY); btnChange.setEnabled(true); btnFunc.setEnabled(false); } }); // change? btnChange.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { change_view.setVisibility(TextView.VISIBLE); func_view.setVisibility(TextView.GONE); CommonDialog.setDlgBoxSizeLimit(dialog, true); // func_view.setEnabled(true); // change_view.setEnabled(false); btnChange.setTextColor(Color.GREEN); btnFunc.setTextColor(Color.DKGRAY); btnChange.setEnabled(false); btnFunc.setEnabled(true); } }); // OK? btnOk.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnOk.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(mContext)); // dialog.setCancelable(false); dialog.show(); }
From source file:com.sentaroh.android.SMBSync2.ActivityMain.java
private void confirmUseAppSpecificDir(final ArrayList<SyncTaskItem> alp, final NotifyEvent p_ntfy) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); if (!prefs.getBoolean(getString(R.string.settings_suppress_warning_app_specific_dir), false)) { boolean app_specific_used = false; String prof_list = "", sep = ""; for (int i = 0; i < alp.size(); i++) { if (alp.get(i).getTargetFolderType().equals(SyncTaskItem.SYNC_FOLDER_TYPE_INTERNAL) || alp.get(i).getTargetFolderType().equals(SyncTaskItem.SYNC_FOLDER_TYPE_SDCARD)) { if (alp.get(i).getTargetDirectoryName().startsWith(APP_SPECIFIC_DIRECTORY)) { app_specific_used = true; prof_list += sep + alp.get(i).getSyncTaskName(); sep = ","; }//from w w w . j a va 2s. com } } if (app_specific_used) { final Dialog dialog = new Dialog(mActivity);//, android.R.style.Theme_Black); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.confirm_app_specific_dir_dlg); final LinearLayout title_view = (LinearLayout) dialog .findViewById(R.id.confirm_app_specific_dlg_title_view); final TextView title = (TextView) dialog.findViewById(R.id.confirm_app_specific_dlg_title); title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color); title.setText(mContext.getString(R.string.msgs_local_mount_point_app_specific_dir_used_title)); title.setTextColor(mGp.themeColorList.text_color_warning); ((TextView) dialog.findViewById(R.id.confirm_app_specific_dlg_msg)) .setText(mContext.getString(R.string.msgs_local_mount_point_app_specific_dir_used_msg) + "\n\n" + prof_list + "\n"); final Button btnOk = (Button) dialog.findViewById(R.id.confirm_app_specific_dlg_ok); final Button btnCancel = (Button) dialog.findViewById(R.id.confirm_app_specific_dlg_cancel); final CheckedTextView ctvSuppr = (CheckedTextView) dialog .findViewById(R.id.confirm_app_specific_dlg_ctv_suppress); CommonUtilities.setCheckedTextView(ctvSuppr); CommonDialog.setDlgBoxSizeCompact(dialog); ctvSuppr.setChecked(false); // OK? btnOk.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); if (ctvSuppr.isChecked()) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); prefs.edit().putBoolean(getString(R.string.settings_suppress_warning_app_specific_dir), true).commit(); } p_ntfy.notifyToListener(true, null); } }); // Cancel? btnCancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); p_ntfy.notifyToListener(false, null); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnOk.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(mContext)); // dialog.setCancelable(false); dialog.show(); } else { p_ntfy.notifyToListener(true, null); } } else { p_ntfy.notifyToListener(true, null); } }