Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handwritten setters that might be useful #27

Open
6 tasks done
zserge opened this issue Oct 4, 2015 · 8 comments
Open
6 tasks done

Handwritten setters that might be useful #27

zserge opened this issue Oct 4, 2015 · 8 comments

Comments

@zserge
Copy link
Collaborator

zserge commented Oct 4, 2015

Currently Anvil contains lots of autogenerated bindings for all setters of all
views in Android SDK, starting with "set" and having exactly one parameter
(normally a value to set). Some setters are not covered - the ones that start
with "add" (like addTextChangedListeer and the ones having more than a single
parameter (like setLineSpacing).

As it was discussed previously in issue #15 - missing setters will be added if
someone finds real need in them (most of them are really exotic), and makes a
pull-request. The list of setters has been taken from the recent android.jar of
API Level 23.

I suggest to split this in two phases:

  • If you find a missing setting really useful - mention it in the comments, and
    I will move it to the "TODO" task list.
  • If you want to implement one of the unimplemented setters from the task list
    please make a pull request, and I will mark the task as done.

TODO

  • addTextChangedListener(TextWatcher) in TextView (implemented as text and
    onTextChanged bindings)
  • setShadowLayer(float,float,float,int) in TextView
  • setPadding(int,int,int,int) - implemented as 1, 2 or 4 parameter function
  • setTag(int, Object) - beware, tag ID should be from R.id.something, not just a random number
  • setTypeface(Typeface,int) inTextView
  • check(int) in RadioGroup

Missing setters starting with "add", not "set"

  • addChildrenForAccessibility(ArrayList) : View
  • addFocusables(ArrayList,int) : View
  • addFocusables(ArrayList,int,int) : View
  • addFooterView(View) : ListView
  • addFooterView(View,Object,boolean) : ListView
  • addHeaderView(View) : ListView
  • addHeaderView(View,Object,boolean) : ListView
  • addJavascriptInterface(Object,String) : WebView
  • addOnAttachStateChangeListener(View$OnAttachStateChangeListener) : View
  • addOnGestureListener(GestureOverlayView$OnGestureListener) : GestureOverlayView
  • addOnGesturePerformedListener(GestureOverlayView$OnGesturePerformedListener) : GestureOverlayView
  • addOnGesturingListener(GestureOverlayView$OnGesturingListener) : GestureOverlayView
  • addOnLayoutChangeListener(View$OnLayoutChangeListener) : View
  • addSubtitleSource(InputStream,MediaFormat) : VideoView
  • addTab(TabHost$TabSpec) : TabHost
  • addTouchables(ArrayList) : View

Missing setters with more than one parameter

  • setAppWidget(int,android.appwidget.AppWidgetProviderInfo) : AppWidgetHostView
  • setChildIndicatorBounds(int,int) : ExpandableListView
  • setChildIndicatorBoundsRelative(int,int) : ExpandableListView
  • setColorFilter(int,PorterDuff$Mode) : ImageView
  • setColumnCollapsed(int,boolean) : TableLayout
  • setColumnShrinkable(int,boolean) : TableLayout
  • setColumnStretchable(int,boolean) : TableLayout
  • setCompoundDrawables(Drawable,Drawable,Drawable,Drawable) : TextView
  • setCompoundDrawablesRelative(Drawable,Drawable,Drawable,Drawable) : TextView
  • setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable,Drawable,Drawable,Drawable) : TextView
  • setCompoundDrawablesRelativeWithIntrinsicBounds(int,int,int,int) : TextView
  • setCompoundDrawablesWithIntrinsicBounds(Drawable,Drawable,Drawable,Drawable) : TextView
  • setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) : TextView
  • setContentInsetsAbsolute(int,int) : Toolbar
  • setContentInsetsRelative(int,int) : Toolbar
  • setDate(long,boolean,boolean) : CalendarView
  • setEGLConfigChooser(int,int,int,int,int,int) : GLSurfaceView
  • setError(CharSequence,Drawable) : TextView
  • setHttpAuthUsernamePassword(String,String,String,String) : WebView
  • setImageState(int[],boolean) : ImageView
  • setImeActionLabel(CharSequence,int) : TextView
  • setInAnimation(Context,int) : AdapterViewAnimator
  • setInAnimation(Context,int) : ViewAnimator
  • setIndicatorBounds(int,int) : ExpandableListView
  • setIndicatorBoundsRelative(int,int) : ExpandableListView
  • setInputExtras(int) throws org.xmlpull.v1.XmlPullParserException,java.io.IOException : TextView
  • setInterpolator(Context,int) : ProgressBar
  • setItemChecked(int,boolean) : AbsListView
  • setLayerType(int,Paint) : TextureView
  • setLayerType(int,Paint) : View
  • setLayerType(int,Paint) : WebView
  • setLineSpacing(float,float) : TextView
  • setOutAnimation(Context,int) : AdapterViewAnimator
  • setOutAnimation(Context,int) : ViewAnimator
  • setPaddingRelative(int,int,int,int) : TextView
  • setPaddingRelative(int,int,int,int) : View
  • setParentTitle(CharSequence,CharSequence,View$OnClickListener) : FragmentBreadCrumbs
  • setPopupOffset(int,int) : KeyboardView
  • setPrevNextListeners(View$OnClickListener,View$OnClickListener) : MediaController
  • setQuery(CharSequence,boolean) : SearchView
  • setScrollIndicators(View,View) : AbsListView
  • setScrollIndicators(int,int) : View
  • setSelectedChild(int,int,boolean) : ExpandableListView
  • setSelection(int,boolean) : AbsSpinner
  • setSelection(int,int) : EditText
  • setSelectionFromTop(int,int) : AbsListView
  • setSubtitleTextAppearance(Context,int) : Toolbar
  • setSwitchTextAppearance(Context,int) : Switch
  • setSwitchTypeface(Typeface,int) : Switch
  • setText(CharSequence,TextView$BufferType) : EditText
  • setText(CharSequence,TextView$BufferType) : TextView
  • setText(CharSequence,boolean) : AutoCompleteTextView
  • setText(char[],int,int) : TextView
  • setText(int,TextView$BufferType) : TextView
  • setTextAppearance(Context,int) : TextView
  • setTextKeepState(CharSequence,TextView$BufferType) : TextView
  • setTextSize(int,float) : TextView
  • setTitle(CharSequence,CharSequence) : FragmentBreadCrumbs
  • setTitleTextAppearance(Context,int) : Toolbar
  • setVideoURI(Uri,Map) : VideoView
