List of usage examples for android.view.animation ScaleAnimation ScaleAnimation
public ScaleAnimation(float fromX, float toX, float fromY, float toY, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)
From source file:org.span.manager.MainActivity.java
/** Called when the activity is first created. */ @Override/*from www. ja va 2s .c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate()"); // DEBUG setContentView(R.layout.main); app = (ManetManagerApp) getApplication(); app.manet.registerObserver(this); // init table rows startTblRow = (TableRow) findViewById(R.id.startAdhocRow); stopTblRow = (TableRow) findViewById(R.id.stopAdhocRow); radioModeImage = (ImageView) findViewById(R.id.radioModeImage); batteryTemperatureLayout = (RelativeLayout) findViewById(R.id.layoutBatteryTemp); headerMainLayout = (RelativeLayout) findViewById(R.id.layoutHeaderMain); batteryTemperature = (TextView) findViewById(R.id.batteryTempText); tvIP = (TextView) findViewById(R.id.tvIP); tvSSID = (TextView) findViewById(R.id.tvSSID); // Update the IP and SSID display immediate when the Activity is shown and // when the orientation is changed. app.manet.sendManetConfigQuery(); // define animation animation = new ScaleAnimation(0.9f, 1, 0.9f, 1, // From x, to x, from y, to y ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(600); animation.setFillAfter(true); animation.setStartOffset(0); animation.setRepeatCount(1); animation.setRepeatMode(Animation.REVERSE); // start button startBtn = (ImageView) findViewById(R.id.startAdhocBtn); startBtnListener = new OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "StartBtn pressed ..."); showDialog(ID_DIALOG_STARTING); currDialogId = ID_DIALOG_STARTING; app.manet.sendStartAdhocCommand(); } }; startBtn.setOnClickListener(this.startBtnListener); // stop button stopBtn = (ImageView) findViewById(R.id.stopAdhocBtn); stopBtnListener = new OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "StopBtn pressed ..."); showDialog(ID_DIALOG_STOPPING); currDialogId = ID_DIALOG_STOPPING; app.manet.sendStopAdhocCommand(); } }; stopBtn.setOnClickListener(this.stopBtnListener); // start messenger service so that it runs even if no active activities are bound to it startService(new Intent(this, MessageService.class)); Intent theIntent = getIntent(); String action = theIntent.getAction(); String intentData = theIntent.getDataString(); if (action != null && action.equals(Intent.ACTION_VIEW)) { Bundle bundle = new Bundle(1); bundle.putString("filepath", intentData); showDialog(ID_DIALOG_CONFIG, bundle); } EulaHelper eula = new EulaHelper(this, this); eula.showDialog(); }
From source file:com.capricorn.ArcMenu.java
private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) { AnimationSet animationSet = new AnimationSet(true); animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f)); animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f)); animationSet.setDuration(duration);//from w w w.java2s.com animationSet.setInterpolator(new DecelerateInterpolator()); animationSet.setFillAfter(true); return animationSet; }
From source file:com.example.android.animationsdemo.CameraActivity.java
private void startFocusAniamtion(int pointX, int pointY) { RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(focusView.getLayoutParams()); layout.setMargins(pointX - 60, pointY - 60, 0, 0); focusView.setLayoutParams(layout);/* w w w .ja va 2 s .c o m*/ focusView.setVisibility(View.VISIBLE); ScaleAnimation sa = new ScaleAnimation(3f, 1f, 3f, 1f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f); sa.setDuration(800); focusView.startAnimation(sa); handler.postDelayed(new Runnable() { @Override public void run() { focusView.setVisibility(View.INVISIBLE); } }, 800); }
From source file:com.cleanwiz.applock.ui.activity.LockMainActivity.java
private void initAnim() { long duration = 300; long durationS = 160; float alpha = 0.3f; AccelerateInterpolator accInterpolator = new AccelerateInterpolator(); tab_left = new TranslateAnimation(tabW, 0, 0, 0); tab_right = new TranslateAnimation(0, tabW, 0, 0); tab_alpha_1 = new AlphaAnimation(1.0f, alpha); tab_alpha_2 = new AlphaAnimation(alpha, 1.0f); pop_in = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0); pop_out = new ScaleAnimation(1, 0, 1, 0, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0); pop_in.setDuration(durationS);//from www. ja v a 2s .c o m pop_in.setInterpolator(accInterpolator); pop_in.setAnimationListener(new PopListener(popView, PopListener.TYPE_IN)); pop_out.setDuration(durationS); pop_out.setInterpolator(accInterpolator); pop_out.setAnimationListener(new PopListener(popView, PopListener.TYPE_OUT)); tab_left.setFillAfter(true); tab_left.setFillEnabled(true); tab_left.setDuration(duration); tab_left.setInterpolator(accInterpolator); tab_right.setFillAfter(true); tab_right.setFillEnabled(true); tab_right.setDuration(duration); tab_right.setInterpolator(accInterpolator); tab_alpha_1.setFillAfter(true); tab_alpha_1.setFillEnabled(true); tab_alpha_1.setDuration(duration); tab_alpha_1.setInterpolator(accInterpolator); tab_alpha_2.setFillAfter(true); tab_alpha_2.setFillEnabled(true); tab_alpha_2.setDuration(duration); tab_alpha_2.setInterpolator(accInterpolator); AlphaAnimation alphaInit = new AlphaAnimation(alpha, alpha); alphaInit.setFillAfter(true); alphaInit.setFillEnabled(true); tv_tab_box.startAnimation(alphaInit); }
From source file:og.android.tether.MainActivity.java
/** Called when the activity is first created. */ @TargetApi(4)// ww w . j a va 2s .c om @Override public void onCreate(Bundle savedInstanceState) { Log.d(MSG_TAG, "Calling onCreate()"); super.onCreate(savedInstanceState); setContentView(R.layout.main); // Init Application this.application = (TetherApplication) this.getApplication(); MainActivity.setCurrent(this); // Init Table-Rows this.startTblRow = (TableRow) findViewById(R.id.startRow); this.stopTblRow = (TableRow) findViewById(R.id.stopRow); this.radioModeImage = (ImageView) findViewById(R.id.radioModeImage); this.progressBar = (ProgressBar) findViewById(R.id.progressBar); this.progressText = (TextView) findViewById(R.id.progressText); this.progressTitle = (TextView) findViewById(R.id.progressTitle); this.downloadUpdateLayout = (RelativeLayout) findViewById(R.id.layoutDownloadUpdate); this.batteryTemperatureLayout = (RelativeLayout) findViewById(R.id.layoutBatteryTemp); this.lockButtonCheckbox = (CheckBox) findViewById(R.id.lockButton); this.trafficRow = (RelativeLayout) findViewById(R.id.trafficRow); this.downloadText = (TextView) findViewById(R.id.trafficDown); this.uploadText = (TextView) findViewById(R.id.trafficUp); this.downloadRateText = (TextView) findViewById(R.id.trafficDownRate); this.uploadRateText = (TextView) findViewById(R.id.trafficUpRate); this.batteryTemperature = (TextView) findViewById(R.id.batteryTempText); // Define animation animation = new ScaleAnimation(0.9f, 1, 0.9f, 1, // From x, to x, from y, to y ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(600); animation.setFillAfter(true); animation.setStartOffset(0); animation.setRepeatCount(1); animation.setRepeatMode(Animation.REVERSE); if (this.application.startupCheckPerformed == false) { if (this.application.settings.getLong("install_timestamp", -1) == -1) { long t = System.currentTimeMillis() / 1000; this.application.preferenceEditor.putLong("install_timestamp", t); } } this.application.reportStats(-1, false); // open ad bar openAdBar(); // Startup-Check if (this.application.startupCheckPerformed == false) { this.application.startupCheckPerformed = true; String regId = C2DMessaging.getRegistrationId(this); boolean registered = this.application.settings.getBoolean("c2dm_registered", false); if (!registered || regId == null || "".equals(regId)) { Log.d(MSG_TAG, "C2DM Registering"); C2DMessaging.register(this, DeviceRegistrar.SENDER_ID); } else { Log.d(MSG_TAG, "C2DM already registered"); } // Check if required kernel-features are enabled if (!this.application.coretask.isNetfilterSupported()) { this.openNoNetfilterDialog(); this.application.accessControlSupported = false; this.application.whitelist.remove(); } else { // Check if access-control-feature is supported by kernel if (!this.application.coretask.isAccessControlSupported()) { if (this.application.settings.getBoolean("warning_noaccesscontrol_displayed", false) == false) { this.openNoAccessControlDialog(); this.application.preferenceEditor.putBoolean("warning_noaccesscontrol_displayed", true); this.application.preferenceEditor.commit(); } this.application.accessControlSupported = false; this.application.whitelist.remove(); } } // Check if binaries need to be updated if (this.application.binariesExists() == false || this.application.coretask.filesetOutdated()) { if (this.application.coretask.hasRootPermission()) { this.application.installFiles(); } } // Open donate-dialog this.openDonateDialog(); // Check for updates this.application.checkForUpdate(); } // Check root-permission, files if (!this.application.coretask.hasRootPermission()) openLaunchedDialog(true); this.rssReader = new RSSReader(getApplicationContext(), TetherApplication.FORUM_RSS_URL); this.rssView = (ListView) findViewById(R.id.RSSView); this.rssAdapter = new ArrayAdapter<Spanned>(this, R.layout.rss_item); this.rssView.setAdapter(this.rssAdapter); this.rssView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Log.d(MSG_TAG, parent + ":" + view + ":" + position + ":" + id); MainActivity.this.application.statRSSClicks(); String url = null; try { url = MainActivity.this.jsonRssArray.getJSONObject(position).getString("link"); } catch (JSONException e) { url = TetherApplication.FORUM_URL; } url = tagURL(url, "android", "rss", "community"); Intent viewRssLink = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(url)); try { startActivity(viewRssLink); } catch (ActivityNotFoundException e) { url = tagURL(TetherApplication.FORUM_URL, "android", "rss", "community"); viewRssLink = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(url)); try { startActivity(viewRssLink); } catch (ActivityNotFoundException e2) { e2.printStackTrace(); } } } }); this.rssPanel = (Panel) findViewById(R.id.RSSPanel); this.rssPanel.setInterpolator(new BounceInterpolator()); this.rssPanel.setOnPanelListener(new OnPanelListener() { public void onPanelClosed(Panel panel) { hideCommunityText(true); MainActivity.this.application.preferenceEditor.putBoolean("rss_closed", true).commit(); } public void onPanelOpened(Panel panel) { hideCommunityText(false); MainActivity.this.application.preferenceEditor.putBoolean("rss_closed", false).commit(); } }); this.communityText = (TextView) findViewById(R.id.communityHeader); this.communityText.setOnClickListener(new OnClickListener() { public void onClick(View v) { MainActivity.this.rssPanel.setOpen(!MainActivity.this.rssPanel.isOpen(), true); } }); hideCommunityText(!this.rssPanel.isOpen()); this.bottomButtonLayout = (LinearLayout) findViewById(R.id.bottomButtonLayout); ((Button) findViewById(R.id.anchorLinkButton)).setOnClickListener(new OnClickListener() { public void onClick(View v) { startGooglePlayMeshclient("nonroot_tether"); } }); ((Button) findViewById(R.id.configButton)).setOnClickListener(new OnClickListener() { public void onClick(View v) { startActivityForResult(new Intent(MainActivity.this, SetupActivity.class).setAction("FOO"), 33); } }); // Start Button this.startBtn = (ImageView) findViewById(R.id.startTetherBtn); this.startBtnListener = new OnClickListener() { public void onClick(View v) { Log.d(MSG_TAG, "StartBtn pressed ..."); new Thread(new Runnable() { public void run() { Intent intent = new Intent(TetherService.INTENT_MANAGE); intent.putExtra("state", TetherService.MANAGE_START); Log.d(MSG_TAG, "SENDING MANAGE: " + intent); MainActivity.this.sendBroadcast(intent); } }).start(); } }; this.startBtn.setOnClickListener(this.startBtnListener); // Stop Button this.stopBtn = (ImageView) findViewById(R.id.stopTetherBtn); this.stopBtnListener = new OnClickListener() { public void onClick(View v) { Log.d(MSG_TAG, "StopBtn pressed ..."); if (MainActivity.this.lockBtn.isChecked()) { Log.d(MSG_TAG, "Tether was locked ..."); MainActivity.this.application.displayToastMessage(getString(R.string.main_activity_locked)); return; } new Thread(new Runnable() { public void run() { Intent intent = new Intent(TetherService.INTENT_MANAGE); intent.setAction(TetherService.INTENT_MANAGE); intent.putExtra("state", TetherService.MANAGE_STOP); Log.d(MSG_TAG, "Sending Intent: " + intent); MainActivity.this.sendBroadcast(intent); } }).start(); } }; this.stopBtn.setOnClickListener(this.stopBtnListener); this.lockBtn = (CompoundButton) findViewById(R.id.lockButton); this.lockBtnListener = new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Log.d(MSG_TAG, "LockBtn pressed ..."); } }; this.lockBtn.setOnCheckedChangeListener(this.lockBtnListener); // Toggles between start and stop screen this.toggleStartStop(); }
From source file:ly.kite.journey.selection.ProductOverviewFragment.java
/***************************************************** * * Returns the content view for this fragment * *****************************************************/ @Override/*from w w w .j av a 2s. c o m*/ public View onCreateView(LayoutInflater layoutInflator, ViewGroup container, Bundle savedInstanceState) { boolean slidingDrawerIsExpanded = false; // Get any saved instance state if (savedInstanceState != null) { slidingDrawerIsExpanded = savedInstanceState.getBoolean(BUNDLE_KEY_SLIDING_DRAWER_IS_EXPANDED, false); } else { Analytics.getInstance(mKiteActivity).trackProductOverviewScreenViewed(mProduct); } // Set up the screen. Note that the SDK allows for different layouts to be used in place of the standard // one, so some of these views are optional and may not actually exist in the current layout. View view = layoutInflator.inflate(R.layout.screen_product_overview, container, false); mProductImageViewPager = (ViewPager) view.findViewById(R.id.view_pager); mOverlaidComponents = view.findViewById(R.id.overlaid_components); mPagingDots = (PagingDots) view.findViewById(R.id.paging_dots); mOverlaidStartButton = (Button) view.findViewById(R.id.overlaid_start_button); mSlidingOverlayFrame = (SlidingOverlayFrame) view.findViewById(R.id.sliding_overlay_frame); mDrawerControlLayout = view.findViewById(R.id.drawer_control_layout); mOpenCloseDrawerIconImageView = (ImageView) view.findViewById(R.id.open_close_drawer_icon_image_view); mProceedOverlayButton = (Button) view.findViewById(R.id.proceed_overlay_button); TextView priceTextView = (TextView) view.findViewById(R.id.price_text_view); TextView summaryDescriptionTextView = (TextView) view.findViewById(R.id.summary_description_text_view); TextView summaryShippingTextView = (TextView) view.findViewById(R.id.summary_shipping_text_view); View descriptionLayout = view.findViewById(R.id.description_layout); TextView descriptionTextView = (TextView) view.findViewById(R.id.description_text_view); View sizeLayout = view.findViewById(R.id.size_layout); TextView sizeTextView = (TextView) view.findViewById(R.id.size_text_view); View quantityLayout = view.findViewById(R.id.quantity_layout); TextView quantityTextView = (TextView) view.findViewById(R.id.quantity_text_view); TextView shippingTextView = (TextView) view.findViewById(R.id.shipping_text_view); // Paging dots Animation pagingDotOutAlphaAnimation = new AlphaAnimation(PAGING_DOT_ANIMATION_OPAQUE, PAGING_DOT_ANIMATION_TRANSLUCENT); pagingDotOutAlphaAnimation.setFillAfter(true); pagingDotOutAlphaAnimation.setDuration(PAGING_DOT_ANIMATION_DURATION_MILLIS); Animation pagingDotOutScaleAnimation = new ScaleAnimation(0f, PAGING_DOT_ANIMATION_NORMAL_SCALE, 0f, PAGING_DOT_ANIMATION_NORMAL_SCALE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); pagingDotOutScaleAnimation.setFillAfter(true); pagingDotOutScaleAnimation.setDuration(PAGING_DOT_ANIMATION_DURATION_MILLIS); pagingDotOutScaleAnimation.setInterpolator(new BellInterpolator(1.0f, 0.8f, true)); AnimationSet pagingDotOutAnimation = new AnimationSet(false); pagingDotOutAnimation.addAnimation(pagingDotOutAlphaAnimation); pagingDotOutAnimation.addAnimation(pagingDotOutScaleAnimation); pagingDotOutAnimation.setFillAfter(true); Animation pagingDotInAlphaAnimation = new AlphaAnimation(PAGING_DOT_ANIMATION_TRANSLUCENT, PAGING_DOT_ANIMATION_OPAQUE); pagingDotInAlphaAnimation.setFillAfter(true); pagingDotInAlphaAnimation.setDuration(PAGING_DOT_ANIMATION_DURATION_MILLIS); Animation pagingDotInScaleAnimation = new ScaleAnimation(0f, PAGING_DOT_ANIMATION_NORMAL_SCALE, 0f, PAGING_DOT_ANIMATION_NORMAL_SCALE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); pagingDotInScaleAnimation.setFillAfter(true); pagingDotInScaleAnimation.setDuration(PAGING_DOT_ANIMATION_DURATION_MILLIS); pagingDotInScaleAnimation.setInterpolator(new BellInterpolator(1.0f, 1.2f)); AnimationSet pagingDotInAnimation = new AnimationSet(false); pagingDotInAnimation.addAnimation(pagingDotInAlphaAnimation); pagingDotInAnimation.addAnimation(pagingDotInScaleAnimation); pagingDotInAnimation.setFillAfter(true); mPagingDots.setProperties(mProduct.getImageURLList().size(), R.drawable.paging_dot_unselected, R.drawable.paging_dot_selected); mPagingDots.setOutAnimation(pagingDotOutAlphaAnimation); mPagingDots.setInAnimation(pagingDotInAnimation); mProductImageViewPager.setOnPageChangeListener(mPagingDots); mOverlaidComponents.setAlpha(slidingDrawerIsExpanded ? 0f : 1f); // If the drawer starts open, these components need to be invisible if (mSlidingOverlayFrame != null) { mSlidingOverlayFrame.snapToExpandedState(slidingDrawerIsExpanded); mSlidingOverlayFrame.setSlideAnimationDuration(SLIDE_ANIMATION_DURATION_MILLIS); mOpenCloseDrawerIconImageView.setRotation( slidingDrawerIsExpanded ? OPEN_CLOSE_ICON_ROTATION_DOWN : OPEN_CLOSE_ICON_ROTATION_UP); } SingleUnitSize size = mProduct.getSizeWithFallback(UnitOfLength.CENTIMETERS); boolean formatAsInt = size.getWidth() == (int) size.getWidth() && size.getHeight() == (int) size.getHeight(); String sizeFormatString = getString( formatAsInt ? R.string.product_size_format_string_int : R.string.product_size_format_string_float); String sizeString = String.format(sizeFormatString, size.getWidth(), size.getHeight(), size.getUnit().shortString(mKiteActivity)); int quantityPerSheet = mProduct.getQuantityPerSheet(); MultipleDestinationShippingCosts shippingCosts = mProduct.getShippingCosts(); Locale locale = Locale.getDefault(); Country country = Country.getInstance(locale); SingleCurrencyAmount singleCurrencyCost; // Price if (isVisible(priceTextView)) { singleCurrencyCost = mProduct.getCostWithFallback(locale); if (singleCurrencyCost != null) priceTextView.setText(singleCurrencyCost.getDisplayAmountForLocale(locale)); } // Summary description. This is a short description - not to be confused with the (full) description. if (isVisible(summaryDescriptionTextView)) { String summaryDescription = String.valueOf(quantityPerSheet) + " " + mProduct.getName() + (Product.isSensibleSize(size) ? " (" + sizeString + ")" : ""); summaryDescriptionTextView.setText(summaryDescription); } // (Full) description String description = mProduct.getDescription(); boolean haveDescription = (description != null && (!description.trim().equals(""))); if (haveDescription && descriptionLayout != null && descriptionTextView != null) { descriptionLayout.setVisibility(View.VISIBLE); descriptionTextView.setVisibility(View.VISIBLE); descriptionTextView.setText(description); } else { if (descriptionLayout != null) descriptionLayout.setVisibility(View.GONE); if (descriptionTextView != null) descriptionTextView.setVisibility(View.GONE); } // Size if (isVisible(sizeTextView)) { if (Product.isSensibleSize(size)) { sizeTextView.setText(String.format(sizeFormatString, size.getWidth(), size.getHeight(), size.getUnit().shortString(mKiteActivity))); } else { sizeLayout.setVisibility(View.GONE); } } // Quantity if (isVisible(quantityTextView)) { if (quantityPerSheet > 1) { quantityLayout.setVisibility(View.VISIBLE); quantityTextView.setText(getString(R.string.product_quantity_format_string, quantityPerSheet)); } else { quantityLayout.setVisibility(View.GONE); } } // Shipping description if (isVisible(summaryShippingTextView)) { // Currently we just check that shipping is free everywhere. If it isn't - we don't display // anything. boolean freeShippingEverywhere = true; MultipleDestinationShippingCosts multipleDestinationShippingCosts = shippingCosts; for (SingleDestinationShippingCost singleDestinationShippingCosts : multipleDestinationShippingCosts .asList()) { MultipleCurrencyAmount multipleCurrencyShippingCost = singleDestinationShippingCosts.getCost(); for (SingleCurrencyAmount singleCurrencyShippingCost : multipleCurrencyShippingCost .asCollection()) { if (singleCurrencyShippingCost.isNonZero()) { freeShippingEverywhere = false; } } } if (freeShippingEverywhere) { summaryShippingTextView.setText(R.string.product_free_worldwide_shipping); } else { summaryShippingTextView.setText(getString(R.string.product_shipping_summary_format_string, shippingCosts.getDisplayCost(locale))); } } // Shipping (postage) if (isVisible(shippingTextView)) { List<SingleDestinationShippingCost> sortedShippingCostList = mProduct.getSortedShippingCosts(country); StringBuilder shippingCostsStringBuilder = new StringBuilder(); String newlineString = ""; for (SingleDestinationShippingCost singleDestinationShippingCost : sortedShippingCostList) { // We want to prepend a new line for every shipping destination except the first shippingCostsStringBuilder.append(newlineString); newlineString = "\n"; // Get the cost in the default currency for the locale, and format the amount. singleCurrencyCost = singleDestinationShippingCost.getCost().getDefaultAmountWithFallback(); if (singleCurrencyCost != null) { String formatString = getString(R.string.product_shipping_format_string); String costString = (singleCurrencyCost.isNonZero() ? singleCurrencyCost.getDisplayAmountForLocale(locale) : getString(R.string.product_free_shipping)); shippingCostsStringBuilder.append(String.format(formatString, singleDestinationShippingCost.getDestinationDescription(mKiteActivity), costString)); } shippingTextView.setText(shippingCostsStringBuilder.toString()); } } if (mProceedOverlayButton != null) { mProceedOverlayButton.setText(R.string.product_overview_start_button_text); mProceedOverlayButton.setOnClickListener(this); } mProductImageViewPager.setOnClickListener(this); if (mDrawerControlLayout != null) mDrawerControlLayout.setOnClickListener(this); mOverlaidStartButton.setOnClickListener(this); return (view); }
From source file:net.mEmoZz.PopMovies.frags.DetailFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Bundle bundle = this.getArguments(); helper = new DBHelper(getActivity()); Configuration conf = getActivity().getResources().getConfiguration(); if (conf.smallestScreenWidthDp >= 600) { if (bundle != null) { movie = bundle.getParcelable("movie"); position = bundle.getInt("pos"); if (movie != null) { posterEndPoint = movie.getPoster(); backdropEndPoint = movie.getBackdrop(); overviewEndPoint = movie.getOverview(); dateEndPoint = movie.getDate(); voteEndPoint = movie.getVoteAvr(); titleEndPoint = movie.getTitle(); idEndpoint = movie.getId(); if (dateEndPoint.equals("")) { year = "Unknown"; } else { year = dateEndPoint.substring(0, 4); }//w w w. j av a2s. c om if (titleEndPoint.equals("")) { titleEndPoint = "Not available."; } else { titleEndPoint = movie.getTitle(); } if (overviewEndPoint.equals("")) { overviewEndPoint = "No overview found."; } else { overviewEndPoint = movie.getOverview(); } } } } else { posterEndPoint = getActivity().getIntent().getExtras().getString("poster"); backdropEndPoint = getActivity().getIntent().getExtras().getString("backdrop"); overviewEndPoint = getActivity().getIntent().getExtras().getString("overview"); dateEndPoint = getActivity().getIntent().getExtras().getString("date"); voteEndPoint = getActivity().getIntent().getExtras().getString("vote"); titleEndPoint = getActivity().getIntent().getExtras().getString("title"); idEndpoint = getActivity().getIntent().getExtras().getString("id"); position = getActivity().getIntent().getExtras().getInt("position"); } boolean ifExist = helper.ifExist(idEndpoint); if (ifExist) { detailUnFav.setVisibility(VISIBLE); detailFav.setVisibility(GONE); } else { detailUnFav.setVisibility(GONE); detailFav.setVisibility(VISIBLE); } String posterUrl = Url.POSTERS_URL + "w342" + posterEndPoint; DisplayImageOptions mOptions = new DisplayImageOptions.Builder().cacheOnDisk(true).cacheInMemory(false) .displayer(new FadeInBitmapDisplayer(1500)).showImageOnFail(R.drawable.no_poster) .showImageForEmptyUri(R.drawable.no_poster).build(); ImageLoader.getInstance().displayImage(posterUrl, detailPoster, mOptions, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { Palette p = Palette.from(loadedImage).generate(); detailCard.setCardBackgroundColor(p.getVibrantColor(0)); if (p.getVibrantColor(0) == Color.TRANSPARENT) { detailCard.setCardBackgroundColor(p.getMutedColor(0)); } } }); String backdropUrl = Url.POSTERS_URL + "w780" + backdropEndPoint; if (conf.smallestScreenWidthDp >= 600) { ImageLoader.getInstance().displayImage(backdropUrl, tabBackdrop, mOptions, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { Palette p = Palette.from(loadedImage).generate(); tabBackdrop.setBackgroundColor(p.getVibrantColor(0)); if (p.getVibrantColor(0) == Color.TRANSPARENT) { tabBackdrop.setBackgroundColor(p.getMutedColor(0)); } } }); detailDate.setText(year); detailTitle.setText(titleEndPoint); } else { detailDate.setText(dateEndPoint); } detailVoteAvr.setText(voteEndPoint); detailOverview.setText(overviewEndPoint); final ScaleAnimation animation = new ScaleAnimation(0f, 1f, 0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(165); detailFav.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { adapter.notifyDataSetChanged(); detailFav.setVisibility(GONE); detailUnFav.startAnimation(animation); detailUnFav.setVisibility(VISIBLE); helper.insertRow(posterEndPoint, backdropEndPoint, idEndpoint, titleEndPoint, dateEndPoint, voteEndPoint, overviewEndPoint); } }); detailUnFav.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { adapter.notifyDataSetChanged(); detailUnFav.setVisibility(GONE); detailFav.startAnimation(animation); detailFav.setVisibility(VISIBLE); helper.deleteRow(idEndpoint); if (fav.isChecked()) { CoreAdapter.movies.remove(position); adapter.notifyItemRemoved(position); adapter.notifyDataSetChanged(); } } }); new DurationTask().execute(); trailsAdapter = new TrailersAdapter(trailers, getActivity()); new TrailersTask().execute(); revsAdapter = new ReviewsAdapter(reviews, getActivity()); new ReviewsTask().execute(); }
From source file:demo.camera.library.ui.CameraCaptureActivity.java
public void setUpUi() { mBlockerSpinner = (RelativeLayout) findViewById(R.id.blocker); mBlockerSpinner.setVisibility(View.GONE); mTouchIndicator = (ImageView) findViewById(R.id.touchIndicator); mTouchInterceptor = (RelativeLayout) findViewById(R.id.touch_interceptor); mTouchInterceptor.setOnTouchListener(new View.OnTouchListener() { @Override/* w ww .j av a 2 s . c o m*/ public boolean onTouch(View v, MotionEvent event) { mTouchIndicator.setImageResource(R.drawable.white_circle); mTouchIndicator.setVisibility(View.VISIBLE); final int X = (int) event.getRawX(); final int Y = (int) event.getRawY(); RelativeLayout.LayoutParams lParams = (RelativeLayout.LayoutParams) mTouchIndicator .getLayoutParams(); lParams.leftMargin = X - mTouchIndicator.getWidth() / 2; lParams.topMargin = Y - mTouchIndicator.getHeight() / 2; mTouchIndicator.setLayoutParams(lParams); mTouchIndicator.invalidate(); ScaleAnimation scaleUpAnimation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, (float) 0.5, Animation.RELATIVE_TO_SELF, (float) 0.5); scaleUpAnimation.setDuration(350); scaleUpAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mTouchIndicator.postDelayed(new Runnable() { @Override public void run() { mTouchIndicator.setVisibility(View.GONE); } }, 100); } @Override public void onAnimationRepeat(Animation animation) { } }); mTouchIndicator.startAnimation(scaleUpAnimation); return false; } }); // mTouchInterceptor.setVisibility(View.GONE); mRecordButton = (Button) findViewById(R.id.recordButton); mExtrasContainer = (LinearLayout) findViewById(R.id.settings_container); mMoreOptions = (ImageView) findViewById(R.id.icon_more); mMoreOptions.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mMoreOptions.setSelected(!mMoreOptions.isSelected()); if (mMoreOptions.isSelected()) { mExtrasContainer.setVisibility(View.VISIBLE); } else { mExtrasContainer.setVisibility(View.GONE); } } }); // mRecordButton .setOnClickListener(mRecordButtonClickListener); setUpTouchInterceptor(mRecordButton); setUpHeaders(); setUpFlashButton(); setUpProgressIndicator(); // setupFilterSpinner(); setupCameraFlipper(); }
From source file:com.silentcircle.common.util.ViewUtil.java
public static void scaleToInvisible(View view) { ScaleAnimation animate = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animate.setDuration(100);/*from ww w .j a v a2 s. c om*/ animate.setFillAfter(true); view.startAnimation(animate); view.setVisibility(View.GONE); }
From source file:com.silentcircle.common.util.ViewUtil.java
public static void scaleToVisible(View view) { ScaleAnimation animate = new ScaleAnimation(0.0f, 1.0f, 0.5f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animate.setDuration(100);/* w w w. ja va 2 s . co m*/ animate.setFillAfter(true); view.startAnimation(animate); view.setVisibility(View.VISIBLE); }