I crated a datetime component but it's constructed automatically (I have it in a XML layout and I don't want to create it manually) but I need to pass a reference to an Activity in order to create dialogs. How can I achieve that? I tried a setter after findViewById but it's not a good solution...
public class DateTimeComponent extends RelativeLayout {
private Activity activity;
public DateComponent(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
// rest ommited
initFields();
}
private void initFields() {
dateEditText = (EditText) findViewById(R.id.dateEditText);
dateEditText.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
activity.showDialog(DATE_PICKER_DIALOG);
}
});
timeEditText = (EditText) findViewById(R.id.timeEditText);
timeEditText.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
activity.showDialog(TIME_PICKER_DIALOG);
}
});
}
// rest ommited
public Dialog getDatePickerDialog() {
int year = selectedDateTime.get(YEAR);
int month = selectedDateTime.get(MONTH);
int day = selectedDateTime.get(DAY_OF_MONTH);
return new DatePickerDialog(activity, onDateSetListener, year, month, day);
}
public Dialog getTimePickerDialog() {
int hour = selectedDateTime.get(HOUR_OF_DAY);
int minute = selectedDateTime.get(MINUTE);
return new TimePickerDialog(activity, onTimeSetListener, hour, minute, true);
}
private final OnDateSetListener onDateSetListener = new OnDateSetListener() {
#Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
// do something
}
};
private final OnTimeSetListener onTimeSetListener = new OnTimeSetListener() {
#Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
// do something
}
};
}
Perhaps this may help you:
Option 1:
public class DateTimeComponent extends RelativeLayout {
private Activity activity;
public DateTimeComponent(Activity act){
activity = act;
}
public void someListener() {
activity.showDialog(...);
}
}
Option 2:
public class DateTimeComponent extends RelativeLayout {
public void someListener(Activity act) {
act.showDialog(...);
}
}
Option 3:
...
private Activity activity;
public DateComponent(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
activity = (Activity) getContext();
// rest ommited
initFields();
}
...
Two ways -
Create a constructor that accepts a Context parameter, and have a (private?) class variable of type Context which you can use whenever.
Add an extra Context context parameter for every method that will be needing it. In some cases you may need to make that final.
The context your constructor receives IS an Activity. So, you can cast it to it. For example like this
MyActivity a = (MyActivity) getContext();
P.S. You do not need to store activity in your own field:
private Activity activity; // not needed
it is already stored inside and can be obtained by http://developer.android.com/reference/android/view/View.html#getContext()
PROOF
Custom text view:
public class MyTextView extends TextView {
public MyTextView(Context context) {
super(context);
setText(Integer.toString(System.identityHashCode(context)));
}
public MyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
setText(Integer.toString(System.identityHashCode(context)));
}
}
Activity:
public class ContextActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView textView = (TextView) findViewById(R.id.textView);
textView.setText( Integer.toString(System.identityHashCode(this)) );
}
}
Layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView" />
<com.inthemoon.incubation.MyTextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
The codes diplayed are identical.
Related
I have a ScrollView which has about 13 EditText. What I am trying to do is converting speech to text,so when the user touch any EditText and click speak button and start speaking, it will convert to text for that EditText,and when he again touch another EditText it will convert to text for that EditText with out changing the previous EditText and so on.. I used for loop but the result of one speech is found in all the 13 EditText. I also add a break statement but didn't work well.
public void onResults(Bundle bundle) {
//getting all the matches
ArrayList<String> matches = bundle
.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
if (matches != null) {
for (int j = 0; j < speEdtId.length; j++) {
eEdit = findViewById(speEdtId[j]);
if (speEdtId[j]==speEdtId[0]) {
eEdit.setText(matches.get(0));
} else if (speEdtId[j]==speEdtId[1]) {
eEdit.setText(matches.get(0));
} else if (speEdtId[j]==speEdtId[2]) {
eEdit.setText(matches.get(0));}
.
.
.
break;
}
}}
You are setting the same value to every Edittext. what you can do is:
if (speEdtId[j]==speEdtId[0]) {
eEdit.setText(matches.get(0));
matches.clear();
}
And also set tag to every Edittext and find with tag within the loop. Hope this helps
It seems like you will have a lot of Speech EditText, I am not sure how you want your program to work with EditText so I will use TextView instead in my solution. In my opinion, it would be better and more efficient to use RecyclerViews than manually creating 13 EditText.
First I will create a Speech object. You can add as many variables you want like for example Timestamp of the speech
Speech.java
public class Speech {
private String speechInText;
private String speech;
public Speech(){
}
public Speech(String speechInText, String speech) {
this.speechInText = speechInText;
this.speech = speech;
}
public String getSpeechInText() {
return speechInText;
}
public void setSpeechInText(String speechInText) {
this.speechInText = speechInText;
}
public String getSpeech() {
return speech;
}
public void setSpeech(String speech) {
this.speech = speech;
}
}
Then, I would create an adapter to each of the speeches
SpeechAdapter.java
public class SpeechAdapter extends RecyclerView.Adapter<SpeechAdapter.ViewHolder> {
public static final String TAG = SpeechAdapter.class.getName();
public interface OnItemClickListener {
void onItemClick(Speech speech, int pos);
}
private List<Speech> speeches;
private AppCompatActivity parentActivity;
private final OnItemClickListener listener;
public SpeechAdapter(AppCompatActivity parentActivity, List<Speech> speeches, OnItemClickListener listener) {
this.parentActivity = parentActivity;
this.speeches = speeches;
this.listener = listener;
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView speechInTextTV;
public ViewHolder(View v) {
super(v);
parentActivity.runOnUiThread(new Runnable() {
#Override
public void run() {
speechInTextTV = itemView.findViewById(R.id.speechInTextTV);
}
});
}
public void bind(final Speech speech,final int pos, final OnItemClickListener listener) {
itemView.setOnClickListener(new View.OnClickListener() {
#Override public void onClick(View v) {
listener.onItemClick(speech, pos);
}
});
}
}
#NonNull
#Override
public ViewHolder onCreateViewHolder(#NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.adapter_speech_list, parent, false);
return new ViewHolder(v);
}
#Override
public void onBindViewHolder(#NonNull final ViewHolder holder, int pos) {
final Speech speech = speeches.get(pos);
holder.speechInTextTV.setText(speech.getSpeechInText());
holder.bind(speech, pos, listener);
}
#Override
public int getItemCount() {
return speeches.size();
}
}
Next, I will create an XML file for the adapter
adapter_speech_list.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/white">
<TextView
android:id="#+id/speechInTextTV"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:padding="20dp"/>
</android.support.constraint.ConstraintLayout>
Finally, the Activity file or Fragment file
SpeechActivity.java
public class SpeechActivity extends AppCompatActivity{
public static final String TAG = SpeechActivity.class.getName();
private SpeechAdapter speechAdapter;
private List<Speech> speeches = new ArrayList<>();
private RecyclerView speechRV;
private int selectedSpeechPosition;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_speech);
speechRV = findViewById(R.id.speechRV);
//I add 13 text views manually here (with empty data)
for(int i = 0; i < 13; i++){
speeches.add(new Speech("",""));
}
speechAdapter = new SpeechAdapter(this, speeches, new SpeechAdapter.OnItemClickListener() {
#Override
public void onItemClick(Speech speech, int position) {
/*
you convert speech to text here
*/
selectedSpeechPosition = position;
}
});
speechRV.setNestedScrollingEnabled(false);
speechRV.setAdapter(speechAdapter);
speechRV.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
}
public void onResults(Bundle bundle) {
//getting all the matches
ArrayList<String> matches = bundle
.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
/*here you get the result of the converted speech and update the speeches list and then update the adapter to refresh the view*/
String convertedSpeech = "<PUT_YOUR_RESULT_HERE>";
speeches.set(selectedSpeechPosition,new Speech(convertedSpeech,"user's original speech or something else?"));
speechAdapter.notifyDataSetChanged();
}
}
and finally the xml file for the activity
activity_speech.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/white"
android:clickable="true">
<android.support.v7.widget.RecyclerView
android:id="#+id/speechRV"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"/>
</android.support.constraint.ConstraintLayout>
This solution is only an example and my way of doing it if I am in your spot. You should study the code and manipulate it yourself to fulfill your own requirement.
Basically, you should pass in some kind of data into the speeches List and update the adapter in the onResult function and the recycler view will be refreshed with new data. When I am initializing the adapter in the activity file, I have implemented a OnItemClick function so when the user clicks on an item in the recycler view it will save the selected speech's position so that it in the onResult function, you can know which speech you should update (by using the selectedSpeechPosition)
I'm new to coding writing a small application to select time from a custom time picker and get time from it and use it.I'm getting a NullRefrenceError.
My xml file:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:key="init_Settings">
<PreferenceCategory
android:title="Set-Time">
<com.lambdahash.sonic.ui_app.fragments.TimePick
android:id="#+id/from_time"
android:title="Time from"
android:defaultValue="--:--"
android:summary="--:--"
android:key="time-from"
/>
<com.lambdahash.sonic.ui_app.fragments.TimePick
android:id="#+id/to_time"
android:title="Time to"
android:summary="--:--"
android:defaultValue="--:--"
android:key="time-to"
/>
</PreferenceCategory>
Here TimePick is a java class that works perfectly fine for picking time.
The code:
public class TimePick extends DialogPreference {
private int lastHour=0;
private int lastMinute=0;
private TimePicker picker=null;
public static int getHour(String time) {
String[] pieces=time.split(":");
return(Integer.parseInt(pieces[0]));
}
public static int getMinute(String time) {
String[] pieces=time.split(":");
return(Integer.parseInt(pieces[1]));
}
public TimePick(Context ctxt, AttributeSet attrs) {
super(ctxt, attrs);
setPositiveButtonText("Set");
setNegativeButtonText("Cancel");
}
#Override
protected View onCreateDialogView() {
picker=new TimePicker(getContext());
return(picker);
}
#Override
protected void onBindDialogView(View v) {
super.onBindDialogView(v);
picker.setCurrentHour(lastHour);
picker.setCurrentMinute(lastMinute);
}
#Override
protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult);
if (positiveResult) {
lastHour=picker.getCurrentHour();
lastMinute=picker.getCurrentMinute();
String time=String.valueOf(lastHour)+":"+String.valueOf(lastMinute);
if (callChangeListener(time)) {
persistString(time);
}
}
}
#Override
protected Object onGetDefaultValue(TypedArray a, int index) {
return(a.getString(index));
}
}
This is where I'm getting error:
public class generalSettings extends PreferenceActivity{
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.general_settings);
TimePicker time_from = (TimePicker) findViewById(R.id.from_time);
TimePicker time_to = (TimePicker) findViewById(R.id.to_time);
time_from.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
#Override
public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
//ts.timeFrom();
Log.d("TESTF:",hourOfDay+":"+minute+"\n");
}
});
}
}
Getting
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TimePicker.setOnTimeChangedListener(android.widget.TimePicker$OnTimeChangedListener)' on a null object reference
How do I workaround this?
Try this code
Preference time_from = findPreference("time-from");
time_from.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
#Override
public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
//ts.timeFrom();
Log.d("TESTF:",hourOfDay+":"+minute+"\n");
}
});
Preference time_to= findPreference("time-to");
time_from.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
#Override
public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
//ts.timeTo();
Log.d("TESTF:",hourOfDay+":"+minute+"\n");
}
});
You should be designing it differently. You should be extending the TimePick class, once for the time_from and once for time_two. Set the onClickListener in the extended class, not in the PreferencesScreen class. You should do that by overriding the onCreateDialogView function, like this.
#Override protected View onCreateDialogView() {
picker=super.onCreateDialogView();
picker.setOnTimeChangedListener(...);
return(picker);
}
Then in your XML, put in your Extended class, rather than the TimePick class.
I'm extending the EditText class in android to incorporate additional functionality one of which is to display a dialog when clicked. I want the behaviour to be portable and hence self contained.
However setting onClickListener to itself (this) as parameter has no effect and the function onClick(View) is never called.
public class TimePickerEditText extends EditText implements View.OnClickListener, TimePickerDialog.OnTimeSetListener {
private Calendar today;
private TimePickerDialog timePickerDialog;
public TimePickerEditText(Context context) {
super(context);
postInstantiateSetup();
}
public TimePickerEditText(Context context, AttributeSet attrs) {
super(context, attrs);
postInstantiateSetup();
}
public TimePickerEditText(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
postInstantiateSetup();
}
#Override
protected void onFinishInflate() {
super.onFinishInflate();
postInstantiateSetup();
}
public void postInstantiateSetup()
{
setOnClickListener(this);
today = Calendar.getInstance();
onTimeSet(null,today.get(Calendar.HOUR_OF_DAY),today.get(Calendar.MINUTE));
}
#Override
public void onClick(View view) {
if(timePickerDialog == null) {
timePickerDialog = new TimePickerDialog(getContext(), this, 20, 0, true);
}
timePickerDialog.show();
}
#Override
public void onTimeSet(TimePicker timePicker, int hours, int minutes) {
String hoursString = ""+hours;
if(hours<10)
hoursString="0"+hoursString;
String minutesString = ""+minutes;
if(minutes<10)
minutesString="0"+minutesString;
this.setText(hoursString+":"+minutesString);
}
}
I have implemented a ricyvlerview search, and i want to listen for clicks, but context is allways null, i even tryed to move the method to an activity and i got the same result
This is my first time messing arround with Data binding i searched alot here but i can't find what i am doing wrong
item_exemple.xml
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="model"
type="pt.condutorresponsavel.android.testescodigo.Search.models.ExampleModel"/>
<variable
name="handlers"
type="pt.condutorresponsavel.android.testescodigo.Study"/>
</data>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true">
<TextView
android:onClick="#{(v) -> handlers.onCategoryClick(v,model)}"
android:ellipsize="end"
android:lines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="#{model.text}"/>
<View
android:layout_marginTop="40dp"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/colorPrimary"
android:alpha="0.17"/>
</FrameLayout>
ExampleViewHolder.java
public class ExampleViewHolder extends SortedListAdapter.ViewHolder<ExampleModel> {
private final ItemExampleBinding mBinding;
public ExampleViewHolder(ItemExampleBinding binding) {
super(binding.getRoot());
mBinding = binding;
}
#Override
protected void performBind(ExampleModel item) {
mBinding.setModel(item);
mBinding.setHandlers(new Study());
}
}
Study.java
public class Study extends Fragment {
public static Fragment fragment;
public static SearchView searchView;
Context context;
private final String[] pageNames = {"Favorites", ""};
ViewPager pager;
private OnFragmentInteractionListener mListener;
public Study() { }
public static Estudo newInstance(String param1, String param2) {
Estudo fragment = new Estudo();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_estudo, container, false);
fragment = this;
...
pager = (ViewPager) view.findViewById(R.id.pager);
pager.setAdapter(buildAdapter());
return view;
}
private PagerAdapter buildAdapter() {
return(new SampleAdapter(getActivity(), getChildFragmentManager()));
}
#Override
public void onAttach(Context context) {
super.onAttach(context);
this.context = context;
}
public interface OnFragmentInteractionListener {
void onFragmentInteraction(Uri uri);
}
public class SampleAdapter extends FragmentPagerAdapter {
Context ctxt = null;
public SampleAdapter(Context ctxt, FragmentManager mgr) {
super(mgr);
this.ctxt = ctxt;
}
#Override
public int getCount() {
return (2);
}
#Override
public Fragment getItem(int position) {
if (position == 0) {
return Favorites.newInstance(position + 1);
}else{
return otherFragment.newInstance(position + 1);
}
}
#Override
public String getPageTitle ( int position){
return (String.valueOf(pageNames[position]));
}
}
public void onCategoryClick(View view, ExampleModel model) {
Log.d("mTag", "Index: " + model.getId());
Dialog dialog = new Dialog(getActivity()); //NullPointerException
dialog.setContentView(R.layout.dialog_pergunta);
dialog.show();
}
public static class Favorites extends Fragment{...} //RecyclerView is in here
public static class otherFragment extends Fragment{...}
}
Problem
public void onCategoryClick(View view, ExampleModel model) {
Log.d("mTag", "Index: " + model.getId());
Dialog dialog = new Dialog(getActivity()); //NullPointerException
dialog.setContentView(R.layout.dialog);
dialog.show();
}
i tried setting the context in onAttach and also tried to use
final Context contex = getActivity();
but nothing worked outside onCategoryClick the context is not null but inside onCategoryClick the context is null
how can i overcome this?
EDIT
if i don't declare my interface static i get this
NullPointerException: Attempt to invoke interface method 'void pt.condutorresponsavel.android.testescodigo.Study$OnItemClick.onClick(long)' on a null object reference at
pt.condutorresponsavel.android.testescodigo.Study.onCategoryClick(Study.java:303)
I was able to fix this, there may be better options to achive the same result but since i am not a expert this was what i come up with.
I created a Interface, on my fragment when the onCategoryClick is called i call a my interface.
static OnItemClick onItemClick;
...
public void onCategoryClick(View view, ExampleModel model) {
onItemClick.onClick(model.getId());
}
public interface OnItemClick{
void onClick(long index);
}
#Override
public void onViewCreated(View view, #Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
onItemClick = new OnItemClick() {
#Override
public void onClick(long index) {
Log.d(TAG, "myIndex: " + index);
Dialog dialog = new Dialog(getActivity());
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.setContentView(R.layout.dialog);
}
}
I was trying to do this,
What I made is,
I have tried HorizontalScrollView in ListView
But can't get it properly.
Any help will be appreciated.
Here is my xml
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="8"
android:orientation="vertical">
<com.android.ViewPagerContainer
android:id="#+id/container"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</com.android.ViewPagerContainer>
</LinearLayout>
My Code is
private class ViewAdapter extends PagerAdapter {
private int count = values.size();
#Override
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
#Override
public boolean isViewFromObject(View view, Object object) {
return (view == object);
}
#Override
public LinearLayout instantiateItem(ViewGroup container, int position) {
LinearLayout llViewOuter = new LinearLayout(getActivity());
llViewOuter.setOrientation(LinearLayout.VERTICAL);
ImageView thumb_image = new ImageView(getActivity());
thumb_image.setImageResource(R.drawable.optionnor);
thumb_image.setScaleType(ImageView.ScaleType.FIT_CENTER);
llViewOuter.addView(thumb_image);
TextView tmpT = new TextView(getActivity());
tmpT.setText(values.get(position));
tmpT.setGravity(Gravity.CENTER);
llViewOuter.addView(tmpT);
final ImageView checkBox = new ImageView(getActivity());
checkBox.setImageResource(R.drawable.optionnor);
checkBox.setAdjustViewBounds(true);
checkBox.setScaleType(ImageView.ScaleType.FIT_CENTER);
checkBox.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
//checkbox2.setImageResource(R.drawable.option);
checkBox.setImageResource(R.drawable.optionselected);
}
});
llViewOuter.addView(checkBox);
((ViewPager) container).addView(llViewOuter);
return llViewOuter;
}
#Override
public void destroyItem(ViewGroup container, int position, Object object) {
((ViewPager) container).removeView((LinearLayout) object);
}
}
You can use this Horizontal ListView library https://github.com/EmirWeb/parchment.
public class ListView<ADAPTER extends Adapter> extends AbstractAdapterView<ADAPTER,View>
implements OnLongClickListener, OnClickListener,
OnSelectedListener, AdapterViewHandler {
public ListView(final Context context) {
super(context);
}
public ListView(final Context context, final AttributeSet attributeSet) {
super(context, attributeSet);
}
public ListView(final Context context, final AttributeSet attributeSet, final int defStyle) {
super(context, attributeSet, defStyle);
}
#Override
protected AdapterViewInitializer<View> getAdapterViewInitializer(final Context context, final AttributeSet attributeSet) {
final Attributes attributes = new Attributes(context, attributeSet);
final boolean isViewPager = attributes.isViewPager();
final boolean isVerticalScroll = attributes.isVertical();
final int cellSpacing = (int) attributes.getCellSpacing();
final boolean isCircularScroll = attributes.isCircularScroll();
final boolean snapToPosition = attributes.isSnapToPosition();
final int viewPagerInterval = attributes.getViewPagerInterval();
final SnapPosition snapPosition = attributes.getSnapPosition();
final boolean selectOnSnap = attributes.selectOnSnap();
final boolean selectWhileScrolling = attributes.selectWhileScrolling();
final LayoutManagerAttributes layoutManagerAttributes = new LayoutManagerAttributes(isCircularScroll, snapToPosition, isViewPager, viewPagerInterval, snapPosition, cellSpacing, selectOnSnap, selectWhileScrolling, isVerticalScroll);
final AdapterViewManager adapterViewManager = new AdapterViewManager();
final ListLayoutManager listLayoutManager = new ListLayoutManager(this, this, adapterViewManager, layoutManagerAttributes);
final AdapterViewInitializer<View> adapterViewAdapterViewInitializer = createAdapterViewInitializer(context, isViewPager, adapterViewManager, listLayoutManager, isVerticalScroll);
return adapterViewAdapterViewInitializer;
}
}
Hope you like it.