List of usage examples for android.app Dialog findViewById
@Nullable public <T extends View> T findViewById(@IdRes int id)
From source file:net.momodalo.app.vimtouch.VimTouch.java
public void showCmdHistory() { final Dialog dialog = new Dialog(this, R.style.DialogSlideAnim); // Setting dialogview Window window = dialog.getWindow(); window.setGravity(Gravity.BOTTOM);/* w w w .j av a2s . c o m*/ window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); dialog.setTitle(null); dialog.setContentView(R.layout.hist_list); dialog.setCancelable(true); LinearLayout layout = (LinearLayout) dialog.findViewById(R.id.hist_layout); if (AndroidCompat.SDK >= 11) { layout.setShowDividers(LinearLayout.SHOW_DIVIDER_BEGINNING | LinearLayout.SHOW_DIVIDER_MIDDLE | LinearLayout.SHOW_DIVIDER_END); } LayoutParams params = layout.getLayoutParams(); params.width = mScreenWidth; layout.setLayoutParams(params); LayoutInflater inflater = LayoutInflater.from(this); boolean exists = false; for (int i = 1; i <= 10; i++) { TextView button = (TextView) inflater.inflate(R.layout.histbutton, layout, false); String cmd = Exec.getCmdHistory(i); if (cmd.length() == 0) break; exists = true; button.setText(":" + cmd); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { TextView text = (TextView) v; CharSequence cmd = text.getText(); Exec.doCommand(cmd.subSequence(1, cmd.length()).toString()); dialog.dismiss(); } }); layout.addView((View) button); } if (exists) dialog.show(); }
From source file:fiskinfoo.no.sintef.fiskinfoo.Implementation.UtilityOnClickListeners.java
@Override public OnClickListener getOfflineModeInformationIconOnClickListener(final User user) { return new OnClickListener() { @Override//from w w w . j a va 2 s . com public void onClick(View v) { Dialog dialog = new UtilityDialogs().getDialog(v.getContext(), R.layout.dialog_offline_mode_info, R.string.offline_mode); TextView textView = (TextView) dialog.findViewById(R.id.offline_mode_info_dialog_text_view); LinearLayout linearLayout = (LinearLayout) dialog .findViewById(R.id.offline_mode_info_dialog_linear_layout); Button okButton = (Button) dialog.findViewById(R.id.offline_mode_info_dialog_dismiss_button); textView.setText(R.string.offline_mode_info); for (final SubscriptionEntry entry : user.getSubscriptionCacheEntries()) { final InfoSwitchRow row = new InfoSwitchRow(v.getContext(), entry.mName, entry.mLastUpdated.replace("T", "\n")); row.setChecked(entry.mOfflineActive); row.setOnCheckedChangedListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { SubscriptionEntry updateEntry = user .getSubscriptionCacheEntry(entry.mSubscribable.ApiName); updateEntry.mOfflineActive = isChecked; user.setSubscriptionCacheEntry(entry.mSubscribable.ApiName, updateEntry); user.writeToSharedPref(buttonView.getContext()); } }); row.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { row.setChecked(!row.isChecked()); } }); linearLayout.addView(row.getView()); } okButton.setOnClickListener(new UtilityOnClickListeners().getDismissDialogListener(dialog)); dialog.show(); } }; }
From source file:reportsas.com.formulapp.Formulario.java
public void btnScan_click() { if (parametroScan == null) { callScaner();// w w w. j ava 2 s.c o m } else { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.dialog_scaner); dialog.setTitle("Lectura Codigo de Barras"); TextView textoS = (TextView) dialog.findViewById(R.id.tvScan); Button Button1 = (Button) dialog.findViewById(R.id.NuevoScan); Button Button2 = (Button) dialog.findViewById(R.id.btn_close); textoS.setText(parametroScan.getValor()); Button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { callScaner(); dialog.dismiss(); } }); Button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } }
From source file:com.pimp.companionforband.activities.main.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sContext = getApplicationContext();// ww w . j a v a 2s.c o m sActivity = this; sharedPreferences = getApplicationContext().getSharedPreferences("MyPrefs", 0); editor = sharedPreferences.edit(); bandSensorData = new BandSensorData(); mDestinationUri = Uri.fromFile(new File(getCacheDir(), SAMPLE_CROPPED_IMAGE_NAME)); SectionsPagerAdapter mSectionsPagerAdapter; ViewPager mViewPager; if (!checkCameraPermission(true)) requestCameraPermission(true); if (!checkCameraPermission(false)) requestCameraPermission(false); FiveStarsDialog fiveStarsDialog = new FiveStarsDialog(this, "pimplay69@gmail.com"); fiveStarsDialog.setTitle(getString(R.string.rate_dialog_title)) .setRateText(getString(R.string.rate_dialog_text)).setForceMode(false).setUpperBound(4) .setNegativeReviewListener(this).showAfter(5); AnalyticsApplication application = (AnalyticsApplication) getApplication(); mTracker = application.getDefaultTracker(); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.container); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOffscreenPageLimit(2); mViewPager.setPageTransformer(true, new ZoomOutPageTransformer()); mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { String name; switch (position) { case 0: name = "THEME"; break; case 1: name = "SENSORS"; break; case 2: name = "EXTRAS"; break; default: name = "CfB"; } mTracker.setScreenName("Image~" + name); mTracker.send(new HitBuilders.ScreenViewBuilder().build()); logSwitch = (Switch) findViewById(R.id.log_switch); backgroundLogSwitch = (Switch) findViewById(R.id.backlog_switch); logStatus = (TextView) findViewById(R.id.logStatus); backgroundLogStatus = (TextView) findViewById(R.id.backlogStatus); } @Override public void onPageScrollStateChanged(int state) { } }); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(mViewPager); Drawable headerBackground = null; String encoded = sharedPreferences.getString("me_tile_image", "null"); if (!encoded.equals("null")) { byte[] imageAsBytes = Base64.decode(encoded.getBytes(), Base64.DEFAULT); headerBackground = new BitmapDrawable( BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length)); } AccountHeader accountHeader = new AccountHeaderBuilder().withActivity(this).withCompactStyle(true) .withHeaderBackground((headerBackground == null) ? getResources().getDrawable(R.drawable.pipboy) : headerBackground) .addProfiles(new ProfileDrawerItem() .withName(sharedPreferences.getString("device_name", "Companion For Band")) .withEmail(sharedPreferences.getString("device_mac", "pimplay69@gmail.com")) .withIcon(getResources().getDrawable(R.drawable.band))) .build(); result = new DrawerBuilder().withActivity(this).withToolbar(toolbar).withActionBarDrawerToggleAnimated(true) .withAccountHeader(accountHeader) .addDrawerItems( new PrimaryDrawerItem().withName(getString(R.string.drawer_cloud)) .withIcon(GoogleMaterial.Icon.gmd_cloud).withIdentifier(1), new DividerDrawerItem(), new PrimaryDrawerItem().withName(getString(R.string.rate)) .withIcon(GoogleMaterial.Icon.gmd_rate_review).withIdentifier(2), new PrimaryDrawerItem().withName(getString(R.string.feedback)) .withIcon(GoogleMaterial.Icon.gmd_feedback).withIdentifier(3), new DividerDrawerItem(), new PrimaryDrawerItem().withName(getString(R.string.share)) .withIcon(GoogleMaterial.Icon.gmd_share).withIdentifier(4), new PrimaryDrawerItem().withName(getString(R.string.other)) .withIcon(GoogleMaterial.Icon.gmd_apps).withIdentifier(5), new DividerDrawerItem(), new PrimaryDrawerItem().withName(getString(R.string.report)) .withIcon(GoogleMaterial.Icon.gmd_bug_report).withIdentifier(6), new PrimaryDrawerItem().withName(getString(R.string.translate)) .withIcon(GoogleMaterial.Icon.gmd_translate).withIdentifier(9), new DividerDrawerItem(), new PrimaryDrawerItem().withName(getString(R.string.support)) .withIcon(GoogleMaterial.Icon.gmd_attach_money).withIdentifier(7), new PrimaryDrawerItem().withName(getString(R.string.aboutLib)) .withIcon(GoogleMaterial.Icon.gmd_info).withIdentifier(8)) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { boolean flag; if (drawerItem != null) { flag = true; switch ((int) drawerItem.getIdentifier()) { case 1: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Cloud").build()); if (!sharedPreferences.getString("access_token", "hi").equals("hi")) startActivity(new Intent(getApplicationContext(), CloudActivity.class)); else startActivity(new Intent(getApplicationContext(), WebviewActivity.class)); break; case 2: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Rate and Review").build()); String MARKET_URL = "https://play.google.com/store/apps/details?id="; String PlayStoreListing = getPackageName(); Intent rate = new Intent(Intent.ACTION_VIEW, Uri.parse(MARKET_URL + PlayStoreListing)); startActivity(rate); break; case 3: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Feedback").build()); final StringBuilder emailBuilder = new StringBuilder(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:pimplay69@gmail.com")); intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.app_name)); emailBuilder.append("\n \n \nOS Version: ").append(System.getProperty("os.version")) .append("(").append(Build.VERSION.INCREMENTAL).append(")"); emailBuilder.append("\nOS API Level: ").append(Build.VERSION.SDK_INT); emailBuilder.append("\nDevice: ").append(Build.DEVICE); emailBuilder.append("\nManufacturer: ").append(Build.MANUFACTURER); emailBuilder.append("\nModel (and Product): ").append(Build.MODEL).append(" (") .append(Build.PRODUCT).append(")"); PackageInfo appInfo = null; try { appInfo = getPackageManager().getPackageInfo(getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } assert appInfo != null; emailBuilder.append("\nApp Version Name: ").append(appInfo.versionName); emailBuilder.append("\nApp Version Code: ").append(appInfo.versionCode); intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString()); startActivity(Intent.createChooser(intent, "Send via")); break; case 4: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Share").build()); Intent i = new AppInviteInvitation.IntentBuilder( getString(R.string.invitation_title)) .setMessage(getString(R.string.invitation_message)) .setCallToActionText(getString(R.string.invitation_cta)).build(); startActivityForResult(i, REQUEST_INVITE); break; case 5: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Other Apps").build()); String PlayStoreDevAccount = "https://play.google.com/store/apps/developer?id=P.I.M.P."; Intent devPlay = new Intent(Intent.ACTION_VIEW, Uri.parse(PlayStoreDevAccount)); startActivity(devPlay); break; case 6: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Report Bugs").build()); startActivity(new Intent(MainActivity.this, GittyActivity.class)); break; case 7: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Donate").build()); String base64EncodedPublicKey = getString(R.string.base64); mHelper = new IabHelper(getApplicationContext(), base64EncodedPublicKey); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { if (!result.isSuccess()) { Toast.makeText(MainActivity.this, "Problem setting up In-app Billing: " + result, Toast.LENGTH_LONG).show(); } } }); final Dialog dialog = new Dialog(MainActivity.this); dialog.setContentView(R.layout.dialog_donate); dialog.setTitle("Donate"); String[] title = { "Coke", "Coffee", "Burger", "Pizza", "Meal" }; String[] price = { "Rs. 10.00", "Rs. 50.00", "Rs. 100.00", "Rs. 500.00", "Rs. 1,000.00" }; ListView listView = (ListView) dialog.findViewById(R.id.list); listView.setAdapter(new DonateListAdapter(MainActivity.this, title, price)); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 0: mHelper.launchPurchaseFlow(MainActivity.this, SKU_COKE, 1, mPurchaseFinishedListener, "payload"); break; case 1: mHelper.launchPurchaseFlow(MainActivity.this, SKU_COFFEE, 1, mPurchaseFinishedListener, "payload"); break; case 2: mHelper.launchPurchaseFlow(MainActivity.this, SKU_BURGER, 1, mPurchaseFinishedListener, "payload"); break; case 3: mHelper.launchPurchaseFlow(MainActivity.this, SKU_PIZZA, 1, mPurchaseFinishedListener, "payload"); break; case 4: mHelper.launchPurchaseFlow(MainActivity.this, SKU_MEAL, 1, mPurchaseFinishedListener, "payload"); break; } } }); dialog.show(); break; case 8: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("About").build()); new LibsBuilder().withLicenseShown(true).withVersionShown(true) .withActivityStyle(Libs.ActivityStyle.DARK).withAboutVersionShown(true) .withActivityTitle(getString(R.string.app_name)).withAboutIconShown(true) .withListener(libsListener).start(MainActivity.this); break; case 9: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Translate").build()); Intent translate = new Intent(Intent.ACTION_VIEW, Uri.parse("https://poeditor.com/join/project/AZQxDV2440")); startActivity(translate); break; default: break; } } else { flag = false; } return flag; } }).withSavedInstance(savedInstanceState).build(); AppUpdater appUpdater = new AppUpdater(this); appUpdater.start(); final DirectoryChooserConfig config = DirectoryChooserConfig.builder() .allowNewDirectoryNameModification(true).newDirectoryName("CfBCamera") .initialDirectory( sharedPreferences.getString("pic_location", "/storage/emulated/0/CompanionForBand/Camera")) .build(); mDialog = DirectoryChooserFragment.newInstance(config); new BandUtils().execute(); CustomActivityOnCrash.install(this); }
From source file:com.example.search.car.pools.welcome.java
public void dialog(String name, final String[] arr, final TextView tv) { final Dialog dialog = new Dialog(welcome.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.setContentView(R.layout.dialog); final ListView list = (ListView) dialog.findViewById(R.id.list_cities); DialogAdapter adapter = new DialogAdapter(welcome.this, arr); list.setAdapter(adapter);/*from www. ja v a 2s.c o m*/ final TextView t = (TextView) dialog.findViewById(R.id.tv_1_send_msg); t.setText("Select " + name); Typeface tf = Typeface.createFromAsset(welcome.this.getAssets(), "AvenirLTStd_Book.otf"); t.setTypeface(tf); list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { tv.setText(arr[position]); dialog.dismiss(); } }); final RelativeLayout l_close = (RelativeLayout) dialog.findViewById(R.id.l_close); l_close.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub dialog.dismiss(); } }); dialog.show(); }
From source file:app.clirnet.com.clirnetapp.activity.LoginActivity.java
private void showCreatePatientAlertDialog() { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.no_inetrnet_login_dialog); dialog.setTitle(//from www . j a v a2s . c o m "Your security credentials have expired. Please login with an active internet connection to refresh."); // dialog.setCancelable(false); Button dialogButtonCancel = (Button) dialog.findViewById(R.id.customDialogCancel); Button dialogButtonOk = (Button) dialog.findViewById(R.id.customDialogOk); // Click cancel to dismiss android custom dialog box dialogButtonCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); // Your android custom dialog ok action // Action for custom dialog ok button click dialogButtonOk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); dialog.dismiss(); } }); dialog.show(); }
From source file:com.birdeye.MainActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!Prefs.usernames.isSet()) { Prefs.usernames.set(Twitter.getSessionManager().getActiveSession().getUserName()); }/*from w w w. j av a 2s .c o m*/ setContentView(R.layout.main); ButterKnife.bind(this); // hideSystemUI(this); Chartboost.startWithAppId(MainActivity.this, "57552756f6cd4526e365b9d1", "239b2e3aa657ccdcdf0b9674c8750f077b5e0aed"); Chartboost.setLoggingLevel(CBLogging.Level.ALL); Chartboost.setDelegate(delegate); Chartboost.onCreate(this); tv_cancel = (TextView) findViewById(R.id.tv_cancel); tvSetTimer = (Button) findViewById(R.id.tvSetTimer); if (!BillingProcessor.isIabServiceAvailable(MainActivity.this)) { // showToast("In-app billing service is unavailable, please upgrade Android Market/Play to version >= 3.9.16"); onBackPressed(); } bp = new BillingProcessor(this, LICENSE_KEY, MERCHANT_ID, new BillingProcessor.IBillingHandler() { @Override public void onProductPurchased(String productId, TransactionDetails details) { showToast("onProductPurchased: " + productId); // updateTextViews(); } @Override public void onBillingError(int errorCode, Throwable error) { showToast("onBillingError: " + Integer.toString(errorCode)); } @Override public void onBillingInitialized() { showToast("onBillingInitialized"); readyToPurchase = true; //updateTextViews(); } @Override public void onPurchaseHistoryRestored() { showToast("onPurchaseHistoryRestored"); for (String sku : bp.listOwnedProducts()) Log.d(LOG_TAG, "Owned Managed Product: " + sku); for (String sku : bp.listOwnedSubscriptions()) Log.d(LOG_TAG, "Owned Subscription: " + sku); //updateTextViews(); Log.i(LOG_TAG, String.format("%s is%s subscribed", SUBSCRIPTION_ID, bp.isSubscribed(SUBSCRIPTION_ID) ? "" : " not")); } }); subs = bp.getSubscriptionListingDetails(SUBSCRIPTION_ID); // showToast(subs != null ? subs.toString() : "Failed to load subscription details"); if (subs == null) { // showToast(subs != null ? subs.toString() : "Failed to load subscription details"); Globals.hasPaid = false; } else { Globals.hasPaid = true; } if (Globals.hasPaid) { tvSetTimer.setVisibility(View.VISIBLE); message4.setVisibility(View.VISIBLE); message5.setVisibility(View.VISIBLE); message6.setVisibility(View.VISIBLE); message7.setVisibility(View.VISIBLE); message8.setVisibility(View.VISIBLE); message9.setVisibility(View.VISIBLE); message10.setVisibility(View.VISIBLE); message11.setVisibility(View.VISIBLE); message12.setVisibility(View.VISIBLE); message13.setVisibility(View.VISIBLE); message14.setVisibility(View.VISIBLE); message15.setVisibility(View.VISIBLE); message16.setVisibility(View.VISIBLE); message17.setVisibility(View.VISIBLE); message18.setVisibility(View.VISIBLE); message19.setVisibility(View.VISIBLE); message20.setVisibility(View.VISIBLE); message21.setVisibility(View.VISIBLE); message22.setVisibility(View.VISIBLE); message23.setVisibility(View.VISIBLE); message24.setVisibility(View.VISIBLE); message25.setVisibility(View.VISIBLE); ets = Arrays.asList(usernames, hashtags, message1, message2, message3, message4, message5, message6, message7, message8, message9, message10, message11, message12, message13, message14, message15, message16, message17, message18, message19, message20, message21, message22, message23, message24, message25); } else { tvSetTimer.setVisibility(View.GONE); message4.setVisibility(View.GONE); message5.setVisibility(View.GONE); message6.setVisibility(View.GONE); message7.setVisibility(View.GONE); message8.setVisibility(View.GONE); message9.setVisibility(View.GONE); message10.setVisibility(View.GONE); message11.setVisibility(View.GONE); message12.setVisibility(View.GONE); message13.setVisibility(View.GONE); message14.setVisibility(View.GONE); message15.setVisibility(View.GONE); message16.setVisibility(View.GONE); message17.setVisibility(View.GONE); message18.setVisibility(View.GONE); message19.setVisibility(View.GONE); message20.setVisibility(View.GONE); message21.setVisibility(View.GONE); message22.setVisibility(View.GONE); message23.setVisibility(View.GONE); message24.setVisibility(View.GONE); message25.setVisibility(View.GONE); ets = Arrays.asList(usernames, hashtags, message1, message2, message3); } tvSetTimer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = new Dialog(MainActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); dialog.setContentView(R.layout.input_time); dialog.setCancelable(true); Button bt_set = (Button) dialog.findViewById(R.id.bt_set); final EditText et_time = (EditText) dialog.findViewById(R.id.et_time); bt_set.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (et_time.getText().toString().equalsIgnoreCase("")) { Toast.makeText(MainActivity.this, "Please enter time to auto shut down", Toast.LENGTH_SHORT).show(); } else { int valueTimer = Integer.parseInt(et_time.getText().toString()) * 1000; initateCounter(valueTimer); tv_cancel.setText("Auto ShutDown started"); tvSetTimer.setVisibility(View.GONE); tv_cancel.setVisibility(View.VISIBLE); dialog.dismiss(); } } }); dialog.show(); } }); cameras.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, Facing.values())); //noinspection ConstantConditions cameras.setSelection(Prefs.facing.get().ordinal()); cameras.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Prefs.facing.set(Facing.values()[position]); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); for (TextInputEditText et : ets) { DrawableCompat.setTint(et.getBackground(), ContextCompat.getColor(this, R.color.colorAccent)); final TextInputLayout til = textLayout(et); til.setError(null); til.setErrorEnabled(false); } TextViews.setText(usernames, Prefs.usernames.get()); TextViews.setText(hashtags, Prefs.hashtags.get()); TextViews.setText(message1, Prefs.message1.get()); TextViews.setText(message2, Prefs.message2.get()); TextViews.setText(message3, Prefs.message3.get()); TextViews.setText(message4, Prefs.message4.get()); TextViews.setText(message5, Prefs.message5.get()); TextViews.setText(message6, Prefs.message6.get()); TextViews.setText(message7, Prefs.message7.get()); TextViews.setText(message8, Prefs.message8.get()); TextViews.setText(message9, Prefs.message9.get()); TextViews.setText(message10, Prefs.message10.get()); TextViews.setText(message11, Prefs.message11.get()); TextViews.setText(message12, Prefs.message12.get()); TextViews.setText(message13, Prefs.message13.get()); TextViews.setText(message14, Prefs.message14.get()); TextViews.setText(message15, Prefs.message15.get()); TextViews.setText(message16, Prefs.message16.get()); TextViews.setText(message17, Prefs.message17.get()); TextViews.setText(message18, Prefs.message18.get()); TextViews.setText(message19, Prefs.message19.get()); TextViews.setText(message20, Prefs.message20.get()); TextViews.setText(message21, Prefs.message21.get()); TextViews.setText(message22, Prefs.message22.get()); TextViews.setText(message23, Prefs.message23.get()); TextViews.setText(message24, Prefs.message24.get()); TextViews.setText(message25, Prefs.message25.get()); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); getWindow().setBackgroundDrawableResource(R.color.bg); mAdView = (AdView) findViewById(R.id.adView); mInterstitialAd = new InterstitialAd(this); // set the ad unit ID mInterstitialAd.setAdUnitId(getString(R.string.interstitial_full_screen)); adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR) // Check the LogCat to get your test device ID .addTestDevice("EB02375D2DA62FFA0F6F145AD2302B3D").build(); // adRequest = new AdRequest.Builder().build(); mAdView.setAdListener(new AdListener() { @Override public void onAdLoaded() { } @Override public void onAdClosed() { // Toast.makeText(getApplicationContext(), "Ad is closed!", Toast.LENGTH_SHORT).show(); } @Override public void onAdFailedToLoad(int errorCode) { // Toast.makeText(getApplicationContext(), "Ad failed to load! error code: " + errorCode, Toast.LENGTH_SHORT).show(); } @Override public void onAdLeftApplication() { // Toast.makeText(getApplicationContext(), "Ad left application!", Toast.LENGTH_SHORT).show(); } @Override public void onAdOpened() { super.onAdOpened(); } }); mAdView.loadAd(adRequest); mInterstitialAd.loadAd(adRequest); mInterstitialAd.setAdListener(new AdListener() { public void onAdLoaded() { showInterstitial(); } @Override public void onAdClosed() { Toast.makeText(getApplicationContext(), "Ad is closed!", Toast.LENGTH_SHORT).show(); } @Override public void onAdFailedToLoad(int errorCode) { Toast.makeText(getApplicationContext(), "Ad failed to load! error code: " + errorCode, Toast.LENGTH_SHORT).show(); } @Override public void onAdLeftApplication() { Toast.makeText(getApplicationContext(), "Ad left application!", Toast.LENGTH_SHORT).show(); } @Override public void onAdOpened() { Toast.makeText(getApplicationContext(), "Ad is opened!", Toast.LENGTH_SHORT).show(); } }); if (Globals.hasPaid) { tv_cancel.setVisibility(View.GONE); mAdView.setVisibility(View.GONE); } else { // initateCounter(120000); startRepeatingTask(); mAdView.setVisibility(View.VISIBLE); } }
From source file:de.mkrtchyan.recoverytools.RecoveryTools.java
public void showPopup(int Menu, final View v) { PopupMenu popup = new PopupMenu(mContext, v); popup.getMenuInflater().inflate(Menu, popup.getMenu()); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override// w ww .j a v a 2 s . com public boolean onMenuItemClick(MenuItem menuItem) { try { final String text = ((TextView) v).getText().toString(); final Dialog dialog = new Dialog(mContext); dialog.setTitle(R.string.setname); dialog.setContentView(R.layout.dialog_input); final Button bGo = (Button) dialog.findViewById(R.id.bGoBackup); final EditText etFileName = (EditText) dialog.findViewById(R.id.etFileName); final File Backup = new File(PathToRecoveryBackups, text); switch (menuItem.getItemId()) { case R.id.iReboot: mToolbox.reboot(Toolbox.REBOOT_REBOOT); return true; case R.id.iRebootRecovery: mToolbox.reboot(Toolbox.REBOOT_RECOVERY); return true; case R.id.iRebootBootloader: mToolbox.reboot(Toolbox.REBOOT_BOOTLOADER); return true; case R.id.iRestoreRecovery: new FlashUtil(mShell, mContext, mDevice, new File(PathToRecoveryBackups, text), FlashUtil.JOB_RESTORE_RECOVERY).execute(); return true; case R.id.iRenameRecovery: etFileName.setHint(text); bGo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String Name; if (etFileName.getText() != null && !etFileName.getText().toString().equals("")) { Name = etFileName.getText().toString(); } else { Name = String.valueOf(etFileName.getHint()); } if (!Name.endsWith(mDevice.getRecoveryExt())) { Name = Name + mDevice.getRecoveryExt(); } final File renamedBackup = new File(PathToRecoveryBackups, Name); if (renamedBackup.exists()) { Toast.makeText(mContext, R.string.backupalready, Toast.LENGTH_SHORT).show(); } else { if (Backup.renameTo(renamedBackup)) { loadBackupDrawer(); } } dialog.dismiss(); } }); dialog.show(); return true; case R.id.iDeleteRecoveryBackup: if (((TextView) v).getText() != null) { if (new File(PathToRecoveryBackups, text).delete()) { Toast.makeText(mContext, String.format(mContext.getString(R.string.bak_deleted), ((TextView) v).getText()), Toast.LENGTH_SHORT).show(); loadBackupDrawer(); } } return true; case R.id.iRestoreKernel: new FlashUtil(mShell, mContext, mDevice, new File(PathToKernelBackups, text), FlashUtil.JOB_RESTORE_KERNEL).execute(); return true; case R.id.iRenameKernel: etFileName.setHint(text); bGo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String Name; if (etFileName.getText() != null && !etFileName.getText().toString().equals("")) { Name = etFileName.getText().toString(); } else { Name = String.valueOf(etFileName.getHint()); } if (!Name.endsWith(mDevice.getKernelExt())) { Name = Name + mDevice.getKernelExt(); } final File renamedBackup = new File(PathToKernelBackups, Name); if (renamedBackup.exists()) { Toast.makeText(mContext, R.string.backupalready, Toast.LENGTH_SHORT).show(); } else { if (Backup.renameTo(renamedBackup)) { loadBackupDrawer(); } } dialog.dismiss(); } }); dialog.show(); return true; case R.id.iDeleteKernelBackup: if (((TextView) v).getText() != null) { if (new File(PathToKernelBackups, text).delete()) { Toast.makeText(mContext, String.format(mContext.getString(R.string.bak_deleted), ((TextView) v).getText()), Toast.LENGTH_SHORT).show(); loadBackupDrawer(); } } return true; default: return false; } } catch (Exception e) { return false; } } }); popup.show(); }
From source file:com.cloverstudio.spika.GroupProfileActivity.java
private void getImageDialog() { final Dialog imageDialog = new Dialog(GroupProfileActivity.this, R.style.TransparentDialogTheme); imageDialog.getWindow().setGravity(Gravity.BOTTOM); imageDialog.setContentView(R.layout.dialog_get_image); WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); Window window = imageDialog.getWindow(); layoutParams.copyFrom(window.getAttributes()); layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT; window.setAttributes(layoutParams); final Button btnGallery = (Button) imageDialog.findViewById(R.id.btnGallery); btnGallery.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); btnGallery.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent galleryIntent = new Intent(GroupProfileActivity.this, CameraCropActivity.class); galleryIntent.putExtra("type", "gallery"); galleryIntent.putExtra("groupUpdate", true); GroupProfileActivity.this.startActivityForResult(galleryIntent, UPDATE_IMAGE_REQUEST_CODE); imageDialog.dismiss();//from w ww . java2 s.co m } }); final Button btnCamera = (Button) imageDialog.findViewById(R.id.btnCamera); btnCamera.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); btnCamera.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent cameraIntent = new Intent(GroupProfileActivity.this, CameraCropActivity.class); cameraIntent.putExtra("type", "camera"); cameraIntent.putExtra("groupUpdate", true); GroupProfileActivity.this.startActivityForResult(cameraIntent, UPDATE_IMAGE_REQUEST_CODE); imageDialog.dismiss(); } }); final Button btnRemovePhoto = (Button) imageDialog.findViewById(R.id.btnRemovePhoto); btnRemovePhoto.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); btnRemovePhoto.setOnClickListener(new OnClickListener() { public void onClick(View v) { mGroupAvatarId = ""; gGroupImage = null; Utils.displayImage(mGroupAvatarId, mIvGroupImage, mPbLoading, ImageLoader.LARGE, R.drawable.group_stub_large, false); imageDialog.dismiss(); } }); imageDialog.show(); }
From source file:info.hl.mediam.GroupProfileActivity.java
private void getImageDialog() { final Dialog imageDialog = new Dialog(GroupProfileActivity.this, R.style.TransparentDialogTheme); imageDialog.getWindow().setGravity(Gravity.BOTTOM); imageDialog.setContentView(R.layout.dialog_get_image); WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); Window window = imageDialog.getWindow(); layoutParams.copyFrom(window.getAttributes()); layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT; window.setAttributes(layoutParams);// w w w .j ava 2s.c o m final Button btnGallery = (Button) imageDialog.findViewById(R.id.btnGallery); btnGallery.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD); btnGallery.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent galleryIntent = new Intent(GroupProfileActivity.this, CameraCropActivity.class); galleryIntent.putExtra("type", "gallery"); galleryIntent.putExtra("groupUpdate", true); GroupProfileActivity.this.startActivityForResult(galleryIntent, UPDATE_IMAGE_REQUEST_CODE); imageDialog.dismiss(); } }); final Button btnCamera = (Button) imageDialog.findViewById(R.id.btnCamera); btnCamera.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD); btnCamera.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent cameraIntent = new Intent(GroupProfileActivity.this, CameraCropActivity.class); cameraIntent.putExtra("type", "camera"); cameraIntent.putExtra("groupUpdate", true); GroupProfileActivity.this.startActivityForResult(cameraIntent, UPDATE_IMAGE_REQUEST_CODE); imageDialog.dismiss(); } }); final Button btnRemovePhoto = (Button) imageDialog.findViewById(R.id.btnRemovePhoto); btnRemovePhoto.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD); btnRemovePhoto.setOnClickListener(new OnClickListener() { public void onClick(View v) { mGroupAvatarId = ""; gGroupImage = null; Utils.displayImage(mGroupAvatarId, mIvGroupImage, mPbLoading, ImageLoader.LARGE, R.drawable.group_stub_large, false); imageDialog.dismiss(); } }); imageDialog.show(); }