Easy way to make dialog for everyone.
Easy way to make dialog for everyone.
compile 'com.github.sakebook:DialogHelper:0.1.1@aar'
DialogHelper.create(this)
.setTitle("title")
.setMessage("message")
.setPositive("label")
.setTouchCancelable(true)
.build();
DialogHelper.customCreate(this)
.setLayout(R.layout.layoutId)
.setEventList(getEventList())
.setBackCancelable(true)
.build();
SimpleDialog
第3~5引数はボタンのラベルになる。
DialogHelper.callDialog(this, "title", "message", "positive", "negative", "neutral", "tag");
DialogHelper.callCustomDialog(this, R.layout.layoutId, getEventList(), "tag");
public class MainActivity extends FragmentActivity implements SimpleDialogsListener{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DialogHelper.create(this)
.setTitle("title")
.setMessage("message")
.setPositive("label")
.setTouchCancelable(true)
.build();
}
@Override
public void simplePositiveClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
@Override
public void simpleNegativeClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
@Override
public void simpleNeutralClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
@Override
public void simpleCancel(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
}
public class MainActivity extends FragmentActivity implements CustomDialogsListener{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DialogHelper.customCreate(this)
.setLayout(R.layout.layoutId)
.setEventList(getEventList())
.setBackCancelable(true)
.build();
}
@Override
public void customClick(int id, View v) {
// TODO Auto-generated method stub
}
@Override
public void customCancel(int id) {
// TODO Auto-generated method stub
}
private ArrayList<Integer> getEventList() {
ArrayList<Integer> eventList = new ArrayList<Integer>();
eventList.add(R.id.button1);
eventList.add(R.id.button2);
eventList.add(R.id.button3);
return eventList;
}
}
Copyright 2014 Shinya Sakemoto.
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.