android:add view source option
This commit is contained in:
parent
82aa3421c6
commit
dfbd46197c
@ -274,24 +274,33 @@ public class DoricDevActivity extends AppCompatActivity implements DoricDev.Stat
|
|||||||
holder.layoutBtn.setOnClickListener(new View.OnClickListener() {
|
holder.layoutBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (DoricDev.getInstance().isInDevMode()) {
|
final String[] items = DoricDev.getInstance().isInDevMode()
|
||||||
final String items[] = {"View source",};
|
? new String[]{"View source",}
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(holder.itemView.getContext(), R.style.Theme_Doric_Modal);
|
: new String[]{"View source",};
|
||||||
builder.setTitle(String.format("%s %s", context.getContextId(), context.getSource()));
|
AlertDialog.Builder builder = new AlertDialog.Builder(holder.itemView.getContext(), R.style.Theme_Doric_Modal);
|
||||||
builder.setIcon(new BitmapDrawable(icon_on));
|
builder.setTitle(String.format("%s %s", context.getContextId(), context.getSource()));
|
||||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
builder.setIcon(new BitmapDrawable(holder.itemView.getContext().getResources(), icon_on));
|
||||||
@Override
|
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
@Override
|
||||||
if (which == 0) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
Toast.makeText(Doric.application(), "View source", Toast.LENGTH_LONG).show();
|
if (which == 0) {
|
||||||
}
|
AlertDialog.Builder builder = new AlertDialog.Builder(holder.itemView.getContext(), R.style.Theme_Doric_Modal_Alert);
|
||||||
dialog.dismiss();
|
builder.setTitle("View source: " + context.getSource());
|
||||||
|
String btnTitle = holder.itemView.getContext().getString(android.R.string.ok);
|
||||||
|
builder.setMessage(context.getScript())
|
||||||
|
.setPositiveButton(btnTitle, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setCancelable(false);
|
||||||
|
builder.show();
|
||||||
}
|
}
|
||||||
});
|
dialog.dismiss();
|
||||||
builder.create().show();
|
}
|
||||||
} else {
|
});
|
||||||
Toast.makeText(Doric.application(), "Please connect to devkit first", Toast.LENGTH_LONG).show();
|
builder.create().show();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user