From 7edef02ef1ce82f923e2278aae4e9c21f3a30452 Mon Sep 17 00:00:00 2001 From: imndx Date: Sat, 15 Apr 2023 11:15:03 +0800 Subject: [PATCH] refactor --- .../cn/wildfire/chat/app/login/LoginActivity.java | 8 ++++---- .../wildfire/chat/app/login/SMSLoginActivity.java | 8 ++++---- .../wildfire/chat/app/main/DiscoveryFragment.java | 8 ++++---- .../cn/wildfire/chat/app/main/MainActivity.java | 4 ++-- .../java/cn/wildfire/chat/app/main/MeFragment.java | 8 ++++---- .../cn/wildfire/chat/app/main/PCLoginActivity.java | 8 ++++---- .../wildfire/chat/app/main/WorkspaceFragment.java | 4 ++-- .../wildfire/chat/app/setting/AboutActivity.java | 8 ++++---- .../wildfire/chat/app/setting/AccountActivity.java | 8 ++------ .../chat/app/setting/ChangePasswordActivity.java | 8 ++++---- .../chat/app/setting/ResetPasswordActivity.java | 12 ++++++------ .../wildfire/chat/app/setting/SettingActivity.java | 12 ++++-------- .../java/cn/wildfire/chat/kit/WfcBaseActivity.java | 9 +++++++-- .../cn/wildfire/chat/kit/WfcWebViewActivity.java | 4 ++-- .../chat/kit/channel/ChannelInfoActivity.java | 4 ++-- .../chat/kit/channel/ChannelListFragment.java | 4 ++-- .../chat/kit/channel/CreateChannelActivity.java | 14 +++++--------- .../kit/channel/viewholder/CategoryViewHolder.java | 4 ++-- .../kit/channel/viewholder/ChannelViewHolder.java | 4 ++-- .../chat/kit/chatroom/ChatRoomListFragment.java | 4 ++-- .../chat/kit/contact/BaseUserListFragment.java | 4 ++-- .../newfriend/FriendRequestListFragment.java | 4 ++-- .../contact/newfriend/FriendRequestViewHolder.java | 8 ++++---- .../contact/newfriend/InviteFriendActivity.java | 8 ++++---- .../chat/kit/contact/pick/PickUserFragment.java | 4 ++-- .../contact/pick/SearchAndPickUserFragment.java | 8 ++++---- .../viewholder/CheckableUserBlackViewHolder.java | 4 ++-- .../pick/viewholder/CheckableUserViewHolder.java | 4 ++-- .../kit/contact/viewholder/UserViewHolder.java | 4 ++-- .../viewholder/footer/ContactCountViewHolder.java | 4 ++-- .../viewholder/header/FriendRequestViewHolder.java | 4 ++-- .../ChannelConversationInfoFragment.java | 8 ++++---- .../kit/conversation/ConversationFragment.java | 8 ++++---- .../kit/conversation/ConversationInputPanel.java | 4 ++-- .../conversation/ConversationMemberAdapter.java | 8 ++++---- .../GroupConversationInfoFragment.java | 8 ++++---- .../chat/kit/conversation/OngoingCallAdapter.java | 4 ++-- .../SecretConversationInfoFragment.java | 8 ++++---- .../SingleConversationInfoFragment.java | 8 ++++---- .../kit/conversation/file/FileRecordFragment.java | 4 ++-- .../conversation/file/FileRecordListActivity.java | 4 ++-- .../conversation/file/FileRecordViewHolder.java | 4 ++-- .../conversation/forward/ForwardPromptView.java | 4 ++-- .../forward/viewholder/ConversationViewHolder.java | 4 ++-- .../message/CompositeMessageContentActivity.java | 4 ++-- .../message/CompositeMessageContentAdapter.java | 8 ++++---- .../ArticlesMessageContentViewHolder.java | 8 ++++---- .../viewholder/AudioMessageContentViewHolder.java | 8 ++++---- .../CompositeMessageContentViewHolder.java | 8 ++++---- .../ConferenceInviteMessageContentViewHolder.java | 8 ++++---- ...leRichNotificationMessageContentViewHolder.java | 8 ++++---- .../viewholder/FileMessageContentViewHolder.java | 8 ++++---- .../viewholder/ImageMessageContentViewHolder.java | 8 ++++---- .../viewholder/LinkMessageContentViewHolder.java | 8 ++++---- .../viewholder/MessageContentViewHolder.java | 4 ++-- .../viewholder/NormalMessageContentViewHolder.java | 8 ++++---- .../viewholder/RecallMessageContentViewHolder.java | 8 ++++---- .../RichNotificationMessageContentViewHolder.java | 8 ++++---- ...SimpleNotificationMessageContentViewHolder.java | 4 ++-- .../StickerMessageContentViewHolder.java | 4 ++-- .../viewholder/TextMessageContentViewHolder.java | 8 ++++---- .../viewholder/UnkownMessageContentViewHolder.java | 4 ++-- .../UserCardMessageContentViewHolder.java | 8 ++++---- .../viewholder/VideoMessageContentViewHolder.java | 8 ++++---- .../message/viewholder/VoipMessageViewHolder.java | 8 ++++---- .../pick/PickOrCreateConversationActivity.java | 4 ++-- .../pick/PickOrCreateConversationFragment.java | 4 ++-- .../receipt/GroupMessageReceiptActivity.java | 4 ++-- .../receipt/GroupMessageReceiptAdapter.java | 8 ++++---- .../receipt/GroupMessageReceiptListFragment.java | 4 ++-- .../viewholder/ConversationViewHolder.java | 4 ++-- .../viewholder/GroupConversationViewHolder.java | 4 ++-- .../StatusNotificationContainerViewHolder.java | 4 ++-- .../chat/kit/favorite/FavoriteListFragment.java | 4 ++-- .../viewholder/FavAudioContentViewHolder.java | 8 ++++---- .../viewholder/FavCompositeContentViewHolder.java | 8 ++++---- .../favorite/viewholder/FavContentViewHolder.java | 4 ++-- .../viewholder/FavFileContentViewHolder.java | 4 ++-- .../viewholder/FavImageContentViewHolder.java | 8 ++++---- .../viewholder/FavTextContentViewHolder.java | 8 ++++---- .../viewholder/FavUnknownContentViewHolder.java | 4 ++-- .../viewholder/FavVideoContentViewHolder.java | 8 ++++---- .../wildfire/chat/kit/group/GroupInfoActivity.java | 8 ++++---- .../wildfire/chat/kit/group/GroupListFragment.java | 4 ++-- .../chat/kit/group/GroupMemberListAdapter.java | 8 ++++---- .../chat/kit/group/GroupMemberListFragment.java | 4 ++-- .../group/GroupMemberMessageHistoryAdapter.java | 4 ++-- .../wildfire/chat/kit/group/GroupViewHolder.java | 4 ++-- .../kit/group/SetGroupAnnouncementActivity.java | 4 ++-- .../chat/kit/group/SetGroupNameActivity.java | 4 ++-- .../chat/kit/group/SetGroupRemarkActivity.java | 4 ++-- .../chat/kit/group/manage/GroupManageFragment.java | 8 ++++---- .../manage/GroupMemberPermissionFragment.java | 4 ++-- .../kit/group/manage/GroupMuteOrAllowActivity.java | 4 ++-- .../cn/wildfire/chat/kit/pc/PCSessionActivity.java | 8 ++++---- .../wildfire/chat/kit/qrcode/QRCodeActivity.java | 6 +++--- .../chat/kit/qrcode/ScanQRCodeActivity.java | 4 ++-- .../wildfire/chat/kit/search/SearchActivity.java | 8 ++++---- .../wildfire/chat/kit/search/SearchFragment.java | 4 ++-- .../kit/search/viewHolder/CategoryViewHolder.java | 4 ++-- .../kit/search/viewHolder/ChannelViewHolder.java | 4 ++-- .../search/viewHolder/ConversationViewHolder.java | 4 ++-- .../kit/search/viewHolder/ExpandViewHolder.java | 4 ++-- .../kit/search/viewHolder/GroupViewHolder.java | 4 ++-- .../kit/search/viewHolder/MessageViewHolder.java | 4 ++-- .../kit/settings/MessageNotifySettingActivity.java | 5 ++--- .../chat/kit/settings/PrivacySettingActivity.java | 8 ++------ .../settings/blacklist/BlacklistListFragment.java | 4 ++-- .../settings/blacklist/BlacklistViewHolder.java | 4 ++-- .../location/ui/activity/MyLocationActivity.java | 4 ++-- .../location/ui/activity/ShowLocationActivity.java | 4 ++-- .../kit/third/location/ui/base/BaseActivity.java | 4 ++-- .../LocationMessageContentViewHolder.java | 8 ++++---- .../chat/kit/user/ChangeMyNameActivity.java | 4 ++-- .../wildfire/chat/kit/user/SetAliasActivity.java | 4 ++-- .../cn/wildfire/chat/kit/user/SetNameActivity.java | 4 ++-- .../wildfire/chat/kit/user/UserInfoFragment.java | 8 ++++---- .../chat/kit/voip/MultiCallAudioFragment.java | 8 ++++---- .../chat/kit/voip/MultiCallIncomingFragment.java | 8 ++++---- .../chat/kit/voip/MultiCallVideoFragment.java | 8 ++++---- .../chat/kit/voip/SingleAudioFragment.java | 8 ++++---- .../chat/kit/voip/SingleVideoFragment.java | 8 ++++---- .../kit/voip/conference/ConferenceFragment.java | 8 ++++---- .../voip/conference/ConferenceInfoActivity.java | 8 ++++---- .../voip/conference/ConferenceMessageFragment.java | 12 ++++++------ .../ConferenceParticipantListFragment.java | 12 ++++++------ .../voip/conference/ConferencePortalActivity.java | 8 ++++---- .../voip/conference/CreateConferenceActivity.java | 10 ++++------ .../chat/kit/voip/conference/InputPanel.java | 4 ++-- .../voip/conference/OrderConferenceActivity.java | 8 ++++---- .../voip/conference/VideoConferenceMainView.java | 4 ++-- .../cn/wildfire/chat/kit/widget/SearchView.java | 4 ++-- .../chat/kit/workspace/WebViewFragment.java | 4 ++-- 133 files changed, 399 insertions(+), 413 deletions(-) diff --git a/chat/src/main/java/cn/wildfire/chat/app/login/LoginActivity.java b/chat/src/main/java/cn/wildfire/chat/app/login/LoginActivity.java index d572cebcd..3d9e4538e 100644 --- a/chat/src/main/java/cn/wildfire/chat/app/login/LoginActivity.java +++ b/chat/src/main/java/cn/wildfire/chat/app/login/LoginActivity.java @@ -34,7 +34,7 @@ public class LoginActivity extends WfcBaseNoToolbarActivity { EditText accountEditText; EditText passwordEditText; - private void bindClickImpl() { + private void bindEvents() { findViewById(R.id.authCodeLoginTextView).setOnClickListener(v -> authCodeLogin()); findViewById(R.id.registerTextView).setOnClickListener(v -> register()); findViewById(R.id.loginButton).setOnClickListener(v -> login()); @@ -52,7 +52,7 @@ public void afterTextChanged(Editable s) { }); } - private void bindViewImpl() { + private void bindViews() { loginButton = findViewById(R.id.loginButton); accountEditText = findViewById(R.id.phoneNumberEditText); passwordEditText = findViewById(R.id.passwordEditText); @@ -65,8 +65,8 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); - bindClickImpl(); + bindViews(); + bindEvents(); setStatusBarTheme(this, false); setStatusBarColor(R.color.gray14); if (getIntent().getBooleanExtra("isKickedOff", false)) { diff --git a/chat/src/main/java/cn/wildfire/chat/app/login/SMSLoginActivity.java b/chat/src/main/java/cn/wildfire/chat/app/login/SMSLoginActivity.java index 865170a00..9048a9d71 100644 --- a/chat/src/main/java/cn/wildfire/chat/app/login/SMSLoginActivity.java +++ b/chat/src/main/java/cn/wildfire/chat/app/login/SMSLoginActivity.java @@ -36,7 +36,7 @@ public class SMSLoginActivity extends WfcBaseNoToolbarActivity { TextView requestAuthCodeButton; - private void bindClickImpl() { + private void bindEvents() { findViewById(R.id.passwordLoginTextView).setOnClickListener(v -> authCodeLogin()); findViewById(R.id.loginButton).setOnClickListener(v -> login()); findViewById(R.id.requestAuthCodeButton).setOnClickListener(v -> requestAuthCode()); @@ -55,7 +55,7 @@ public void afterTextChanged(Editable s) { }); } - private void bindViewImpl() { + private void bindViews() { loginButton = findViewById(R.id.loginButton); phoneNumberEditText = findViewById(R.id.phoneNumberEditText); authCodeEditText = findViewById(R.id.authCodeEditText); @@ -69,8 +69,8 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); - bindClickImpl(); + bindViews(); + bindEvents(); setStatusBarTheme(this, false); setStatusBarColor(R.color.gray14); } diff --git a/chat/src/main/java/cn/wildfire/chat/app/main/DiscoveryFragment.java b/chat/src/main/java/cn/wildfire/chat/app/main/DiscoveryFragment.java index 46be07924..f43f51d87 100644 --- a/chat/src/main/java/cn/wildfire/chat/app/main/DiscoveryFragment.java +++ b/chat/src/main/java/cn/wildfire/chat/app/main/DiscoveryFragment.java @@ -43,8 +43,8 @@ public class DiscoveryFragment extends Fragment { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.main_fragment_discovery, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); initMoment(); if (!AVEngineKit.isSupportConference()) { conferenceOptionItemView.setVisibility(View.GONE); @@ -52,7 +52,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.chatRoomOptionItemView).setOnClickListener(v -> chatRoom()); view.findViewById(R.id.robotOptionItemView).setOnClickListener(v -> robot()); view.findViewById(R.id.channelOptionItemView).setOnClickListener(v -> channel()); @@ -61,7 +61,7 @@ private void bindClickImpl(View view) { view.findViewById(R.id.conferenceOptionItemView).setOnClickListener(v -> conference()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { momentOptionItemView = view.findViewById(R.id.momentOptionItemView); conferenceOptionItemView = view.findViewById(R.id.conferenceOptionItemView); } diff --git a/chat/src/main/java/cn/wildfire/chat/app/main/MainActivity.java b/chat/src/main/java/cn/wildfire/chat/app/main/MainActivity.java index b76636a12..d9a16b246 100644 --- a/chat/src/main/java/cn/wildfire/chat/app/main/MainActivity.java +++ b/chat/src/main/java/cn/wildfire/chat/app/main/MainActivity.java @@ -108,7 +108,8 @@ public class MainActivity extends WfcBaseActivity implements ViewPager.OnPageCha private ContactViewModel contactViewModel; private ConversationListViewModel conversationListViewModel; - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); bottomNavigationView = findViewById(R.id.bottomNavigationView); contentViewPager = findViewById(R.id.contentViewPager); startingTextView = findViewById(R.id.startingTextView); @@ -139,7 +140,6 @@ protected void onResume() { @Override protected void afterViews() { - bindViewImpl(); bottomNavigationView.setItemIconTintList(null); if (TextUtils.isEmpty(Config.WORKSPACE_URL)) { bottomNavigationView.getMenu().removeItem(R.id.workspace); diff --git a/chat/src/main/java/cn/wildfire/chat/app/main/MeFragment.java b/chat/src/main/java/cn/wildfire/chat/app/main/MeFragment.java index 63bfc933b..6455e8c4f 100644 --- a/chat/src/main/java/cn/wildfire/chat/app/main/MeFragment.java +++ b/chat/src/main/java/cn/wildfire/chat/app/main/MeFragment.java @@ -78,13 +78,13 @@ public void onChanged(@Nullable List userInfos) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.main_fragment_me, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.meLinearLayout).setOnClickListener(v -> showMyInfo()); view.findViewById(R.id.favOptionItemView).setOnClickListener(v -> fav()); view.findViewById(R.id.accountOptionItemView).setOnClickListener(v -> account()); @@ -94,7 +94,7 @@ private void bindClickImpl(View view) { view.findViewById(R.id.notificationOptionItemView).setOnClickListener(v -> msgNotifySetting()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { meLinearLayout = view.findViewById(R.id.meLinearLayout); portraitImageView = view.findViewById(R.id.portraitImageView); nameTextView = view.findViewById(R.id.nameTextView); diff --git a/chat/src/main/java/cn/wildfire/chat/app/main/PCLoginActivity.java b/chat/src/main/java/cn/wildfire/chat/app/main/PCLoginActivity.java index 2c0aee549..1b7f7593a 100644 --- a/chat/src/main/java/cn/wildfire/chat/app/main/PCLoginActivity.java +++ b/chat/src/main/java/cn/wildfire/chat/app/main/PCLoginActivity.java @@ -28,12 +28,14 @@ public class PCLoginActivity extends WfcBaseActivity { private Platform platform; - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.confirmButton).setOnClickListener(v -> confirmPCLogin()); findViewById(R.id.cancelButton).setOnClickListener(v -> cancelPCLogin()); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); confirmButton = findViewById(R.id.confirmButton); descTextView = findViewById(R.id.descTextView); } @@ -56,8 +58,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); - bindClickImpl(); descTextView.setText("允许 " + platform.getPlatFormName() + " 登录"); if (isConfirmPcLogin) { confirmButton.setEnabled(true); diff --git a/chat/src/main/java/cn/wildfire/chat/app/main/WorkspaceFragment.java b/chat/src/main/java/cn/wildfire/chat/app/main/WorkspaceFragment.java index 620883376..ee33498f7 100644 --- a/chat/src/main/java/cn/wildfire/chat/app/main/WorkspaceFragment.java +++ b/chat/src/main/java/cn/wildfire/chat/app/main/WorkspaceFragment.java @@ -48,12 +48,12 @@ public static WorkspaceFragment loadHtmlContent(String htmlContent) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview, container, false); - bindViewImpl(view); + bindViews(view); init(); return view; } - private void bindViewImpl(View view) { + private void bindViews(View view) { webView = view.findViewById(R.id.webview); } diff --git a/chat/src/main/java/cn/wildfire/chat/app/setting/AboutActivity.java b/chat/src/main/java/cn/wildfire/chat/app/setting/AboutActivity.java index d135de657..92351a4d6 100644 --- a/chat/src/main/java/cn/wildfire/chat/app/setting/AboutActivity.java +++ b/chat/src/main/java/cn/wildfire/chat/app/setting/AboutActivity.java @@ -19,13 +19,15 @@ public class AboutActivity extends WfcBaseActivity { TextView infoTextView; - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.introOptionItemView).setOnClickListener(v -> intro()); findViewById(R.id.agreementOptionItemView).setOnClickListener(v -> agreement()); findViewById(R.id.privacyOptionItemView).setOnClickListener(v -> privacy()); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); infoTextView = findViewById(R.id.infoTextView); } @@ -36,8 +38,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); - bindClickImpl(); PackageManager packageManager = getPackageManager(); try { PackageInfo packageInfo = packageManager.getPackageInfo(getPackageName(), PackageManager.GET_CONFIGURATIONS); diff --git a/chat/src/main/java/cn/wildfire/chat/app/setting/AccountActivity.java b/chat/src/main/java/cn/wildfire/chat/app/setting/AccountActivity.java index 76753ec44..fe64d00a8 100644 --- a/chat/src/main/java/cn/wildfire/chat/app/setting/AccountActivity.java +++ b/chat/src/main/java/cn/wildfire/chat/app/setting/AccountActivity.java @@ -19,15 +19,11 @@ protected int contentLayout() { return R.layout.account_activity; } - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.changePasswordOptionItemView).setOnClickListener(v -> changePassword()); } - @Override - protected void afterViews() { - bindClickImpl(); - } - void changePassword() { new MaterialDialog.Builder(this).items(R.array.change_password).itemsCallback(new MaterialDialog.ListCallback() { @Override diff --git a/chat/src/main/java/cn/wildfire/chat/app/setting/ChangePasswordActivity.java b/chat/src/main/java/cn/wildfire/chat/app/setting/ChangePasswordActivity.java index 602e8407f..025ce2e4b 100644 --- a/chat/src/main/java/cn/wildfire/chat/app/setting/ChangePasswordActivity.java +++ b/chat/src/main/java/cn/wildfire/chat/app/setting/ChangePasswordActivity.java @@ -33,7 +33,8 @@ public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.confirmButton).setOnClickListener(v -> resetPassword()); oldPasswordEditText.addTextChangedListener(new SimpleTextWatcher() { @Override @@ -55,7 +56,8 @@ public void afterTextChanged(Editable s) { }); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); confirmButton = findViewById(R.id.confirmButton); oldPasswordEditText = findViewById(R.id.oldPasswordEditText); newPasswordEditText = findViewById(R.id.newPasswordEditText); @@ -69,8 +71,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); - bindClickImpl(); // setStatusBarTheme(this, false); // setStatusBarColor(R.color.gray14); } diff --git a/chat/src/main/java/cn/wildfire/chat/app/setting/ResetPasswordActivity.java b/chat/src/main/java/cn/wildfire/chat/app/setting/ResetPasswordActivity.java index 92fe06bd1..36f7bc195 100644 --- a/chat/src/main/java/cn/wildfire/chat/app/setting/ResetPasswordActivity.java +++ b/chat/src/main/java/cn/wildfire/chat/app/setting/ResetPasswordActivity.java @@ -36,9 +36,10 @@ public class ResetPasswordActivity extends WfcBaseActivity { private String resetCode; - private void bindClickImpl() { - findViewById(R.id.requestAuthCodeButton).setOnClickListener(v -> requestAuthCode()); - findViewById(R.id.confirmButton).setOnClickListener(v -> resetPassword()); + protected void bindEvents() { + super.bindEvents(); + requestAuthCodeButton.setOnClickListener(v -> requestAuthCode()); + confirmButton.setOnClickListener(v -> resetPassword()); authCodeEditText.addTextChangedListener(new SimpleTextWatcher() { @Override public void afterTextChanged(Editable s) { @@ -59,7 +60,8 @@ public void afterTextChanged(Editable s) { }); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); confirmButton = findViewById(R.id.confirmButton); authCodeEditText = findViewById(R.id.authCodeEditText); newPasswordEditText = findViewById(R.id.newPasswordEditText); @@ -75,8 +77,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); - bindClickImpl(); resetCode = getIntent().getStringExtra("resetCode"); if (!TextUtils.isEmpty(resetCode)) { authCodeFrameLayout.setVisibility(View.GONE); diff --git a/chat/src/main/java/cn/wildfire/chat/app/setting/SettingActivity.java b/chat/src/main/java/cn/wildfire/chat/app/setting/SettingActivity.java index 8a4affd0a..08686bf2d 100644 --- a/chat/src/main/java/cn/wildfire/chat/app/setting/SettingActivity.java +++ b/chat/src/main/java/cn/wildfire/chat/app/setting/SettingActivity.java @@ -34,7 +34,8 @@ public class SettingActivity extends WfcBaseActivity { OptionItemView diagnoseOptionItemView; - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.exitOptionItemView).setOnClickListener(v -> exit()); findViewById(R.id.privacySettingOptionItemView).setOnClickListener(v -> privacySetting()); findViewById(R.id.diagnoseOptionItemView).setOnClickListener(v -> diagnose()); @@ -43,7 +44,8 @@ private void bindClickImpl() { findViewById(R.id.aboutOptionItemView).setOnClickListener(v -> about()); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); diagnoseOptionItemView = findViewById(R.id.diagnoseOptionItemView); } @@ -52,12 +54,6 @@ protected int contentLayout() { return R.layout.setting_activity; } - @Override - protected void afterViews() { - bindViewImpl(); - bindClickImpl(); - } - @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { switch (requestCode) { diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/WfcBaseActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/WfcBaseActivity.java index b2a98462e..dfa3ae0b2 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/WfcBaseActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/WfcBaseActivity.java @@ -34,7 +34,8 @@ public void onCreate(@Nullable Bundle savedInstanceState) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); beforeViews(); setContentView(contentLayout()); - bindViewImpl(); + bindViews(); + bindEvents(); setSupportActionBar(toolbar); SharedPreferences sp = getSharedPreferences("wfc_kit_config", Context.MODE_PRIVATE); if (sp.getBoolean("darkTheme", true)) { @@ -49,10 +50,14 @@ public void onCreate(@Nullable Bundle savedInstanceState) { afterViews(); } - private void bindViewImpl() { + protected void bindViews() { toolbar = findViewById(R.id.toolbar); } + protected void bindEvents() { + + } + /** * @param darkTheme 和toolbar.xml里面的 app:theme="@style/AppTheme.DarkAppbar" 相关 */ diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/WfcWebViewActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/WfcWebViewActivity.java index 5e9148285..8646b0849 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/WfcWebViewActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/WfcWebViewActivity.java @@ -28,7 +28,8 @@ public class WfcWebViewActivity extends WfcBaseActivity { DWebView webView; private JsApi jsApi; - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); webView = findViewById(R.id.webview); } @@ -95,7 +96,6 @@ protected void onDestroy() { @Override protected void afterViews() { - bindViewImpl(); url = getIntent().getStringExtra("url"); String htmlContent = getIntent().getStringExtra("content"); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/channel/ChannelInfoActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/channel/ChannelInfoActivity.java index a69872486..096f649bf 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/channel/ChannelInfoActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/channel/ChannelInfoActivity.java @@ -44,13 +44,13 @@ public class ChannelInfoActivity extends AppCompatActivity { protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.channel_info_activity); - bindViewImpl(); + bindViews(); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); init(); } - private void bindViewImpl() { + private void bindViews() { portraitImageView = findViewById(R.id.portraitImageView); channelTextView = findViewById(R.id.channelNameTextView); channelDescTextView = findViewById(R.id.channelDescTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/channel/ChannelListFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/channel/ChannelListFragment.java index a1a23471f..669198ec5 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/channel/ChannelListFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/channel/ChannelListFragment.java @@ -47,12 +47,12 @@ public void onCreate(@Nullable Bundle savedInstanceState) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.channel_list_frament, container, false); - bindViewImpl(view); + bindViews(view); init(); return view; } - private void bindViewImpl(View view) { + private void bindViews(View view) { recyclerView = view.findViewById(R.id.recyclerView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/channel/CreateChannelActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/channel/CreateChannelActivity.java index 5b8b120a8..5a9c26ac1 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/channel/CreateChannelActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/channel/CreateChannelActivity.java @@ -43,11 +43,13 @@ public class CreateChannelActivity extends WfcBaseActivity { private String portraitPath; - private void bindClickImpl() { - findViewById(R.id.portraitImageView).setOnClickListener(v -> portraitClick()); + protected void bindEvents() { + super.bindEvents(); + portraitImageView.setOnClickListener(v -> portraitClick()); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); portraitImageView = findViewById(R.id.portraitImageView); nameInputEditText = findViewById(R.id.channelNameTextInputEditText); descInputEditText = findViewById(R.id.channelDescTextInputEditText); @@ -58,12 +60,6 @@ protected int contentLayout() { return R.layout.channel_create_fragment; } - @Override - protected void afterViews() { - bindViewImpl(); - bindClickImpl(); - } - void inputChannelName(Editable editable) { // if (!TextUtils.isEmpty(editable)) { // confirmButton.setEnabled(true); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/channel/viewholder/CategoryViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/channel/viewholder/CategoryViewHolder.java index fe99f943d..39a300691 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/channel/viewholder/CategoryViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/channel/viewholder/CategoryViewHolder.java @@ -16,10 +16,10 @@ public class CategoryViewHolder extends RecyclerView.ViewHolder { public CategoryViewHolder(View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { categoryTextView = itemView.findViewById(R.id.categoryTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/channel/viewholder/ChannelViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/channel/viewholder/ChannelViewHolder.java index 9f1c98504..420b91991 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/channel/viewholder/ChannelViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/channel/viewholder/ChannelViewHolder.java @@ -21,10 +21,10 @@ public class ChannelViewHolder extends RecyclerView.ViewHolder { public ChannelViewHolder(View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); channelNameTextView = itemView.findViewById(R.id.channelNameTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/chatroom/ChatRoomListFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/chatroom/ChatRoomListFragment.java index 7d692bc43..1a3976f8b 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/chatroom/ChatRoomListFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/chatroom/ChatRoomListFragment.java @@ -23,11 +23,11 @@ public class ChatRoomListFragment extends Fragment { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.chatroom_list_fragment, container, false); - bindClickImpl(view); + bindEvents(view); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.chatRoomTextView_0).setOnClickListener(this::joinChatRoom); view.findViewById(R.id.chatRoomTextView_1).setOnClickListener(this::joinChatRoom); view.findViewById(R.id.chatRoomTextView_2).setOnClickListener(this::joinChatRoom); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/contact/BaseUserListFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/contact/BaseUserListFragment.java index c574dc7e4..3ed118023 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/contact/BaseUserListFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/contact/BaseUserListFragment.java @@ -50,11 +50,11 @@ protected int contentLayout() { @Override protected void afterViews(View view) { - bindViewImpl(view); + bindViews(view); initView(); } - private void bindViewImpl(View view) { + private void bindViews(View view) { usersRecyclerView = view.findViewById(R.id.usersRecyclerView); quickIndexBar = view.findViewById(R.id.quickIndexBar); indexLetterTextView = view.findViewById(R.id.indexLetterTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/contact/newfriend/FriendRequestListFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/contact/newfriend/FriendRequestListFragment.java index 1b87d8768..3d6e3718a 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/contact/newfriend/FriendRequestListFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/contact/newfriend/FriendRequestListFragment.java @@ -36,12 +36,12 @@ public class FriendRequestListFragment extends Fragment { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.contact_new_friend_fragment, container, false); - bindViewImpl(view); + bindViews(view); init(); return view; } - private void bindViewImpl(View view) { + private void bindViews(View view) { noNewFriendLinearLayout = view.findViewById(R.id.noNewFriendLinearLayout); newFriendLinearLayout = view.findViewById(R.id.newFriendListLinearLayout); recyclerView = view.findViewById(R.id.friendRequestListRecyclerView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/contact/newfriend/FriendRequestViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/contact/newfriend/FriendRequestViewHolder.java index 56debac16..87378520a 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/contact/newfriend/FriendRequestViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/contact/newfriend/FriendRequestViewHolder.java @@ -40,17 +40,17 @@ public FriendRequestViewHolder(FriendRequestListFragment fragment, FriendRequest super(itemView); this.fragment = fragment; this.adapter = adapter; - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); userViewModel =ViewModelProviders.of(fragment).get(UserViewModel.class); contactViewModel = ViewModelProviders.of(fragment).get(ContactViewModel.class); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.acceptButton).setOnClickListener(_v -> accept()); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); nameTextView = itemView.findViewById(R.id.nameTextView); introTextView = itemView.findViewById(R.id.introTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/contact/newfriend/InviteFriendActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/contact/newfriend/InviteFriendActivity.java index 408aa7076..8fca37ec4 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/contact/newfriend/InviteFriendActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/contact/newfriend/InviteFriendActivity.java @@ -23,18 +23,18 @@ public class InviteFriendActivity extends WfcBaseActivity { private UserInfo userInfo; - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.clearImageButton).setOnClickListener(v -> clear()); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); introTextView = findViewById(R.id.introTextView); } @Override protected void afterViews() { - bindViewImpl(); - bindClickImpl(); userInfo = getIntent().getParcelableExtra("userInfo"); if (userInfo == null) { finish(); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/PickUserFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/PickUserFragment.java index e569b7e55..66713aeb8 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/PickUserFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/PickUserFragment.java @@ -54,7 +54,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) { pickUserViewModel.userCheckStatusUpdateLiveData().observeForever(contactCheckStatusUpdateLiveDataObserver); } - private void bindViewImpl(View view) { + private void bindViews(View view) { pickedUserRecyclerView = view.findViewById(R.id.pickedUserRecyclerView); searchEditText = view.findViewById(R.id.searchEditText); searchUserFrameLayout = view.findViewById(R.id.searchFrameLayout); @@ -72,7 +72,7 @@ public void afterTextChanged(Editable s) { @Override protected void afterViews(View view) { super.afterViews(view); - bindViewImpl(view); + bindViews(view); initView(); setupPickFromUsers(); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/SearchAndPickUserFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/SearchAndPickUserFragment.java index 2c0b0289b..2468ed4bf 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/SearchAndPickUserFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/SearchAndPickUserFragment.java @@ -36,17 +36,17 @@ public class SearchAndPickUserFragment extends Fragment implements UserListAdapt @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.contact_search_fragment, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.tipTextView).setOnClickListener(_v -> onTipTextViewClick()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { contactRecyclerView = view.findViewById(R.id.usersRecyclerView); tipTextView = view.findViewById(R.id.tipTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/viewholder/CheckableUserBlackViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/viewholder/CheckableUserBlackViewHolder.java index 47be56a31..d6b8d9717 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/viewholder/CheckableUserBlackViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/viewholder/CheckableUserBlackViewHolder.java @@ -18,10 +18,10 @@ public class CheckableUserBlackViewHolder extends CheckableUserViewHolder { public CheckableUserBlackViewHolder(Fragment fragment, CheckableUserListAdapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { checkBox = itemView.findViewById(R.id.checkbox); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/viewholder/CheckableUserViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/viewholder/CheckableUserViewHolder.java index 94a0f6a3d..4b254b3ca 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/viewholder/CheckableUserViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/contact/pick/viewholder/CheckableUserViewHolder.java @@ -19,10 +19,10 @@ public class CheckableUserViewHolder extends UserViewHolder { public CheckableUserViewHolder(Fragment fragment, CheckableUserListAdapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { checkBox = itemView.findViewById(R.id.checkbox); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/contact/viewholder/UserViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/contact/viewholder/UserViewHolder.java index 1771c6fa0..e916ff2a1 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/contact/viewholder/UserViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/contact/viewholder/UserViewHolder.java @@ -36,10 +36,10 @@ public UserViewHolder(Fragment fragment, UserListAdapter adapter, View itemView) super(itemView); this.fragment = fragment; this.adapter = adapter; - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); nameTextView = itemView.findViewById(R.id.nameTextView); descTextView = itemView.findViewById(R.id.descTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/contact/viewholder/footer/ContactCountViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/contact/viewholder/footer/ContactCountViewHolder.java index 26ab343f5..0e0b8c409 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/contact/viewholder/footer/ContactCountViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/contact/viewholder/footer/ContactCountViewHolder.java @@ -20,10 +20,10 @@ public class ContactCountViewHolder extends FooterViewHolder searchGroupMessage()); view.findViewById(R.id.clearMessagesOptionItemView).setOnClickListener(_v -> clearMessage()); view.findViewById(R.id.channelQRCodeOptionItemView).setOnClickListener(_v -> showChannelQRCode()); @@ -94,7 +94,7 @@ private void bindClickImpl(View view) { view.findViewById(R.id.unsubscribeButton).setOnClickListener(_v -> unsubscribe()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { portraitImageView = view.findViewById(R.id.portraitImageView); stickTopSwitchButton = view.findViewById(R.id.stickTopSwitchButton); silentSwitchButton = view.findViewById(R.id.silentSwitchButton); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/ConversationFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/ConversationFragment.java index 55debb5c5..b40efdf35 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/ConversationFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/ConversationFragment.java @@ -404,17 +404,17 @@ public void onCreate(@Nullable Bundle savedInstanceState) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.conversation_activity, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); initView(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.unreadCountTextView).setOnClickListener(_v -> onUnreadCountTextViewClick()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { rootLinearLayout = view.findViewById(R.id.rootLinearLayout); swipeRefreshLayout = view.findViewById(R.id.swipeRefreshLayout); recyclerView = view.findViewById(R.id.msgRecyclerView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/ConversationInputPanel.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/ConversationInputPanel.java index 8b385d68b..74b6e7fc2 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/ConversationInputPanel.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/ConversationInputPanel.java @@ -222,7 +222,7 @@ public void onDestroy() { public void init(Fragment fragment, InputAwareLayout rootInputAwareLayout) { LayoutInflater.from(getContext()).inflate(R.layout.conversation_input_panel, this, true); - bindViewImpl(); + bindViews(); this.activity = fragment.getActivity(); this.fragment = fragment; @@ -289,7 +289,7 @@ public void onEmotionSettingClick(View view) { } } - private void bindViewImpl() { + private void bindViews() { inputContainerLinearLayout = findViewById(R.id.inputContainerLinearLayout); disableInputTipTextView = findViewById(R.id.disableInputTipTextView); menuImageView = findViewById(R.id.menuImageView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/ConversationMemberAdapter.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/ConversationMemberAdapter.java index 4ef906531..08b694d9e 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/ConversationMemberAdapter.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/ConversationMemberAdapter.java @@ -154,16 +154,16 @@ void onClick() { public MemberViewHolder(View itemView) { super(itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); nameTextView = itemView.findViewById(R.id.nameTextView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.portraitImageView).setOnClickListener(_v -> onClick()); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/GroupConversationInfoFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/GroupConversationInfoFragment.java index 075d6f46b..0ed72ddb4 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/GroupConversationInfoFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/GroupConversationInfoFragment.java @@ -140,13 +140,13 @@ public void onCreate(@Nullable Bundle savedInstanceState) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.conversation_info_group_fragment, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.groupNameOptionItemView).setOnClickListener(_v -> updateGroupName()); view.findViewById(R.id.groupPortraitOptionItemView).setOnClickListener(_v -> updateGroupPortrait()); view.findViewById(R.id.groupRemarkOptionItemView).setOnClickListener(_v -> updateGroupRemark()); @@ -161,7 +161,7 @@ private void bindClickImpl(View view) { view.findViewById(R.id.fileRecordOptionItemView).setOnClickListener(_v -> fileRecord()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { progressBar = view.findViewById(R.id.progressBar); contentNestedScrollView = view.findViewById(R.id.contentNestedScrollView); groupLinearLayout_0 = view.findViewById(R.id.groupLinearLayout_0); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/OngoingCallAdapter.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/OngoingCallAdapter.java index f44834834..9331751f7 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/OngoingCallAdapter.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/OngoingCallAdapter.java @@ -65,10 +65,10 @@ static class OngoingCallViewHolder extends RecyclerView.ViewHolder { public OngoingCallViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { descTextView = itemView.findViewById(R.id.descTextView); joinButton = itemView.findViewById(R.id.joinButton); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/SecretConversationInfoFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/SecretConversationInfoFragment.java index 32b68c0b6..f0a4adb48 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/SecretConversationInfoFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/SecretConversationInfoFragment.java @@ -79,13 +79,13 @@ public void onCreate(@Nullable Bundle savedInstanceState) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.conversation_info_secret_fragment, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.clearMessagesOptionItemView).setOnClickListener(_v -> clearMessage()); view.findViewById(R.id.searchMessageOptionItemView).setOnClickListener(_v -> searchGroupMessage()); view.findViewById(R.id.fileRecordOptionItemView).setOnClickListener(_v -> fileRecord()); @@ -93,7 +93,7 @@ private void bindClickImpl(View view) { view.findViewById(R.id.burnOptionItemView).setOnClickListener(_v -> setSecretChatBurnTime()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { stickTopSwitchButton = view.findViewById(R.id.stickTopSwitchButton); silentSwitchButton = view.findViewById(R.id.silentSwitchButton); fileRecordOptionItem = view.findViewById(R.id.fileRecordOptionItemView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/SingleConversationInfoFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/SingleConversationInfoFragment.java index 7d6866dc8..62467b7f5 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/SingleConversationInfoFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/SingleConversationInfoFragment.java @@ -77,19 +77,19 @@ public void onCreate(@Nullable Bundle savedInstanceState) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.conversation_info_single_fragment, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.clearMessagesOptionItemView).setOnClickListener(_v -> clearMessage()); view.findViewById(R.id.searchMessageOptionItemView).setOnClickListener(_v -> searchGroupMessage()); view.findViewById(R.id.fileRecordOptionItemView).setOnClickListener(_v -> fileRecord()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { memberReclerView = view.findViewById(R.id.memberRecyclerView); stickTopSwitchButton = view.findViewById(R.id.stickTopSwitchButton); silentSwitchButton = view.findViewById(R.id.silentSwitchButton); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/file/FileRecordFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/file/FileRecordFragment.java index a214f4a4e..0ae5af7ee 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/file/FileRecordFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/file/FileRecordFragment.java @@ -78,12 +78,12 @@ public void onCreate(Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.file_record_fragment, container, false); - bindViewImpl(view); + bindViews(view); init(); return view; } - private void bindViewImpl(View view) { + private void bindViews(View view) { fileRecordLinearLayout = view.findViewById(R.id.fileRecordLinearLayout); fileRecordRecyclerView = view.findViewById(R.id.fileRecordRecyclerView); tipTextView = view.findViewById(R.id.tipTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/file/FileRecordListActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/file/FileRecordListActivity.java index 9d7a04c4c..8928477b7 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/file/FileRecordListActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/file/FileRecordListActivity.java @@ -21,7 +21,8 @@ protected int contentLayout() { return R.layout.activity_file_record_list; } - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.allFilesItemView).setOnClickListener(v -> allFiles()); findViewById(R.id.myFilesItemView).setOnClickListener(v -> myFiles()); findViewById(R.id.conversationFilesItemView).setOnClickListener(v -> convFiles()); @@ -30,7 +31,6 @@ private void bindClickImpl() { @Override protected void afterViews() { - bindClickImpl(); if (!isDarkTheme()) { setTitleBackgroundResource(R.color.white, false); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/file/FileRecordViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/file/FileRecordViewHolder.java index 6e6c61015..831e5ad37 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/file/FileRecordViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/file/FileRecordViewHolder.java @@ -32,10 +32,10 @@ class FileRecordViewHolder extends RecyclerView.ViewHolder { public FileRecordViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { fileNameTextView = itemView.findViewById(R.id.fileNameTextView); fileSizeTextView = itemView.findViewById(R.id.fileSizeTextView); fileIconImageView = itemView.findViewById(R.id.fileIconImageView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/forward/ForwardPromptView.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/forward/ForwardPromptView.java index c02146991..ec9999a1a 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/forward/ForwardPromptView.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/forward/ForwardPromptView.java @@ -54,10 +54,10 @@ public ForwardPromptView(Context context, AttributeSet attrs, int defStyleAttr, private void init() { View view = LayoutInflater.from(getContext()) .inflate(R.layout.forward_prompt_dialog, this, true); - bindViewImpl(view); + bindViews(view); } - private void bindViewImpl(View view) { + private void bindViews(View view) { portraitImageView = view.findViewById(R.id.portraitImageView); nameTextView = view.findViewById(R.id.nameTextView); contentTextView = view.findViewById(R.id.contentTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/forward/viewholder/ConversationViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/forward/viewholder/ConversationViewHolder.java index 90d688318..293beac16 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/forward/viewholder/ConversationViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/forward/viewholder/ConversationViewHolder.java @@ -34,13 +34,13 @@ public class ConversationViewHolder extends RecyclerView.ViewHolder { public ConversationViewHolder(Fragment fragment, View itemView) { super(itemView); this.fragment = fragment; - bindViewImpl(itemView); + bindViews(itemView); userViewModel = ViewModelProviders.of(fragment).get(UserViewModel.class); groupViewModel = ViewModelProviders.of(fragment).get(GroupViewModel.class); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { nameTextView = itemView.findViewById(R.id.nameTextView); portraitImageView = itemView.findViewById(R.id.portraitImageView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/CompositeMessageContentActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/CompositeMessageContentActivity.java index 471ed76df..ce423cc2d 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/CompositeMessageContentActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/CompositeMessageContentActivity.java @@ -33,7 +33,8 @@ public class CompositeMessageContentActivity extends WfcBaseActivity implements RecyclerView recyclerView; private CompositeMessageContentAdapter adapter; - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); recyclerView = findViewById(R.id.recyclerView); } @@ -44,7 +45,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); Message message = getIntent().getParcelableExtra("message"); if (message == null || !(message.content instanceof CompositeMessageContent)) { finish(); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/CompositeMessageContentAdapter.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/CompositeMessageContentAdapter.java index 3d0bbf462..87e2c06e5 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/CompositeMessageContentAdapter.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/CompositeMessageContentAdapter.java @@ -125,7 +125,7 @@ class MessageContentViewHolder extends RecyclerView.ViewHolder { public MessageContentViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -134,7 +134,7 @@ public void onClick(View v) { }); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); nameTextView = itemView.findViewById(R.id.nameTextView); timeTextView = itemView.findViewById(R.id.timeTextView); @@ -260,10 +260,10 @@ static class HeaderViewHolder extends RecyclerView.ViewHolder { public HeaderViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { compositeDurationTextView = itemView.findViewById(R.id.compositeDurationTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ArticlesMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ArticlesMessageContentViewHolder.java index 30d29a1b5..f1cab31a1 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ArticlesMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ArticlesMessageContentViewHolder.java @@ -41,16 +41,16 @@ public class ArticlesMessageContentViewHolder extends ContextableNotificationMes public ArticlesMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.singleArticleContainerLinearLayout).setOnClickListener(this::onClick); itemView.findViewById(R.id.topArticleContainerLinearLayout).setOnClickListener(this::onClick); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { singleArticleContainerLinearLayout =itemView.findViewById(R.id.singleArticleContainerLinearLayout); singleCoverImageView =itemView.findViewById(R.id.singleCoverImageView); singleTitleTextView =itemView.findViewById(R.id.singleTitleTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/AudioMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/AudioMessageContentViewHolder.java index 8f55e0542..78572b0d4 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/AudioMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/AudioMessageContentViewHolder.java @@ -41,15 +41,15 @@ public class AudioMessageContentViewHolder extends MediaMessageContentViewHolder public AudioMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.audioContentLayout).setOnClickListener(this::onClick); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { ivAudio =itemView.findViewById(R.id.audioImageView); durationTextView =itemView.findViewById(R.id.durationTextView); contentLayout =itemView.findViewById(R.id.audioContentLayout); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/CompositeMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/CompositeMessageContentViewHolder.java index 4779f263f..e42388c64 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/CompositeMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/CompositeMessageContentViewHolder.java @@ -30,15 +30,15 @@ public class CompositeMessageContentViewHolder extends NormalMessageContentViewH public CompositeMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.compositeContentLayout).setOnClickListener(this::onClick); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { titleTextView =itemView.findViewById(R.id.titleTextView); contentTextView =itemView.findViewById(R.id.contentTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ConferenceInviteMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ConferenceInviteMessageContentViewHolder.java index 0bfe7d261..9095d3371 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ConferenceInviteMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ConferenceInviteMessageContentViewHolder.java @@ -41,15 +41,15 @@ public class ConferenceInviteMessageContentViewHolder extends NormalMessageConte public ConferenceInviteMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.contentLayout).setOnClickListener(_v -> joinConference()); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { hostPortraitImageView =itemView.findViewById(R.id.hostPortraitImageView); titleTextView =itemView.findViewById(R.id.titleTextView); descTextView =itemView.findViewById(R.id.descTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ExampleRichNotificationMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ExampleRichNotificationMessageContentViewHolder.java index d7fa13ded..dbbe04b5a 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ExampleRichNotificationMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ExampleRichNotificationMessageContentViewHolder.java @@ -32,15 +32,15 @@ public class ExampleRichNotificationMessageContentViewHolder extends Notificatio public ExampleRichNotificationMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.stickerImageView).setOnClickListener(this::onClick); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { imageView =itemView.findViewById(R.id.stickerImageView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/FileMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/FileMessageContentViewHolder.java index 00e833c6e..3c5d76fb4 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/FileMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/FileMessageContentViewHolder.java @@ -37,15 +37,15 @@ public class FileMessageContentViewHolder extends MediaMessageContentViewHolder public FileMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.fileMessageContentItemView).setOnClickListener(this::onClick); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { fileIconImageView =itemView.findViewById(R.id.fileIconImageView); nameTextView =itemView.findViewById(R.id.fileNameTextView); sizeTextView =itemView.findViewById(R.id.fileSizeTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ImageMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ImageMessageContentViewHolder.java index 08cdef335..5db241b8c 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ImageMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/ImageMessageContentViewHolder.java @@ -41,15 +41,15 @@ public class ImageMessageContentViewHolder extends MediaMessageContentViewHolder public ImageMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.imageView).setOnClickListener(_v -> preview()); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { imageView =itemView.findViewById(R.id.imageView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/LinkMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/LinkMessageContentViewHolder.java index b2d9195c4..45af52c0b 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/LinkMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/LinkMessageContentViewHolder.java @@ -31,15 +31,15 @@ public class LinkMessageContentViewHolder extends NormalMessageContentViewHolder public LinkMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.linkMessageContentItemView).setOnClickListener(this::onClick); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { thumbnailImageView =itemView.findViewById(R.id.thumbnailImageView); titleTextView =itemView.findViewById(R.id.titleTextView); descTextView =itemView.findViewById(R.id.descTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/MessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/MessageContentViewHolder.java index c6df3b6ba..35ee0ca6c 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/MessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/MessageContentViewHolder.java @@ -38,10 +38,10 @@ public MessageContentViewHolder(@NonNull ConversationFragment fragment, Recycler this.itemView = itemView; this.adapter = adapter; messageViewModel = ViewModelProviders.of(fragment).get(MessageViewModel.class); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { timeTextView = itemView.findViewById(R.id.timeTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/NormalMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/NormalMessageContentViewHolder.java index 4ad3a7d0f..684fadfd7 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/NormalMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/NormalMessageContentViewHolder.java @@ -95,11 +95,11 @@ public abstract class NormalMessageContentViewHolder extends MessageContentViewH public NormalMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { if (errorLinearLayout != null) { errorLinearLayout.setOnClickListener(this::onRetryClick); } @@ -108,7 +108,7 @@ private void bindClickImpl(View itemView) { } } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); errorLinearLayout = itemView.findViewById(R.id.errorLinearLayout); nameTextView = itemView.findViewById(R.id.nameTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/RecallMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/RecallMessageContentViewHolder.java index 2b8dd00eb..104744e8e 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/RecallMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/RecallMessageContentViewHolder.java @@ -29,15 +29,15 @@ public class RecallMessageContentViewHolder extends NotificationMessageContentVi public RecallMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.reeditTextView).setOnClickListener(this::onClick); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { notificationTextView =itemView.findViewById(R.id.notificationTextView); reeditTextView =itemView.findViewById(R.id.reeditTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/RichNotificationMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/RichNotificationMessageContentViewHolder.java index 8e9f84966..a00e20dc6 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/RichNotificationMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/RichNotificationMessageContentViewHolder.java @@ -39,15 +39,15 @@ public class RichNotificationMessageContentViewHolder extends NotificationMessag public RichNotificationMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.richNotificationContentItemView).setOnClickListener(this::onClick); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { titleTextView =itemView.findViewById(R.id.titleTextView); descTextView =itemView.findViewById(R.id.descTextView); dataContainerLayout =itemView.findViewById(R.id.dataContainerLayout); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/SimpleNotificationMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/SimpleNotificationMessageContentViewHolder.java index df9d5ac08..e973a1b6a 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/SimpleNotificationMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/SimpleNotificationMessageContentViewHolder.java @@ -74,10 +74,10 @@ public class SimpleNotificationMessageContentViewHolder extends NotificationMess public SimpleNotificationMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { notificationTextView =itemView.findViewById(R.id.notificationTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/StickerMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/StickerMessageContentViewHolder.java index e3eaf1bd7..dab9fc407 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/StickerMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/StickerMessageContentViewHolder.java @@ -33,10 +33,10 @@ public class StickerMessageContentViewHolder extends NormalMessageContentViewHol public StickerMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { imageView =itemView.findViewById(R.id.stickerImageView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/TextMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/TextMessageContentViewHolder.java index e92793e3d..420b9f529 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/TextMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/TextMessageContentViewHolder.java @@ -50,16 +50,16 @@ public class TextMessageContentViewHolder extends NormalMessageContentViewHolder public TextMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.contentTextView).setOnClickListener(this::onClick); itemView.findViewById(R.id.refTextView).setOnClickListener(this::onRefClick); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { contentTextView =itemView.findViewById(R.id.contentTextView); refTextView =itemView.findViewById(R.id.refTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/UnkownMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/UnkownMessageContentViewHolder.java index 0cb2febf1..f73a6ff55 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/UnkownMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/UnkownMessageContentViewHolder.java @@ -23,10 +23,10 @@ public class UnkownMessageContentViewHolder extends NormalMessageContentViewHold public UnkownMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { contentTextView =itemView.findViewById(R.id.contentTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/UserCardMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/UserCardMessageContentViewHolder.java index 3c35a9c47..59561e0fc 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/UserCardMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/UserCardMessageContentViewHolder.java @@ -39,15 +39,15 @@ public class UserCardMessageContentViewHolder extends NormalMessageContentViewHo public UserCardMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.contentLayout).setOnClickListener(_v -> onUserCardClick()); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView =itemView.findViewById(R.id.userCardPortraitImageView); nameTextView =itemView.findViewById(R.id.userCardNameTextView); userIdTextView =itemView.findViewById(R.id.userIdTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/VideoMessageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/VideoMessageContentViewHolder.java index 8532a9d0f..68b1e862b 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/VideoMessageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/VideoMessageContentViewHolder.java @@ -42,15 +42,15 @@ public class VideoMessageContentViewHolder extends MediaMessageContentViewHolder public VideoMessageContentViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.videoContentLayout).setOnClickListener(_v -> play()); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { imageView =itemView.findViewById(R.id.imageView); playImageView =itemView.findViewById(R.id.playImageView); time_tv =itemView.findViewById(R.id.time_tv); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/VoipMessageViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/VoipMessageViewHolder.java index 04597aa0d..434a0b537 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/VoipMessageViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/VoipMessageViewHolder.java @@ -29,15 +29,15 @@ public class VoipMessageViewHolder extends NormalMessageContentViewHolder { public VoipMessageViewHolder(ConversationFragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.contentTextView).setOnClickListener(this::call); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { textView = itemView.findViewById(R.id.contentTextView); callTypeImageView = itemView.findViewById(R.id.callTypeImageView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/pick/PickOrCreateConversationActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/pick/PickOrCreateConversationActivity.java index 48cddcc82..a67e27584 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/pick/PickOrCreateConversationActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/pick/PickOrCreateConversationActivity.java @@ -34,7 +34,8 @@ abstract public class PickOrCreateConversationActivity extends WfcBaseActivity { EditText editText; - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); editText = findViewById(R.id.searchEditText); editText.addTextChangedListener(new SimpleTextWatcher(){ @Override @@ -46,7 +47,6 @@ public void afterTextChanged(Editable s) { @Override protected void afterViews() { - bindViewImpl(); PickOrCreateConversationFragment pickOrCreateConversationFragment = new PickOrCreateConversationFragment(); pickOrCreateConversationFragment.setListener(this::onPickOrCreateConversation); getSupportFragmentManager() diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/pick/PickOrCreateConversationFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/pick/PickOrCreateConversationFragment.java index cc3ffb637..ce06fc8d6 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/pick/PickOrCreateConversationFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/pick/PickOrCreateConversationFragment.java @@ -45,12 +45,12 @@ public void setListener(OnPickOrCreateConversationListener listener) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.pick_or_create_conversation_fragmentn, container, false); - bindViewImpl(view); + bindViews(view); init(); return view; } - private void bindViewImpl(View view) { + private void bindViews(View view) { recyclerView = view.findViewById(R.id.recyclerView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/receipt/GroupMessageReceiptActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/receipt/GroupMessageReceiptActivity.java index eb7ec4c3e..2569b77ed 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/receipt/GroupMessageReceiptActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/receipt/GroupMessageReceiptActivity.java @@ -29,7 +29,8 @@ public class GroupMessageReceiptActivity extends WfcBaseActivity { private Message message; private GroupInfo groupInfo; - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); viewPager = findViewById(R.id.viewPager); tabLayout = findViewById(R.id.tabLayout); } @@ -41,7 +42,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); viewPager.setAdapter(new ReceiptFragmentPagerAdapter(getSupportFragmentManager())); tabLayout.setupWithViewPager(viewPager); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/receipt/GroupMessageReceiptAdapter.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/receipt/GroupMessageReceiptAdapter.java index 7ef1b1159..4fb8ae0a3 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/receipt/GroupMessageReceiptAdapter.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/receipt/GroupMessageReceiptAdapter.java @@ -91,16 +91,16 @@ void onClick() { public MemberViewHolder(View itemView) { super(itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); nameTextView = itemView.findViewById(R.id.nameTextView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.receiptItem).setOnClickListener(_v -> onClick()); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/receipt/GroupMessageReceiptListFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/receipt/GroupMessageReceiptListFragment.java index 950faa0c5..5c4e6c9e8 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversation/receipt/GroupMessageReceiptListFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversation/receipt/GroupMessageReceiptListFragment.java @@ -63,7 +63,7 @@ protected int contentLayout() { @Override protected void afterViews(View view) { super.afterViews(view); - bindViewImpl(view); + bindViews(view); groupMemberListAdapter = new GroupMessageReceiptAdapter(groupInfo); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setAdapter(groupMemberListAdapter); @@ -73,7 +73,7 @@ protected void afterViews(View view) { loadAndShowGroupMembers(); } - private void bindViewImpl(View view) { + private void bindViews(View view) { recyclerView = view.findViewById(R.id.recyclerView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversationlist/viewholder/ConversationViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversationlist/viewholder/ConversationViewHolder.java index dd9f7d418..d7b1e4a01 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversationlist/viewholder/ConversationViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversationlist/viewholder/ConversationViewHolder.java @@ -67,13 +67,13 @@ public ConversationViewHolder(Fragment fragment, RecyclerView.Adapter adapter, V this.fragment = fragment; this.itemView = itemView; this.adapter = adapter; - bindViewImpl(itemView); + bindViews(itemView); conversationListViewModel = new ViewModelProvider(fragment.getActivity(), new ConversationListViewModelFactory(Arrays.asList(Conversation.ConversationType.Single, Conversation.ConversationType.Group, Conversation.ConversationType.SecretChat), Arrays.asList(0))) .get(ConversationListViewModel.class); conversationViewModel = ViewModelProviders.of(fragment).get(ConversationViewModel.class); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { nameTextView = itemView.findViewById(R.id.nameTextView); timeTextView = itemView.findViewById(R.id.timeTextView); portraitImageView = itemView.findViewById(R.id.portraitImageView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversationlist/viewholder/GroupConversationViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversationlist/viewholder/GroupConversationViewHolder.java index ebeb5fc45..2e991274b 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversationlist/viewholder/GroupConversationViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversationlist/viewholder/GroupConversationViewHolder.java @@ -33,10 +33,10 @@ public class GroupConversationViewHolder extends ConversationViewHolder { public GroupConversationViewHolder(Fragment fragment, RecyclerView.Adapter adapter, View itemView) { super(fragment, adapter, itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { organizationGroupIndicator =itemView.findViewById(R.id.organizationGroupIndicator); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/conversationlist/viewholder/StatusNotificationContainerViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/conversationlist/viewholder/StatusNotificationContainerViewHolder.java index c9041f748..78a982f15 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/conversationlist/viewholder/StatusNotificationContainerViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/conversationlist/viewholder/StatusNotificationContainerViewHolder.java @@ -26,10 +26,10 @@ public class StatusNotificationContainerViewHolder extends RecyclerView.ViewHold public StatusNotificationContainerViewHolder(View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { containerLayout = itemView.findViewById(R.id.notificationContainerLayout); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/FavoriteListFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/FavoriteListFragment.java index 659fa2bb7..39b6b9b60 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/FavoriteListFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/FavoriteListFragment.java @@ -36,12 +36,12 @@ public class FavoriteListFragment extends Fragment { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fav_list_frament, container, false); - bindViewImpl(view); + bindViews(view); init(); return view; } - private void bindViewImpl(View view) { + private void bindViews(View view) { recyclerView = view.findViewById(R.id.recyclerView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavAudioContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavAudioContentViewHolder.java index 4867cf789..29f08634c 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavAudioContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavAudioContentViewHolder.java @@ -35,15 +35,15 @@ public class FavAudioContentViewHolder extends FavContentViewHolder { public FavAudioContentViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.audioContentLayout).setOnClickListener(_v -> playAudio()); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { audioImageView = itemView.findViewById(R.id.audioImageView); contentLayout = itemView.findViewById(R.id.audioContentLayout); durationTextView = itemView.findViewById(R.id.durationTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavCompositeContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavCompositeContentViewHolder.java index 629b813bc..15fc5bfe7 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavCompositeContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavCompositeContentViewHolder.java @@ -22,15 +22,15 @@ public class FavCompositeContentViewHolder extends FavContentViewHolder { public FavCompositeContentViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.contentTextView).setOnClickListener(_v -> showFavText()); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { titleTextView = itemView.findViewById(R.id.titleTextView); contentTextView = itemView.findViewById(R.id.contentTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavContentViewHolder.java index 4bb113169..4f72825be 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavContentViewHolder.java @@ -27,10 +27,10 @@ public abstract class FavContentViewHolder extends RecyclerView.ViewHolder { public FavContentViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { senderTextView = itemView.findViewById(R.id.senderTextView); timeTextView = itemView.findViewById(R.id.timeTextView); itemView.findViewById(R.id.favContentContainerLinearLayout).setOnLongClickListener(v -> this.onLongClick()); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavFileContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavFileContentViewHolder.java index 40e90ccac..98fce9e18 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavFileContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavFileContentViewHolder.java @@ -23,10 +23,10 @@ public class FavFileContentViewHolder extends FavContentViewHolder { public FavFileContentViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { fileIconImageView = itemView.findViewById(R.id.fileIconImageView); fileNameTextView = itemView.findViewById(R.id.fileNameTextView); fileSizeTextView = itemView.findViewById(R.id.fileSizeTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavImageContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavImageContentViewHolder.java index 1bf58c03e..e373d413e 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavImageContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavImageContentViewHolder.java @@ -20,15 +20,15 @@ public class FavImageContentViewHolder extends FavContentViewHolder { public FavImageContentViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.favImageContentImageView).setOnClickListener(_v -> showFavImage()); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { imageView = itemView.findViewById(R.id.favImageContentImageView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavTextContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavTextContentViewHolder.java index a3417cb59..03385e690 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavTextContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavTextContentViewHolder.java @@ -19,15 +19,15 @@ public class FavTextContentViewHolder extends FavContentViewHolder { public FavTextContentViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.favTextContentTextView).setOnClickListener(_v -> showFavText()); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { favTextContentTextView = itemView.findViewById(R.id.favTextContentTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavUnknownContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavUnknownContentViewHolder.java index 897a52212..94f84cadd 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavUnknownContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavUnknownContentViewHolder.java @@ -18,10 +18,10 @@ public class FavUnknownContentViewHolder extends FavContentViewHolder { public FavUnknownContentViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { textView = itemView.findViewById(R.id.favUnkownContentTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavVideoContentViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavVideoContentViewHolder.java index 448654a40..732226422 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavVideoContentViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/favorite/viewholder/FavVideoContentViewHolder.java @@ -20,15 +20,15 @@ public class FavVideoContentViewHolder extends FavContentViewHolder { public FavVideoContentViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.favImageContentImageView).setOnClickListener(_v -> showFavImage()); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { imageView = itemView.findViewById(R.id.favImageContentImageView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupInfoActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupInfoActivity.java index 8ff4304f8..a812fedf0 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupInfoActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupInfoActivity.java @@ -40,11 +40,13 @@ public class GroupInfoActivity extends WfcBaseActivity { private MaterialDialog dialog; - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.actionButton).setOnClickListener(v -> action()); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); groupNameTextView = findViewById(R.id.groupNameTextView); groupPortraitImageView = findViewById(R.id.portraitImageView); actionButton = findViewById(R.id.actionButton); @@ -52,8 +54,6 @@ private void bindViewImpl() { @Override protected void afterViews() { - bindViewImpl(); - bindClickImpl(); Intent intent = getIntent(); groupId = intent.getStringExtra("groupId"); groupViewModel = ViewModelProviders.of(this).get(GroupViewModel.class); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupListFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupListFragment.java index 09313e1f2..0002ea3ef 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupListFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupListFragment.java @@ -43,12 +43,12 @@ public void setOnGroupItemClickListener(OnGroupItemClickListener onGroupItemClic @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.group_list_fragment, container, false); - bindViewImpl(view); + bindViews(view); init(); return view; } - private void bindViewImpl(View view) { + private void bindViews(View view) { recyclerView = view.findViewById(R.id.groupRecyclerView); tipTextView = view.findViewById(R.id.tipTextView); groupsLinearLayout = view.findViewById(R.id.groupsLinearLayout); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupMemberListAdapter.java b/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupMemberListAdapter.java index 46202c023..9ddf9290f 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupMemberListAdapter.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupMemberListAdapter.java @@ -114,16 +114,16 @@ void onClick() { public MemberViewHolder(View itemView) { super(itemView); - bindViewImpl(itemView); - bindClickImpl(itemView); + bindViews(itemView); + bindEvents(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); nameTextView = itemView.findViewById(R.id.nameTextView); } - private void bindClickImpl(View itemView) { + private void bindEvents(View itemView) { itemView.findViewById(R.id.portraitImageView).setOnClickListener(_v -> onClick()); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupMemberListFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupMemberListFragment.java index e4a4aa6bd..59bb885e3 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupMemberListFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupMemberListFragment.java @@ -50,7 +50,7 @@ protected int contentLayout() { @Override protected void afterViews(View view) { super.afterViews(view); - bindViewImpl(view); + bindViews(view); groupMemberListAdapter = new GroupMemberListAdapter(groupInfo); memberRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 5)); memberRecyclerView.setAdapter(groupMemberListAdapter); @@ -60,7 +60,7 @@ protected void afterViews(View view) { loadAndShowGroupMembers(); } - private void bindViewImpl(View view) { + private void bindViews(View view) { memberRecyclerView = view.findViewById(R.id.memberRecyclerView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupMemberMessageHistoryAdapter.java b/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupMemberMessageHistoryAdapter.java index fc8189bbf..cc618723b 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupMemberMessageHistoryAdapter.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupMemberMessageHistoryAdapter.java @@ -80,10 +80,10 @@ public class MessageViewHolder extends RecyclerView.ViewHolder { public MessageViewHolder(View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); nameTextView = itemView.findViewById(R.id.nameTextView); contentTextView = itemView.findViewById(R.id.contentTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupViewHolder.java index 6ef48d5bf..87f3a6fb1 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/group/GroupViewHolder.java @@ -30,10 +30,10 @@ public GroupViewHolder(Fragment fragment, GroupListAdapter adapter, View itemVie super(itemView); this.fragment = fragment; this.adapter = adapter; - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); nameTextView = itemView.findViewById(R.id.nameTextView); categoryTextView = itemView.findViewById(R.id.categoryTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/group/SetGroupAnnouncementActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/group/SetGroupAnnouncementActivity.java index c93cf7d41..cedf92ef5 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/group/SetGroupAnnouncementActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/group/SetGroupAnnouncementActivity.java @@ -27,7 +27,8 @@ public class SetGroupAnnouncementActivity extends WfcBaseActivity { private GroupInfo groupInfo; - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); announcementEditText = findViewById(R.id.announcementEditText); announcementEditText.addTextChangedListener(new SimpleTextWatcher() { @Override @@ -44,7 +45,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); groupInfo = getIntent().getParcelableExtra("groupInfo"); if (groupInfo == null) { finish(); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/group/SetGroupNameActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/group/SetGroupNameActivity.java index b8c396e2d..81ef87cbe 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/group/SetGroupNameActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/group/SetGroupNameActivity.java @@ -35,7 +35,8 @@ public class SetGroupNameActivity extends WfcBaseActivity { public static final int RESULT_SET_GROUP_NAME_SUCCESS = 100; - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); nameEditText = findViewById(R.id.nameEditText); nameEditText.addTextChangedListener(new SimpleTextWatcher() { @Override @@ -52,7 +53,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); groupInfo = getIntent().getParcelableExtra("groupInfo"); if (groupInfo == null) { finish(); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/group/SetGroupRemarkActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/group/SetGroupRemarkActivity.java index d4310b63b..10289103a 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/group/SetGroupRemarkActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/group/SetGroupRemarkActivity.java @@ -28,7 +28,8 @@ public class SetGroupRemarkActivity extends WfcBaseActivity { private GroupInfo groupInfo; private GroupViewModel groupViewModel; - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); remarkEditText = findViewById(R.id.remarkEditText); } @@ -39,7 +40,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); groupInfo = getIntent().getParcelableExtra("groupInfo"); if (groupInfo == null) { finish(); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/group/manage/GroupManageFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/group/manage/GroupManageFragment.java index 006222ff4..2e87ceaf0 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/group/manage/GroupManageFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/group/manage/GroupManageFragment.java @@ -54,13 +54,13 @@ public void onCreate(@Nullable Bundle savedInstanceState) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.group_manage_fragment, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.managerOptionItemView).setOnClickListener(_v -> showGroupManagerSetting()); view.findViewById(R.id.muteOptionItemView).setOnClickListener(_v -> showGroupMuteSetting()); view.findViewById(R.id.permissionOptionItemView).setOnClickListener(_v -> showMemberPermissionSetting()); @@ -69,7 +69,7 @@ private void bindClickImpl(View view) { view.findViewById(R.id.historyMessageOptionItemView).setOnClickListener(_v -> showHistoryMessageSetting()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { joinOptionItemView = view.findViewById(R.id.joinOptionItemView); searchOptionItemView = view.findViewById(R.id.searchOptionItemView); historyOptionItemView = view.findViewById(R.id.historyMessageOptionItemView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/group/manage/GroupMemberPermissionFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/group/manage/GroupMemberPermissionFragment.java index 4e71e07be..2eb535bd0 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/group/manage/GroupMemberPermissionFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/group/manage/GroupMemberPermissionFragment.java @@ -46,12 +46,12 @@ public void onCreate(@Nullable Bundle savedInstanceState) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.group_manage_member_permission_fragment, container, false); - bindViewImpl(view); + bindViews(view); init(); return view; } - private void bindViewImpl(View view) { + private void bindViews(View view) { privateChatSwitchButton = view.findViewById(R.id.privateChatSwitchButton); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/group/manage/GroupMuteOrAllowActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/group/manage/GroupMuteOrAllowActivity.java index 79d596cdc..c1e54ee9b 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/group/manage/GroupMuteOrAllowActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/group/manage/GroupMuteOrAllowActivity.java @@ -25,7 +25,8 @@ public class GroupMuteOrAllowActivity extends WfcBaseActivity { SwitchMaterial switchButton; - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); switchButton = findViewById(R.id.muteSwitchButton); } @@ -36,7 +37,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); groupInfo = getIntent().getParcelableExtra("groupInfo"); init(); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/pc/PCSessionActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/pc/PCSessionActivity.java index 02558e29f..e94e62456 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/pc/PCSessionActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/pc/PCSessionActivity.java @@ -29,13 +29,15 @@ public class PCSessionActivity extends WfcBaseActivity { private PCOnlineInfo pcOnlineInfo; private boolean isMuteWhenPCOnline = false; - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.kickOffPCButton).setOnClickListener(v -> kickOffPC()); findViewById(R.id.muteImageView).setOnClickListener(v -> mutePhone()); findViewById(R.id.fileHelperImageView).setOnClickListener(v -> fileHelper()); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); kickOffPCButton = findViewById(R.id.kickOffPCButton); descTextView = findViewById(R.id.descTextView); muteImageView = findViewById(R.id.muteImageView); @@ -43,8 +45,6 @@ private void bindViewImpl() { @Override protected void beforeViews() { - bindViewImpl(); - bindClickImpl(); pcOnlineInfo = getIntent().getParcelableExtra("pcOnlineInfo"); if (pcOnlineInfo == null) { finish(); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/qrcode/QRCodeActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/qrcode/QRCodeActivity.java index d60b10ff8..46d318d22 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/qrcode/QRCodeActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/qrcode/QRCodeActivity.java @@ -29,7 +29,8 @@ public class QRCodeActivity extends WfcBaseActivity { ImageView qrCodeImageView; - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); qrCodeImageView = findViewById(R.id.qrCodeImageView); } @@ -43,7 +44,6 @@ public static Intent buildQRCodeIntent(Context context, String title, String log @Override protected void beforeViews() { - super.beforeViews(); Intent intent = getIntent(); title = intent.getStringExtra("title"); qrCodeValue = intent.getStringExtra("qrCodeValue"); @@ -57,7 +57,7 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); + bindViews(); setTitle(title); genQRCode(); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/qrcode/ScanQRCodeActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/qrcode/ScanQRCodeActivity.java index 04fde6614..27b580892 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/qrcode/ScanQRCodeActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/qrcode/ScanQRCodeActivity.java @@ -34,7 +34,8 @@ public class ScanQRCodeActivity extends WfcBaseActivity { private static final int REQUEST_CODE_IMAGE = 100; - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); surfaceView = findViewById(R.id.surfaceView); viewfinderView = findViewById(R.id.viewfinderView); } @@ -46,7 +47,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); mCaptureHelper = new CaptureHelper(this, surfaceView, viewfinderView); mCaptureHelper.onCreate(); mCaptureHelper.vibrate(true) diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/search/SearchActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/search/SearchActivity.java index 685542d68..89b56d076 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/search/SearchActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/search/SearchActivity.java @@ -28,11 +28,11 @@ public void onCancelClick() { finish(); } - private void bindClickImpl() { + private void bindEvents() { findViewById(R.id.cancel).setOnClickListener(v -> onCancelClick()); } - private void bindViewImpl() { + private void bindViews() { searchView = findViewById(R.id.search_view); } @@ -54,8 +54,8 @@ protected void beforeViews() { } protected void afterViews() { - bindViewImpl(); - bindClickImpl(); + bindViews(); + bindEvents(); initSearchView(); initSearchFragment(); String initialKeyword = getIntent().getStringExtra("keyword"); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/search/SearchFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/search/SearchFragment.java index 3ce0fd0ec..57c807721 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/search/SearchFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/search/SearchFragment.java @@ -50,7 +50,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c View view = inflater.inflate(R.layout.search_fragment, container, false); searchViewModel = ViewModelProviders.of(this).get(SearchViewModel.class); searchViewModel.getResultLiveData().observeForever(searchResultObserver); - bindViewImpl(view); + bindViews(view); inputManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override @@ -62,7 +62,7 @@ public void onScrollStateChanged(RecyclerView recyclerView, int newState) { return view; } - private void bindViewImpl(View view) { + private void bindViews(View view) { recyclerView = view.findViewById(R.id.recyclerView); emptyLinearLayout = view.findViewById(R.id.emptyLinearLayout); descLinearLayout = view.findViewById(R.id.descLinearLayout); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/CategoryViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/CategoryViewHolder.java index 885da58e3..9c31293ee 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/CategoryViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/CategoryViewHolder.java @@ -17,10 +17,10 @@ public class CategoryViewHolder extends RecyclerView.ViewHolder { public CategoryViewHolder(View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { categoryTextView = itemView.findViewById(R.id.categoryTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/ChannelViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/ChannelViewHolder.java index 3f6ed389a..3c40bd49b 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/ChannelViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/ChannelViewHolder.java @@ -21,10 +21,10 @@ public class ChannelViewHolder extends RecyclerView.ViewHolder { public ChannelViewHolder(View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); channelNameTextView = itemView.findViewById(R.id.channelNameTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/ConversationViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/ConversationViewHolder.java index 4ed4d557e..50f3fea31 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/ConversationViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/ConversationViewHolder.java @@ -33,13 +33,13 @@ public class ConversationViewHolder extends ResultItemViewHolder { public GroupViewHolder(Fragment fragment, View itemView) { super(fragment, itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); nameTextView = itemView.findViewById(R.id.nameTextView); descTextView = itemView.findViewById(R.id.descTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/MessageViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/MessageViewHolder.java index b0dd2b1a0..c6da783ce 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/MessageViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/search/viewHolder/MessageViewHolder.java @@ -35,10 +35,10 @@ public MessageViewHolder(Fragment fragment, View itemView) { super(itemView); this.fragment = fragment; this.userViewModel = ViewModelProviders.of(fragment).get(UserViewModel.class); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); nameTextView = itemView.findViewById(R.id.nameTextView); contentTextView = itemView.findViewById(R.id.contentTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/settings/MessageNotifySettingActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/settings/MessageNotifySettingActivity.java index 096c5cb59..1385fe97e 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/settings/MessageNotifySettingActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/settings/MessageNotifySettingActivity.java @@ -23,7 +23,8 @@ public class MessageNotifySettingActivity extends WfcBaseActivity { SwitchMaterial switchSyncDraft; SwitchMaterial switchPtt; - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); switchMsgNotification = findViewById(R.id.switchMsgNotification); switchVoipNotification = findViewById(R.id.switchVoipNotification); switchShowMsgDetail = findViewById(R.id.switchShowMsgDetail); @@ -39,8 +40,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); - switchMsgNotification.setChecked(!ChatManager.Instance().isGlobalSilent()); switchShowMsgDetail.setChecked(!ChatManager.Instance().isHiddenNotificationDetail()); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/settings/PrivacySettingActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/settings/PrivacySettingActivity.java index aa295d5a8..816df0168 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/settings/PrivacySettingActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/settings/PrivacySettingActivity.java @@ -12,7 +12,8 @@ public class PrivacySettingActivity extends WfcBaseActivity { - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.blacklistOptionItemView).setOnClickListener(v -> blacklistSettings()); findViewById(R.id.momentsPrivacyOptionItemView).setOnClickListener(v -> mementsSettings()); } @@ -22,11 +23,6 @@ protected int contentLayout() { return R.layout.privacy_setting_activity; } - @Override - protected void afterViews() { - bindClickImpl(); - } - void blacklistSettings() { Intent intent = new Intent(this, BlacklistListActivity.class); startActivity(intent); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/settings/blacklist/BlacklistListFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/settings/blacklist/BlacklistListFragment.java index 6a2ac668b..e88e30112 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/settings/blacklist/BlacklistListFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/settings/blacklist/BlacklistListFragment.java @@ -39,12 +39,12 @@ public class BlacklistListFragment extends Fragment implements BlacklistListAdap @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.blacklist_list_frament, container, false); - bindViewImpl(view); + bindViews(view); init(); return view; } - private void bindViewImpl(View view) { + private void bindViews(View view) { recyclerView = view.findViewById(R.id.recyclerView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/settings/blacklist/BlacklistViewHolder.java b/uikit/src/main/java/cn/wildfire/chat/kit/settings/blacklist/BlacklistViewHolder.java index 9b28e9b86..f6d425dff 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/settings/blacklist/BlacklistViewHolder.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/settings/blacklist/BlacklistViewHolder.java @@ -22,10 +22,10 @@ public class BlacklistViewHolder extends RecyclerView.ViewHolder { public BlacklistViewHolder(View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); userNameTextView = itemView.findViewById(R.id.userNameTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/third/location/ui/activity/MyLocationActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/third/location/ui/activity/MyLocationActivity.java index eabec4b8c..fbf5a556d 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/third/location/ui/activity/MyLocationActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/third/location/ui/activity/MyLocationActivity.java @@ -70,7 +70,7 @@ public class MyLocationActivity extends BaseActivity chat()); view.findViewById(R.id.momentButton).setOnClickListener(_v -> moment()); view.findViewById(R.id.voipChatButton).setOnClickListener(_v -> voipChat()); @@ -132,7 +132,7 @@ private void bindClickImpl(View view) { view.findViewById(R.id.qrCodeOptionItemView).setOnClickListener(_v -> showMyQRCode()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { portraitImageView = view.findViewById(R.id.portraitImageView); titleTextView = view.findViewById(R.id.titleTextView); displayNameTextView = view.findViewById(R.id.displayNameTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/MultiCallAudioFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/MultiCallAudioFragment.java index cb811077e..2e86aaa0b 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/MultiCallAudioFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/MultiCallAudioFragment.java @@ -50,13 +50,13 @@ public class MultiCallAudioFragment extends Fragment implements AVEngineKit.Call @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.av_multi_audio_outgoing_connected, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.minimizeImageView).setOnClickListener(_v -> minimize()); view.findViewById(R.id.addParticipantImageView).setOnClickListener(_v -> addParticipant()); view.findViewById(R.id.muteImageView).setOnClickListener(_v -> mute()); @@ -64,7 +64,7 @@ private void bindClickImpl(View view) { view.findViewById(R.id.hangupImageView).setOnClickListener(_v -> hangup()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { durationTextView = view.findViewById(R.id.durationTextView); audioContainerGridLayout = view.findViewById(R.id.audioContainerGridLayout); speakerImageView = view.findViewById(R.id.speakerImageView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/MultiCallIncomingFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/MultiCallIncomingFragment.java index 38197826c..ea75f2bd3 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/MultiCallIncomingFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/MultiCallIncomingFragment.java @@ -45,18 +45,18 @@ public class MultiCallIncomingFragment extends Fragment implements AVEngineKit.C @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.av_multi_incoming, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.hangupImageView).setOnClickListener(_v -> hangup()); view.findViewById(R.id.acceptImageView).setOnClickListener(_v -> accept()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { invitorImageView = view.findViewById(R.id.invitorImageView); invitorTextView = view.findViewById(R.id.invitorTextView); participantRecyclerView = view.findViewById(R.id.participantGridView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/MultiCallVideoFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/MultiCallVideoFragment.java index 88099a2b3..ac2a23533 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/MultiCallVideoFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/MultiCallVideoFragment.java @@ -63,13 +63,13 @@ public class MultiCallVideoFragment extends Fragment implements AVEngineKit.Call @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.av_multi_video_outgoing_connected, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.minimizeImageView).setOnClickListener(_v -> minimize()); view.findViewById(R.id.addParticipantImageView).setOnClickListener(_v -> addParticipant()); view.findViewById(R.id.muteImageView).setOnClickListener(_v -> mute()); @@ -79,7 +79,7 @@ private void bindClickImpl(View view) { view.findViewById(R.id.shareScreenImageView).setOnClickListener(_v -> shareScreen()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { rootLinearLayout = view.findViewById(R.id.rootView); durationTextView = view.findViewById(R.id.durationTextView); fullScreenDurationTextView = view.findViewById(R.id.fullScreenDurationTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/SingleAudioFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/SingleAudioFragment.java index 6aedf6fa3..ea1d85877 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/SingleAudioFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/SingleAudioFragment.java @@ -57,13 +57,13 @@ public void onCreate(@Nullable Bundle savedInstanceState) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.av_p2p_audio_layout, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.muteImageView).setOnClickListener(_v -> mute()); view.findViewById(R.id.incomingHangupImageView).setOnClickListener(_v -> hangup()); view.findViewById(R.id.outgoingHangupImageView).setOnClickListener(_v -> hangup()); @@ -72,7 +72,7 @@ private void bindClickImpl(View view) { view.findViewById(R.id.speakerImageView).setOnClickListener(_v -> speakerClick()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { backgroundImageView = view.findViewById(R.id.backgroundImageView); portraitImageView = view.findViewById(R.id.portraitImageView); nameTextView = view.findViewById(R.id.nameTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/SingleVideoFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/SingleVideoFragment.java index 70f96979e..938c90503 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/SingleVideoFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/SingleVideoFragment.java @@ -66,13 +66,13 @@ public void onCreate(@Nullable Bundle savedInstanceState) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.av_p2p_video_layout, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.acceptImageView).setOnClickListener(_v -> accept()); view.findViewById(R.id.incomingAudioOnlyImageView).setOnClickListener(_v -> audioAccept()); view.findViewById(R.id.outgoingAudioOnlyImageView).setOnClickListener(_v -> audioCall()); @@ -88,7 +88,7 @@ private void bindClickImpl(View view) { view.findViewById(R.id.pip_video_view).setOnClickListener(_v -> setSwappedFeeds()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { pipVideoContainer = view.findViewById(R.id.pip_video_view); fullscreenVideoContainer = view.findViewById(R.id.fullscreen_video_view); outgoingActionContainer = view.findViewById(R.id.outgoingActionContainer); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceFragment.java index d9b77e86b..ab7e4eb03 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceFragment.java @@ -128,8 +128,8 @@ public class ConferenceFragment extends BaseConferenceFragment implements AVEngi @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.av_conference, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); callSession = AVEngineKit.Instance().getCurrentSession(); if (callSession == null || callSession.getState() == AVEngineKit.CallState.Idle) { @@ -191,7 +191,7 @@ public void onChanged(Object o) { return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.speakerImageView).setOnClickListener(_v -> switchSpeaker()); view.findViewById(R.id.manageParticipantView).setOnClickListener(_v -> addParticipant()); view.findViewById(R.id.muteView).setOnClickListener(_v -> muteAudio()); @@ -204,7 +204,7 @@ private void bindClickImpl(View view) { view.findViewById(R.id.moreActionLinearLayout).setOnClickListener(_v -> showMoreActionDialog()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { rootFrameLayout = view.findViewById(R.id.rootFrameLayout); topBarView = view.findViewById(R.id.topBarView); bottomPanel = view.findViewById(R.id.bottomPanel); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceInfoActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceInfoActivity.java index 051ce7609..5281bad58 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceInfoActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceInfoActivity.java @@ -43,12 +43,14 @@ public class ConferenceInfoActivity extends WfcBaseActivity { private MenuItem favItem; private MenuItem unFavItem; - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.conferenceQRCodeLinearLayout).setOnClickListener(v -> showConferenceQRCode()); findViewById(R.id.joinConferenceBtn).setOnClickListener(v -> joinConference()); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); titleTextView = findViewById(R.id.titleTextView); ownerTextView = findViewById(R.id.ownerTextView); callIdTextView = findViewById(R.id.callIdTextView); @@ -86,8 +88,6 @@ protected void afterMenus(Menu menu) { @Override protected void afterViews() { - bindViewImpl(); - bindClickImpl(); Intent intent = getIntent(); conferenceId = intent.getStringExtra("conferenceId"); password = intent.getStringExtra("password"); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceMessageFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceMessageFragment.java index 8f7142671..8cff2c8a4 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceMessageFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceMessageFragment.java @@ -43,18 +43,18 @@ public class ConferenceMessageFragment extends Fragment { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.av_conference_message, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); messageViewModel = new ViewModelProvider(this).get(MessageViewModel.class); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.inputTextView).setOnClickListener(_v -> showMessageInputFragment()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { messageRecyclerView = view.findViewById(R.id.messageRecyclerView); } @@ -131,10 +131,10 @@ static class TextMessageViewHolder extends MessageViewHolder { public TextMessageViewHolder(@NonNull View itemView) { super(itemView); - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { senderTextView = itemView.findViewById(R.id.senderTextView); messageContentTextView = itemView.findViewById(R.id.messageContentTextView); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceParticipantListFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceParticipantListFragment.java index 0b7539225..abb164a94 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceParticipantListFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferenceParticipantListFragment.java @@ -58,20 +58,20 @@ public class ConferenceParticipantListFragment extends Fragment { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.av_conference_participant_list, container, false); - bindViewImpl(view); - bindClickImpl(view); + bindViews(view); + bindEvents(view); init(); return view; } - private void bindClickImpl(View view) { + private void bindEvents(View view) { view.findViewById(R.id.applyingUnmuteTextView).setOnClickListener(_v -> showApplyingUnmuteDialog()); view.findViewById(R.id.handupTextView).setOnClickListener(_v -> showHandupDialog()); view.findViewById(R.id.muteAllButton).setOnClickListener(_v -> muteAll()); view.findViewById(R.id.unmuteAllButton).setOnClickListener(_v -> unmuteAll()); } - private void bindViewImpl(View view) { + private void bindViews(View view) { recyclerView = view.findViewById(R.id.recyclerView); handupTextView = view.findViewById(R.id.handupTextView); applyingUnmuteTextView = view.findViewById(R.id.applyingUnmuteTextView); @@ -304,10 +304,10 @@ class ParticipantViewHolder extends RecyclerView.ViewHolder { public ParticipantViewHolder(@NonNull View itemView) { super(itemView); this.itemView = itemView; - bindViewImpl(itemView); + bindViews(itemView); } - private void bindViewImpl(View itemView) { + private void bindViews(View itemView) { portraitImageView = itemView.findViewById(R.id.portraitImageView); nameTextView = itemView.findViewById(R.id.nameTextView); descTextView = itemView.findViewById(R.id.descTextView); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferencePortalActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferencePortalActivity.java index e275d72d7..a9c35ab03 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferencePortalActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/ConferencePortalActivity.java @@ -35,14 +35,16 @@ public class ConferencePortalActivity extends WfcBaseActivity { private FavConferenceAdapter adapter; private List favConferenceList; - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.startConferenceLinearLayout).setOnClickListener(v -> startConference()); findViewById(R.id.joinConferenceLinearLayout).setOnClickListener(v -> joinConference()); findViewById(R.id.orderConferenceLinearLayout).setOnClickListener(v -> orderConference()); findViewById(R.id.conferenceHistoryButton).setOnClickListener(v -> showConferenceHistory()); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); recyclerView = findViewById(R.id.conferenceListRecyclerView); emptyLinearLayout = findViewById(R.id.emptyLinearLayout); } @@ -54,8 +56,6 @@ protected int contentLayout() { @Override protected void afterViews() { - bindViewImpl(); - bindClickImpl(); adapter = new FavConferenceAdapter(); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(this)); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/CreateConferenceActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/CreateConferenceActivity.java index 90882326d..52ce24a98 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/CreateConferenceActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/CreateConferenceActivity.java @@ -5,7 +5,6 @@ package cn.wildfire.chat.kit.voip.conference; import android.content.Intent; -import android.os.Bundle; import android.text.Editable; import android.text.TextUtils; import android.util.Log; @@ -18,7 +17,6 @@ import android.widget.Toast; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import androidx.lifecycle.ViewModelProviders; import com.afollestad.materialdialogs.MaterialDialog; @@ -67,7 +65,8 @@ public class CreateConferenceActivity extends WfcBaseActivity { private static final String TAG = "createConference"; - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.endDateTimeRelativeLayout).setOnClickListener(v -> pickEndDateTime()); findViewById(R.id.joinConferenceBtn).setOnClickListener(v -> onClickJoinBtn()); audienceSwitch.setOnCheckedChangeListener(this::audienceChecked); @@ -80,7 +79,8 @@ public void afterTextChanged(Editable s) { }); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); titleEditText = findViewById(R.id.conferenceTitleTextInputEditText); audienceSwitch = findViewById((R.id.audienceSwitch)); modeSwitch = findViewById((R.id.modeSwitch)); @@ -123,8 +123,6 @@ public boolean onOptionsItemSelected(MenuItem item) { @Override protected void afterViews() { - bindViewImpl(); - bindClickImpl(); UserViewModel userViewModel = ViewModelProviders.of(this).get(UserViewModel.class); UserInfo userInfo = userViewModel.getUserInfo(ChatManager.Instance().getUserId(), false); if (userInfo != null) { diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/InputPanel.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/InputPanel.java index 2a6897f58..e22b41d71 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/InputPanel.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/InputPanel.java @@ -84,7 +84,7 @@ public void onDestroy() { public void init(KeyboardDialogFragment commentFragment, InputAwareLayout rootInputAwareLayout) { LayoutInflater.from(getContext()).inflate(R.layout.input_panel, this, true); - bindViewImpl(); + bindViews(); this.keyboardDialogFragment = commentFragment; this.rootLinearLayout = rootInputAwareLayout; @@ -96,7 +96,7 @@ public void init(KeyboardDialogFragment commentFragment, InputAwareLayout rootIn emotionLayout.setEmotionSelectedListener(this); } - private void bindViewImpl() { + private void bindViews() { editText = findViewById(R.id.editText); emotionImageView = findViewById(R.id.emotionImageView); sendButton = findViewById(R.id.sendButton); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/OrderConferenceActivity.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/OrderConferenceActivity.java index 4ca4dbc1f..cb38aaa37 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/OrderConferenceActivity.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/OrderConferenceActivity.java @@ -56,7 +56,8 @@ public class OrderConferenceActivity extends WfcBaseActivity { private static final String TAG = "orderConference"; - private void bindClickImpl() { + protected void bindEvents() { + super.bindEvents(); findViewById(R.id.endDateTimeRelativeLayout).setOnClickListener(v -> pickEndDateTime()); findViewById(R.id.startDateTimeRelativeLayout).setOnClickListener(v -> pickStartDateTime()); @@ -70,7 +71,8 @@ public void afterTextChanged(Editable s) { }); } - private void bindViewImpl() { + protected void bindViews() { + super.bindViews(); titleEditText = findViewById(R.id.conferenceTitleTextInputEditText); audienceSwitch = findViewById((R.id.audienceSwitch)); modeSwitch = findViewById((R.id.modeSwitch)); @@ -111,8 +113,6 @@ public boolean onOptionsItemSelected(MenuItem item) { @Override protected void afterViews() { - bindViewImpl(); - bindClickImpl(); UserInfo userInfo = ChatManager.Instance().getUserInfo(ChatManager.Instance().getUserId(), false); if (userInfo != null) { titleEditText.setText(userInfo.displayName + "的会议"); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/VideoConferenceMainView.java b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/VideoConferenceMainView.java index 545ac1419..965d3a952 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/VideoConferenceMainView.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/voip/conference/VideoConferenceMainView.java @@ -61,10 +61,10 @@ public VideoConferenceMainView(Context context, AttributeSet attrs, int defStyle private void initView(Context context, AttributeSet attrs) { View view = inflate(context, R.layout.av_conference_video_main, this); - bindViewImpl(view); + bindViews(view); } - private void bindViewImpl(View view) { + private void bindViews(View view) { previewContainerFrameLayout = view.findViewById(R.id.previewContainerFrameLayout); focusContainerFrameLayout = view.findViewById(R.id.focusContainerFrameLayout); } diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/widget/SearchView.java b/uikit/src/main/java/cn/wildfire/chat/kit/widget/SearchView.java index a55e5197c..538b3a381 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/widget/SearchView.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/widget/SearchView.java @@ -44,7 +44,7 @@ public SearchView(@NonNull Context context, @Nullable AttributeSet attrs, int de private void init() { inflate(getContext(), R.layout.search_view, this); - bindViewImpl(); + bindViews(); mEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -64,7 +64,7 @@ public void afterTextChanged(Editable s) { }); } - private void bindViewImpl() { + private void bindViews() { mEditText = findViewById(R.id.editText); mCancelView = findViewById(R.id.search_cancel); mCancelView.setOnClickListener(_v -> onCancelClick()); diff --git a/uikit/src/main/java/cn/wildfire/chat/kit/workspace/WebViewFragment.java b/uikit/src/main/java/cn/wildfire/chat/kit/workspace/WebViewFragment.java index c457c8746..cd8c9f432 100644 --- a/uikit/src/main/java/cn/wildfire/chat/kit/workspace/WebViewFragment.java +++ b/uikit/src/main/java/cn/wildfire/chat/kit/workspace/WebViewFragment.java @@ -40,12 +40,12 @@ public static WebViewFragment loadUrl(String url) { @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview, container, false); - bindViewImpl(view); + bindViews(view); init(); return view; } - private void bindViewImpl(View view) { + private void bindViews(View view) { webView = view.findViewById(R.id.webview); }