Commit 305aa196 authored by iman Fauzi's avatar iman Fauzi

fix broken

parent ea490968
...@@ -13,12 +13,9 @@ import android.os.PersistableBundle; ...@@ -13,12 +13,9 @@ import android.os.PersistableBundle;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.provider.Settings; import android.provider.Settings;
import android.util.Log; import android.util.Log;
import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.AdapterView; import android.widget.ImageView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
...@@ -36,7 +33,6 @@ import com.yono.messeripos.models.ProductModels; ...@@ -36,7 +33,6 @@ import com.yono.messeripos.models.ProductModels;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
public class FormProductActivity extends AppCompatActivity { public class FormProductActivity extends AppCompatActivity {
...@@ -46,12 +42,6 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -46,12 +42,6 @@ public class FormProductActivity extends AppCompatActivity {
private static final int REQUEST_IMAGE_CAPTURE = 1; private static final int REQUEST_IMAGE_CAPTURE = 1;
private static final int REQUEST_PERMISSIONS = 448; private static final int REQUEST_PERMISSIONS = 448;
private boolean isUpdate = false; private boolean isUpdate = false;
private Spinner splistCategory;
String kondisi_spin;
private String[] default_category = {
"--pilih category--",
};
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
...@@ -76,30 +66,13 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -76,30 +66,13 @@ public class FormProductActivity extends AppCompatActivity {
binding.cvProduct.setOnClickListener(view -> openFile()); binding.cvProduct.setOnClickListener(view -> openFile());
binding.btnAdd.setOnClickListener(view -> saveProduct()); binding.btnAdd.setOnClickListener(view -> saveProduct());
//spinner
final ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, default_category);
splistCategory = findViewById(R.id.listCategory);
splistCategory.setAdapter(adapter);
splistCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
kondisi_spin = splistCategory.getSelectedItem().toString();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
} }
private void saveProduct(){ private void saveProduct(){
productModels.setProductName(binding.etName.getText().toString()); productModels.setProductName(binding.etName.getText().toString());
productModels.setPriceProduct(Integer.parseInt(binding.etPrice.getText().toString())); // productModels.setPriceProduct(Integer.parseInt(binding.etPrice.getText().toString()));
productModels.setStockProduct(Integer.parseInt(binding.etStock.getText().toString())); // productModels.setStockProduct(Integer.parseInt(binding.etStock.getText().toString()));
Toast.makeText(this, productModels.getImageProduct()+" "+productModels.getProductName(), Toast.LENGTH_LONG).show(); Toast.makeText(this, productModels.getImageProduct()+" "+productModels.getProductName(), Toast.LENGTH_LONG).show();
} }
...@@ -179,5 +152,4 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -179,5 +152,4 @@ public class FormProductActivity extends AppCompatActivity {
cursor.close(); cursor.close();
return result; return result;
} }
} }
...@@ -49,7 +49,7 @@ public class PaymentActivity extends AppCompatActivity { ...@@ -49,7 +49,7 @@ public class PaymentActivity extends AppCompatActivity {
LinearLayoutManager llm = new LinearLayoutManager(this, RecyclerView.VERTICAL, false); LinearLayoutManager llm = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
rvPayment.setLayoutManager(llm); rvPayment.setLayoutManager(llm);
paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "cash")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/5c40mWX/cash-logo.png", "cash"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png", "mandiri")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png", "mandiri"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/2n65nCT/bca-bank-central-asia.png", "bca")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/2n65nCT/bca-bank-central-asia.png", "bca"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "bni")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "bni"));
......
...@@ -73,52 +73,13 @@ ...@@ -73,52 +73,13 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tfPrice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="@string/price"
android:textColor="#fff"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf="@id/tfName">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etPrice"
android:text="@{productForm.priceProduct+``}"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tfStock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="@string/stock"
android:textColor="#fff"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf="@id/tfPrice">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etStock"
android:text="@{productForm.stockProduct+``}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#fff" />
</com.google.android.material.textfield.TextInputLayout>
<Spinner <Spinner
android:layout_width="match_parent" android:id="@+id/planets_spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/listCategory" app:layout_constraintTop_toBottomOf="@id/tfName"
android:padding="25dp" app:layout_constraintStart_toStartOf="parent"/>
android:layout_margin="10dp"
android:textAlignment="textStart"
android:spinnerMode="dropdown"
app:layout_constraintTop_toBottomOf="@id/tfStock"/>
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/btnAdd" android:id="@+id/btnAdd"
...@@ -129,7 +90,6 @@ ...@@ -129,7 +90,6 @@
android:text="@string/add" android:text="@string/add"
android:padding="16dp" android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/listCategory"
app:layout_constraintVertical_bias="1.0" app:layout_constraintVertical_bias="1.0"
tools:ignore="MissingConstraints" tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="16dp" /> tools:layout_editor_absoluteX="16dp" />
......
...@@ -24,4 +24,16 @@ ...@@ -24,4 +24,16 @@
<string name="add">Add</string> <string name="add">Add</string>
<string name="hint_billing">Billing</string> <string name="hint_billing">Billing</string>
<string-array name="planets_array">
<item>Mercury</item>
<item>Venus</item>
<item>Earth</item>
<item>Mars</item>
<item>Jupiter</item>
<item>Saturn</item>
<item>Uranus</item>
<item>Neptune</item>
</string-array>
</resources> </resources>
\ No newline at end of file
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
resourcePrefix 'ms__'
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
}
}
dependencies {
implementation 'androidx.annotation:annotation:1.0.0'
testImplementation 'junit:junit:4.12'
}
VERSION_NAME=1.3.1
VERSION_CODE=131
GROUP=com.jaredrummler
POM_NAME=Material Spinner
POM_ARTIFACT_ID=material-spinner
POM_PACKAGING=aar
POM_DESCRIPTION=A spinner view for Android
POM_URL=https://github.com/jaredrummler/Material-Spinner
POM_SCM_URL=https://github.com/jaredrummler/MaterialSpinner
POM_SCM_CONNECTION=scm:git@github.com:jaredrummler/MaterialSpinner.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:jaredrummler/MaterialSpinner.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=jaredrummler
POM_DEVELOPER_NAME=Jared Rummler
SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots
RELEASE_REPOSITORY_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2
\ No newline at end of file
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
<manifest package="com.jaredrummler.materialspinner"/>
\ No newline at end of file
/*
* Copyright (C) 2016 Jared Rummler
*
* 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.jaredrummler.materialspinner;
import android.content.Context;
import java.util.List;
public class MaterialSpinnerAdapter<T> extends MaterialSpinnerBaseAdapter {
private final List<T> items;
public MaterialSpinnerAdapter(Context context, List<T> items) {
super(context);
this.items = items;
}
@Override public int getCount() {
int size = items.size();
if (size == 1 || isHintEnabled()) return size;
return size - 1;
}
@Override public T getItem(int position) {
if (isHintEnabled()) {
return items.get(position);
} else if (position >= getSelectedIndex() && items.size() != 1) {
return items.get(position + 1);
} else {
return items.get(position);
}
}
@Override public T get(int position) {
return items.get(position);
}
@Override public List<T> getItems() {
return items;
}
}
\ No newline at end of file
/*
* Copyright (C) 2016 Jared Rummler
*
* 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.jaredrummler.materialspinner;
import android.content.Context;
import android.widget.ListAdapter;
import java.util.ArrayList;
import java.util.List;
final class MaterialSpinnerAdapterWrapper extends MaterialSpinnerBaseAdapter {
private final ListAdapter listAdapter;
public MaterialSpinnerAdapterWrapper(Context context, ListAdapter toWrap) {
super(context);
listAdapter = toWrap;
}
@Override public int getCount() {
int size = listAdapter.getCount();
if (size == 1 || isHintEnabled()) return size;
return size - 1;
}
@Override public Object getItem(int position) {
if (isHintEnabled()) {
return listAdapter.getItem(position);
} else if (position >= getSelectedIndex() && listAdapter.getCount() != 1) {
return listAdapter.getItem(position + 1);
} else {
return listAdapter.getItem(position);
}
}
@Override public Object get(int position) {
return listAdapter.getItem(position);
}
@Override public List<Object> getItems() {
List<Object> items = new ArrayList<>();
for (int i = 0; i < listAdapter.getCount(); i++) {
items.add(listAdapter.getItem(i));
}
return items;
}
}
\ No newline at end of file
/*
* Copyright (C) 2016 Jared Rummler
*
* 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.jaredrummler.materialspinner;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import java.util.List;
public abstract class MaterialSpinnerBaseAdapter<T> extends BaseAdapter {
private final Context context;
private int selectedIndex;
private int textColor;
private int backgroundSelector;
private int popupPaddingTop;
private int popupPaddingLeft;
private int popupPaddingBottom;
private int popupPaddingRight;
private boolean isHintEnabled;
public MaterialSpinnerBaseAdapter(Context context) {
this.context = context;
}
@Override public View getView(int position, View convertView, ViewGroup parent) {
final TextView textView;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.ms__list_item, parent, false);
textView = (TextView) convertView.findViewById(R.id.tv_tinted_spinner);
textView.setTextColor(textColor);
textView.setPadding(popupPaddingLeft, popupPaddingTop, popupPaddingRight, popupPaddingBottom);
//
// int left, right, bottom, top;
// if (popupPaddingTop != -1) {
// left = textView.getPaddingLeft();
// right = textView.getPaddingRight();
// bottom = textView.getPaddingBottom();
//
// textView.setPadding(left, popupPaddingTop, right, bottom);
// }
//
// if (popupPaddingLeft != -1) {
// top = textView.getPaddingTop();
// right = textView.getPaddingRight();
// bottom = textView.getPaddingBottom();
//
// textView.setPadding(popupPaddingLeft, top, right, bottom);
// }
//
// if (popupPaddingBottom != -1) {
// left = textView.getPaddingLeft();
// top = textView.getPaddingTop();
// right = textView.getPaddingRight();
//
// textView.setPadding(left, top, right, popupPaddingBottom);
// }
//
// if (popupPaddingRight != -1) {
// left = textView.getPaddingLeft();
// top = textView.getPaddingTop();
// bottom = textView.getPaddingBottom();
//
// textView.setPadding(left, top, popupPaddingRight, bottom);
// }
if (backgroundSelector != 0) {
textView.setBackgroundResource(backgroundSelector);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
Configuration config = context.getResources().getConfiguration();
if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
textView.setTextDirection(View.TEXT_DIRECTION_RTL);
}
}
convertView.setTag(new ViewHolder(textView));
} else {
textView = ((ViewHolder) convertView.getTag()).textView;
}
textView.setText(getItemText(position));
return convertView;
}
public String getItemText(int position) {
return getItem(position).toString();
}
public int getSelectedIndex() {
return selectedIndex;
}
public void notifyItemSelected(int index) {
selectedIndex = index;
}
@Override public long getItemId(int position) {
return position;
}
@Override public abstract T getItem(int position);
@Override public abstract int getCount();
public abstract T get(int position);
public abstract List<T> getItems();
public void setHintEnabled(boolean isHintEnabled) {
this.isHintEnabled = isHintEnabled;
}
public boolean isHintEnabled() {
return this.isHintEnabled;
}
public MaterialSpinnerBaseAdapter<T> setTextColor(@ColorInt int textColor) {
this.textColor = textColor;
return this;
}
public MaterialSpinnerBaseAdapter<T> setBackgroundSelector(@DrawableRes int backgroundSelector) {
this.backgroundSelector = backgroundSelector;
return this;
}
public MaterialSpinnerBaseAdapter<T> setPopupPadding(int left, int top, int right, int bottom) {
this.popupPaddingLeft = left;
this.popupPaddingTop = top;
this.popupPaddingRight = right;
this.popupPaddingBottom = bottom;
return this;
}
private static class ViewHolder {
private TextView textView;
private ViewHolder(TextView textView) {
this.textView = textView;
}
}
}
\ No newline at end of file
/*
* Copyright (C) 2016 Jared Rummler
*
* 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.jaredrummler.materialspinner;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.View;
final class Utils {
/**
* Darkens a color by a given factor.
*
* @param color the color to darken
* @param factor The factor to darken the color.
* @return darker version of specified color.
*/
static int darker(int color, float factor) {
return Color.argb(Color.alpha(color), Math.max((int) (Color.red(color) * factor), 0),
Math.max((int) (Color.green(color) * factor), 0), Math.max((int) (Color.blue(color) * factor), 0));
}
/**
* Lightens a color by a given factor.
*
* @param color The color to lighten
* @param factor The factor to lighten the color. 0 will make the color unchanged. 1 will make the
* color white.
* @return lighter version of the specified color.
*/
static int lighter(int color, float factor) {
int red = (int) ((Color.red(color) * (1 - factor) / 255 + factor) * 255);
int green = (int) ((Color.green(color) * (1 - factor) / 255 + factor) * 255);
int blue = (int) ((Color.blue(color) * (1 - factor) / 255 + factor) * 255);
return Color.argb(Color.alpha(color), red, green, blue);
}
/**
* Check if layout direction is RTL
*
* @param context the current context
* @return {@code true} if the layout direction is right-to-left
*/
static boolean isRtl(Context context) {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1
&& context.getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
}
/**
* Return a drawable object associated with a particular resource ID.
*
* <p>Starting in {@link android.os.Build.VERSION_CODES#LOLLIPOP}, the returned drawable will be styled for the
* specified Context's theme.</p>
*
* @param id The desired resource identifier, as generated by the aapt tool.
* This integer encodes the package, type, and resource entry.
* The value 0 is an invalid identifier.
* @return Drawable An object that can be used to draw this resource.
*/
static Drawable getDrawable(Context context, int id) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return context.getDrawable(id);
}
return context.getResources().getDrawable(id);
}
}
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item
android:id="@android:id/mask"
android:drawable="@android:color/white"/>
<item android:bottom="1dp">
<shape>
<solid android:color="@android:color/white"/>
</shape>
</item>
</ripple>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ms__menu_down"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="180"/>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="3dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners
android:bottomLeftRadius="1dp"
android:bottomRightRadius="1dp"
android:topLeftRadius="1dp"
android:topRightRadius="1dp"/>
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M7,10L12,15L17,10H7Z"/>
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/darker_gray" android:state_pressed="true"/>
<item android:drawable="@android:color/white" android:state_pressed="false"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tv_tinted_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:minHeight="@dimen/ms__item_height"
android:paddingBottom="@dimen/ms__popup_padding_top"
android:paddingLeft="@dimen/ms__popup_padding_left"
android:paddingRight="@dimen/ms__popup_padding_left"
android:paddingStart="@dimen/ms__popup_padding_left"
android:paddingTop="@dimen/ms__popup_padding_top"
android:singleLine="true"
/>
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<resources xmlns:tools="http://schemas.android.com/tools">
<declare-styleable name="MaterialSpinner" tools:ignore="ResourceName">
<attr format="color" name="ms_arrow_tint"/>
<attr format="boolean" name="ms_hide_arrow"/>
<attr format="color" name="ms_background_color"/>
<attr format="color" name="ms_text_color"/>
<attr format="dimension" name="ms_dropdown_max_height"/>
<attr format="dimension" name="ms_dropdown_height">
<enum name="fill_parent" value="-1"/>
<enum name="match_parent" value="-1"/>
<enum name="wrap_content" value="-2"/>
</attr>
<attr format="integer" name="ms_background_selector"/>
<attr format="dimension" name="ms_padding_top"/>
<attr format="dimension" name="ms_padding_left"/>
<attr format="dimension" name="ms_padding_bottom"/>
<attr format="dimension" name="ms_padding_right"/>
<attr format="dimension" name="ms_popup_padding_top"/>
<attr format="dimension" name="ms_popup_padding_left"/>
<attr format="dimension" name="ms_popup_padding_bottom"/>
<attr format="dimension" name="ms_popup_padding_right"/>
<attr format="string" name="ms_hint"/>
<attr format="color" name="ms_hint_color"/>
</declare-styleable>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<resources>
<dimen name="ms__padding_left">24dp</dimen>
<dimen name="ms__padding_top">12dp</dimen>
<dimen name="ms__item_height">48dp</dimen>
<dimen name="ms__popup_padding_left">24dp</dimen>
<dimen name="ms__popup_padding_top">12dp</dimen>
</resources>
\ No newline at end of file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.jaredrummler.materialspinner.example"
minSdkVersion 14
targetSdkVersion 28
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation 'com.google.android.material:material:1.0.0'
implementation project(':library')
}
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<manifest package="com.jaredrummler.materialspinner.example"
xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
/*
* Copyright (C) 2016 Jared Rummler
*
* 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.jaredrummler.materialspinner.example;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.jaredrummler.materialspinner.MaterialSpinner;
public class MainActivity extends AppCompatActivity {
private static final String[] ANDROID_VERSIONS = {
"Cupcake",
"Donut",
"Eclair",
"Froyo",
"Gingerbread",
"Honeycomb",
"Ice Cream Sandwich",
"Jelly Bean",
"KitKat",
"Lollipop",
"Marshmallow",
"Nougat",
"Oreo"
};
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View view) {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/jaredrummler/MaterialSpinner")));
} catch (ActivityNotFoundException ignored) {
}
}
});
MaterialSpinner spinner = (MaterialSpinner) findViewById(R.id.spinner);
spinner.setItems(ANDROID_VERSIONS);
spinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {
@Override public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
Snackbar.make(view, "Clicked " + item, Snackbar.LENGTH_LONG).show();
}
});
spinner.setOnNothingSelectedListener(new MaterialSpinner.OnNothingSelectedListener() {
@Override public void onNothingSelected(MaterialSpinner spinner) {
Snackbar.make(spinner, "Nothing selected", Snackbar.LENGTH_LONG).show();
}
});
}
}
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z"/>
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_main"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_github_white_24dp"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".MainActivity"
tools:showIn="@layout/activity_main">
<com.jaredrummler.materialspinner.MaterialSpinner
android:id="@+id/spinner"
app:ms_dropdown_max_height="350dp"
app:ms_dropdown_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<resources>>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
</resources>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">16dp</dimen>
</resources>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<resources>
<string name="app_name">Material Spinner</string>
</resources>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ 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
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light"/>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment