diff --git a/libraries/im/src/main/assets/emojikf b/app/src/main/assets/emojikf similarity index 100% rename from libraries/im/src/main/assets/emojikf rename to app/src/main/assets/emojikf diff --git a/libraries/im/src/main/assets/iattest.wav b/app/src/main/assets/iattest.wav similarity index 100% rename from libraries/im/src/main/assets/iattest.wav rename to app/src/main/assets/iattest.wav diff --git a/libraries/im/src/main/assets/microlog.properties b/app/src/main/assets/microlog.properties similarity index 100% rename from libraries/im/src/main/assets/microlog.properties rename to app/src/main/assets/microlog.properties diff --git a/app/src/main/java/com/gh/common/view/WelcomeDialog.kt b/app/src/main/java/com/gh/common/view/WelcomeDialog.kt index 5a99dbb51a..a68dc80122 100644 --- a/app/src/main/java/com/gh/common/view/WelcomeDialog.kt +++ b/app/src/main/java/com/gh/common/view/WelcomeDialog.kt @@ -58,7 +58,13 @@ class WelcomeDialog : BaseDialogFragment() { } dismiss() } - binding.ivClose.setOnClickListener { dismiss() } + binding.ivClose.setOnClickListener { + try { + dismiss() + } catch (e: Exception) { + e.printStackTrace() + } + } binding.welcome = mWelcomeEntity return binding.root } diff --git a/app/src/main/java/com/gh/common/view/WrapContentDraweeView.kt b/app/src/main/java/com/gh/common/view/WrapContentDraweeView.kt new file mode 100644 index 0000000000..57d7042b92 --- /dev/null +++ b/app/src/main/java/com/gh/common/view/WrapContentDraweeView.kt @@ -0,0 +1,41 @@ +package com.gh.common.view + +import android.content.Context +import android.graphics.drawable.Animatable +import android.net.Uri +import android.support.annotation.Nullable +import android.util.AttributeSet +import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder +import com.facebook.drawee.controller.BaseControllerListener +import com.facebook.drawee.view.SimpleDraweeView +import com.facebook.imagepipeline.image.ImageInfo + +class WrapContentDraweeView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : SimpleDraweeView(context, attrs, defStyleAttr) { + + // we set a listener and update the view's aspect ratio depending on the loaded image + private val listener = object : BaseControllerListener() { + override fun onIntermediateImageSet(id: String?, @Nullable imageInfo: ImageInfo?) { + updateViewSize(imageInfo) + } + + override fun onFinalImageSet(id: String?, @Nullable imageInfo: ImageInfo?, @Nullable animatable: Animatable?) { + updateViewSize(imageInfo) + } + } + + override fun setImageURI(uri: Uri?, callerContext: Any?) { + val controller = (controllerBuilder as PipelineDraweeControllerBuilder) + .setControllerListener(listener) + .setCallerContext(callerContext) + .setUri(uri) + .setOldController(controller) + .build() + setController(controller) + } + + internal fun updateViewSize(@Nullable imageInfo: ImageInfo?) { + if (imageInfo != null) { + aspectRatio = imageInfo.width.toFloat() / imageInfo.height + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/game/GameViewModel.kt b/app/src/main/java/com/gh/gamecenter/game/GameViewModel.kt index dc05acc68e..0da0408c4d 100644 --- a/app/src/main/java/com/gh/gamecenter/game/GameViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/game/GameViewModel.kt @@ -117,7 +117,7 @@ class GameViewModel(application: Application, blockData: SubjectRecommendEntity? /** - * 获取开启弹窗 + * 获取启动弹窗 */ fun requestOpeningData() { val lastId = PreferenceManager.getDefaultSharedPreferences(getApplication()).getString(Constants.SP_LAST_OPENING_ID, "") diff --git a/app/src/main/res/layout/dialog_welcome.xml b/app/src/main/res/layout/dialog_welcome.xml index 423f4ec98d..f9345e0300 100644 --- a/app/src/main/res/layout/dialog_welcome.xml +++ b/app/src/main/res/layout/dialog_welcome.xml @@ -17,10 +17,10 @@ android:layout_height="wrap_content" android:layout_centerInParent="true"> - 0) { - if (sc.getEntranceNode().getEntrances().size() == 1) { - ScheduleConfig.EntranceNodeBean.EntrancesBean bean = sc.getEntranceNode().getEntrances().get(0); - Intent chatIntent = new Intent(MainActivity.this, ChatActivity.class); - chatIntent.putExtra("type", "schedule"); - chatIntent.putExtra("scheduleId", sc.getScheduleId()); - chatIntent.putExtra("processId", sc.getProcessId()); - chatIntent.putExtra("currentNodeId", bean.getProcessTo()); - chatIntent.putExtra("processType", bean.getProcessType()); - chatIntent.putExtra("entranceId", bean.get_id()); - startActivity(chatIntent); - } else { - Scheduledialog scheduledialog = new Scheduledialog(); - Bundle b = new Bundle(); - b.putSerializable("Schedules", (Serializable) sc.getEntranceNode().getEntrances()); - b.putString("scheduleId", sc.getScheduleId()); - b.putString("processId", sc.getProcessId()); - scheduledialog.setArguments(b); - scheduledialog.show(getFragmentManager(), ""); - } - - } else { - ToastUtils.showShort(R.string.sorryconfigurationiswrong); - } - } else { - ToastUtils.showShort(R.string.sorryconfigurationiswrong); - } - } - - @Override - public void getPeers() { - LogUtils.aTag("MainActivity", "技能组"); - IMChatManager.getInstance().getPeers(new GetPeersListener() { - @Override - public void onSuccess(List peers) { - if (peers.size() > 1) { - PeerDialog dialog = new PeerDialog(); - Bundle b = new Bundle(); - b.putSerializable("Peers", (Serializable) peers); - b.putString("type", "init"); - dialog.setArguments(b); - dialog.show(getFragmentManager(), ""); - } else if (peers.size() == 1) { - startChatActivity(peers.get(0).getId()); - } else { - startChatActivity(""); - } - } - - @Override - public void onFailed() { - - } - }); - } - }); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - } - - - private void startKFService() { - new Thread() { - @Override - public void run() { - IMChatManager.getInstance().setOnInitListener(new InitListener() { - @Override - public void oninitSuccess() { - IMChatManager.isKFSDK = true; - loadingDialog.dismiss(); - getIsGoSchedule(); - Log.d("MainActivity", "sdk初始化成功"); - - } - - @Override - public void onInitFailed() { - IMChatManager.isKFSDK = false; - loadingDialog.dismiss(); - ToastUtils.showShort(R.string.sdkinitwrong); - Log.d("MainActivity", "sdk初始化失败, 请填写正确的accessid"); - } - }); - /** - * 初始化sdk方法,必须先调用该方法进行初始化后才能使用IM相关功能 - * @param appContext 上下文(使用全局上下文) - * @param receiverAction 接收新消息广播的action,必须和AndroidManifest中注册的广播中的action一致 - * @param accessId 接入id(需后台配置获取) - * @param userName 用户名 - * @param userId 用户id - */ - IMChatManager.getInstance().init(getApplicationContext(), "com.m7.imkf.KEFU_NEW_MSG", "accessId", "hhtest", "userid"); - - - } - }.start(); - - } - - private void startChatActivity(String peerId) { - Intent chatIntent = new Intent(MainActivity.this, ChatActivity.class); - chatIntent.putExtra("PeerId", peerId); - chatIntent.putExtra("type", "peedId"); - startActivity(chatIntent); - } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - PermissionUtils.onRequestPermissionsResult(this, 0x11, new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE}, grantResults); - } - - /** - * 语言切换 - * 中文 language:"" - * 英文 language:"en" - */ - private void initLanguage(String language) { - Resources resources = getApplicationContext().getResources(); - Configuration configuration = resources.getConfiguration(); - configuration.locale = new Locale(language); - resources.updateConfiguration(configuration, resources.getDisplayMetrics());//更新配置 - } -} +//package com.m7.imkfsdk; +// +//import android.Manifest; +//import android.app.Activity; +//import android.content.Intent; +//import android.content.res.Configuration; +//import android.content.res.Resources; +//import android.os.Bundle; +//import android.os.Handler; +//import android.support.annotation.NonNull; +//import android.util.Log; +//import android.view.View; +//import android.view.Window; +//import android.widget.Toast; +// +//import com.m7.imkfsdk.chat.ChatActivity; +//import com.m7.imkfsdk.chat.LoadingFragmentDialog; +//import com.m7.imkfsdk.chat.PeerDialog; +//import com.m7.imkfsdk.chat.Scheduledialog; +//import com.m7.imkfsdk.utils.PermissionUtils; +//import com.m7.imkfsdk.utils.ToastUtils; +//import com.moor.imkf.GetGlobleConfigListen; +//import com.moor.imkf.GetPeersListener; +//import com.moor.imkf.IMChatManager; +//import com.moor.imkf.InitListener; +//import com.moor.imkf.model.entity.Peer; +//import com.moor.imkf.model.entity.ScheduleConfig; +//import com.moor.imkf.utils.LogUtils; +//import com.moor.imkf.utils.Utils; +// +//import java.io.Serializable; +//import java.util.List; +//import java.util.Locale; +// +// +//public class MainActivity extends Activity { +// +// private LoadingFragmentDialog loadingDialog; +// +// @Override +// protected void onCreate(Bundle savedInstanceState) { +// super.onCreate(savedInstanceState); +// requestWindowFeature(Window.FEATURE_NO_TITLE); +// setContentView(R.layout.kf_activity_main); +// loadingDialog = new LoadingFragmentDialog(); +// //初始化表情,聊天界面需要 +// new Thread(new Runnable() { +// @Override +// public void run() { +// com.m7.imkfsdk.utils.FaceConversionUtil.getInstace().getFileText( +// getApplicationContext()); +// } +// }).start(); +// +// findViewById(R.id.button).setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// init(); +// } +// }); +// findViewById(R.id.setting).setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// } +// }); +// +// if (PermissionUtils.hasAlwaysDeniedPermission(this, Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { +// PermissionUtils.requestPermissions(this, 0x11, new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE}, new PermissionUtils.OnPermissionListener() { +// @Override +// public void onPermissionGranted() { +// } +// +// @Override +// public void onPermissionDenied(String[] deniedPermissions) { +// Toast.makeText(MainActivity.this, R.string.notpermession, Toast.LENGTH_SHORT).show(); +// new Handler().postDelayed(new Runnable() { +// @Override +// public void run() { +// finish(); +// } +// }, 2000); +// } +// }); +// } +// } +// +// private void init() { +// +// if (!Utils.isNetWorkConnected(MainActivity.this)) { +// Toast.makeText(MainActivity.this, R.string.notnetwork, Toast.LENGTH_SHORT).show(); +// return; +// } +// +// loadingDialog.show(getFragmentManager(), ""); +// if (IMChatManager.isKFSDK) { +// loadingDialog.dismiss(); +// getIsGoSchedule(); +// } else { +// startKFService(); +// } +// } +// +// private void getIsGoSchedule() { +// IMChatManager.getInstance().getWebchatScheduleConfig(new GetGlobleConfigListen() { +// @Override +// public void getSchedule(ScheduleConfig sc) { +// LogUtils.aTag("MainActivity", "日程"); +// if (!sc.getScheduleId().equals("") && !sc.getProcessId().equals("") && sc.getEntranceNode() != null && sc.getLeavemsgNodes() != null) { +// if (sc.getEntranceNode().getEntrances().size() > 0) { +// if (sc.getEntranceNode().getEntrances().size() == 1) { +// ScheduleConfig.EntranceNodeBean.EntrancesBean bean = sc.getEntranceNode().getEntrances().get(0); +// Intent chatIntent = new Intent(MainActivity.this, ChatActivity.class); +// chatIntent.putExtra("type", "schedule"); +// chatIntent.putExtra("scheduleId", sc.getScheduleId()); +// chatIntent.putExtra("processId", sc.getProcessId()); +// chatIntent.putExtra("currentNodeId", bean.getProcessTo()); +// chatIntent.putExtra("processType", bean.getProcessType()); +// chatIntent.putExtra("entranceId", bean.get_id()); +// startActivity(chatIntent); +// } else { +// Scheduledialog scheduledialog = new Scheduledialog(); +// Bundle b = new Bundle(); +// b.putSerializable("Schedules", (Serializable) sc.getEntranceNode().getEntrances()); +// b.putString("scheduleId", sc.getScheduleId()); +// b.putString("processId", sc.getProcessId()); +// scheduledialog.setArguments(b); +// scheduledialog.show(getFragmentManager(), ""); +// } +// +// } else { +// ToastUtils.showShort(R.string.sorryconfigurationiswrong); +// } +// } else { +// ToastUtils.showShort(R.string.sorryconfigurationiswrong); +// } +// } +// +// @Override +// public void getPeers() { +// LogUtils.aTag("MainActivity", "技能组"); +// IMChatManager.getInstance().getPeers(new GetPeersListener() { +// @Override +// public void onSuccess(List peers) { +// if (peers.size() > 1) { +// PeerDialog dialog = new PeerDialog(); +// Bundle b = new Bundle(); +// b.putSerializable("Peers", (Serializable) peers); +// b.putString("type", "init"); +// dialog.setArguments(b); +// dialog.show(getFragmentManager(), ""); +// } else if (peers.size() == 1) { +// startChatActivity(peers.get(0).getId()); +// } else { +// startChatActivity(""); +// } +// } +// +// @Override +// public void onFailed() { +// +// } +// }); +// } +// }); +// } +// +// @Override +// protected void onDestroy() { +// super.onDestroy(); +// } +// +// +// private void startKFService() { +// new Thread() { +// @Override +// public void run() { +// IMChatManager.getInstance().setOnInitListener(new InitListener() { +// @Override +// public void oninitSuccess() { +// IMChatManager.isKFSDK = true; +// loadingDialog.dismiss(); +// getIsGoSchedule(); +// Log.d("MainActivity", "sdk初始化成功"); +// +// } +// +// @Override +// public void onInitFailed() { +// IMChatManager.isKFSDK = false; +// loadingDialog.dismiss(); +// ToastUtils.showShort(R.string.sdkinitwrong); +// Log.d("MainActivity", "sdk初始化失败, 请填写正确的accessid"); +// } +// }); +// /** +// * 初始化sdk方法,必须先调用该方法进行初始化后才能使用IM相关功能 +// * @param appContext 上下文(使用全局上下文) +// * @param receiverAction 接收新消息广播的action,必须和AndroidManifest中注册的广播中的action一致 +// * @param accessId 接入id(需后台配置获取) +// * @param userName 用户名 +// * @param userId 用户id +// */ +// IMChatManager.getInstance().init(getApplicationContext(), "com.m7.imkf.KEFU_NEW_MSG", "accessId", "hhtest", "userid"); +// +// +// } +// }.start(); +// +// } +// +// private void startChatActivity(String peerId) { +// Intent chatIntent = new Intent(MainActivity.this, ChatActivity.class); +// chatIntent.putExtra("PeerId", peerId); +// chatIntent.putExtra("type", "peedId"); +// startActivity(chatIntent); +// } +// +// @Override +// public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { +// super.onRequestPermissionsResult(requestCode, permissions, grantResults); +// PermissionUtils.onRequestPermissionsResult(this, 0x11, new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE}, grantResults); +// } +// +// /** +// * 语言切换 +// * 中文 language:"" +// * 英文 language:"en" +// */ +// private void initLanguage(String language) { +// Resources resources = getApplicationContext().getResources(); +// Configuration configuration = resources.getConfiguration(); +// configuration.locale = new Locale(language); +// resources.updateConfiguration(configuration, resources.getDisplayMetrics());//更新配置 +// } +//} diff --git a/libraries/im/src/main/java/com/m7/imkfsdk/chat/ChatActivity.java b/libraries/im/src/main/java/com/m7/imkfsdk/chat/ChatActivity.java index 9305243a7d..30b621d987 100644 --- a/libraries/im/src/main/java/com/m7/imkfsdk/chat/ChatActivity.java +++ b/libraries/im/src/main/java/com/m7/imkfsdk/chat/ChatActivity.java @@ -1469,27 +1469,27 @@ public class ChatActivity extends MyBaseActivity implements OnClickListener, IMChatManager.getInstance().beginSession(peerId, new OnSessionBeginListener() { @Override public void onSuccess() { - if (IMChatManager.getInstance().isInvestigateOn()) { - //显示评价按钮 - moreList.clear(); - ChatMore chatMore2 = new ChatMore(2, R.drawable.kf_icon_chat_pic + "", - getString(R.string.chat_img)); - ChatMore chatMore3 = new ChatMore(3, R.drawable.kf_icon_chat_file + "", - getString(R.string.chat_file)); - ChatMore chatMore4 = new ChatMore(4, R.drawable.kf_icon_chat_investigate + "", - getString(R.string.chat_evaluate)); - moreList.add(chatMore2); - moreList.add(chatMore3); - moreList.add(chatMore4); - moreLists.clear(); - int pageCount = (int) Math.ceil(moreList.size() / 8 + 0.1); - for (int i = 0; i < pageCount; i++) { - moreLists.add(getData(i)); - } - initMoreViewPager(); - initMorePoint(); - initMoreData(); - } else { +// if (IMChatManager.getInstance().isInvestigateOn()) { +// //显示评价按钮 +// moreList.clear(); +// ChatMore chatMore2 = new ChatMore(2, R.drawable.kf_icon_chat_pic + "", +// getString(R.string.chat_img)); +// ChatMore chatMore3 = new ChatMore(3, R.drawable.kf_icon_chat_file + "", +// getString(R.string.chat_file)); +// ChatMore chatMore4 = new ChatMore(4, R.drawable.kf_icon_chat_investigate + "", +// getString(R.string.chat_evaluate)); +// moreList.add(chatMore2); +// moreList.add(chatMore3); +// moreList.add(chatMore4); +// moreLists.clear(); +// int pageCount = (int) Math.ceil(moreList.size() / 8 + 0.1); +// for (int i = 0; i < pageCount; i++) { +// moreLists.add(getData(i)); +// } +// initMoreViewPager(); +// initMorePoint(); +// initMoreData(); +// } else { //隐藏评价按钮 moreList.clear(); ChatMore chatMore2 = new ChatMore(2, R.drawable.kf_icon_chat_pic + "", @@ -1508,7 +1508,7 @@ public class ChatActivity extends MyBaseActivity implements OnClickListener, initMorePoint(); initMoreData(); } - } +// } @Override public void onFailed() { @@ -1524,28 +1524,28 @@ public class ChatActivity extends MyBaseActivity implements OnClickListener, @Override public void onSuccess() { - if (IMChatManager.getInstance().isInvestigateOn()) { - //显示评价按钮 - moreList.clear(); - ChatMore chatMore2 = new ChatMore(2, R.drawable.kf_icon_chat_pic + "", - getString(R.string.chat_img)); - ChatMore chatMore3 = new ChatMore(3, R.drawable.kf_icon_chat_file + "", - getString(R.string.chat_file)); - ChatMore chatMore4 = new ChatMore(4, R.drawable.kf_icon_chat_investigate + "", - getString(R.string.chat_evaluate)); - moreList.add(chatMore2); - moreList.add(chatMore3); - moreList.add(chatMore4); - - moreLists.clear(); - int pageCount = (int) Math.ceil(moreList.size() / 8 + 0.1); - for (int i = 0; i < pageCount; i++) { - moreLists.add(getData(i)); - } - initMoreViewPager(); - initMorePoint(); - initMoreData(); - } else { +// if (IMChatManager.getInstance().isInvestigateOn()) { +// //显示评价按钮 +// moreList.clear(); +// ChatMore chatMore2 = new ChatMore(2, R.drawable.kf_icon_chat_pic + "", +// getString(R.string.chat_img)); +// ChatMore chatMore3 = new ChatMore(3, R.drawable.kf_icon_chat_file + "", +// getString(R.string.chat_file)); +// ChatMore chatMore4 = new ChatMore(4, R.drawable.kf_icon_chat_investigate + "", +// getString(R.string.chat_evaluate)); +// moreList.add(chatMore2); +// moreList.add(chatMore3); +// moreList.add(chatMore4); +// +// moreLists.clear(); +// int pageCount = (int) Math.ceil(moreList.size() / 8 + 0.1); +// for (int i = 0; i < pageCount; i++) { +// moreLists.add(getData(i)); +// } +// initMoreViewPager(); +// initMorePoint(); +// initMoreData(); +// } else { //隐藏评价按钮 moreList.clear(); ChatMore chatMore2 = new ChatMore(2, R.drawable.kf_icon_chat_pic + "", @@ -1563,7 +1563,7 @@ public class ChatActivity extends MyBaseActivity implements OnClickListener, initMoreViewPager(); initMorePoint(); initMoreData(); - } +// } } @Override diff --git a/libraries/im/src/main/java/com/m7/imkfsdk/utils/FaceConversionUtil.java b/libraries/im/src/main/java/com/m7/imkfsdk/utils/FaceConversionUtil.java index 2abda6ea2f..f2d9fc18da 100644 --- a/libraries/im/src/main/java/com/m7/imkfsdk/utils/FaceConversionUtil.java +++ b/libraries/im/src/main/java/com/m7/imkfsdk/utils/FaceConversionUtil.java @@ -154,7 +154,6 @@ public class FaceConversionUtil { public void getFileText(Context context) { ParseData(Utils.getEmojiFile(context), context); - } /**