Fixed SendFeedback

Cleaned up looks overall. Keyboard closes. Maximum length of text.
This commit is contained in:
2020-05-09 19:35:14 -04:00
parent 29363e4669
commit d7efe2315f
14 changed files with 42 additions and 9 deletions

1
.gitignore vendored
View File

@@ -21,7 +21,6 @@ hs_err_pid*
### Gradle ### ### Gradle ###
.gradle .gradle
/build/ /build/
.DS_Store
# Ignore Gradle GUI config # Ignore Gradle GUI config
gradle-app.setting gradle-app.setting

View File

@@ -1,7 +1,11 @@
package com.josh.trackcovid19v2; package com.josh.trackcovid19v2;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu; import android.view.Menu;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
@@ -24,6 +28,7 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
hideKeyboardFrom(this);
DrawerLayout drawer = findViewById(R.id.drawer_layout); DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view); NavigationView navigationView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each // Passing each menu ID as a set of Ids because each
@@ -38,6 +43,16 @@ public class MainActivity extends AppCompatActivity {
Toast.makeText(getApplicationContext(), "Data Imported Successfully",Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), "Data Imported Successfully",Toast.LENGTH_SHORT).show();
} }
public static void hideKeyboardFrom(Activity activity) {
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
//Find the currently focused view, so we can grab the correct window token from it.
View view = activity.getCurrentFocus();
//If no view currently has focus, create a new one, just so we can grab a window token from it
if (view == null) {
view = new View(activity);
}
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {

View File

@@ -80,6 +80,10 @@ public class SendFeedbackFragment extends Fragment {
sendE.setOnClickListener(new View.OnClickListener() { sendE.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(android.view.View v) { public void onClick(android.view.View v) {
message.setCursorVisible(false);
message.clearFocus();
subject.setCursorVisible(false);
subject.clearFocus();
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Data"); builder.setTitle("Data");

View File

@@ -1,6 +1,7 @@
package com.josh.trackcovid19v2.ui.yourworld; package com.josh.trackcovid19v2.ui.yourworld;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.ClipDrawable; import android.graphics.drawable.ClipDrawable;
import android.os.Build; import android.os.Build;
@@ -14,6 +15,7 @@ import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@@ -42,6 +44,7 @@ public class YourworldFragment extends Fragment {
ViewGroup container, Bundle savedInstanceState) { ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_yourworld, container, false); View view = inflater.inflate(R.layout.fragment_yourworld, container, false);
hideKeyboardFrom(getActivity());
SwipeRefreshLayout mSwipeRefreshLayout = view.findViewById(R.id.swiperefresh); SwipeRefreshLayout mSwipeRefreshLayout = view.findViewById(R.id.swiperefresh);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override @Override
@@ -196,8 +199,16 @@ public class YourworldFragment extends Fragment {
return view; return view;
} }
public static void hideKeyboardFrom(Activity activity) {
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
//Find the currently focused view, so we can grab the correct window token from it.
View view = activity.getCurrentFocus();
//If no view currently has focus, create a new one, just so we can grab a window token from it
if (view == null) {
view = new View(activity);
}
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
private void postRequest() { private void postRequest() {
int size = 100; // this is the count of the data items. int size = 100; // this is the count of the data items.
int page = 1; // Which page do we want to get from the server. int page = 1; // Which page do we want to get from the server.

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#794A4949"/> <solid android:color="#B4B4B4"/>
<corners android:radius="64dp"/> <corners android:radius="128dp"/>
</shape> </shape>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#79DFCFCF"/> <solid android:color="#A3A3A3"/>
<corners android:radius="64dp"/> <corners android:radius="128dp"/>
</shape> </shape>

View File

@@ -11,8 +11,9 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ems="10" android:ems="10"
android:gravity="center"
android:inputType="textEmailAddress" android:inputType="textEmailAddress"
android:text="joshpatra12@protonmail.com" android:text="To: joshpatra12@protonmail.com"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.5"
@@ -27,6 +28,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ems="10" android:ems="10"
android:hint="Enter a subject for the email here" android:hint="Enter a subject for the email here"
android:gravity="center"
android:maxLength="30"
android:inputType="textPersonName" android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@@ -41,9 +44,10 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ems="10" android:ems="10"
android:gravity="start|top" android:gravity="center"
android:hint="Please highlight what the bug was." android:hint="Please highlight what the bug was."
android:inputType="textMultiLine" android:inputType="textMultiLine"
android:maxLength="429"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.5"