diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..ddf57ac --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/me/electronicsboy/yapca/ui/chat/ChatScreen.java b/app/src/main/java/me/electronicsboy/yapca/ui/chat/ChatScreen.java index 74642ae..29370a0 100644 --- a/app/src/main/java/me/electronicsboy/yapca/ui/chat/ChatScreen.java +++ b/app/src/main/java/me/electronicsboy/yapca/ui/chat/ChatScreen.java @@ -5,7 +5,10 @@ import android.content.Intent; import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; import android.util.Log; +import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; @@ -71,18 +74,12 @@ public void onCancelled(@NonNull DatabaseError error) { // Failed to read value // Toast.makeText(LoginActivity.this, "ERROR!\n" + error.toException().getMessage(), Toast.LENGTH_LONG).show(); Log.w(null,"Failed to read value.", error.toException()); -// ((TextView) findViewById(R.id.status)).setText("Oh no! Connect to the internet and restart the app to continue!"); } }; myRef.addValueEventListener(vel); adapter.notifyDataSetChanged(); ((Button) findViewById(R.id.sendtxt)).setOnClickListener((v) -> { HashMap data2 = new HashMap<>(); - System.out.println((String) TempStorage.get("USERNAME")); - System.out.println((String) TempStorage.get("CT_CP")); - System.out.println(((EditText)findViewById(R.id.messagesend)).getText().toString()); - System.out.println(Crypto.encrypt((String) TempStorage.get("USERNAME"), (String) TempStorage.get("CT_CP"))); - System.out.println(Crypto.encrypt(((EditText)findViewById(R.id.messagesend)).getText().toString(), (String) TempStorage.get("CT_CP"))); data2.put("user", Crypto.encrypt((String) TempStorage.get("USERNAME"), (String) TempStorage.get("CT_CP"))); data2.put("msg", Crypto.encrypt(((EditText)findViewById(R.id.messagesend)).getText().toString(), (String) TempStorage.get("CT_CP"))); myRef.push().setValue(data2); @@ -92,5 +89,24 @@ public void onCancelled(@NonNull DatabaseError error) { TempStorage.clear(); startActivity(new Intent(ChatScreen.this, SplashScreen.class)); }); + ((Button) findViewById(R.id.logout)).setEnabled(false); + ((EditText)findViewById(R.id.messagesend)).setEnabled(true); + ((EditText)findViewById(R.id.messagesend)).setVisibility(View.VISIBLE); + ((EditText)findViewById(R.id.messagesend)).addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + // Do nothing + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + // Do nothing + } + + @Override + public void afterTextChanged(Editable s) { + ((Button) findViewById(R.id.sendtxt)).setEnabled(s.toString().isEmpty()); + } + }); } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_chat_screen.xml b/app/src/main/res/layout/activity_chat_screen.xml index 7185587..0cc2283 100644 --- a/app/src/main/res/layout/activity_chat_screen.xml +++ b/app/src/main/res/layout/activity_chat_screen.xml @@ -51,6 +51,7 @@ android:ems="10" android:hint="Message" android:inputType="textPersonName" + android:visibility="visible" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.454" diff --git a/app/src/main/res/layout/activity_chat_select_screen.xml b/app/src/main/res/layout/activity_chat_select_screen.xml index eca3f5e..a8acf8e 100644 --- a/app/src/main/res/layout/activity_chat_select_screen.xml +++ b/app/src/main/res/layout/activity_chat_select_screen.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".ui.chat.ChatSelectScreen" - tools:layout_editor_absoluteX="-1sp" + tools:layout_editor_absoluteX="1sp" tools:layout_editor_absoluteY="7sp">