Skip to content

Commit

Permalink
Fix issue #24,#19,#32,#42 and able to set auto item selection on star…
Browse files Browse the repository at this point in the history
…t and enable/disable dropdown hint
  • Loading branch information
Chivorns committed Apr 3, 2021
1 parent b78d837 commit f4ad916
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private void initSpinnerInJava() {
spProvinceDialog.setItem(provinceList);
spCustomColor.setItem(provinceList);
spCustomView.setItem(provinceList);
spNoHint.setItem(provinceList);

spSearchable.setSearchDialogGravity(Gravity.TOP);
spSearchable.setErrorTextAlignment(SmartMaterialSpinner.TextAlignment.ALIGN_LEFT);
Expand All @@ -44,7 +45,7 @@ private void initSpinnerInJava() {
spCustomColor.setItemListColor(ContextCompat.getColor(this, R.color.custom_item_list_color));

setOnEmptySpinnerClickListener(spEmptyItem);
setOnItemSelectedListener(spSearchable, spReSelectable, spProvince, spProvinceOutlinedStyle, spProvinceDialog, spCustomColor, spEmptyItem, spVisibilityChanged);
setOnItemSelectedListener(spSearchable, spReSelectable, spProvince, spProvinceOutlinedStyle, spProvinceDialog, spCustomColor, spEmptyItem, spVisibilityChanged, spCustomView, spNoHint);
setOnSpinnerEventListener(spSearchable, spReSelectable, spProvince, spProvinceOutlinedStyle, spProvinceDialog, spCustomColor, spEmptyItem);
// setItemTextSize(90, spSearchable, spProvince, spProvinceNoHint, spProvinceDialog, spCustomColor, spEmptyItem);
// setErrorTextSize(90, spSearchable, spProvince, spProvinceNoHint, spProvinceDialog, spCustomColor, spEmptyItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class MainActivity<T> : MainApp<T>() {
spProvinceOutlinedStyle!!.item = provinceList
spProvinceDialog!!.item = provinceList
spCustomColor!!.item = provinceList
spNoHint!!.item = provinceList

setOnEmptySpinnerClickListener(spEmptyItem)
setOnItemSelectedListener(spSearchable, spProvince, spProvinceOutlinedStyle, spProvinceDialog, spCustomColor, spEmptyItem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class MainApp<T> extends AppCompatActivity implements View.OnClickListene
protected SmartMaterialSpinner<String> spEmptyItem;
protected SmartMaterialSpinner<String> spCustomView;
protected SmartMaterialSpinner<String> spVisibilityChanged;
protected SmartMaterialSpinner<String> spNoHint;

private LinearLayout githubRepo;
private Button btnShowError;
Expand All @@ -47,6 +48,8 @@ public void initBaseView() {
spEmptyItem = findViewById(R.id.sp_empty_item);
spCustomView = findViewById(R.id.sp_custom_search_item_layout);
spVisibilityChanged = findViewById(R.id.sp_visibility_changed);
spNoHint = findViewById(R.id.sp_provinces_no_hint);

githubRepo = findViewById(R.id.git_repo_container);
btnShowError = findViewById(R.id.btn_show_error);
btnGotoRuntimeRender = findViewById(R.id.btn_goto_runtime_render);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,25 @@
android:padding="10dp"
android:weightSum="2">

<TextView
style="@style/headerTextStyle"
android:text="@string/outlined_style" />

<com.chivorn.smartmaterialspinner.SmartMaterialSpinner
android:id="@+id/sp_provinces_outlined_style"
style="@style/spinnerStyle"
app:smsp_arrowColor="#3da4ab"
app:smsp_errorText="@string/sample_error_message"
app:smsp_hint="Outlined Style"
app:smsp_hintColor="#fe8a71"
app:smsp_isOutlined="true"
app:smsp_multilineError="false"
app:smsp_outlinedBoxColor="#0e9aa7"
app:smsp_outlinedBoxRadius="12dp"
app:smsp_outlinedHintPadding="4dp"
app:smsp_outlinedHintStartX="10dp"
app:smsp_outlinedStrokeWidth="1dp" />

<TextView
style="@style/headerTextStyle"
android:text="@string/searchable_spinner" />
Expand All @@ -29,18 +48,6 @@
app:smsp_searchTextColor="@color/search_text_color"
app:smsp_typeface="fonts/hinted_cello_sans_light" />

<TextView
style="@style/headerTextStyle"
android:text="Re-Selectable Spinner" />

<com.chivorn.smartmaterialspinner.SmartMaterialSpinner
android:id="@+id/sp_reselectable"
style="@style/spinnerStyle"
app:smsp_errorText="@string/sample_error_message"
app:smsp_hint="Re-Selectable Spinner"
app:smsp_isReSelectable="true"
app:smsp_typeface="@font/hinted_cello_sans_medium_italic" />

<TextView
style="@style/headerTextStyle"
android:text="@string/dropdown_spinner" />
Expand All @@ -52,21 +59,6 @@
app:smsp_hint="Province (Dropdown Mode)"
app:smsp_multilineError="false" />

<com.chivorn.smartmaterialspinner.SmartMaterialSpinner
android:id="@+id/sp_provinces_outlined_style"
style="@style/spinnerStyle"
app:smsp_arrowColor="#3da4ab"
app:smsp_errorText="@string/sample_error_message"
app:smsp_hint="Outlined Style"
app:smsp_hintColor="#fe8a71"
app:smsp_isOutlined="true"
app:smsp_multilineError="false"
app:smsp_outlinedBoxColor="#0e9aa7"
app:smsp_outlinedBoxRadius="12dp"
app:smsp_outlinedHintPadding="4dp"
app:smsp_outlinedHintStartX="10dp"
app:smsp_outlinedStrokeWidth="1dp" />

<TextView
style="@style/headerTextStyle"
android:text="@string/dialog_spinner" />
Expand All @@ -78,6 +70,26 @@
app:smsp_hint="Province (Dialog Mode)"
app:smsp_multilineError="true" />

<TextView
style="@style/headerTextStyle"
android:text="@string/spinner_no_hint" />

<com.chivorn.smartmaterialspinner.SmartMaterialSpinner
android:id="@+id/sp_provinces_no_hint"
style="@style/spinnerStyle" />

<TextView
style="@style/headerTextStyle"
android:text="@string/re_selectable_spinner" />

<com.chivorn.smartmaterialspinner.SmartMaterialSpinner
android:id="@+id/sp_reselectable"
style="@style/spinnerStyle"
app:smsp_errorText="@string/sample_error_message"
app:smsp_hint="Re-Selectable Spinner"
app:smsp_isReSelectable="true"
app:smsp_typeface="@font/hinted_cello_sans_medium_italic" />

<TextView
style="@style/headerTextStyle"
android:text="@string/custom_color" />
Expand Down
3 changes: 3 additions & 0 deletions resources/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@
<string name="test_visibility_changed">Test Visibility Changed</string>
<string name="show_spinner">Show Spinner</string>
<string name="hide_spinner">Hide Spinner</string>
<string name="outlined_style">Outlined Style</string>
<string name="re_selectable_spinner">Re-Selectable Spinner</string>
<string name="spinner_no_hint">Spinner no hint</string>
</resources>
Loading

0 comments on commit f4ad916

Please sign in to comment.