Actionshet-android is an Android Library to build Actionshet like iOS UIActionSheet component, iOS7 style, custom color etc
- Add the following to your project level
build.gradle:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}- Add this to your app
build.gradle:
dependencies {
implementation 'com.github.mkhoiron:Actionsheet-android:0.1'
}ArrayList<String> data = newArrayList<>();
data.add("Delete it");
data.add("Copy");
data.add("Move");
data.add("Duplicate");
newActionSheet(MainActivityJava.this,data)
.setTitle("What do you want to do with the file")
.setCancelTitle("Cancle")
.setColorTitle(getResources().getColor(R.color.title))
.setColorTitleCancel(getResources().getColor(R.color.action))
.setColorData(getResources().getColor(R.color.action))
.create(newActionSheetCallBack() {
@Overridepublicvoiddata(@NotNullStringdata, intposition) {
switch (position){
case0:
// your actioncase1:
// your actioncase2:
// your actioncase3:
// your action
}
}
});- In Kotlin
val data by lazy { ArrayList<String>() }
data.add("English")
data.add("Indonesia")
ActionSheet(this,data)
.setTitle("Select Country")
.setCancelTitle("Cancel")
.setColorTitleCancel(Color.parseColor("#FF4081"))
.setColorTitle(Color.parseColor("#FF4081"))
.setColorData(Color.parseColor("#FF4081"))
.create(object:ActionSheetCallBack{
overridefundata(data:String, position:Int) {
if ("English".equals(data)){
// your action
}elseif("Indonesia".equals(data)){
// your action
}
setToast(data)
}
})- Initialize variable:
ActionSheetactionSheet;
actionSheet = newActionSheet(MainActivityJava.this,data)
.setTitle("What do you want to do with the file")
.setCancelTitle("Cancle")
.setColorTitle(getResources().getColor(R.color.title))
.setColorTitleCancel(getResources().getColor(R.color.action))
.setColorData(getResources().getColor(R.color.action));
actionSheet.create(newActionSheetCallBack() {
@Overridepublicvoiddata(@NotNullStringdata, intposition) {
// switch or if handle
}
});Copyright 2018 M Khoiron
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.
Al-hamdulillahi Rabbil 'alamin And Special thanks to JetBrains and jitpack.io for their contributions to this project.

