@Override public void onResume() { super.onResume(); File path = new File(Environment.getExternalStorageDirectory(), "/weHappening/profile_image.png"); Bitmap b = null; if (path.exists()) { try { b = BitmapFactory.decodeStream(new FileInputStream(path)); } catch (FileNotFoundException e) { e.printStackTrace(); } CircularImageView img = (CircularImageView) findViewById(R.id.imgPicker); img.setImageBitmap(b); } else { CircularImageView img = (CircularImageView) findViewById(R.id.imgPicker); img.setImageDrawable(getResources().getDrawable(R.drawable.ic_person)); } }
private void updateUI() { Profile profile = Profile.getCurrentProfile(); if (profile != null) { txtName.setText(profile.getName()); new FbImageAsync().execute(profile.getId()); } else { txtName.setText("UserName"); mCircularImageView.setImageResource(R.drawable.com_facebook_profile_picture_blank_portrait); } }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); imgBg = (ImageView) view.findViewById(R.id.imgTrendEventBackground); imgMap = (ImageView) view.findViewById(R.id.imgMap); tvTitle = (TextView) view.findViewById(R.id.tvTitle); tvAddress = (TextView) view.findViewById(R.id.tvAddress); tvDate = (TextView) view.findViewById(R.id.tvDate); tvParticipantsCount = (TextView) view.findViewById(R.id.tvParticipantsCount); holder = (LinearLayout) view.findViewById(R.id.trendEventHolder); participantHolder = (LinearLayout) view.findViewById(R.id.participantsHolder); icon = (IconImageView) view.findViewById(R.id.icon); icon.setIconImage(mEvent.dataPublicEvent.getIcon()); setImages(); tvTitle.setText(mEvent.dataPublicEvent.event_title); tvAddress.setText(mEvent.getLocationText()); tvDate.setText(Utils.getEventSchedule(mEvent)); tvParticipantsCount.setText( "" + mEvent.getTrend_users().size() + " " + dm.getResourceText(R.string.Participants)); int width = Utils.dpToPx(40); int i = 0; for (DataPeople people : mEvent.getTrend_users()) { if (i >= 7) break; // participantHolder.addView(); CircularImageView circularImageView = new CircularImageView(getActivity()); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, width); if (i++ > 0) params.setMargins(-Utils.dpToPx(12), 0, 0, 0); circularImageView.setLayoutParams(params); if (!TextUtils.isEmpty(people.image_url)) Picasso.with(getActivity()).load(people.image_url).fit().into(circularImageView); participantHolder.addView(circularImageView); } holder.setOnClickListener(this); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_TAKE_PHOTO) { if (resultCode == RESULT_OK) { Bitmap bitmap = BitmapFactory.decodeFile(photoFile.getPath()); imagenPerfil.setImageBitmap(bitmap); subirFoto(bitmap); } } else if (requestCode == SELECT_FILE) { if (resultCode == RESULT_OK) { Uri selectedImageUri = data.getData(); imagenPerfil.setImageURI(selectedImageUri); try { Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), selectedImageUri); subirFoto(bitmap); } catch (IOException e) { e.printStackTrace(); } } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_profile); mFlexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height); mFlexibleSpaceShowFabOffset = getResources().getDimensionPixelSize(R.dimen.flexible_space_show_fab_offset); mActionBarSize = getActionBarSize(); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mImageView = findViewById(R.id.image); mOverlayView = findViewById(R.id.overlay); mScrollView = (ObservableScrollView) findViewById(R.id.scroll); mScrollView.setScrollViewCallbacks(this); mTitleView = (TextView) findViewById(R.id.title); mTitleView.setText(getTitle()); setTitle(null); mFab = findViewById(R.id.fab); mFab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), EditProfile.class); startActivity(intent); } }); mFabMargin = getResources().getDimensionPixelSize(R.dimen.margin_standard); ViewHelper.setScaleX(mFab, 0); ViewHelper.setScaleY(mFab, 0); ScrollUtils.addOnGlobalLayoutListener( mScrollView, new Runnable() { @Override public void run() { mScrollView.scrollTo(0, mFlexibleSpaceImageHeight - mActionBarSize); // If you'd like to start from scrollY == 0, don't write like this: // mScrollView.scrollTo(0, 0); // The initial scrollY is 0, so it won't invoke onScrollChanged(). // To do this, use the following: // onScrollChanged(0, false, false); // You can also achieve it with the following codes. // This causes scroll change from 1 to 0. mScrollView.scrollTo(0, 1); mScrollView.scrollTo(0, 0); } }); File path = new File(Environment.getExternalStorageDirectory(), "/weHappening/profile_image.png"); Bitmap b = null; if (path.exists()) { try { b = BitmapFactory.decodeStream(new FileInputStream(path)); } catch (FileNotFoundException e) { e.printStackTrace(); } CircularImageView img = (CircularImageView) findViewById(R.id.imgPicker); img.setImageBitmap(b); } else { CircularImageView img = (CircularImageView) findViewById(R.id.imgPicker); img.setImageDrawable(getResources().getDrawable(R.drawable.ic_person)); } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflating view layout View layout = inflater.inflate(R.layout.fragment_navigation_drawer, container, false); recyclerView = (RecyclerView) layout.findViewById(R.id.drawerList); adapter = new NavigationDrawerAdapter(getActivity(), getData()); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); List<SimpleSectionedRecyclerViewAdapter.Section> sections = new ArrayList<SimpleSectionedRecyclerViewAdapter.Section>(); // Sections sections.add(new SimpleSectionedRecyclerViewAdapter.Section(5, "Categories")); // Add your adapter to the sectionAdapter SimpleSectionedRecyclerViewAdapter.Section[] dummy = new SimpleSectionedRecyclerViewAdapter.Section[sections.size()]; SimpleSectionedRecyclerViewAdapter mSectionedAdapter = new SimpleSectionedRecyclerViewAdapter( getContext(), R.layout.section, R.id.section_text, adapter); mSectionedAdapter.setSections(sections.toArray(dummy)); // Apply this adapter to the RecyclerView recyclerView.setAdapter(mSectionedAdapter); recyclerView.addOnItemTouchListener( new RecyclerTouchListener( getActivity(), recyclerView, new ClickListener() { @Override public void onClick(View view, int position) { NavigationDrawerAdapter.selected_item = position; recyclerView.getAdapter().notifyDataSetChanged(); drawerListener.onDrawerItemSelected(view, position); mDrawerLayout.closeDrawer(containerView); } @Override public void onLongClick(View view, int position) {} })); name = (TextView) layout.findViewById(R.id.name); email = (TextView) layout.findViewById(R.id.email); String fontPath = "fonts/Centurygothic.ttf"; Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), fontPath); name.setTypeface(tf); email.setTypeface(tf); options = (ImageView) layout.findViewById(R.id.options); options.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { showFilterPopup(view); } }); search = (ImageView) layout.findViewById(R.id.imageView3); search.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) {} }); File path = new File(Environment.getExternalStorageDirectory(), "/weHappening/profile_image.png"); Bitmap b = null; if (path.exists()) { try { b = BitmapFactory.decodeStream(new FileInputStream(path)); } catch (FileNotFoundException e) { e.printStackTrace(); } CircularImageView img = (CircularImageView) layout.findViewById(R.id.imageView2); img.setImageBitmap(b); } else { CircularImageView img = (CircularImageView) layout.findViewById(R.id.imageView2); img.setImageDrawable(getResources().getDrawable(R.drawable.ic_person)); } CircularImageView img = (CircularImageView) layout.findViewById(R.id.imageView2); img.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getContext(), MyProfile.class); startActivity(intent); } }); return layout; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_crear_cuenta); butCrearCuenta = (ImageButton) findViewById(R.id.imageButtonCrearCuenta); butCrearCuenta.setOnClickListener(this); editNombre = (EditText) findViewById(R.id.editUsername); editApellido = (EditText) findViewById(R.id.editApellido); editPass = (EditText) findViewById(R.id.editTextPass); editEmail = (EditText) findViewById(R.id.editEmail); imagenPerfil = (CircularImageView) findViewById(R.id.circularImagePerfil); imagenPerfil.setOnClickListener(this); // gps gps = new GPSTracker(this); if (gps.canGetLocation()) { latitude = gps.getLatitude(); longitude = gps.getLongitude(); Toast.makeText( getApplicationContext(), "Your Location is -\nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG) .show(); } else { gps.showSettingsAlert(); } // circularImageView.setImageResource(R.drawable.logo); GCMClientManager pushClientManager = new GCMClientManager(this, PROJECT_NUMBER); pushClientManager.registerIfNeeded( new GCMClientManager.RegistrationCompletedHandler() { @Override public void onSuccess(String registrationId, boolean isNewRegistration) { Log.d("Registration id", registrationId); idGoogle = registrationId; // send this registrationId to your server // verificar q notifiacion abra matchactivity pero no abra el registro // poner esto en registro y guardarlo en BD, crear campo paara guardarlo } @Override public void onFailure(String ex) { super.onFailure(ex); } }); /* OBTENER FOTOS PARA UN IMAGEVIEW //9KSJIHrjo2 progressDialog = ProgressDialog.show(this, "", "Downloading Image...", true); ParseQuery<ParseObject> query = new ParseQuery<ParseObject>( "ImagenDueno"); // Locate the objectId from the class query.getInBackground("9KSJIHrjo2", new GetCallback<ParseObject>() { @Override public void done(ParseObject object, com.parse.ParseException e) { ParseFile fileObject = (ParseFile) object .get("ImageFile"); fileObject .getDataInBackground(new GetDataCallback() { @Override public void done(byte[] data, com.parse.ParseException e) { if (e == null) { Log.d("test", "We've got data in data."); // Decode the Byte[] into // Bitmap Bitmap bmp = BitmapFactory .decodeByteArray( data, 0, data.length); imagenPerfil.setImageBitmap(bmp); // Close progress dialog progressDialog.dismiss(); } else { Log.d("test", "There was a problem downloading the data."); } } }); } }); */ }