Skip to content

Commit

Permalink
Merge pull request Neamar#685 from diego-suarez/master
Browse files Browse the repository at this point in the history
Add preference: Large search bar
  • Loading branch information
Neamar authored Sep 4, 2017
2 parents 06c967b + 816c3c9 commit a4fa8e0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/src/main/java/fr/neamar/kiss/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.database.DataSetObserver;
import android.graphics.drawable.Drawable;
import android.os.Build;
Expand Down Expand Up @@ -151,6 +152,10 @@ public void run() {
* Task launched on text change
*/
private Searcher searcher;
/**
* Search edit layout
*/
private View searchEditLayout;

/**
* Called when the activity is first created.
Expand Down Expand Up @@ -256,6 +261,7 @@ public void onChanged() {

registerLongClickOnFavorites();
searchEditText = (EditText) findViewById(R.id.searchEditText);
searchEditLayout = findViewById(R.id.searchEditLayout);

// Listen to changes
searchEditText.addTextChangedListener(new TextWatcher() {
Expand Down Expand Up @@ -423,6 +429,17 @@ protected void onResume() {
displayKissBar(false);
}

boolean largeSearchBar = prefs.getBoolean("large-search-bar", false);
Resources res = getResources();
int searchHeight;
if (largeSearchBar) {
searchHeight = res.getDimensionPixelSize(R.dimen.large_bar_height);
} else {
searchHeight = res.getDimensionPixelSize(R.dimen.bar_height);
}
searchEditLayout.getLayoutParams().height = searchHeight;
kissBar.getLayoutParams().height = searchHeight;

//Show favorites above search field ONLY if AppProvider is already loaded
//Otherwise this will get triggered by the broadcastreceiver in the onCreate
AppProvider appProvider = KissApplication.getDataHandler(this).getAppProvider();
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<dimen name="color_swatch_margins_small">4dip</dimen>

<dimen name="bar_height">40dp</dimen>
<dimen name="large_bar_height">58dp</dimen>

<dimen name="launcher_button_width">45dp</dimen>
<dimen name="launcher_button_padding">10dp</dimen>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,5 @@
<string name="color_swatch_description">Color <xliff:g id="color_index" example="14">%1$d</xliff:g></string>
<!-- Content description for a selected color square. -->
<string name="color_swatch_description_selected">Color <xliff:g id="color_index" example="14">%1$d</xliff:g> selected</string>
<string name="large_search_bar">Large search bar</string>
</resources>
6 changes: 6 additions & 0 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@
android:key="icons-hide"
android:summary="@string/icons_hide_desc"
android:title="@string/icons_hide_main" />

<fr.neamar.kiss.SwitchPreference
android:defaultValue="false"
android:key="large-search-bar"
android:title="@string/large_search_bar" />

</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen
Expand Down

0 comments on commit a4fa8e0

Please sign in to comment.