If you think the Android project Visu listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.ufavaloro.android.visu.UI;
//fromwww.java2s.comimport org.apache.http.auth.MalformedChallengeException;
import com.ufavaloro.android.visu.draw.channel.Channel;
import com.ufavaloro.android.visu.study.Study;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
publicclass ChannelOptionsDialog extends AlertDialog {
private MainActivity mMainActivity;
private Study mStudy;
privateint mChannelNumber;
privatefinal CharSequence[] mOnlineChannelOptions = {"Configurar", "Ocultar"};
privatefinal CharSequence[] mOfflineChannelOptions = {"Propiedades", "Ocultar"};
public ChannelOptionsDialog(Context context, int theme, int channelNumber) {
super(context, theme);
mChannelNumber = channelNumber;
}
publicvoid setup() {
AlertDialog.Builder builder = new AlertDialog.Builder(mMainActivity);
Channel channel = mStudy.draw.getChannels().getChannelAtIndex(mChannelNumber);
//builder.setTitle("Canal " + (mChannel.getChannelNumber() + 1));
// The channel is an on-line channel (connected to an ADC)
if(channel.isOnline()) {
builder.setItems(mOnlineChannelOptions, new DialogInterface.OnClickListener() {
publicvoid onClick(DialogInterface dialog, int item) {
switch(item) {
// Configurar
case 0:
mMainActivity.onlineChannelPropertiesDialog(mChannelNumber);
break;
// Ocultar canal
case 1:
mStudy.hideChannel(mChannelNumber);
break;
// Remover canal
case 2:
mStudy.removeChannel(mChannelNumber);
default:
break;
}
}
});
// The channel is an offline channel (loaded from local storage or google drive)
} else {
builder.setItems(mOnlineChannelOptions, new DialogInterface.OnClickListener() {
publicvoid onClick(DialogInterface dialog, int item) {
switch(item) {
// Properties
case 0:
mMainActivity.offlineChannelPropertiesDialog(mChannelNumber);
break;
// Ocultar canal
case 1:
mStudy.hideChannel(mChannelNumber);
break;
// Remover canal
case 2:
mStudy.removeChannel(mChannelNumber);
default:
break;
}
}
});
}
builder.create().show();
}
publicvoid setMainActivity(MainActivity mainActivity) {
mMainActivity = mainActivity;
}
publicvoid setStudy(Study study) {
mStudy = study;
}
}