Skip to content

Commit

Permalink
Other user's profile Redesign.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnybedi990 committed Mar 26, 2018
1 parent 55643d3 commit 3c32406
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public class ChatFragment extends Fragment {
private SharedPreferences sharedpreferences1;
private String temp6;
private String myencryptionkey;
private String tendigitnumber;

public ChatFragment() {

Expand Down Expand Up @@ -147,7 +148,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_chat, container, false);
RecentUser = (ListView) view.findViewById(R.id.list_chat_fragment);
RecentUser = view.findViewById(R.id.list_chat_fragment);
return view;
}

Expand Down Expand Up @@ -276,7 +277,7 @@ public void onDataChange(DataSnapshot dataSnapshot) {
String[] parts = chatuser.split(":"); // escape .
String part1 = parts[0];
String part2 = parts[1];
String tendigitnumber = getLastThree(part2);
tendigitnumber = getLastThree(part2);
// Log.e(">>>>>last", dataSnapshot.child(currentuser).getChildrenCount() + "");

hashMap1.put(tendigitnumber, keyname);
Expand Down Expand Up @@ -313,7 +314,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
// Log.e(">>>>>NAME_NUMBER", hashMap.get(lst.get(position)) + "");

// Log.e(">>>>>NUMBER_KEY", hashMap1.get(hashMap.get(lst.get(position))) + "");
Intent intent4 = new Intent(getActivity(), chatactivity.class).putExtra("key_position", hashMap1.get(hashMap.get(lst.get(position)))).putExtra("namenumber", lst.get(position) + "");
Intent intent4 = new Intent(getActivity(), chatactivity.class).putExtra("key_position", hashMap1.get(hashMap.get(lst.get(position)))).putExtra("namenumber", lst.get(position) + "").putExtra("number", tendigitnumber);
startActivity(intent4);
// overridePendingTransition(R.anim.pull_in_right, R.anim.push_out_left);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public class chatactivity extends AppCompatActivity {
private String urifile;
private File imageFile;
private StorageReference islandRef;
private String mobilenumber;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -164,6 +165,7 @@ protected void onCreate(Bundle savedInstanceState) {
message1 = bundle.getString("key_position1");
message2 = bundle.getString("key_position");
namenumber = bundle.getString("namenumber");
mobilenumber = bundle.getString("number");

setTitle(namenumber);

Expand Down Expand Up @@ -381,7 +383,7 @@ public void onDataChange(DataSnapshot dataSnapshot1) {
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent4 = new Intent(chatactivity.this, viewuuserpropic.class).putExtra("image", imageAsBytes).putExtra("title", namenumber).putExtra("status", connectionstatus4).putExtra("uri", urifile);
Intent intent4 = new Intent(chatactivity.this, viewuuserpropic.class).putExtra("image", imageAsBytes).putExtra("title", namenumber).putExtra("status", connectionstatus4).putExtra("number", mobilenumber);
startActivity(intent4);
Log.w("MainActivity", "ActionBar's title clicked.");
}
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/java/com/vedant/hereami/chatfolder/chatmain.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ public class chatmain extends AppCompatActivity implements SwipeRefreshLayout.On
private TextView tv;
private SpannableString wordtoSpan;
private String contactmatch;
private String tendigitnumber;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chatmain);
setTitle("Select contact");
listView = (ListView) findViewById(R.id.listview_chatmain);
mCustomSwipeRefreshLayout = (CustomSwipeRefreshLayout) findViewById(R.id.swipelayout);
listView = findViewById(R.id.listview_chatmain);
mCustomSwipeRefreshLayout = findViewById(R.id.swipelayout);
mCustomSwipeRefreshLayout.setOnRefreshListener(chatmain.this);
mCustomSwipeRefreshLayout.setCustomHeadview(new MyCustomHeadView(this));
mCustomSwipeRefreshLayout.setProgressBarColorRes();
Expand Down Expand Up @@ -99,7 +100,7 @@ public void onDataChange(DataSnapshot result) {
String[] parts = keyname.split(":"); // escape .
String part1 = parts[0];
String part2 = parts[1];
String tendigitnumber = getLastThree(part2);
tendigitnumber = getLastThree(part2);

hashMap1.put(tendigitnumber, keyname.replace(":", "+"));

Expand Down Expand Up @@ -152,7 +153,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
Log.e(">>>>>NAME_NUMBER", hashMap.get(lst.get(position)) + "");

Log.e(">>>>>NUMBER_KEY", hashMap1.get(hashMap.get(lst.get(position))) + "");
Intent intent4 = new Intent(chatmain.this, chatactivity.class).putExtra("key_position1", hashMap1.get(hashMap.get(lst.get(position)))).putExtra("namenumber", lst.get(position) + "");
Intent intent4 = new Intent(chatmain.this, chatactivity.class).putExtra("key_position1", hashMap1.get(hashMap.get(lst.get(position)))).putExtra("namenumber", lst.get(position) + "").putExtra("number", tendigitnumber);
startActivity(intent4);
overridePendingTransition(R.anim.pull_in_right, R.anim.push_out_left);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package com.vedant.hereami.chatfolder;

import android.app.Dialog;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.vedant.hereami.R;
Expand All @@ -21,39 +28,74 @@ public class viewuuserpropic extends AppCompatActivity {
private byte[] filename;
private String title;
private String status;
private TextView statusview;
private String Imageuri;
private TextView statusview, number, name;
private String mobile;
private Bitmap myBitmap;
private ImageView myImage;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_viewuuserpropic);
statusview = findViewById(R.id.statustextview);
number = findViewById(R.id.textview_mobileno);
name = findViewById(R.id.textview_nameuser);
Bundle bundle = getIntent().getExtras();

assert bundle != null;

filename = bundle.getByteArray("image");
title = bundle.getString("title");
status = bundle.getString("status");
Imageuri = bundle.getString("uri");
mobile = bundle.getString("number");
// Log.e("title", title);
setTitle(title);
statusview.setText(status);
ImageView myImage = findViewById(R.id.userpropicimageview);
name.setText(title);
number.setText(mobile);
myImage = findViewById(R.id.userpropicimageview);
File imgFile = new File(Environment.getExternalStorageDirectory().getPath() + "/HereamI/" + title + "1.jpg");
if (imgFile.exists()) {

Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
myImage.setImageBitmap(myBitmap);
} else {
myImage.setImageResource(R.drawable.headshot_7);
}
// myImage.setImageBitmap(BitmapFactory.decodeFile(imgFile));
// myImage.setImageBitmap(BitmapFactory.decodeByteArray(filename, 0, filename.length));
myImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showImage();
}
});

}

