Define a custom class extending SeekBar to show the progress text on thumb of SeekBar.
public class TextThumbSeekBar extends SeekBar {
private int mThumbSize;
private TextPaint mTextPaint;
public TextThumbSeekBar(Context context) {| public class MyFragment { | |
| boolean loaded; | |
| private void maybeLoad() { | |
| if (!loaded && getUserVisibleHint()) { | |
| loaded = true; | |
| loadMyData(); | |
| } | |
| } | |
| @Override |
| <?xml version="1.0" encoding="utf-8"?> | |
| <!-- | |
| Copyright (C) 2015 The Android Open Source Project | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 |
| /* | |
| Copyright 2015 Michal Pawlowski | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software |
You can use this class to realize a simple sectioned grid RecyclerView.Adapter without changing your code.
The RecyclerView has to use a GridLayoutManager.
This is a porting of the class SimpleSectionedListAdapter provided by Google
If you are looking for a sectioned list RecyclerView.Adapter you can take a look here
| public class SettingsAdapter extends WearableListView.Adapter { | |
| private final Context context; | |
| private final List<SettingsItems> items; | |
| public SettingsAdapter(Context context, List<SettingsItems> items) { | |
| this.context = context; | |
| this.items = items; | |
| } |
| import android.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.graphics.Canvas; | |
| import android.graphics.Rect; | |
| import android.graphics.drawable.Drawable; | |
| import android.support.v7.widget.LinearLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.util.AttributeSet; | |
| import android.view.View; |
| /* | |
| * Copyright 2014 Chris Banes | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |