本文整理汇总了Java中com.nispok.snackbar.Snackbar类的典型用法代码示例。如果您正苦于以下问题:Java Snackbar类的具体用法?Java Snackbar怎么用?Java Snackbar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Snackbar类属于com.nispok.snackbar包,在下文中一共展示了Snackbar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Recarregar
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
private void Recarregar()
{
//Verifica se há internet
if (Utils.haveInternet(getActivity())) {
//Carrega as Faltas
new DownloadJSON().execute(Utils.getUrlApiFalta(getActivity().getBaseContext()).replace("$rm",ActivityPrincipal.mAluno.getRm()).replace("$mes", String.valueOf(mes)));
} else
SnackbarManager.show(
Snackbar.with(getActivity())
.text("Por favor verifique sua conexão com a Internet")
.type(SnackbarType.MULTI_LINE)
.actionLabel("CONECTAR")
.actionColor(getResources().getColor(R.color.colorAccent))
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
.actionListener(new ActionClickListener() {
@Override
public void onActionClicked(Snackbar snackbar) {
//Inicia as configurações de rede
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
}
})
);
}
示例2: Recarregar
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
private void Recarregar()
{
//Verifica se há internet
if (Utils.haveInternet(getActivity())) {
//Carrega as Faltas
new DownloadJSON().execute(Utils.getUrlApiNota(getActivity().getBaseContext()).replace("$rm",ActivityPrincipal.mAluno.getRm()).replace("$bim", String.valueOf(bimestre)));
} else
SnackbarManager.show(
Snackbar.with(getActivity())
.text("Por favor verifique sua conexão com a Internet")
.type(SnackbarType.MULTI_LINE)
.actionLabel("CONECTAR")
.actionColor(getResources().getColor(R.color.colorAccent))
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
.actionListener(new ActionClickListener() {
@Override
public void onActionClicked(Snackbar snackbar) {
//Inicia as configurações de rede
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
}
})
);
}
示例3: Recarregar
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
private void Recarregar()
{
//Verifica se há internet
if (Utils.haveInternet(getActivity())) {
//Carrega as Faltas
new DownloadJSON().execute(Utils.getUrlApiHorario(getActivity().getBaseContext(),true).replace("$turma", String.valueOf(ActivityPrincipal.mAluno.getIdTurma())).replace("$dia", String.valueOf(dia)));
} else
SnackbarManager.show(
Snackbar.with(getActivity())
.text("Por favor verifique sua conexão com a Internet")
.type(SnackbarType.MULTI_LINE)
.actionLabel("CONECTAR")
.actionColor(getResources().getColor(R.color.colorAccent))
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
.actionListener(new ActionClickListener() {
@Override
public void onActionClicked(Snackbar snackbar) {
//Inicia as configurações de rede
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
}
})
);
}
示例4: Recarregar
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
private void Recarregar() {
//Verifica se há internet
if (Utils.haveInternet(getActivity())) {
//Carrega as Notícias
new DownloadNoticias(getActivity(), mRelativeLayout, mRecyclerView).execute(Utils.getUrlApiNoticia(getActivity()));
} else
SnackbarManager.show(
Snackbar.with(getActivity())
.text("Por favor verifique sua conexão com a Internet")
.type(SnackbarType.MULTI_LINE)
.actionLabel("CONECTAR")
.actionColor(getResources().getColor(R.color.colorAccent))
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
.actionListener(new ActionClickListener() {
@Override
public void onActionClicked(Snackbar snackbar) {
//Inicia as configurações de rede
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
}
})
);
}
示例5: onViewCreated
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.add).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (dataService.getEffectiveContactCount() == 0) {
SnackbarManager.show(Snackbar.with(getActivity()).text("You still have no buddies to play with!").color(Color.RED).textColor(Color.WHITE));
} else {
Intent intent = new Intent(getActivity(), NewGameActivity.class);
startActivityForResult(intent, 123);
}
}
});
ListView listView = null;
}
示例6: onItemSelected
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
@Override
public void onItemSelected(String id) {
Document document = dataService.getDocument(id);
Boolean accepted = (Boolean) document.getProperty("accepted");
Boolean reverseAccepted = (Boolean) document.getProperty("reverseAccepted");
accepted = accepted != null ? accepted : false;
reverseAccepted = reverseAccepted != null ? reverseAccepted : false;
if (accepted && !reverseAccepted) {
SnackbarManager.show(Snackbar.with(this).position(Snackbar.SnackbarPosition.TOP).text("This buddy did not accept you yet!").color(Color.YELLOW).textColor(Color.BLACK));
} else if (!accepted && reverseAccepted) {
this.id = id;
showDialog();
} else if (reverseAccepted && accepted) {
Intent intent = new Intent(ContactListActivity.this, GameListActivity.class);
intent.putExtra(Intent.EXTRA_EMAIL, (String) document.getProperties().get("email"));
startActivity(intent);
}
}
示例7: checkMACAddressRequired
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
private void checkMACAddressRequired()
{
boolean showAlert = true;
if(BluetoothAdapter.getDefaultAdapter().isEnabled()) {
final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
final Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
for (BluetoothDevice pairedDevice : pairedDevices) {
if (pairedDevice.getName().equals("MI") && pairedDevice.getAddress().startsWith(MiBandConstants.MAC_ADDRESS_FILTER)) {
showAlert = false;
}
}
if(showAlert)
{
if(!userPreferences.getMiBandMAC().equals(""))
showAlert = false;
}
if(showAlert)
{
Snackbar.with(getApplicationContext()).text(getResources().getString(R.string.alert_MAC_address)).show(MainActivity.this);
}
}
}
示例8: onClickQQShare
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
private void onClickQQShare() {
if(!AppInstallUtil.isQQInstalled(getActivity())){
Snackbar.with(getActivity()) // context
.colorResource(R.color.app_main_theme_color_transparent)
.duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
.text("请先安装QQ客户端") // text to display
.show(getActivity());
return;
}else {
final Bundle params = new Bundle();
params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_DEFAULT);
params.putString(QQShare.SHARE_TO_QQ_TITLE, "一个神秘的礼物");
params.putString(QQShare.SHARE_TO_QQ_SUMMARY, "这里没有浮躁与喧嚣,这里会让你静下心来感受生活的美好,一切精彩尽在NEW!");
params.putString(QQShare.SHARE_TO_QQ_TARGET_URL, "http://www.taoxiaoxian.com");
params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL, "http://d.pcs.baidu.com/thumbnail/6d273718ff0d96bef858eb5b7bfa69e7?fid=742504005-250528-921719865042031&time=1441375200&sign=FDTAER-DCb740ccc5511e5e8fedcff06b081203-u31sUbnYcNuMo9RQFOZjJJhaJRA%3D&rt=sh&expires=2h&r=432920246&sharesign=unknown&size=c710_u500&quality=100");
params.putString(QQShare.SHARE_TO_QQ_APP_NAME, "NEW");
params.putInt(QQShare.SHARE_TO_QQ_EXT_INT, QQShare.SHARE_TO_QQ_FLAG_QZONE_ITEM_HIDE);
mTencent.shareToQQ(getActivity(), params, new BaseUiListener(getActivity()));
}
}
示例9: onComplete
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
@Override
public void onComplete(Bundle values) {
// 从 Bundle 中解析 Token
Oauth2AccessToken mAccessToken = Oauth2AccessToken.parseAccessToken(values);
//从这里获取用户输入的 电话号码信息
if (mAccessToken.isSessionValid()) {
// 保存 Token 到 SharedPreferences
AccessTokenKeeper.writeAccessToken(getActivity(), mAccessToken);
Snackbar.with(getActivity()) // context
.colorResource(R.color.app_main_theme_color_transparent)
.duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
.text("授权成功") // text to display
.show(getActivity());
} else {
// 以下几种情况,您会收到 Code:
// 1. 当您未在平台上注册的应用程序的包名与签名时;
// 2. 当您注册的应用程序包名与签名不正确时;
// 3. 当您在平台上注册的包名和签名与您当前测试的应用的包名和签名不匹配时。
String code = values.getString("code");
Snackbar.with(getActivity()) // context
.colorResource(R.color.app_main_theme_color_transparent)
.duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
.text("授权失败") // text to display
.show(getActivity());
}
}
示例10: onKeyDown
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mDrawerLayout.isDrawerOpen(menuLayout)) {
mDrawerLayout.closeDrawer(menuLayout);
}else {
if ((System.currentTimeMillis() - mExitTime) > 2000) {
Snackbar.with(getApplicationContext()) // context
.colorResource(R.color.app_main_theme_color_transparent)
.duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
.text("再按一次退出程序") // text to display
.show(this);
mExitTime = System.currentTimeMillis();
} else {
finish();
}
}
return true;
}
return super.onKeyDown(keyCode, event);
}
示例11: onClickQQShare
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
private void onClickQQShare() {
if(!AppInstallUtil.isQQInstalled(this)){
Snackbar.with(this) // context
.colorResource(R.color.app_main_theme_color_transparent)
.duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
.text("请先安装QQ客户端") // text to display
.show(this);
return;
}else {
final Bundle params = new Bundle();
params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_DEFAULT);
params.putString(QQShare.SHARE_TO_QQ_TITLE, "一个神秘的礼物");
params.putString(QQShare.SHARE_TO_QQ_SUMMARY, "这里没有浮躁与喧嚣,这里会让你静下心来感受生活的美好,一切精彩尽在NEW!");
params.putString(QQShare.SHARE_TO_QQ_TARGET_URL, "http://www.taoxiaoxian.com");
params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL, "http://imgcache.qq.com/qzone/space_item/pre/0/66768.gif");
params.putString(QQShare.SHARE_TO_QQ_APP_NAME, "NEW");
params.putInt(QQShare.SHARE_TO_QQ_EXT_INT, QQShare.SHARE_TO_QQ_FLAG_QZONE_ITEM_HIDE);
mTencent.shareToQQ(this, params, new BaseUiListener(this));
}
}
示例12: showError
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
@UiThread
protected void showError(String s) {
if (navigator.isInForeground()) {
Snackbar errorSnack;
if (snackBarBackgroundColor != null) {
errorSnack = Snackbar.with(context)
.text(s)
.duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
.color(snackBarBackgroundColor);
} else {
errorSnack = Snackbar.with(context)
.text(s)
.duration(Snackbar.SnackbarDuration.LENGTH_SHORT);
}
SnackbarManager.show(errorSnack, navigator.getCurrentActivityOnScreen());
}
}
示例13: fillRow
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
public void fillRow(View view, final String title, final String description) {
TextView titleView = (TextView) view.findViewById(R.id.title);
titleView.setText(title);
TextView descriptionView = (TextView) view.findViewById(R.id.description);
descriptionView.setText(description);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("AppInfo", description);
clipboard.setPrimaryClip(clip);
Snackbar.with(getApplicationContext()).dismiss();
Snackbar.with(getApplicationContext()) // context
.text("Copied " + title) // text to display
.show(DetailActivity.this);
}
});
}
示例14: showIfNotDefault
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
public void showIfNotDefault(ViewGroup viewGroup) {
if (!mIsDefault) {
long deltaTime = (System.nanoTime() / 1000000) - sLastShown;
long duration = deltaTime > 60 * 1000 ? 8000 : 3000;
Snackbar snackBar = Snackbar.with(mContext)
.type(getSnackBarType())
.text(mMessage)
.duration(duration)
.actionColor(ThemeManager.getColor())
.actionLabel(R.string.upgrade_now)
.actionListener(this);
if (viewGroup == null) {
SnackbarManager.show(snackBar);
} else {
SnackbarManager.show(snackBar, viewGroup);
}
sLastShown = System.nanoTime() / 1000000;
}
}
示例15: onCreateView
import com.nispok.snackbar.Snackbar; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.activity_feedback, container, false);
WebView browser = (WebView) rootView.findViewById(R.id.webview);
pb= (ProgressBar) rootView.findViewById(R.id.pb);
browser.setWebViewClient(new MyWebViewClient());
if(activity!=null) {
if (Utils.isNetworkAvailable(activity))
browser.loadUrl("http://goo.gl/forms/DS8To6mufz");
else
SnackbarManager.show(
Snackbar.with(activity.getApplicationContext())
.text("Check You Internet Connection")
.duration(Snackbar.SnackbarDuration.LENGTH_SHORT), activity);
}
return rootView;
}