diff --git a/android/app/src/main/java/io/highfidelity/hifiinterface/HomeActivity.java b/android/app/src/main/java/io/highfidelity/hifiinterface/HomeActivity.java index 1257ad2b52..4227de4ac9 100644 --- a/android/app/src/main/java/io/highfidelity/hifiinterface/HomeActivity.java +++ b/android/app/src/main/java/io/highfidelity/hifiinterface/HomeActivity.java @@ -1,7 +1,6 @@ package io.highfidelity.hifiinterface; import android.content.Intent; -import android.graphics.Color; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.NavigationView; @@ -19,6 +18,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; +import android.widget.ImageView; import android.widget.TextView; import io.highfidelity.hifiinterface.view.DomainAdapter; @@ -41,6 +41,9 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On private NavigationView mNavigationView; private RecyclerView mDomainsView; private TextView searchNoResultsView; + private ImageView mSearchIconView; + private ImageView mClearSearch; + private EditText mSearchView; @Override protected void onCreate(Bundle savedInstanceState) { @@ -94,16 +97,11 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On }); mDomainsView.setAdapter(mDomainAdapter); - EditText searchView = findViewById(R.id.searchView); - int searchPlateId = searchView.getContext().getResources().getIdentifier("android:id/search_plate", null, null); - View searchPlate = searchView.findViewById(searchPlateId); - if (searchPlate != null) { - searchPlate.setBackgroundColor (Color.TRANSPARENT); - int searchTextId = searchPlate.getContext ().getResources ().getIdentifier ("android:id/search_src_text", null, null); - TextView searchTextView = searchView.findViewById(searchTextId); - searchTextView.setTextAppearance(R.style.SearchText); - } - searchView.addTextChangedListener(new TextWatcher() { + mSearchView = findViewById(R.id.searchView); + mSearchIconView = findViewById(R.id.search_mag_icon); + mClearSearch = findViewById(R.id.search_clear); + + mSearchView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {} @@ -113,11 +111,18 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On @Override public void afterTextChanged(Editable editable) { mDomainAdapter.loadDomains(editable.toString()); + if(editable.length()>0) { + mSearchIconView.setVisibility(View.GONE); + mClearSearch.setVisibility(View.VISIBLE); + } else { + mSearchIconView.setVisibility(View.VISIBLE); + mClearSearch.setVisibility(View.GONE); + } } }); - searchView.setOnKeyListener((view, i, keyEvent) -> { + mSearchView.setOnKeyListener((view, i, keyEvent) -> { if (i == KeyEvent.KEYCODE_ENTER) { - String urlString = searchView.getText().toString(); + String urlString = mSearchView.getText().toString(); if (!urlString.trim().isEmpty()) { urlString = HifiUtils.getInstance().sanitizeHifiUrl(urlString); } @@ -126,6 +131,7 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On } return false; }); + updateLoginMenu(); } @@ -215,4 +221,8 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On public void onBackPressed() { finishAffinity(); } + + public void onSearchClear(View view) { + mSearchView.setText(""); + } } diff --git a/android/app/src/main/java/io/highfidelity/hifiinterface/provider/UserStoryDomainProvider.java b/android/app/src/main/java/io/highfidelity/hifiinterface/provider/UserStoryDomainProvider.java index 32980e6547..50202234e9 100644 --- a/android/app/src/main/java/io/highfidelity/hifiinterface/provider/UserStoryDomainProvider.java +++ b/android/app/src/main/java/io/highfidelity/hifiinterface/provider/UserStoryDomainProvider.java @@ -79,6 +79,7 @@ public class UserStoryDomainProvider implements DomainProvider { true, mProtocol, pageNumber); + Log.d("API-USER-STORY-DOMAINS", "Protocol [" + mProtocol + "] include_actions [" + INCLUDE_ACTIONS_FOR_PLACES + "]"); userStories.enqueue(new retrofit2.Callback() { @Override public void onResponse(Call call, Response response) { diff --git a/android/app/src/main/res/drawable/ic_clear.xml b/android/app/src/main/res/drawable/ic_clear.xml new file mode 100644 index 0000000000..94efe2bbdb --- /dev/null +++ b/android/app/src/main/res/drawable/ic_clear.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/android/app/src/main/res/drawable/ic_search.xml b/android/app/src/main/res/drawable/ic_search.xml new file mode 100644 index 0000000000..099c8ea953 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_search.xml @@ -0,0 +1,4 @@ + + + diff --git a/android/app/src/main/res/layout/content_home.xml b/android/app/src/main/res/layout/content_home.xml index 2b6f8d94d6..59a7abb66c 100644 --- a/android/app/src/main/res/layout/content_home.xml +++ b/android/app/src/main/res/layout/content_home.xml @@ -17,13 +17,37 @@ android:background="@drawable/search_bg" android:gravity="center_vertical|end" android:paddingStart="32dp" - android:paddingEnd="32dp" + android:paddingEnd="56dp" android:fontFamily="@font/raleway" android:hint="@string/search_hint" android:inputType="textUri" android:imeOptions="actionGo" /> + + + + #ffffff - #272727 + @color/backgroundLight #000000 #54D7FD #E3E3E3