public void showImage() {
Dialog builder = new Dialog(this);
builder.requestWindowFeature(Window.FEATURE_SWIPE_TO_DISMISS);

builder.getWindow().setBackgroundDrawable(
new ColorDrawable(android.graphics.Color.TRANSPARENT));
builder.setTitle(title);

builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
//nothing;
}
});

ImageView imageView = new ImageView(this);
imageView.setImageBitmap(myBitmap);
builder.addContentView(imageView, new RelativeLayout.LayoutParams(
ViewGroup.MarginLayoutParams.MATCH_PARENT,
ViewGroup.MarginLayoutParams.MATCH_PARENT));

builder.show();
}

}
Expand Down
128 changes: 93 additions & 35 deletions app/src/main/res/layout/content_viewuuserpropic.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/constraintLayout"

android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.vedant.hereami.chatfolder.viewuuserpropic"
tools:showIn="@layout/activity_viewuuserpropic">
android:layout_height="match_parent">

<TextView
android:id="@+id/statustextview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="@color/cast_libraries_material_featurehighlight_outer_highlight_default_color"
android:fontFamily="sans-serif"
android:text="TextView"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/userpropicimageview"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="551dp"
android:layout_marginTop="8dp"
android:contentDescription="TODO"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/statustextview"
app:srcCompat="@drawable/amu_bubble_shadow" />

</android.support.constraint.ConstraintLayout>
android:layout_height="match_parent"
android:id="@+id/layout">


<ImageView
android:id="@+id/header_cover_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="centerCrop"

android:src="@drawable/nav_menu_header_bg"
app:srcCompat="@drawable/nav_menu_header_bg" />

<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"

android:id="@+id/userpropicimageview"
android:layout_width="200dp"
android:layout_height="200dp"

android:layout_below="@+id/header_cover_image"
android:layout_centerHorizontal="true"
android:layout_marginTop="-130dp"
android:clickable="true"
android:elevation="5dp"
android:padding="20dp"
android:scaleType="centerCrop"
android:src="@drawable/headshot_7"
app:civ_border_color="#FFFFFFFF"
app:civ_border_width="3dp" />

<RelativeLayout
android:id="@+id/profile_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/header_cover_image"
android:background="#ebca0707"
android:elevation="4dp"
android:paddingBottom="24dp">


<ImageView
android:id="@+id/edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:clickable="true"

android:src="@android:drawable/ic_menu_edit" />

<TextView
android:id="@+id/textview_nameuser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="70dp"
android:text="Laxman Marothiya"
android:textColor="#fff"
android:textSize="24sp"
android:textStyle="bold" />

<TextView
android:id="@+id/statustextview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textview_mobileno"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Surat"
android:textColor="#fff"
android:textSize="16sp" />

<TextView
android:id="@+id/textview_mobileno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textview_nameuser"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="(Adhyaksh)"
android:textColor="#fff"
android:textSize="18sp" />
</RelativeLayout>

</RelativeLayout>
</ScrollView>

0 comments on commit 3c32406

Please sign in to comment.