@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."); } } }); } }); */ }