Skip to content

Commit

Permalink
Android UI Kit v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
darshanbhanushali committed Jun 29, 2020
1 parent 41d5442 commit 4b2c62e
Show file tree
Hide file tree
Showing 122 changed files with 5,231 additions and 800 deletions.
30 changes: 30 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ android {
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
Expand All @@ -57,8 +57,6 @@ dependencies {

implementation 'com.google.android.material:material:1.2.0-alpha05'
implementation 'com.facebook.shimmer:shimmer:0.4.0'

implementation 'com.cometchat:pro-android-chat-sdk:2.0.4-beta1'

//
implementation 'com.cometchat:pro-android-chat-sdk:2.0.6'
}

28 changes: 15 additions & 13 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,34 @@

<application
android:name=".UIKitApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/cc_small"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@drawable/cc_small"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".ComponentListActivity"/>
<activity android:name=".CreateUserActivity"></activity>
<activity android:name=".ComponentListActivity" />
<activity
android:name=".LoginActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity android:name=".ComponentLoadActivity"
android:screenOrientation="portrait"/>
<activity android:name=".SelectActivity"
android:screenOrientation="portrait"/>
<activity android:name=".MainActivity"
android:theme="@style/AppTheme"
android:screenOrientation="portrait">
<activity
android:name=".ComponentLoadActivity"
android:screenOrientation="portrait" />
<activity
android:name=".SelectActivity"
android:screenOrientation="portrait" />
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import android.content.Context;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
Expand All @@ -19,13 +20,18 @@
import com.cometchat.pro.core.CometChat;
import com.cometchat.pro.uikit.Avatar;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;

import java.util.Random;

import utils.Utils;

public class AvatarFragment extends Fragment implements ColorPickerDialog.OnColorChangedListener {

private Context context;

private TextInputLayout borderWidthLayout;

public AvatarFragment() {
// Required empty public constructor
}
Expand All @@ -44,6 +50,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
avatar.setBorderColor(getResources().getColor(R.color.colorPrimaryDark));
avatar.setAvatar(CometChat.getLoggedInUser().getAvatar());
TextInputEditText borderWidth = view.findViewById(R.id.borderWidth);
borderWidthLayout = view.findViewById(R.id.borderWidth_layout);
borderWidth.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
Expand Down Expand Up @@ -119,10 +126,22 @@ public void onClick(View view) {
refreshAvatar(avatar);
}
});

checkDarkMode();
return view;
}

private void checkDarkMode() {
if(Utils.isDarkMode(getContext())) {
borderWidthLayout.setDefaultHintTextColor(ColorStateList.valueOf(getResources().getColor(R.color.textColorWhite)));
borderWidthLayout.setHintTextColor(ColorStateList.valueOf(getResources().getColor(R.color.textColorWhite)));
borderWidthLayout.setBoxStrokeColor(getResources().getColor(R.color.textColorWhite));
} else {
borderWidthLayout.setDefaultHintTextColor(ColorStateList.valueOf(getResources().getColor(R.color.primaryTextColor)));
borderWidthLayout.setHintTextColor(ColorStateList.valueOf(getResources().getColor(R.color.primaryTextColor)));
borderWidthLayout.setBoxStrokeColor(getResources().getColor(R.color.primaryTextColor));
}
}


@Override
public void colorChanged(String key, int color) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.cometchat.pro.androiduikit.ComponentFragments;

import android.content.res.ColorStateList;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
Expand All @@ -15,10 +16,15 @@
import com.cometchat.pro.uikit.BadgeCount;
import com.cometchat.pro.uikit.StatusIndicator;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;

import utils.Utils;

public class BadgeCountFragment extends Fragment {

private int count=1;
private TextInputLayout badgeCountLayout,badgeCountSizeLayout;
private TextInputEditText badgeCountEdt,countSize;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -30,11 +36,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_badge_count, container, false);
BadgeCount badgeCount = view.findViewById(R.id.badgeCount);
TextInputEditText badgecountedt = view.findViewById(R.id.badgeCount_edt);
TextInputEditText countSize = view.findViewById(R.id.countSize);
badgeCountLayout = view.findViewById(R.id.badgeCount_layout);
badgeCountSizeLayout = view.findViewById(R.id.badgeCountSize_layout);
badgeCountEdt = view.findViewById(R.id.badgeCount_edt);
countSize = view.findViewById(R.id.countSize);
countSize.setText(String.valueOf(12));
badgecountedt.setText(String.valueOf(1));
badgecountedt.addTextChangedListener(new TextWatcher() {
badgeCountEdt.setText(String.valueOf(1));
badgeCountEdt.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

Expand Down Expand Up @@ -160,9 +168,30 @@ public void onClick(View view) {
refreshbadgeCount(badgeCount);
}
});
checkDarkMode();
return view;
}