@corbt
Copy link
Contributor

corbt commented Oct 24, 2015

I'd like to nominate setTypeface(Typeface,int) for manual implementation. It's the easiest way to style text in italics or underlined, and I use that in a few places.

I'm happy to put together a PR if that would be helpful.

@zserge
Copy link
Collaborator Author

zserge commented Oct 24, 2015

Sure, a PR for such a function is more than welcome!

@LukasVykuka
Copy link
Contributor

Hi, I just create PR #71 implementing setters for compound drawable for TextView (and so for many subclasses). But I have question: there are 3 more setters (setCompoundDrawablesRelative*) which was introduced in API 17. How to implement them if minimal API for BaseDSL is 15?

@zserge
Copy link
Collaborator Author

zserge commented May 26, 2016

@LukasVykuka if I understand it correctly, you can just wrap actual methods with if (Build.VERSION.SDK_INT >= 17) ... so they won't be called on older API levels. On the other hand I'd prefer to keep BaseDSL small, so I wonder how these Relative variants are different from just setCompoundDrawable (sorry, I'm asking because the documentation looks identical).

@LukasVykuka
Copy link
Contributor

Relative version place drawable dependently on direction of text of current Locale. Some languages are writen from right to left (https://en.wikipedia.org/wiki/Right-to-left) so if I set drawable to "start" position than it will be showed on left in normal language and on right in, e. g., in arabic language.
Non-relative version place drawable absolute, independently on laguage.

I'm happy with this methods so far.

@zserge
Copy link
Collaborator Author

zserge commented May 26, 2016

@LukasVykuka Ah, I see. I'd either leave it as it is now, or implemented via SDK_INT check so that on pre-17 devices it was calling setCompoundDrawable, but on newer devices would call a better alternative to respect the RTL languages (I believe that's what android:drawableLeft etc do in XML)

@LukasVykuka
Copy link
Contributor

I think that there should be both versions (relative and non-relative) even for API >=17 because sometimes it will be appropriate to place drawable on some side independently on text direction.

But I agree, leave it as it is now :)

Oh btw is the best lib I have found in my 3 year Android developer life! Thank you 👍

@ElectricCookie
Copy link

I'm missing "TextInputLayout.setPasswordVisibilityToggleEnabled(boolean enabled)" in the Design library. But so far I'm loving everything about anvil!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants