Skip to content

Commit

Permalink
this.add( baidumapview活跃用户marker显示,点击infowindow添加好友并展开对话 )
Browse files Browse the repository at this point in the history
  • Loading branch information
hechao committed Apr 12, 2016
1 parent bb0a38e commit 6e6845c
Show file tree
Hide file tree
Showing 9 changed files with 430 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<activity android:name=".main"/>
<activity android:name=".Myrun"/>


<activity android:name=".FriendProfile"/>
<!-- 添加好友 -->
<activity android:name=".AddFriendActivity" />
<!-- 好友列表 -->
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/hechao/chat/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class App extends Application {
public static String username = null;
public static boolean isLogin = false;
public static String ip="10.176.174.185";
public static double x=0;
public static double y=0;

@Override
public void onCreate() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/hechao/chat/ConversationAcivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected void onCreate(Bundle savedInstanceState) {

setContentView(R.layout.conversation);

setTitle(App.username);
setTitle("");

}
}
86 changes: 86 additions & 0 deletions app/src/main/java/com/hechao/chat/FriendProfile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package com.hechao.chat;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.TextView;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;

import butterknife.ButterKnife;
import butterknife.OnClick;
import cz.msebera.android.httpclient.Header;
import io.rong.imkit.RongIM;

/**
* Created by Administrator on 2016/4/12.
*/
public class FriendProfile extends Activity{


String username=null;
TextView friendname=null;
Button startPrivate =null;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.friendprofile);

ButterKnife.inject(FriendProfile.this);
Bundle info=getIntent().getExtras();
username=info.getString("username");

friendname = (TextView) findViewById(R.id.friendname);
friendname.setText("欢迎来到 "+username+" 的主页");

startPrivate= (Button) findViewById(R.id.startprivate);

startPrivate.setClickable(false);
startPrivate.setTextColor(getResources().getColor(R.color.highlighted_text_material_dark));

}


@OnClick(R.id.startprivate)
void setStartPrivateF(){

RongIM.getInstance().startPrivateChat(FriendProfile.this, username, null);

}



@OnClick(R.id.addfriend1)
void addfriend(){
AsyncHttpClient client= new AsyncHttpClient();
String url="http://"+App.ip+"/chat/addFriend.php?username="+App.username+"&target="+username;
client.get(url, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int i, Header[] headers, byte[] bytes) {
String response= new String(bytes);

Log.e("hechao",response);
friendname.setText("欢迎来到 "+username+" 的主页 "+"你们已经是好友");

friendname.setTextColor(getResources().getColor(R.color.abc_primary_text_disable_only_material_light));

startPrivate.setClickable(true);
startPrivate.setTextSize(15);
startPrivate.setTextColor(getResources().getColor(R.color.rc_normal_bg));

}

@Override
public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {

}
});



}

}
1 change: 1 addition & 0 deletions app/src/main/java/com/hechao/chat/Register1.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ void regist() {
// RequestParams params = new RequestParams();
// params.add("username", user_name);
// params.add("password", pass_word);
// http://localhost/chat/reg.php?username=ll&password=123
String url = "http://"+App.ip+"/chat/reg.php?username=" + username.getText().toString() + "&password=" + password.getText().toString();
Log.e("hechao", url);
client.get(url, new AsyncHttpResponseHandler() {
Expand Down
Loading

0 comments on commit 6e6845c

Please sign in to comment.