private void checkDarkMode() {
if(Utils.isDarkMode(getContext())) {
badgeCountLayout.setBoxStrokeColor(getResources().getColor(R.color.textColorWhite));
badgeCountLayout.setHintTextColor(ColorStateList.valueOf(getResources().getColor(R.color.textColorWhite)));
badgeCountLayout.setDefaultHintTextColor(ColorStateList.valueOf(getResources().getColor(R.color.textColorWhite)));

badgeCountSizeLayout.setBoxStrokeColor(getResources().getColor(R.color.textColorWhite));
badgeCountSizeLayout.setHintTextColor(ColorStateList.valueOf(getResources().getColor(R.color.textColorWhite)));
badgeCountSizeLayout.setDefaultHintTextColor(ColorStateList.valueOf(getResources().getColor(R.color.textColorWhite)));
} else {
badgeCountLayout.setBoxStrokeColor(getResources().getColor(R.color.primaryTextColor));
badgeCountLayout.setHintTextColor(ColorStateList.valueOf(getResources().getColor(R.color.primaryTextColor)));
badgeCountLayout.setDefaultHintTextColor(ColorStateList.valueOf(getResources().getColor(R.color.primaryTextColor)));

badgeCountSizeLayout.setBoxStrokeColor(getResources().getColor(R.color.primaryTextColor));
badgeCountSizeLayout.setHintTextColor(ColorStateList.valueOf(getResources().getColor(R.color.primaryTextColor)));
badgeCountSizeLayout.setDefaultHintTextColor(ColorStateList.valueOf(getResources().getColor(R.color.primaryTextColor)));
}
}

private void refreshbadgeCount(BadgeCount badgeCount) {
badgeCount.setCount(count);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ public void OnItemClick(Call var, int position) {
intent.putExtra(StringContract.IntentStrings.NAME, group.getName());
intent.putExtra(StringContract.IntentStrings.AVATAR, group.getIcon());
intent.putExtra(StringContract.IntentStrings.MEMBER_SCOPE, group.getScope());
intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,group.getMembersCount());
intent.putExtra(StringContract.IntentStrings.GROUP_OWNER, group.getOwner());
intent.putExtra(StringContract.IntentStrings.GROUP_DESC,group.getDescription());
intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,group.getPassword());
intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,group.getGroupType());
startActivity(intent);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ public void OnItemClick(Conversation conversation, int position) {
intent.putExtra(StringContract.IntentStrings.GUID,((Group)conversation.getConversationWith()).getGuid());
intent.putExtra(StringContract.IntentStrings.GROUP_OWNER,((Group)conversation.getConversationWith()).getOwner());
intent.putExtra(StringContract.IntentStrings.AVATAR,((Group)conversation.getConversationWith()).getIcon());

intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,((Group)conversation.getConversationWith()).getGroupType());
intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,((Group)conversation.getConversationWith()).getMembersCount());
intent.putExtra(StringContract.IntentStrings.GROUP_DESC,((Group)conversation.getConversationWith()).getDescription());
intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,((Group)conversation.getConversationWith()).getPassword());
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ public void OnItemClick(Group group, int position) {
intent.putExtra(StringContract.IntentStrings.GROUP_OWNER,group.getOwner());
intent.putExtra(StringContract.IntentStrings.GUID,group.getGuid());
intent.putExtra(StringContract.IntentStrings.AVATAR,group.getIcon());
intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,group.getGroupType());
intent.putExtra(StringContract.IntentStrings.TYPE,CometChatConstants.RECEIVER_TYPE_GROUP);
intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,group.getMembersCount());
intent.putExtra(StringContract.IntentStrings.GROUP_DESC,group.getDescription());
intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,group.getPassword());
startActivity(intent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.google.android.material.card.MaterialCardView;

Expand All @@ -17,11 +18,18 @@ public class ComponentListActivity extends AppCompatActivity {
MaterialCardView cometchatGroupList;
MaterialCardView cometchatConversationList;
MaterialCardView cometchatCallList;

ImageView backIcon;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_component_list);
backIcon = findViewById(R.id.backIcon);
backIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
cometchatAvatar = findViewById(R.id.cometchat_avatar);
cometchatAvatar.setOnClickListener(view -> {
Intent intent = new Intent(ComponentListActivity.this, ComponentLoadActivity.class);
Expand Down Expand Up @@ -65,9 +73,4 @@ protected void onCreate(Bundle savedInstanceState) {
startActivity(intent);
});
}

public void backClick(View view)
{
super.onBackPressed();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ private void startGroupIntent(Group group) {
intent.putExtra(StringContract.IntentStrings.GROUP_OWNER,group.getOwner());
intent.putExtra(StringContract.IntentStrings.AVATAR, group.getIcon());
intent.putExtra(StringContract.IntentStrings.NAME, group.getName());
intent.putExtra(StringContract.IntentStrings.GROUP_TYPE,group.getGroupType());
intent.putExtra(StringContract.IntentStrings.TYPE, CometChatConstants.RECEIVER_TYPE_GROUP);
intent.putExtra(StringContract.IntentStrings.MEMBER_COUNT,group.getMembersCount());
intent.putExtra(StringContract.IntentStrings.GROUP_DESC,group.getDescription());
intent.putExtra(StringContract.IntentStrings.GROUP_PASSWORD,group.getPassword());
startActivity(intent);
}

Expand Down
Loading

0 comments on commit 4b2c62e

Please sign in to comment.