List of usage examples for android.app Dialog findViewById
@Nullable public <T extends View> T findViewById(@IdRes int id)
From source file:ua.mkh.settings.full.MainActivity.java
public void lock() { 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.block_license); textB.setText(R.string.attention);/*from w w w . jav a 2 s. c o m*/ dialogButton.setTypeface(typefaceRoman); text.setTypeface(typefaceRoman); textB.setTypeface(typefaceBold); 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(); }
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 ww w . j a v a2 s .com*/ 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);/*w ww. jav a 2 s . co 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 {// ww w . j a v a 2s .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// ww w. jav a 2 s . com 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:Steps.StepsFragment.java
private void showStickerMoreInfo(final Sticker clickedSticker) { // custom dialog clickedSticker.getName();/* w ww. j ava 2s . c o m*/ Log.d("NAMe", clickedSticker.getName()); final Dialog dialog = new Dialog(getActivity()); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { dialog.dismiss(); } }); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.BLACK)); dialog.setContentView(R.layout.sticker_dialog); ImageView image = (ImageView) (dialog).findViewById(R.id.image); //get the correct image String file = clickedSticker.getImagesrc(); file = file.substring(0, file.lastIndexOf(".")); //trim the extension Resources resources = getActivity().getResources(); int resourceId = resources.getIdentifier(file, "drawable", getActivity().getPackageName()); image.setImageBitmap(SampleImage.decodeSampledBitmapFromResource(getResources(), resourceId, 250, 250)); //load the additional details and information TextView id = (TextView) (dialog).findViewById(R.id.sticker_id); id.setText("#" + Integer.toString(clickedSticker.getId())); TextView status = (TextView) (dialog).findViewById(R.id.sticker_status); //at this poinrt only glued and notSticker available glued=1 notGlued=0 String statuss = clickedSticker.getStatus().equals(2) ? "1" : "0"; Integer count = clickedSticker.getCount(); status.setText("(" + statuss + " glued, " + count + " left)"); TextView title = (TextView) (dialog).findViewById(R.id.sticker_title); title.setText(clickedSticker.getName()); TextView rarity = (TextView) (dialog).findViewById(R.id.rarity); rarity.setText(clickedSticker.getPopularity()); TextView movie = (TextView) (dialog).findViewById(R.id.sticker_movie); movie.setText(clickedSticker.getMovie()); //set the layout to have the same widh and height as the windows screen Display display = getActivity().getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int height = size.y; WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(dialog.getWindow().getAttributes()); lp.width = width; lp.height = height; dialog.getWindow().setAttributes(lp); RelativeLayout mainLayout = (RelativeLayout) dialog.findViewById(R.id.showStickerLayout); dialog.show(); // if button is clicked, close the custom dialog mainLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); //listen for the inf tab ImageView info = (ImageView) (dialog).findViewById(R.id.info_image); info.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showInfoDialog(clickedSticker); } }); }
From source file:com.mitre.holdshort.MainActivity.java
private void showNotSupportedDialog(String airport) { final Dialog dialog = new Dialog(MainActivity.this); OnCancelListener notSupportedCancelListener = null; notSupportedCancelListener = new OnCancelListener() { @Override// w w w . j av a 2s . c o m public void onCancel(DialogInterface dialog) { dialog.dismiss(); finish(); } }; OnClickListener noAirportClickListener = new OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.exit: dialog.dismiss(); finish(); break; case R.id.contactMitre: Log.d(LOG_TAG, "TEST"); contactMITRE("RIPPLE App Support"); case R.id.uploadData: AlertLogger al = new AlertLogger("999", MainActivity.this); default: return; } } }; if (airport == null) { dialog.setOnCancelListener(notSupportedCancelListener); dialog.setContentView(R.layout.no_airport_found_dialog); dialog.setTitle("No Airport Found!"); dialog.getWindow().setLayout(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); Button exit = (Button) dialog.findViewById(R.id.exit); Button contact = (Button) dialog.findViewById(R.id.contactMitre); Button uploadData = (Button) dialog.findViewById(R.id.uploadData); contact.setOnClickListener(noAirportClickListener); exit.setOnClickListener(noAirportClickListener); uploadData.setOnClickListener(noAirportClickListener); dialog.show(); } else { dialog.setOnCancelListener(notSupportedCancelListener); dialog.setContentView(R.layout.airport_not_supported_dialog); dialog.setTitle("Airport " + (airport.split("_"))[0] + " Not Supported"); dialog.getWindow().setLayout(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); Button exit = (Button) dialog.findViewById(R.id.exit); Button contact = (Button) dialog.findViewById(R.id.contactMitre); contact.setOnClickListener(noAirportClickListener); exit.setOnClickListener(noAirportClickListener); dialog.show(); } }
From source file:biz.bokhorst.xprivacy.ActivityMain.java
@SuppressLint("DefaultLocale") private void optionAbout() { // About/*w ww .ja v a 2 s .c om*/ Dialog dlgAbout = new Dialog(this); dlgAbout.requestWindowFeature(Window.FEATURE_LEFT_ICON); dlgAbout.setTitle(R.string.menu_about); dlgAbout.setContentView(R.layout.about); dlgAbout.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher)); // Show version try { int userId = Util.getUserId(Process.myUid()); Version currentVersion = new Version(Util.getSelfVersionName(this)); Version storedVersion = new Version( PrivacyManager.getSetting(userId, PrivacyManager.cSettingVersion, "0.0")); boolean migrated = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingMigrated, false); String versionName = currentVersion.toString(); if (currentVersion.compareTo(storedVersion) != 0) versionName += "/" + storedVersion.toString(); if (!migrated) versionName += "!"; int versionCode = Util.getSelfVersionCode(this); TextView tvVersion = (TextView) dlgAbout.findViewById(R.id.tvVersion); tvVersion.setText(String.format(getString(R.string.app_version), versionName, versionCode)); } catch (Throwable ex) { Util.bug(null, ex); } if (!PrivacyManager.cVersion3 || Hook.isAOSP(19)) ((TextView) dlgAbout.findViewById(R.id.tvCompatibility)).setVisibility(View.GONE); // Show license String licensed = Util.hasProLicense(this); TextView tvLicensed1 = (TextView) dlgAbout.findViewById(R.id.tvLicensed); TextView tvLicensed2 = (TextView) dlgAbout.findViewById(R.id.tvLicensedAlt); if (licensed == null) { tvLicensed1.setText(Environment.getExternalStorageDirectory().getAbsolutePath()); tvLicensed2.setText(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) .getAbsolutePath()); } else { tvLicensed1.setText(String.format(getString(R.string.app_licensed), licensed)); tvLicensed2.setVisibility(View.GONE); } // Show some build properties String android = String.format("%s (%d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT); ((TextView) dlgAbout.findViewById(R.id.tvAndroid)).setText(android); ((TextView) dlgAbout.findViewById(R.id.build_brand)).setText(Build.BRAND); ((TextView) dlgAbout.findViewById(R.id.build_manufacturer)).setText(Build.MANUFACTURER); ((TextView) dlgAbout.findViewById(R.id.build_model)).setText(Build.MODEL); ((TextView) dlgAbout.findViewById(R.id.build_product)).setText(Build.PRODUCT); ((TextView) dlgAbout.findViewById(R.id.build_device)).setText(Build.DEVICE); ((TextView) dlgAbout.findViewById(R.id.build_host)).setText(Build.HOST); ((TextView) dlgAbout.findViewById(R.id.build_display)).setText(Build.DISPLAY); ((TextView) dlgAbout.findViewById(R.id.build_id)).setText(Build.ID); dlgAbout.setCancelable(true); final int userId = Util.getUserId(Process.myUid()); if (PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFirstRun, true)) dlgAbout.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { Dialog dlgUsage = new Dialog(ActivityMain.this); dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON); dlgUsage.setTitle(R.string.app_name); dlgUsage.setContentView(R.layout.usage); dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher)); dlgUsage.setCancelable(true); dlgUsage.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { PrivacyManager.setSetting(userId, PrivacyManager.cSettingFirstRun, Boolean.FALSE.toString()); optionLegend(); } }); dlgUsage.show(); } }); dlgAbout.show(); }
From source file:org.anurag.file.quest.TaskerActivity.java
/** * FUNCTION MAKE 3d LIST VIEW VISIBLE OR GONE AS PER REQUIREMENT * @param mode/*from w w w . ja va 2s . com*/ * @param con */ public static void load_FIle_Gallery(final int mode) { final Dialog pDialog = new Dialog(mContext, R.style.custom_dialog_theme); final Handler handle = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case 0: try { pDialog.setContentView(R.layout.p_dialog); pDialog.setCancelable(false); pDialog.getWindow().getAttributes().width = size.x * 4 / 5; WebView web = (WebView) pDialog.findViewById(R.id.p_Web_View); web.loadUrl("file:///android_asset/Progress_Bar_HTML/index.html"); web.setEnabled(false); pDialog.show(); } catch (InflateException e) { error = true; Toast.makeText(mContext, "An exception encountered please wait while loading" + " file list", Toast.LENGTH_SHORT).show(); } break; case 1: if (pDialog != null) if (pDialog.isShowing()) pDialog.dismiss(); if (mediaFileList.size() > 0) { FILE_GALLEY.setVisibility(View.GONE); LIST_VIEW_3D.setVisibility(View.VISIBLE); element = new MediaElementAdapter(mContext, R.layout.row_list_1, mediaFileList); //AT THE PLACE OF ELEMENT YOU CAN USE MUSIC ADAPTER.... // AND SEE WHAT HAPPENS if (mediaFileList.size() > 0) { LIST_VIEW_3D.setAdapter(element); LIST_VIEW_3D.setEnabled(true); } else if (mediaFileList.size() == 0) { LIST_VIEW_3D.setAdapter(new EmptyAdapter(mContext, R.layout.row_list_3, EMPTY)); LIST_VIEW_3D.setEnabled(false); } LIST_VIEW_3D.setDynamics(new SimpleDynamics(0.7f, 0.6f)); if (!elementInFocus) { mFlipperBottom.showPrevious(); mFlipperBottom.setAnimation(prevAnim()); elementInFocus = true; } if (SEARCH_FLAG) { mVFlipper.showPrevious(); mVFlipper.setAnimation(nextAnim()); } } else { LIST_VIEW_3D.setVisibility(View.GONE); FILE_GALLEY.setVisibility(View.VISIBLE); Toast.makeText(mContext, R.string.empty, Toast.LENGTH_SHORT).show(); if (elementInFocus) { mFlipperBottom.showNext(); mFlipperBottom.setAnimation(nextAnim()); } elementInFocus = false; } break; } } }; Thread thread = new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub handle.sendEmptyMessage(0); while (!Utils.loaded) { //STOPPING HERE WHILE FILES ARE BEING LOADED IN BACKGROUND.... } if (mode == 0) mediaFileList = Utils.music; else if (mode == 1) mediaFileList = Utils.apps; else if (mode == 2) mediaFileList = Utils.doc; else if (mode == 3) mediaFileList = Utils.img; else if (mode == 4) mediaFileList = Utils.vids; else if (mode == 5) mediaFileList = Utils.zip; else if (mode == 6) mediaFileList = Utils.mis; handle.sendEmptyMessage(1); } }); thread.start(); }