-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
single view example added and position and gravity fixed
- Loading branch information
1 parent
5605e1b
commit 5a40921
Showing
16 changed files
with
318 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="me.himanshusoni.chatmessageview.example" > | ||
package="me.himanshusoni.chatmessageview.example"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" > | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/app_name" > | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name=".SingleViewActivity" | ||
android:label="@string/title_activity_single_view" | ||
android:theme="@style/AppTheme.NoActionBar" /> | ||
</application> | ||
|
||
</manifest> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
example/src/main/java/me/himanshusoni/chatmessageview/example/SingleViewActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package me.himanshusoni.chatmessageview.example; | ||
|
||
import android.os.Bundle; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.design.widget.Snackbar; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.Toolbar; | ||
import android.view.View; | ||
|
||
import me.himanshusoni.chatmessageview.ChatMessageView; | ||
|
||
public class SingleViewActivity extends AppCompatActivity implements View.OnClickListener { | ||
|
||
private ChatMessageView mChatMessageView; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_single_view); | ||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
setSupportActionBar(toolbar); | ||
|
||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | ||
fab.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) | ||
.setAction("Action", null).show(); | ||
} | ||
}); | ||
|
||
mChatMessageView = (ChatMessageView) findViewById(R.id.chatMessageView); | ||
|
||
findViewById(R.id.btn_arrow_gravity_start).setOnClickListener(this); | ||
findViewById(R.id.btn_arrow_gravity_end).setOnClickListener(this); | ||
findViewById(R.id.btn_arrow_gravity_center).setOnClickListener(this); | ||
findViewById(R.id.btn_arrow_position_left).setOnClickListener(this); | ||
findViewById(R.id.btn_arrow_position_right).setOnClickListener(this); | ||
findViewById(R.id.btn_arrow_position_top).setOnClickListener(this); | ||
findViewById(R.id.btn_arrow_position_bottom).setOnClickListener(this); | ||
} | ||
|
||
@Override | ||
public void onClick(View v) { | ||
int id = v.getId(); | ||
if (id == R.id.btn_arrow_gravity_start) { | ||
mChatMessageView.setArrowGravity(ChatMessageView.ArrowGravity.START); | ||
} else if (id == R.id.btn_arrow_gravity_center) { | ||
mChatMessageView.setArrowGravity(ChatMessageView.ArrowGravity.CENTER); | ||
} else if (id == R.id.btn_arrow_gravity_end) { | ||
mChatMessageView.setArrowGravity(ChatMessageView.ArrowGravity.END); | ||
} else if (id == R.id.btn_arrow_position_left) { | ||
mChatMessageView.setArrowPosition(ChatMessageView.ArrowPosition.LEFT); | ||
} else if (id == R.id.btn_arrow_position_right) { | ||
mChatMessageView.setArrowPosition(ChatMessageView.ArrowPosition.RIGHT); | ||
} else if (id == R.id.btn_arrow_position_top) { | ||
mChatMessageView.setArrowPosition(ChatMessageView.ArrowPosition.TOP); | ||
} else if (id == R.id.btn_arrow_position_bottom) { | ||
mChatMessageView.setArrowPosition(ChatMessageView.ArrowPosition.BOTTOM); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.design.widget.CoordinatorLayout 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:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:fitsSystemWindows="true" | ||
tools:context="me.himanshusoni.chatmessageview.example.SingleViewActivity"> | ||
|
||
<android.support.design.widget.AppBarLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:theme="@style/AppTheme.AppBarOverlay"> | ||
|
||
<android.support.v7.widget.Toolbar | ||
android:id="@+id/toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
android:background="?attr/colorPrimary" | ||
app:popupTheme="@style/AppTheme.PopupOverlay" /> | ||
|
||
</android.support.design.widget.AppBarLayout> | ||
|
||
<include layout="@layout/content_single_view" /> | ||
|
||
<android.support.design.widget.FloatingActionButton | ||
android:id="@+id/fab" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="bottom|end" | ||
android:layout_margin="@dimen/fab_margin" | ||
app:srcCompat="@android:drawable/ic_dialog_email" /> | ||
|
||
</android.support.design.widget.CoordinatorLayout> |
Oops, something went wrong.