-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from huttneab/reg_flow_rearrange
Rearrange Registration Flow
- Loading branch information
Showing
35 changed files
with
667 additions
and
510 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
app/src/main/java/com/rockthevote/grommet/ui/misc/BetterSpinner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.rockthevote.grommet.ui.misc; | ||
|
||
import android.content.Context; | ||
import android.support.annotation.NonNull; | ||
import android.support.design.widget.TextInputEditText; | ||
import android.support.design.widget.TextInputLayout; | ||
import android.support.v7.widget.ListPopupWindow; | ||
import android.util.AttributeSet; | ||
import android.widget.AdapterView; | ||
import android.widget.ListAdapter; | ||
|
||
import com.rockthevote.grommet.R; | ||
|
||
|
||
public class BetterSpinner extends TextInputLayout { | ||
|
||
ListPopupWindow listPopupWindow; | ||
ListAdapter listAdapter; | ||
TextInputEditText editText; | ||
|
||
public BetterSpinner(Context context) { | ||
this(context, null); | ||
} | ||
|
||
public BetterSpinner(Context context, AttributeSet attrs) { | ||
this(context, attrs, 0); | ||
} | ||
|
||
public BetterSpinner(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
|
||
editText = new TextInputEditText(context); | ||
editText.setId(R.id.titleId); | ||
editText.setHeight((int) getResources().getDimension(R.dimen.list_item_height)); | ||
editText.setFocusable(false); | ||
editText.setMaxLines(1); | ||
editText.setCursorVisible(false); | ||
editText.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, | ||
R.drawable.drop_down_arrow, 0); | ||
|
||
addView(editText, 0); | ||
listPopupWindow = new ListPopupWindow(context); | ||
listPopupWindow.setAnchorView(editText); | ||
} | ||
|
||
public void setAdapter(ListAdapter listAdapter) { | ||
this.listAdapter = listAdapter; | ||
listPopupWindow.setAdapter(listAdapter); | ||
getEditText().setOnClickListener(view -> listPopupWindow.show()); | ||
} | ||
|
||
public void setOnItemClickListener(AdapterView.OnItemClickListener listener) { | ||
listPopupWindow.setOnItemClickListener(listener); | ||
} | ||
|
||
public void dismiss() { | ||
listPopupWindow.dismiss(); | ||
} | ||
|
||
/** | ||
* set the height of the popup window in pixes | ||
*/ | ||
public void setHeight(int height) { | ||
listPopupWindow.setHeight(height); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public TextInputEditText getEditText() { | ||
return editText; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/rockthevote/grommet/ui/misc/BetterSpinnerValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.rockthevote.grommet.ui.misc; | ||
|
||
import com.mobsandgeeks.saripaar.adapter.ViewDataAdapter; | ||
import com.mobsandgeeks.saripaar.exception.ConversionException; | ||
|
||
public class BetterSpinnerValidator implements ViewDataAdapter<BetterSpinner, String> { | ||
@Override | ||
public String getData(BetterSpinner view) throws ConversionException { | ||
if (view.getEditText() != null) { | ||
return view.getEditText().getText().toString(); | ||
} else { | ||
return ""; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.