Skip to content

Commit

Permalink
Merge pull request #127 from Zolon-DOL/master
Browse files Browse the repository at this point in the history
Sprint 2 changes 2023
  • Loading branch information
pbhatt17 authored Apr 29, 2023
2 parents 4bef7c9 + be6aa44 commit 222c02d
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 70 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/gov/dol/childlabor/MoreInfoActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package gov.dol.childlabor;

import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import android.os.Bundle;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
Expand Down Expand Up @@ -210,80 +211,86 @@ public void onPrepareOptionsMenu(Menu menu) {
searchView.clearFocus();
}

if (searchView != null) {
searchView.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
}


searchView.setQueryHint(searchstring);
searchView.setIconified(false);
searchView.clearFocus();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextChange(String query) {
searchQuery = query;
TextView countrycountTextView = (TextView) getView().findViewById(R.id.countrycounttextview);
Country[] countries;
String selection;
switch (sectionNumber) {
case 2:
searchstring = query.trim();
if( searchstring.trim().equals("")) {
searchstring = "Filter Countries/Areas";
searchView.setQueryHint(searchstring);
}
selection = ((Spinner) getView().findViewById(R.id.listViewSpinner)).getSelectedItem().toString();
countries = getCountriesBySearch(query, getCountriesByLevel(selection));
if (countrycount != null) {
countrycountTextView.setVisibility(View.VISIBLE);
countrycountTextView.setText(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.announceForAccessibility(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.setContentDescription(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.setFocusable(true);
countrycountTextView.setFocusableInTouchMode(true);
}
else
{
countrycountTextView.setVisibility(View.GONE);
}
break;
case 3:
searchstring = query.trim();
if( searchstring.trim().equals("")) {
searchstring = "Filter Countries/Areas";
searchView.setQueryHint(searchstring);
}
selection = ((Spinner) getView().findViewById(R.id.listViewSpinner)).getSelectedItem().toString();
countries = getCountriesBySearch(query, getCountriesByRegion(selection));
if (countrycount != null) {
countrycountTextView.setVisibility(View.VISIBLE);
countrycountTextView.setText(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.announceForAccessibility(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.setContentDescription(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.setFocusable(true);
countrycountTextView.setFocusableInTouchMode(true);
}
else
{
countrycountTextView.setVisibility(View.GONE);
}
break;
default:
searchstring = query.trim();
countries = getCountriesBySearch(query);

if (countrycount != null) {
countrycountTextView.setVisibility(View.VISIBLE);
countrycountTextView.setText(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.announceForAccessibility(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.setContentDescription(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.setFocusable(true);
countrycountTextView.setFocusableInTouchMode(true);
}
else
{
countrycountTextView.setVisibility(View.GONE);
}
boolean check_alphabetOnly = query.matches("[a-zA-Z ]+");
if (check_alphabetOnly) {
searchQuery = query;
TextView countrycountTextView = (TextView) getView().findViewById(R.id.countrycounttextview);
Country[] countries;
String selection;
switch (sectionNumber) {
case 2:
searchstring = query.trim();
if (searchstring.trim().equals("")) {
searchstring = "Filter Countries/Areas";
searchView.setQueryHint(searchstring);
}
selection = ((Spinner) getView().findViewById(R.id.listViewSpinner)).getSelectedItem().toString();
countries = getCountriesBySearch(query, getCountriesByLevel(selection));
if (countrycount != null) {
countrycountTextView.setVisibility(View.VISIBLE);
countrycountTextView.setText(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.announceForAccessibility(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.setContentDescription(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.setFocusable(true);
countrycountTextView.setFocusableInTouchMode(true);
} else {
countrycountTextView.setVisibility(View.GONE);
}
break;
case 3:
searchstring = query.trim();
if (searchstring.trim().equals("")) {
searchstring = "Filter Countries/Areas";
searchView.setQueryHint(searchstring);
}
selection = ((Spinner) getView().findViewById(R.id.listViewSpinner)).getSelectedItem().toString();
countries = getCountriesBySearch(query, getCountriesByRegion(selection));
if (countrycount != null) {
countrycountTextView.setVisibility(View.VISIBLE);
countrycountTextView.setText(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.announceForAccessibility(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.setContentDescription(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.setFocusable(true);
countrycountTextView.setFocusableInTouchMode(true);
} else {
countrycountTextView.setVisibility(View.GONE);
}
break;
default:
searchstring = query.trim();
countries = getCountriesBySearch(query);

if (countrycount != null) {
countrycountTextView.setVisibility(View.VISIBLE);
countrycountTextView.setText(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.announceForAccessibility(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.setContentDescription(String.valueOf(countrycount) + " results found for " + query.trim());
countrycountTextView.setFocusable(true);
countrycountTextView.setFocusableInTouchMode(true);
} else {
countrycountTextView.setVisibility(View.GONE);
}
}

CountryListAdapter itemsAdapter = new CountryListAdapter(getActivity(), countries, 1);
ListView listView = (ListView) getView().findViewById(R.id.listView);
listView.setAdapter(itemsAdapter);
}else{
if( !searchQuery.trim().equals("")) {
searchView.setQuery(searchQuery, false);
}
}
CountryListAdapter itemsAdapter = new CountryListAdapter(getActivity(), countries, 1);
ListView listView = (ListView) getView().findViewById(R.id.listView);
listView.setAdapter(itemsAdapter);
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/gov/dol/childlabor/ToolKitActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected void onCreate(Bundle savedInstanceState) {
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=gov.dol.complychain"));
intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=gov.dol.complychain&hl=en_US&gl=US&pli=1"));//"market://details?id=gov.dol.complychain"));
startActivity(intent);
// Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.dol.gov/ComplyChain"));
// startActivity(intent);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_charts_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Goods By Region"
android:visibility="gone"
android:drawableRight="@drawable/ic_baseline_keyboard_arrow_right_24"
app:drawableEndCompat="@drawable/ic_baseline_keyboard_arrow_right_24" />
<TextView
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/content_menu_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<TextView
android:id="@+id/textView10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="#dadada" />

Expand Down Expand Up @@ -177,7 +177,7 @@
<TextView
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="#dadada" />
<TextView
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/menu/menu_search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
xmlns:tools="http://schemas.android.com/tools">
<item android:id="@+id/search"
android:title="Filter"
android:digits="abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"
android:icon="@android:drawable/ic_menu_search"
app:showAsAction="always"
app:actionViewClass="android.widget.SearchView" />
app:actionViewClass="android.widget.SearchView"
/>
</menu>

0 comments on commit 222c02d

Please sign in to comment.