mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
Search activity price seekbar layout
This commit is contained in:
parent
8fa081e4b7
commit
e98d2a6a93
@ -51,5 +51,5 @@ dependencies {
|
|||||||
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
||||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
|
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.8.1'
|
implementation 'com.squareup.okhttp3:okhttp:4.8.1'
|
||||||
|
implementation 'com.crystal:crystalrangeseekbar:1.1.3'
|
||||||
}
|
}
|
||||||
@ -10,9 +10,18 @@ import android.widget.AdapterView;
|
|||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
|
import com.crystal.crystalrangeseekbar.interfaces.OnRangeSeekbarChangeListener;
|
||||||
|
import com.crystal.crystalrangeseekbar.interfaces.OnRangeSeekbarFinalValueListener;
|
||||||
|
import com.crystal.crystalrangeseekbar.widgets.CrystalRangeSeekbar;
|
||||||
|
|
||||||
|
import org.w3c.dom.Text;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
||||||
@ -136,6 +145,31 @@ public class SortDialogFragment extends DialogFragment {
|
|||||||
sortDirectionButton.setEnabled(false);
|
sortDirectionButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set up the seekbar for price
|
||||||
|
final CrystalRangeSeekbar priceSeekbar = (CrystalRangeSeekbar) root.findViewById(R.id.price_range_seekbar);
|
||||||
|
final TextView tvMin = (TextView) root.findViewById(R.id.tv_min_price);
|
||||||
|
final TextView tvMax = (TextView) root.findViewById(R.id.tv_max_price);
|
||||||
|
|
||||||
|
priceSeekbar.setMaxValue(367);
|
||||||
|
|
||||||
|
// Update price display
|
||||||
|
priceSeekbar.setOnRangeSeekbarChangeListener(new OnRangeSeekbarChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void valueChanged(Number minValue, Number maxValue) {
|
||||||
|
tvMin.setText(String.format("$%.2f", minValue.doubleValue()));
|
||||||
|
tvMax.setText(String.format("$%.2f", maxValue.doubleValue()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Save price values when user finishes moving the slider
|
||||||
|
priceSeekbar.setOnRangeSeekbarFinalValueListener(new OnRangeSeekbarFinalValueListener() {
|
||||||
|
@Override
|
||||||
|
public void finalValue(Number minValue, Number maxValue) {
|
||||||
|
System.out.println(String.format("Min: $%.2f, Max: $%.2f", minValue.doubleValue(), maxValue.doubleValue()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="100dp"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="15dp">
|
android:paddingStart="15dp">
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
@ -50,4 +50,45 @@
|
|||||||
android:src="@drawable/ic_baseline_arrow_upward_50"/>
|
android:src="@drawable/ic_baseline_arrow_upward_50"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_price_label"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:text="Price" />
|
||||||
|
|
||||||
|
<com.crystal.crystalrangeseekbar.widgets.CrystalRangeSeekbar
|
||||||
|
android:id="@+id/price_range_seekbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="10dp"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_min_price"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:text="$00.00" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_max_price"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:gravity="end"
|
||||||
|
android:text="$00.00" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
Loading…
Reference in New Issue
Block a user