diff --git a/app/src/main/java/com/haohanyh/linmengjia/nearlink/nlchat/fun/MainActivity.java b/app/src/main/java/com/haohanyh/linmengjia/nearlink/nlchat/fun/MainActivity.java index 079b788..8248358 100644 --- a/app/src/main/java/com/haohanyh/linmengjia/nearlink/nlchat/fun/MainActivity.java +++ b/app/src/main/java/com/haohanyh/linmengjia/nearlink/nlchat/fun/MainActivity.java @@ -21,8 +21,10 @@ import android.util.Log; import android.util.TypedValue; import android.view.Gravity; +import android.view.KeyEvent; import android.view.View; import android.view.WindowManager; +import android.view.inputmethod.EditorInfo; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.RadioButton; @@ -81,9 +83,10 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe //主要控件 private FloatingActionButton btnGO; private FloatingActionMenu btnMenu; - private com.github.clans.fab.FloatingActionButton btnNearLinkStatus,btnNearLinkSettings,btnNearlinkUart,btnNearlinkDev; + private com.github.clans.fab.FloatingActionButton btnNearLinkStatus,btnNearLinkSettings,btnNearLinkUIChanges,btnNearlinkUart,btnNearlinkDev; private int clickCountButton_btnNearLinkStatus = 0; //按钮计数 private int clickCountButton_btnNearLinkSettings = 0; //按钮计数 + private int clickCountButton_btnNearLinkUIChanges = 0; //按钮计数,切换新旧UI private int clickCountButton_btnNearLinkUart = 0; //按钮计数 private int clickCountButton_btnNearLinkDev = 0; //按钮计数 private CardView CNearLinkStatus,CNearlinkUart,CNearLinkSettings,CNearlinkDev,CTHANKS; @@ -238,6 +241,17 @@ private void Init() { NearLinkUserText = findViewById(id.readText); NearLinkMeText = findViewById(id.writeText); EditChatSend = findViewById(id.editChatSend); + EditChatSend.setOnEditorActionListener(new TextView.OnEditorActionListener() { + @Override + public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) { + if (actionId == EditorInfo.IME_ACTION_DONE || + (keyEvent != null && keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER && keyEvent.getAction() == KeyEvent.ACTION_DOWN)) { + NearLinkChatSendData(textView); + return true; + } + return false; + } + }); CheckBoxUartWarn = findViewById(id.cbUartWarn); NearLinkUartWarnToast = CheckBoxUartWarn.isChecked(); @@ -569,6 +583,8 @@ public void NearLinkChatSendData(View view) { } MainAPP.Vibrate(this); } + //发送完消息清空待发送文本 + EditChatSend.setText(""); }); } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 159e16c..d6d82cf 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -130,7 +130,7 @@ android:layout_marginTop="35dp" android:layout_marginRight="15dp" android:layout_marginBottom="15dp" - android:visibility="visible" + android:visibility="gone" app:cardCornerRadius="4dp" app:cardElevation="18dp"> @@ -212,6 +212,7 @@ android:layout_marginBottom="10dp" android:layout_weight="8" android:textColor="@color/blue_biaozhun_logowai" + android:singleLine="true" tools:ignore="HardcodedText" /> + + NLChat com.haohanyh.linmengjia.nearlink.nlchat.fun - 1.3.52.2024.0705 + 1.3.56.2024.0706 NLChat,浩瀚银河宗旨为用爱和魔法创造Android APP。 友情感谢