Commit 0606e5dbf651dff9d5e6680581aa79a66b23c26a
1 parent
3eb23d09
修改整体布局
Showing
6 changed files
with
391 additions
and
0 deletions
app/src/main/java/com/cnlive/im/ui/ChatItemActivity.java
0 → 100644
| 1 | +package com.cnlive.im.ui; | |
| 2 | + | |
| 3 | +import android.content.Intent; | |
| 4 | +import android.os.Bundle; | |
| 5 | +import android.support.annotation.Nullable; | |
| 6 | +import android.support.v7.app.AppCompatActivity; | |
| 7 | +import android.view.View; | |
| 8 | +import android.widget.Button; | |
| 9 | + | |
| 10 | +import com.cnlive.im.R; | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * @author 陈硕 | |
| 16 | + * @time 2017/3/20 10:32 | |
| 17 | + * @desc ${TODD} | |
| 18 | + */ | |
| 19 | +public class ChatItemActivity extends AppCompatActivity implements View.OnClickListener { | |
| 20 | + | |
| 21 | + private Button grounp_chat, private_chat; | |
| 22 | + private String user_name_string; | |
| 23 | + private String user_id_string; | |
| 24 | + | |
| 25 | + @Override | |
| 26 | + protected void onCreate(@Nullable Bundle savedInstanceState) { | |
| 27 | + super.onCreate(savedInstanceState); | |
| 28 | + setContentView(R.layout.activity_chat_item); | |
| 29 | + intUI(); | |
| 30 | + | |
| 31 | + } | |
| 32 | + | |
| 33 | + private void intUI() { | |
| 34 | + grounp_chat = (Button) findViewById(R.id.grounp_chat); | |
| 35 | + private_chat = (Button) findViewById(R.id.private_chat); | |
| 36 | + grounp_chat.setOnClickListener(this); | |
| 37 | + private_chat.setOnClickListener(this); | |
| 38 | + Intent intent = getIntent(); | |
| 39 | + user_name_string = intent.getStringExtra("user_name_string"); | |
| 40 | + user_id_string = intent.getStringExtra("user_id_string"); | |
| 41 | + | |
| 42 | + | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void onClick(View v) { | |
| 47 | + switch (v.getId()) { | |
| 48 | + case R.id.grounp_chat: | |
| 49 | + doIntentChatRoom(ChatRoomActivity.class); | |
| 50 | + break; | |
| 51 | + case R.id.private_chat: | |
| 52 | + doIntentPriRoom(PrivateChatActivity.class); | |
| 53 | + break; | |
| 54 | + } | |
| 55 | + } | |
| 56 | + | |
| 57 | + private void doIntentChatRoom(Class classes) { | |
| 58 | + Intent intent = new Intent(); | |
| 59 | + intent.setClass(this, classes); | |
| 60 | + intent.putExtra("user_name_string",user_name_string); | |
| 61 | + intent.putExtra("user_id_string",user_id_string); | |
| 62 | + startActivity(intent); | |
| 63 | + } | |
| 64 | + | |
| 65 | + private void doIntentPriRoom(Class classes) { | |
| 66 | + Intent intent = new Intent(); | |
| 67 | + intent.setClass(this, classes); | |
| 68 | + startActivity(intent); | |
| 69 | + } | |
| 70 | +} | ... | ... |
app/src/main/java/com/cnlive/im/ui/LoGinActivity.java
0 → 100644
| 1 | +package com.cnlive.im.ui; | |
| 2 | + | |
| 3 | +import android.content.Intent; | |
| 4 | +import android.os.Bundle; | |
| 5 | +import android.support.annotation.Nullable; | |
| 6 | +import android.support.v7.app.AppCompatActivity; | |
| 7 | +import android.view.View; | |
| 8 | +import android.widget.Button; | |
| 9 | + | |
| 10 | +import com.cnlive.im.R; | |
| 11 | +import com.cnlive.libs.util.chat.ChatUtil; | |
| 12 | +import com.cnlive.libs.util.chat.base.IChat; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * @author 陈硕 | |
| 16 | + * @time 2017/3/16 18:11 | |
| 17 | + * @desc ${TODD} | |
| 18 | + */ | |
| 19 | +public class LoGinActivity extends AppCompatActivity implements View.OnClickListener { | |
| 20 | + | |
| 21 | + private Button user_login, user_logOut, vis_login; | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + protected void onCreate(@Nullable Bundle savedInstanceState) { | |
| 25 | + super.onCreate(savedInstanceState); | |
| 26 | + setContentView(R.layout.activity_login); | |
| 27 | + initUI(); | |
| 28 | + | |
| 29 | + } | |
| 30 | + | |
| 31 | + private void initUI() { | |
| 32 | + user_login = (Button) findViewById(R.id.user_login); | |
| 33 | + user_logOut = (Button) findViewById(R.id.user_logOut); | |
| 34 | + vis_login = (Button) findViewById(R.id.vis_login); | |
| 35 | + user_login.setOnClickListener(this); | |
| 36 | + user_logOut.setOnClickListener(this); | |
| 37 | + vis_login.setOnClickListener(this); | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + public void onClick(View v) { | |
| 42 | + switch (v.getId()) { | |
| 43 | + case R.id.vis_login: | |
| 44 | + Intent intent = new Intent(LoGinActivity.this, ChatRoomActivity.class); | |
| 45 | + startActivity(intent); | |
| 46 | + break; | |
| 47 | + case R.id.user_logOut: | |
| 48 | + ChatUtil.disconnect(false); | |
| 49 | + finish(); | |
| 50 | + break; | |
| 51 | + case R.id.user_login: | |
| 52 | + Intent intent2 = new Intent(LoGinActivity.this, UserLoginActivity.class); | |
| 53 | + startActivity(intent2); | |
| 54 | + break; | |
| 55 | + } | |
| 56 | + } | |
| 57 | + | |
| 58 | + | |
| 59 | + IChat.OnConnectListener connectListener = new IChat.OnConnectListener() { | |
| 60 | + @Override | |
| 61 | + public void onTokenIncorrect() { | |
| 62 | + } | |
| 63 | + | |
| 64 | + @Override | |
| 65 | + public void onSuccess(String s) { | |
| 66 | + } | |
| 67 | + | |
| 68 | + @Override | |
| 69 | + public void onError(int i, String s) { | |
| 70 | + | |
| 71 | + } | |
| 72 | + }; | |
| 73 | + | |
| 74 | +} | ... | ... |
app/src/main/res/layout/activity_chat_item.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:layout_width="match_parent" | |
| 4 | + android:layout_height="match_parent" | |
| 5 | + android:orientation="vertical"> | |
| 6 | + | |
| 7 | + <LinearLayout | |
| 8 | + android:layout_width="match_parent" | |
| 9 | + android:layout_height="wrap_content" | |
| 10 | + android:layout_centerInParent="true" | |
| 11 | + android:orientation="vertical"> | |
| 12 | + | |
| 13 | + <Button | |
| 14 | + android:id="@+id/grounp_chat" | |
| 15 | + android:layout_width="match_parent" | |
| 16 | + android:layout_height="wrap_content" | |
| 17 | + android:text="群聊" /> | |
| 18 | + | |
| 19 | + <Button | |
| 20 | + android:id="@+id/private_chat" | |
| 21 | + android:layout_width="match_parent" | |
| 22 | + android:layout_height="wrap_content" | |
| 23 | + android:text="私聊" /> | |
| 24 | + | |
| 25 | + </LinearLayout> | |
| 26 | +</RelativeLayout> | |
| 0 | 27 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/activity_login.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:orientation="vertical" android:layout_width="match_parent" | |
| 4 | + android:layout_height="match_parent"> | |
| 5 | + <LinearLayout | |
| 6 | + android:id="@+id/lin_btn" | |
| 7 | + android:layout_centerInParent="true" | |
| 8 | + android:layout_width="match_parent" | |
| 9 | + android:layout_height="wrap_content" | |
| 10 | + android:orientation="vertical"> | |
| 11 | + | |
| 12 | + <Button | |
| 13 | + android:id="@+id/user_login" | |
| 14 | + android:layout_width="match_parent" | |
| 15 | + android:layout_height="wrap_content" | |
| 16 | + android:layout_marginTop="15dp" | |
| 17 | + android:text="登录" /> | |
| 18 | + | |
| 19 | + | |
| 20 | + <Button | |
| 21 | + android:id="@+id/vis_login" | |
| 22 | + android:layout_width="match_parent" | |
| 23 | + android:layout_height="wrap_content" | |
| 24 | + android:layout_marginTop="15dp" | |
| 25 | + android:text="游客" /> | |
| 26 | + | |
| 27 | + | |
| 28 | + <Button | |
| 29 | + android:id="@+id/user_logOut" | |
| 30 | + android:layout_width="match_parent" | |
| 31 | + android:layout_height="wrap_content" | |
| 32 | + android:layout_marginTop="15dp" | |
| 33 | + android:text="退出" /> | |
| 34 | + | |
| 35 | + </LinearLayout> | |
| 36 | +</RelativeLayout> | |
| 0 | 37 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/activity_user.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:layout_width="match_parent" | |
| 4 | + android:layout_height="match_parent"> | |
| 5 | + | |
| 6 | + <LinearLayout | |
| 7 | + android:layout_width="match_parent" | |
| 8 | + android:layout_height="wrap_content" | |
| 9 | + android:layout_centerInParent="true" | |
| 10 | + android:orientation="vertical"> | |
| 11 | + | |
| 12 | + <LinearLayout | |
| 13 | + android:layout_width="match_parent" | |
| 14 | + android:layout_height="wrap_content" | |
| 15 | + android:layout_centerInParent="true"> | |
| 16 | + | |
| 17 | + <TextView | |
| 18 | + android:layout_width="wrap_content" | |
| 19 | + android:layout_height="match_parent" | |
| 20 | + android:gravity="center" | |
| 21 | + android:text="userID :" /> | |
| 22 | + | |
| 23 | + <EditText | |
| 24 | + android:id="@+id/user_ID" | |
| 25 | + android:layout_width="0dp" | |
| 26 | + android:layout_height="match_parent" | |
| 27 | + android:layout_weight="1" /> | |
| 28 | + </LinearLayout> | |
| 29 | + | |
| 30 | + <LinearLayout | |
| 31 | + android:layout_width="match_parent" | |
| 32 | + android:layout_height="wrap_content"> | |
| 33 | + | |
| 34 | + <TextView | |
| 35 | + android:layout_width="wrap_content" | |
| 36 | + android:layout_height="match_parent" | |
| 37 | + android:gravity="center" | |
| 38 | + android:text="userName:" /> | |
| 39 | + | |
| 40 | + <EditText | |
| 41 | + android:id="@+id/user_name" | |
| 42 | + android:layout_width="0dp" | |
| 43 | + android:layout_height="match_parent" | |
| 44 | + android:layout_weight="1" /> | |
| 45 | + </LinearLayout> | |
| 46 | + | |
| 47 | + <Button | |
| 48 | + android:id="@+id/uconnect" | |
| 49 | + android:layout_width="match_parent" | |
| 50 | + android:layout_height="wrap_content" | |
| 51 | + android:text="连接" /> | |
| 52 | + </LinearLayout> | |
| 53 | + | |
| 54 | + | |
| 55 | +</RelativeLayout> | ... | ... |
app/src/main/res/layout/mytest.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:orientation="vertical" android:layout_width="match_parent" | |
| 4 | + android:layout_height="match_parent"> | |
| 5 | + <RelativeLayout | |
| 6 | + android:id="@+id/re_chat_mian" | |
| 7 | + android:layout_width="match_parent" | |
| 8 | + android:layout_height="match_parent" | |
| 9 | + android:visibility="invisible"> | |
| 10 | + | |
| 11 | + <Button | |
| 12 | + android:id="@+id/groupChat" | |
| 13 | + android:layout_width="match_parent" | |
| 14 | + android:layout_height="wrap_content" | |
| 15 | + android:layout_marginTop="140dp" | |
| 16 | + android:text="群聊" /> | |
| 17 | + | |
| 18 | + <Button | |
| 19 | + android:id="@+id/privateChat" | |
| 20 | + android:layout_width="match_parent" | |
| 21 | + android:layout_height="wrap_content" | |
| 22 | + android:layout_below="@+id/groupChat" | |
| 23 | + android:layout_marginTop="34dp" | |
| 24 | + android:text="私聊" /> | |
| 25 | + | |
| 26 | + </RelativeLayout> | |
| 27 | + | |
| 28 | + | |
| 29 | + <LinearLayout | |
| 30 | + android:id="@+id/lin_user" | |
| 31 | + android:layout_width="match_parent" | |
| 32 | + android:layout_height="wrap_content" | |
| 33 | + android:layout_centerVertical="true" | |
| 34 | + android:orientation="vertical" | |
| 35 | + android:visibility="invisible"> | |
| 36 | + | |
| 37 | + | |
| 38 | + <LinearLayout | |
| 39 | + android:layout_width="match_parent" | |
| 40 | + android:layout_height="wrap_content"> | |
| 41 | + | |
| 42 | + <TextView | |
| 43 | + android:layout_width="wrap_content" | |
| 44 | + android:layout_height="match_parent" | |
| 45 | + android:gravity="center" | |
| 46 | + android:text="userID :" /> | |
| 47 | + | |
| 48 | + <EditText | |
| 49 | + android:id="@+id/user_ID" | |
| 50 | + android:layout_width="0dp" | |
| 51 | + android:layout_height="match_parent" | |
| 52 | + android:layout_weight="1" /> | |
| 53 | + </LinearLayout> | |
| 54 | + | |
| 55 | + <LinearLayout | |
| 56 | + android:layout_width="match_parent" | |
| 57 | + android:layout_height="wrap_content"> | |
| 58 | + | |
| 59 | + <TextView | |
| 60 | + android:layout_width="wrap_content" | |
| 61 | + android:layout_height="match_parent" | |
| 62 | + android:gravity="center" | |
| 63 | + android:text="userName:" /> | |
| 64 | + | |
| 65 | + <EditText | |
| 66 | + android:id="@+id/user_name" | |
| 67 | + android:layout_width="0dp" | |
| 68 | + android:layout_height="match_parent" | |
| 69 | + android:layout_weight="1" /> | |
| 70 | + </LinearLayout> | |
| 71 | + | |
| 72 | + <Button | |
| 73 | + android:id="@+id/uconnect" | |
| 74 | + android:layout_width="match_parent" | |
| 75 | + android:layout_height="wrap_content" | |
| 76 | + android:text="连接" | |
| 77 | + /> | |
| 78 | + | |
| 79 | + | |
| 80 | + </LinearLayout> | |
| 81 | + | |
| 82 | + | |
| 83 | + <LinearLayout | |
| 84 | + android:id="@+id/connect_uav" | |
| 85 | + android:layout_width="match_parent" | |
| 86 | + android:layout_height="wrap_content" | |
| 87 | + android:layout_centerInParent="true" | |
| 88 | + android:orientation="vertical"> | |
| 89 | + | |
| 90 | + <Button | |
| 91 | + android:id="@+id/connect" | |
| 92 | + android:layout_width="match_parent" | |
| 93 | + android:layout_height="wrap_content" | |
| 94 | + android:text="连接" /> | |
| 95 | + | |
| 96 | + <LinearLayout | |
| 97 | + android:id="@+id/lin_btn" | |
| 98 | + android:visibility="invisible" | |
| 99 | + android:layout_width="match_parent" | |
| 100 | + android:layout_height="wrap_content" | |
| 101 | + android:orientation="vertical"> | |
| 102 | + | |
| 103 | + <Button | |
| 104 | + android:id="@+id/user_login" | |
| 105 | + android:layout_width="match_parent" | |
| 106 | + android:layout_height="wrap_content" | |
| 107 | + android:layout_marginTop="15dp" | |
| 108 | + android:text="登录" /> | |
| 109 | + | |
| 110 | + | |
| 111 | + <Button | |
| 112 | + android:id="@+id/vis_login" | |
| 113 | + android:layout_width="match_parent" | |
| 114 | + android:layout_height="wrap_content" | |
| 115 | + android:layout_marginTop="15dp" | |
| 116 | + android:text="游客" /> | |
| 117 | + | |
| 118 | + | |
| 119 | + <Button | |
| 120 | + android:id="@+id/user_logOut" | |
| 121 | + android:layout_width="match_parent" | |
| 122 | + android:layout_height="wrap_content" | |
| 123 | + android:layout_marginTop="15dp" | |
| 124 | + android:text="退出" /> | |
| 125 | + | |
| 126 | + </LinearLayout> | |
| 127 | + | |
| 128 | + | |
| 129 | + </LinearLayout> | |
| 130 | +</LinearLayout> | |
| 0 | 131 | \ No newline at end of file | ... | ... |