Search in sources :

Example 36 with LinearLayoutManager

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);
}
Also used : LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 37 with LinearLayoutManager

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;
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Bundle(android.os.Bundle) Prefs(com.a5corp.weather.preferences.Prefs) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) SwipeRefreshLayout(androidx.swiperefreshlayout.widget.SwipeRefreshLayout) GPSTracker(com.a5corp.weather.permissions.GPSTracker) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Example 38 with LinearLayoutManager

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();
}
Also used : LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 39 with LinearLayoutManager

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();
}
Also used : ConversationAdapter(eu.siacs.conversations.ui.adapter.ConversationAdapter) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 40 with LinearLayoutManager

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();
}
Also used : ItemTouchHelper(androidx.recyclerview.widget.ItemTouchHelper) OnConversationSelected(eu.siacs.conversations.ui.interfaces.OnConversationSelected) ConversationAdapter(eu.siacs.conversations.ui.adapter.ConversationAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Aggregations

LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)470 RecyclerView (androidx.recyclerview.widget.RecyclerView)281 View (android.view.View)183 TextView (android.widget.TextView)65 ArrayList (java.util.ArrayList)37 Nullable (androidx.annotation.Nullable)33 Bundle (android.os.Bundle)32 Toolbar (androidx.appcompat.widget.Toolbar)32 Intent (android.content.Intent)30 ImageView (android.widget.ImageView)27 List (java.util.List)24 Test (org.junit.Test)24 Context (android.content.Context)23 NonNull (androidx.annotation.NonNull)23 ViewGroup (android.view.ViewGroup)22 AlertDialog (androidx.appcompat.app.AlertDialog)21 ContextualCard (com.android.settings.homepage.contextualcards.ContextualCard)20 LayoutInflater (android.view.LayoutInflater)18 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)16 SwipeRefreshLayout (androidx.swiperefreshlayout.widget.SwipeRefreshLayout)16