use of androidx.recyclerview.widget.LinearLayoutManager in project Douya by DreaminginCodeZH.
the class ProfileItemsLayout method init.
private void init() {
ViewUtils.inflateInto(R.layout.profile_items_layout, this);
ButterKnife.bind(this);
mItemList.setHasFixedSize(true);
mItemList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
mItemAdapter = new ProfileItemAdapter();
mItemList.setAdapter(mItemAdapter);
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Weather by Sparker0i.
the class WeatherFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_weather, container, false);
ButterKnife.bind(this, rootView);
MaterialDialog.Builder builder = new MaterialDialog.Builder(this.activity()).title(getString(R.string.please_wait)).content(getString(R.string.loading)).cancelable(false).progress(true, 0);
pd = builder.build();
setHasOptionsMenu(true);
preferences = new Prefs(context());
weatherFont = Typeface.createFromAsset(activity().getAssets(), "fonts/weather-icons-v2.0.10.ttf");
fab = ((WeatherActivity) activity()).findViewById(R.id.fab);
Bundle bundle = getArguments();
fabProgressCircle = ((WeatherActivity) activity()).findViewById(R.id.fabProgressCircle);
int mode;
if (bundle != null)
mode = bundle.getInt(Constants.MODE, 0);
else
mode = 0;
if (mode == 0)
updateWeatherData(preferences.getCity(), null, null);
else
updateWeatherData(null, Float.toString(preferences.getLatitude()), Float.toString(preferences.getLongitude()));
gps = new GPSTracker(context());
cityField.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
updatedField.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
humidityView.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
sunriseIcon.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
sunriseIcon.setTypeface(weatherFont);
sunriseIcon.setText(activity().getString(R.string.sunrise_icon));
sunsetIcon.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
sunsetIcon.setTypeface(weatherFont);
sunsetIcon.setText(activity().getString(R.string.sunset_icon));
humidityIcon.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
humidityIcon.setTypeface(weatherFont);
humidityIcon.setText(activity().getString(R.string.humidity_icon));
windView.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
swipeView.setColorSchemeResources(R.color.red, R.color.green, R.color.blue, R.color.yellow, R.color.orange);
swipeView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
handler.post(new Runnable() {
@Override
public void run() {
changeCity(preferences.getCity());
swipeView.setRefreshing(false);
}
});
}
});
horizontalLayoutManager = new LinearLayoutManager(context(), LinearLayoutManager.HORIZONTAL, false);
horizontalRecyclerView.setLayoutManager(horizontalLayoutManager);
horizontalRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (horizontalLayoutManager.findLastVisibleItemPosition() == 9 || citys != null)
fab.hide();
else
fab.show();
}
});
directionView.setTypeface(weatherFont);
directionView.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
dailyView.setText(getString(R.string.daily));
dailyView.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
sunriseView.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
sunsetView.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
button.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
pd.show();
horizontalRecyclerView.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
weatherIcon.setTypeface(weatherFont);
weatherIcon.setTextColor(ContextCompat.getColor(context(), R.color.textColor));
if (citys == null)
((WeatherActivity) activity()).showFab();
else
((WeatherActivity) activity()).hideFab();
return rootView;
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Conversations by siacs.
the class ChooseCountryActivity method onCreate.
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(ThemeHelper.find(this));
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_choose_country);
setSupportActionBar((Toolbar) this.binding.toolbar);
configureActionBar(getSupportActionBar());
this.countries.addAll(PhoneNumberUtilWrapper.getCountries(this));
Collections.sort(this.countries);
this.binding.countries.setAdapter(countryAdapter);
this.binding.countries.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
countryAdapter.setOnCountryClicked(this);
countryAdapter.notifyDataSetChanged();
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Conversations by siacs.
the class ShareWithActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_share_with);
setSupportActionBar(findViewById(R.id.toolbar));
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
getSupportActionBar().setHomeButtonEnabled(false);
}
setTitle(getString(R.string.title_activity_sharewith));
RecyclerView mListView = findViewById(R.id.choose_conversation_list);
mAdapter = new ConversationAdapter(this, this.mConversations);
mListView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mListView.setAdapter(mAdapter);
mAdapter.setConversationClickListener((view, conversation) -> share(conversation));
this.share = new Share();
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Conversations by siacs.
the class ConversationsOverviewFragment method onCreateView.
@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
this.mSwipeEscapeVelocity = getResources().getDimension(R.dimen.swipe_escape_velocity);
this.binding = DataBindingUtil.inflate(inflater, R.layout.fragment_conversations_overview, container, false);
this.binding.fab.setOnClickListener((view) -> StartConversationActivity.launch(getActivity()));
this.conversationsAdapter = new ConversationAdapter(this.activity, this.conversations);
this.conversationsAdapter.setConversationClickListener((view, conversation) -> {
if (activity instanceof OnConversationSelected) {
((OnConversationSelected) activity).onConversationSelected(conversation);
} else {
Log.w(ConversationsOverviewFragment.class.getCanonicalName(), "Activity does not implement OnConversationSelected");
}
});
this.binding.list.setAdapter(this.conversationsAdapter);
this.binding.list.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
this.touchHelper = new ItemTouchHelper(this.callback);
this.touchHelper.attachToRecyclerView(this.binding.list);
return binding.getRoot();
}
Aggregations