本文整理匯總了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;
}