List of usage examples for android.widget ImageView setVisibility
@RemotableViewMethod @Override public void setVisibility(int visibility)
From source file:openscience.crowdsource.video.experiments.MainActivity.java
private void updateControlStatusPreloading(boolean isEnable) { startStopCam.setEnabled(isEnable);/*from w ww . j a v a 2s .c om*/ recognize.setEnabled(isEnable); btnOpenImage.setEnabled(isEnable); View selectedScenarioTopBar = findViewById(R.id.selectedScenarioTopBar); if (isEnable && RecognitionScenarioService.isRecognitionScenariosLoaded()) { selectedScenarioTopBar.setEnabled(true); consoleEditText.setVisibility(View.GONE); recognize.setVisibility(View.VISIBLE); startStopCam.setVisibility(View.VISIBLE); btnOpenImage.setVisibility(View.VISIBLE); ImageView downArrowSelectedScenarioTopBar = (ImageView) findViewById(R.id.ico_scenarioInfo); downArrowSelectedScenarioTopBar.setVisibility(View.VISIBLE); } else { TextView selectScenarioText = (TextView) findViewById(R.id.selectedScenarioText); if (isEnable) { selectScenarioText.setText(RecognitionScenarioService.NOT_FOUND_TEXT); } } final TextView resultPreviewText = (TextView) findViewById(R.id.resultPreviewtText); if (!isEnable) { consoleEditText.setVisibility(View.VISIBLE); recognize.setVisibility(View.GONE); startStopCam.setVisibility(View.GONE); btnOpenImage.setVisibility(View.GONE); resultPreviewText.setText(AppConfigService.PLEASE_WAIT); AppConfigService.updatePreviewRecognitionText(AppConfigService.PLEASE_WAIT); ImageView downArrowSelectedScenarioTopBar = (ImageView) findViewById(R.id.ico_scenarioInfo); downArrowSelectedScenarioTopBar.setVisibility(View.GONE); } else { resultPreviewText.setText(""); AppConfigService.updatePreviewRecognitionText(null); } }
From source file:org.mareatlantica.ui.IntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_TMessages);/* w w w .ja v a2 s .c o m*/ super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.intro_layout); if (LocaleController.isRTL) { icons = new int[] { R.drawable.intro7, R.drawable.intro6, R.drawable.intro5, R.drawable.intro4, R.drawable.intro3, R.drawable.intro2, R.drawable.intro1 }; titles = new int[] { R.string.Page7Title, R.string.Page6Title, R.string.Page5Title, R.string.Page4Title, R.string.Page3Title, R.string.Page2Title, R.string.Page1Title }; messages = new int[] { R.string.Page7Message, R.string.Page6Message, R.string.Page5Message, R.string.Page4Message, R.string.Page3Message, R.string.Page2Message, R.string.Page1Message }; } else { icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4, R.drawable.intro5, R.drawable.intro6, R.drawable.intro7 }; titles = new int[] { R.string.Page1Title, R.string.Page2Title, R.string.Page3Title, R.string.Page4Title, R.string.Page5Title, R.string.Page6Title, R.string.Page7Title }; messages = new int[] { R.string.Page1Message, R.string.Page2Message, R.string.Page3Message, R.string.Page4Message, R.string.Page5Message, R.string.Page6Message, R.string.Page7Message }; } viewPager = (ViewPager) findViewById(R.id.intro_view_pager); TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button); startMessagingButton.setText(LocaleController.getString("StartMessaging", R.string.StartMessaging)); topImage1 = (ImageView) findViewById(R.id.icon_image1); topImage2 = (ImageView) findViewById(R.id.icon_image2); bottomPages = (ViewGroup) findViewById(R.id.bottom_pages); topImage2.setVisibility(View.GONE); viewPager.setAdapter(new IntroAdapter()); viewPager.setPageMargin(0); viewPager.setOffscreenPageLimit(1); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int i) { } @Override public void onPageScrollStateChanged(int i) { if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) { if (lastPage != viewPager.getCurrentItem()) { lastPage = viewPager.getCurrentItem(); final ImageView fadeoutImage; final ImageView fadeinImage; if (topImage1.getVisibility() == View.VISIBLE) { fadeoutImage = topImage1; fadeinImage = topImage2; } else { fadeoutImage = topImage2; fadeinImage = topImage1; } fadeinImage.bringToFront(); fadeinImage.setImageResource(icons[lastPage]); fadeinImage.clearAnimation(); fadeoutImage.clearAnimation(); Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_out); outAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { fadeoutImage.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_in); inAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { fadeinImage.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); fadeoutImage.startAnimation(outAnimation); fadeinImage.startAnimation(inAnimation); } } } }); startMessagingButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (startPressed) { return; } startPressed = true; Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class); intent2.putExtra("fromIntro", true); startActivity(intent2); finish(); } }); justCreated = true; }
From source file:com.hybris.mobile.app.commerce.adapter.VariantAdapter.java
/** * Create the view for spinner item/*from w w w. j a v a 2s .c o m*/ * * @param position * @param convertView * @param parent * @return */ public View getCustomView(int position, View convertView, ViewGroup parent) { View rowView; if (convertView == null) { LayoutInflater inflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.item_product_variant, parent, false); } else { rowView = convertView; } VariantOption productVariant = getItem(position); TextView productVariantName = (TextView) rowView.findViewById(R.id.product_variant_name); final ImageView productVariantImage = (ImageView) rowView.findViewById(R.id.product_variant_image); final ProgressBar productVariantProgressBar = (ProgressBar) rowView .findViewById(R.id.product_variant_image_loading); productVariantName.setText( ((List<VariantOptionQualifier>) productVariant.getVariantOptionQualifiers()).get(0).getValue()); if (((List<VariantOptionQualifier>) productVariant.getVariantOptionQualifiers()).get(0) .getImage() != null) { // Loading the product image if (CommerceApplication.isOnline()) { if (StringUtils .isNotBlank(((List<VariantOptionQualifier>) productVariant.getVariantOptionQualifiers()) .get(0).getImage().getUrl())) { CommerceApplication.getContentServiceHelper().loadImage( ((List<VariantOptionQualifier>) productVariant.getVariantOptionQualifiers()).get(0) .getImage().getUrl(), null, productVariantImage, 0, 0, true, new OnRequestListener() { @Override public void beforeRequest() { productVariantImage.setImageResource(android.R.color.transparent); productVariantImage.setVisibility(View.GONE); productVariantProgressBar.setVisibility(View.VISIBLE); } @Override public void afterRequestBeforeResponse() { } @Override public void afterRequest(boolean isDataSynced) { productVariantImage.setVisibility(View.VISIBLE); productVariantProgressBar.setVisibility(View.GONE); } }, true); } } else { Log.i(TAG, "Application offline, displaying no image for variant " + productVariant.getCode()); productVariantImage .setImageDrawable(getContext().getResources().getDrawable(R.drawable.no_image_product)); productVariantImage.setVisibility(View.VISIBLE); } } return rowView; }
From source file:com.flipzu.flipzu.Player.java
private void setLiveVisible(boolean visible) { ImageView live_v = (ImageView) findViewById(R.id.livetag); ImageView live_vb = (ImageView) findViewById(R.id.livetag_bottom); TextView time_str = (TextView) findViewById(R.id.time_str); if (visible) { int color = Color.parseColor("#FFFFFF"); updateBanner("", color); live_v.setVisibility(View.VISIBLE); live_vb.setVisibility(View.VISIBLE); time_str.setVisibility(View.INVISIBLE); findViewById(R.id.seekbar).setVisibility(View.INVISIBLE); } else {/*from ww w . j a v a 2 s . co m*/ live_v.setVisibility(View.INVISIBLE); live_vb.setVisibility(View.INVISIBLE); // time_str.setVisibility(View.VISIBLE); } }
From source file:com.owncloud.android.ui.adapter.FileListListAdapter.java
@Override public View getView(final int position, View convertView, ViewGroup parent) { View view = convertView;// ww w . j a va 2 s.c om if (view == null) { LayoutInflater inflator = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflator.inflate(R.layout.list_item, null); } if (mFiles != null && mFiles.size() > position) { OCFile file = mFiles.get(position); TextView fileName = (TextView) view.findViewById(R.id.Filename); String name = file.getFileName(); if (dataSourceShareFile == null) dataSourceShareFile = new DbShareFile(mContext); Account account = AccountUtils.getCurrentOwnCloudAccount(mContext); String[] accountNames = account.name.split("@"); if (accountNames.length > 2) { accountName = accountNames[0] + "@" + accountNames[1]; url = accountNames[2]; } Map<String, String> fileSharers = dataSourceShareFile.getUsersWhoSharedFilesWithMe(accountName); TextView sharer = (TextView) view.findViewById(R.id.sharer); ImageView shareButton = (ImageView) view.findViewById(R.id.shareItem); fileName.setText(name); ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1); fileIcon.setImageResource(DisplayUtils.getResourceId(file.getMimetype())); ImageView localStateView = (ImageView) view.findViewById(R.id.imageView2); FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder(); FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder(); if (fileSharers.size() != 0 && (!file.equals("Shared") && file.getRemotePath().contains("Shared"))) { if (fileSharers.containsKey(name)) { sharer.setText(fileSharers.get(name)); fileSharers.remove(name); } else { sharer.setText(" "); } } else { sharer.setText(" "); } if (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)) { localStateView.setImageResource(R.drawable.downloading_file_indicator); localStateView.setVisibility(View.VISIBLE); } else if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file)) { localStateView.setImageResource(R.drawable.uploading_file_indicator); localStateView.setVisibility(View.VISIBLE); } else if (file.isDown()) { localStateView.setImageResource(R.drawable.local_file_indicator); localStateView.setVisibility(View.VISIBLE); } else { localStateView.setVisibility(View.INVISIBLE); } TextView fileSizeV = (TextView) view.findViewById(R.id.file_size); TextView lastModV = (TextView) view.findViewById(R.id.last_mod); ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox); shareButton.setOnClickListener(new OnClickListener() { String shareStatusDisplay; int flagShare = 0; @Override public void onClick(View v) { final Dialog dialog = new Dialog(mContext); final OCFile fileToBeShared = (OCFile) getItem(position); final ArrayAdapter<String> shareWithFriends; final ArrayAdapter<String> shareAdapter; final String filePath; sharedWith = new ArrayList<String>(); dataSource = new DbFriends(mContext); dataSourceShareFile = new DbShareFile(mContext); dialog.setContentView(R.layout.share_file_with); dialog.setTitle("Share"); Account account = AccountUtils.getCurrentOwnCloudAccount(mContext); String[] accountNames = account.name.split("@"); if (accountNames.length > 2) { accountName = accountNames[0] + "@" + accountNames[1]; url = accountNames[2]; } final AutoCompleteTextView textView = (AutoCompleteTextView) dialog .findViewById(R.id.autocompleteshare); Button shareBtn = (Button) dialog.findViewById(R.id.ShareBtn); Button doneBtn = (Button) dialog.findViewById(R.id.ShareDoneBtn); final ListView listview = (ListView) dialog.findViewById(R.id.alreadySharedWithList); textView.setThreshold(2); final String itemType; filePath = "files" + String.valueOf(fileToBeShared.getRemotePath()); final String fileName = fileToBeShared.getFileName(); final String fileRemotePath = fileToBeShared.getRemotePath(); if (dataSourceShareFile == null) dataSourceShareFile = new DbShareFile(mContext); sharedWith = dataSourceShareFile.getUsersWithWhomIhaveSharedFile(fileName, fileRemotePath, accountName, String.valueOf(1)); shareAdapter = new ArrayAdapter<String>(mContext, android.R.layout.simple_list_item_1, sharedWith); listview.setAdapter(shareAdapter); final String itemSource; if (fileToBeShared.isDirectory()) { itemType = "folder"; int lastSlashInFolderPath = filePath.lastIndexOf('/'); itemSource = filePath.substring(0, lastSlashInFolderPath); } else { itemType = "file"; itemSource = filePath; } //Permissions disabled with friends app ArrayList<String> friendList = dataSource.getFriendList(accountName); dataSource.close(); shareWithFriends = new ArrayAdapter<String>(mContext, android.R.layout.simple_list_item_1, friendList); textView.setAdapter(shareWithFriends); textView.setFocusableInTouchMode(true); dialog.show(); textView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { } }); final Handler finishedHandler = new Handler() { @Override public void handleMessage(Message msg) { shareAdapter.notifyDataSetChanged(); Toast.makeText(mContext, shareStatusDisplay, Toast.LENGTH_SHORT).show(); } }; shareBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final String shareWith = textView.getText().toString(); if (shareWith.equals("")) { textView.setHint("Share With"); Toast.makeText(mContext, "Please enter the friends name with whom you want to share", Toast.LENGTH_SHORT).show(); } else if (sharedWith.contains(shareWith)) { textView.setHint("Share With"); Toast.makeText(mContext, "You have shared the file with that person", Toast.LENGTH_SHORT).show(); } else { textView.setText(""); Runnable runnable = new Runnable() { @Override public void run() { HttpPost post = new HttpPost( "http://" + url + "/owncloud/androidshare.php"); final ArrayList<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("itemType", itemType)); params.add(new BasicNameValuePair("itemSource", itemSource)); params.add(new BasicNameValuePair("shareType", shareType)); params.add(new BasicNameValuePair("shareWith", shareWith)); params.add(new BasicNameValuePair("permission", permissions)); params.add(new BasicNameValuePair("uidOwner", accountName)); HttpEntity entity; String shareSuccess = "false"; try { entity = new UrlEncodedFormEntity(params, "utf-8"); HttpClient client = new DefaultHttpClient(); post.setEntity(entity); HttpResponse response = client.execute(post); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { HttpEntity entityresponse = response.getEntity(); String jsonentity = EntityUtils.toString(entityresponse); JSONObject obj = new JSONObject(jsonentity); shareSuccess = obj.getString("SHARE_STATUS"); flagShare = 1; if (shareSuccess.equals("true")) { dataSourceShareFile.putNewShares(fileName, fileRemotePath, accountName, shareWith); sharedWith.add(shareWith); shareStatusDisplay = "File share succeeded"; } else if (shareSuccess.equals("INVALID_FILE")) { shareStatusDisplay = "File you are trying to share does not exist"; } else if (shareSuccess.equals("INVALID_SHARETYPE")) { shareStatusDisplay = "File Share type is invalid"; } else { shareStatusDisplay = "Share did not succeed. Please check your internet connection"; } finishedHandler.sendEmptyMessage(flagShare); } } catch (Exception e) { e.printStackTrace(); } } }; new Thread(runnable).start(); } if (flagShare == 1) { } } }); doneBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); //dataSourceShareFile.close(); } }); } }); //dataSourceShareFile.close(); if (!file.isDirectory()) { fileSizeV.setVisibility(View.VISIBLE); fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength())); lastModV.setVisibility(View.VISIBLE); lastModV.setText(DisplayUtils.unixTimeToHumanReadable(file.getModificationTimestamp())); // this if-else is needed even thoe fav icon is visible by default // because android reuses views in listview if (!file.keepInSync()) { view.findViewById(R.id.imageView3).setVisibility(View.GONE); } else { view.findViewById(R.id.imageView3).setVisibility(View.VISIBLE); } ListView parentList = (ListView) parent; if (parentList.getChoiceMode() == ListView.CHOICE_MODE_NONE) { checkBoxV.setVisibility(View.GONE); } else { if (parentList.isItemChecked(position)) { checkBoxV.setImageResource(android.R.drawable.checkbox_on_background); } else { checkBoxV.setImageResource(android.R.drawable.checkbox_off_background); } checkBoxV.setVisibility(View.VISIBLE); } } else { fileSizeV.setVisibility(View.VISIBLE); fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength())); lastModV.setVisibility(View.VISIBLE); lastModV.setText(DisplayUtils.unixTimeToHumanReadable(file.getModificationTimestamp())); checkBoxV.setVisibility(View.GONE); view.findViewById(R.id.imageView3).setVisibility(View.GONE); } } return view; }
From source file:org.montanafoodhub.app.producer.ProducerDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.producer_detail_fragment, container, false); Bundle args = getArguments();/*w ww. ja va 2 s. c o m*/ String producerId = args.getString(ProducerDetailActivity.EXTRA_PRODUCER_ID); _producer = Hub.producerMap.get(producerId); // image ImageCache imageCache = ((HubApplication) getActivity().getApplication()).getImageCache(); ImageView imageView = (ImageView) view.findViewById(R.id.producerImageView); imageCache.loadImage(imageView, _producer.getIconUrl(), R.drawable.default_producer); // name TextView textView = (TextView) view.findViewById(R.id.producerNameTextView); textView.setText(_producer.getName()); // address textView = (TextView) view.findViewById(R.id.producerAddressTextView); textView.setText(_producer.getLocation()); ActionBar actionBar = (ActionBar) view.findViewById(R.id.actionBar); actionBar.setOnClickActionListener(this); // phone / email action - default is call. if (hasEmail(_producer) == true) { actionBar.setLeftActionText(getResources().getString(R.string.producer_email_action)); actionBar.setLeftActionImage(getResources().getDrawable(R.drawable.ic_action_email_blue)); } // quote textView = (TextView) view.findViewById(R.id.quoteTextView); if (_producer.getQuote().isEmpty() == false) { textView.setText(String.format("\"%s\"", _producer.getQuote())); } else { textView.setVisibility(View.GONE); } // photo imageView = (ImageView) view.findViewById(R.id.photoImageView); if (_producer.getPhotoUrl().isEmpty() == true) { imageView.setVisibility(View.GONE); } else { imageCache.loadImage(imageView, _producer.getPhotoUrl(), R.drawable.ic_contact_picture); } loadCertifications(view); return view; }
From source file:me.cpwc.nibblegram.ui.IntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_TMessages);/*from w ww . j a v a2 s .c o m*/ super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); if (AndroidUtilities.isTablet()) { setContentView(R.layout.intro_layout_tablet); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.intro_layout); } if (LocaleController.isRTL) { icons = new int[] { R.drawable.intro7, R.drawable.intro6, R.drawable.intro5, R.drawable.intro4, R.drawable.intro3, R.drawable.intro2, R.drawable.intro1 }; titles = new int[] { R.string.Page7Title, R.string.Page6Title, R.string.Page5Title, R.string.Page4Title, R.string.Page3Title, R.string.Page2Title, R.string.Page1Title }; messages = new int[] { R.string.Page7Message, R.string.Page6Message, R.string.Page5Message, R.string.Page4Message, R.string.Page3Message, R.string.Page2Message, R.string.Page1Message }; } else { icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4, R.drawable.intro5, R.drawable.intro6, R.drawable.intro7 }; titles = new int[] { R.string.Page1Title, R.string.Page2Title, R.string.Page3Title, R.string.Page4Title, R.string.Page5Title, R.string.Page6Title, R.string.Page7Title }; messages = new int[] { R.string.Page1Message, R.string.Page2Message, R.string.Page3Message, R.string.Page4Message, R.string.Page5Message, R.string.Page6Message, R.string.Page7Message }; } viewPager = (ViewPager) findViewById(R.id.intro_view_pager); TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button); startMessagingButton.setText(LocaleController.getString("StartMessaging", R.string.StartMessaging)); topImage1 = (ImageView) findViewById(R.id.icon_image1); topImage2 = (ImageView) findViewById(R.id.icon_image2); bottomPages = (ViewGroup) findViewById(R.id.bottom_pages); topImage2.setVisibility(View.GONE); viewPager.setAdapter(new IntroAdapter()); viewPager.setPageMargin(0); viewPager.setOffscreenPageLimit(1); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int i) { } @Override public void onPageScrollStateChanged(int i) { if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) { if (lastPage != viewPager.getCurrentItem()) { lastPage = viewPager.getCurrentItem(); final ImageView fadeoutImage; final ImageView fadeinImage; if (topImage1.getVisibility() == View.VISIBLE) { fadeoutImage = topImage1; fadeinImage = topImage2; } else { fadeoutImage = topImage2; fadeinImage = topImage1; } fadeinImage.bringToFront(); fadeinImage.setImageResource(icons[lastPage]); fadeinImage.clearAnimation(); fadeoutImage.clearAnimation(); Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_out); outAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { fadeoutImage.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_in); inAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { fadeinImage.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); fadeoutImage.startAnimation(outAnimation); fadeinImage.startAnimation(inAnimation); } } } }); startMessagingButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (startPressed) { return; } startPressed = true; Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class); intent2.putExtra("fromIntro", true); startActivity(intent2); finish(); } }); justCreated = true; }
From source file:demo.vicshady.classes.ui.IntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.intro_layout); if (Utilities.isRTL) { icons = new int[] { R.drawable.intro7, R.drawable.intro6, R.drawable.intro5, R.drawable.intro4, R.drawable.intro3, R.drawable.intro2, R.drawable.intro1 }; titles = new int[] { R.string.Page7Title, R.string.Page6Title, R.string.Page5Title, R.string.Page4Title, R.string.Page3Title, R.string.Page2Title, R.string.Page1Title }; messages = new int[] { R.string.Page7Message, R.string.Page6Message, R.string.Page5Message, R.string.Page4Message, R.string.Page3Message, R.string.Page2Message, R.string.Page1Message }; } else {// www. j a va 2 s .c o m icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4, R.drawable.intro5, R.drawable.intro6, R.drawable.intro7 }; titles = new int[] { R.string.Page1Title, R.string.Page2Title, R.string.Page3Title, R.string.Page4Title, R.string.Page5Title, R.string.Page6Title, R.string.Page7Title }; messages = new int[] { R.string.Page1Message, R.string.Page2Message, R.string.Page3Message, R.string.Page4Message, R.string.Page5Message, R.string.Page6Message, R.string.Page7Message }; } viewPager = (ViewPager) findViewById(R.id.intro_view_pager); TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button); topImage1 = (ImageView) findViewById(R.id.icon_image1); topImage2 = (ImageView) findViewById(R.id.icon_image2); bottomPages = (ViewGroup) findViewById(R.id.bottom_pages); next = (Button) findViewById(R.id.next); previous = (Button) findViewById(R.id.previous); topImage2.setVisibility(View.GONE); viewPager.setAdapter(new IntroAdapter()); viewPager.setPageMargin(0); viewPager.setOffscreenPageLimit(1); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int i) { } @Override public void onPageScrollStateChanged(int i) { if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) { if (lastPage != viewPager.getCurrentItem()) { lastPage = viewPager.getCurrentItem(); final ImageView fadeoutImage; final ImageView fadeinImage; if (topImage1.getVisibility() == View.VISIBLE) { fadeoutImage = topImage1; fadeinImage = topImage2; } else { fadeoutImage = topImage2; fadeinImage = topImage1; } fadeinImage.bringToFront(); fadeinImage.setImageResource(icons[lastPage]); fadeinImage.clearAnimation(); fadeoutImage.clearAnimation(); Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_out); outAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { fadeoutImage.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_in); inAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { fadeinImage.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); fadeoutImage.startAnimation(outAnimation); fadeinImage.startAnimation(inAnimation); } } } }); startMessagingButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (startPressed) { return; } startPressed = true; Intent intent2 = new Intent(IntroActivity.this, MainActivity.class); startActivity(intent2); finish(); } }); justCreated = true; // getSupportActionBar().hide(); }
From source file:org.telegraph.ui.IntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_TMessages);// www. jav a 2 s . c o m super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); if (AndroidUtilities.isTablet()) { setContentView(R.layout.intro_layout_tablet); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.intro_layout); } if (LocaleController.isRTL) { icons = new int[] { R.drawable.ic_gratuite, R.drawable.ic_securise, R.drawable.ic_transparente, R.drawable.ic_citoyenne, R.drawable.ic_representative, R.drawable.ic_democratique, R.drawable.logo_laprimaire_sq }; titles = new int[] { R.string.Page7Title, R.string.Page6Title, R.string.Page5Title, R.string.Page4Title, R.string.Page3Title, R.string.Page2Title, R.string.Page1Title }; messages = new int[] { R.string.Page7Message, R.string.Page6Message, R.string.Page5Message, R.string.Page4Message, R.string.Page3Message, R.string.Page2Message, R.string.Page1Message }; } else { icons = new int[] { R.drawable.logo_laprimaire_sq, R.drawable.ic_democratique, R.drawable.ic_representative, R.drawable.ic_citoyenne, R.drawable.ic_transparente, R.drawable.ic_securise, R.drawable.ic_gratuite }; titles = new int[] { R.string.Page1Title, R.string.Page2Title, R.string.Page3Title, R.string.Page4Title, R.string.Page5Title, R.string.Page6Title, R.string.Page7Title }; messages = new int[] { R.string.Page1Message, R.string.Page2Message, R.string.Page3Message, R.string.Page4Message, R.string.Page5Message, R.string.Page6Message, R.string.Page7Message }; } viewPager = (ViewPager) findViewById(R.id.intro_view_pager); TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button); startMessagingButton .setText(LocaleController.getString("StartMessaging", R.string.StartMessaging).toUpperCase()); if (Build.VERSION.SDK_INT >= 21) { StateListAnimator animator = new StateListAnimator(); animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4)) .setDuration(200)); animator.addState(new int[] {}, ObjectAnimator .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2)) .setDuration(200)); startMessagingButton.setStateListAnimator(animator); } topImage1 = (ImageView) findViewById(R.id.icon_image1); topImage2 = (ImageView) findViewById(R.id.icon_image2); bottomPages = (ViewGroup) findViewById(R.id.bottom_pages); topImage2.setVisibility(View.GONE); viewPager.setAdapter(new IntroAdapter()); viewPager.setPageMargin(0); viewPager.setOffscreenPageLimit(1); viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int i) { } @Override public void onPageScrollStateChanged(int i) { if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) { if (lastPage != viewPager.getCurrentItem()) { lastPage = viewPager.getCurrentItem(); final ImageView fadeoutImage; final ImageView fadeinImage; if (topImage1.getVisibility() == View.VISIBLE) { fadeoutImage = topImage1; fadeinImage = topImage2; } else { fadeoutImage = topImage2; fadeinImage = topImage1; } fadeinImage.bringToFront(); fadeinImage.setImageResource(icons[lastPage]); fadeinImage.clearAnimation(); fadeoutImage.clearAnimation(); Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_out); outAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { fadeoutImage.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_in); inAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { fadeinImage.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); fadeoutImage.startAnimation(outAnimation); fadeinImage.startAnimation(inAnimation); } } } }); startMessagingButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (startPressed) { return; } startPressed = true; Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class); intent2.putExtra("fromIntro", true); startActivity(intent2); finish(); } }); justCreated = true; }
From source file:com.negaheno.ui.IntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_TMessages);/*from w ww. ja v a2s . co m*/ super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); if (AndroidUtilities.isTablet()) { setContentView(R.layout.intro_layout_tablet); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.intro_layout); } if (LocaleController.isRTL) { icons = new int[] { R.drawable.intro7, R.drawable.intro6, R.drawable.intro5, R.drawable.intro4, R.drawable.intro3, R.drawable.intro2, R.drawable.intro1 }; titles = new int[] { R.string.Page7Title, R.string.Page6Title, R.string.Page5Title, R.string.Page4Title, R.string.Page3Title, R.string.Page2Title, R.string.Page1Title }; messages = new int[] { R.string.Page7Message, R.string.Page6Message, R.string.Page5Message, R.string.Page4Message, R.string.Page3Message, R.string.Page2Message, R.string.Page1Message }; } else { icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4, R.drawable.intro5, R.drawable.intro6, R.drawable.intro7 }; titles = new int[] { R.string.Page1Title, R.string.Page2Title, R.string.Page3Title, R.string.Page4Title, R.string.Page5Title, R.string.Page6Title, R.string.Page7Title }; messages = new int[] { R.string.Page1Message, R.string.Page2Message, R.string.Page3Message, R.string.Page4Message, R.string.Page5Message, R.string.Page6Message, R.string.Page7Message }; } viewPager = (ViewPager) findViewById(R.id.intro_view_pager); TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button); startMessagingButton .setText(LocaleController.getString("StartMessaging", R.string.StartMessaging).toUpperCase()); if (Build.VERSION.SDK_INT >= 21) { StateListAnimator animator = new StateListAnimator(); animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4)) .setDuration(200)); animator.addState(new int[] {}, ObjectAnimator .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2)) .setDuration(200)); startMessagingButton.setStateListAnimator(animator); } topImage1 = (ImageView) findViewById(R.id.icon_image1); topImage2 = (ImageView) findViewById(R.id.icon_image2); bottomPages = (ViewGroup) findViewById(R.id.bottom_pages); topImage2.setVisibility(View.GONE); viewPager.setAdapter(new IntroAdapter()); viewPager.setPageMargin(0); viewPager.setOffscreenPageLimit(1); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int i) { } @Override public void onPageScrollStateChanged(int i) { if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) { if (lastPage != viewPager.getCurrentItem()) { lastPage = viewPager.getCurrentItem(); final ImageView fadeoutImage; final ImageView fadeinImage; if (topImage1.getVisibility() == View.VISIBLE) { fadeoutImage = topImage1; fadeinImage = topImage2; } else { fadeoutImage = topImage2; fadeinImage = topImage1; } fadeinImage.bringToFront(); fadeinImage.setImageResource(icons[lastPage]); fadeinImage.clearAnimation(); fadeoutImage.clearAnimation(); Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_out); outAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { fadeoutImage.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_in); inAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { fadeinImage.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); fadeoutImage.startAnimation(outAnimation); fadeinImage.startAnimation(inAnimation); } } } }); startMessagingButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (startPressed) { return; } startPressed = true; Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class); intent2.putExtra("fromIntro", true); startActivity(intent2); finish(); } }); justCreated = true; }