• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SnackBar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.rey.material.widget.SnackBar的典型用法代码示例。如果您正苦于以下问题:Java SnackBar类的具体用法?Java SnackBar怎么用?Java SnackBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SnackBar类属于com.rey.material.widget包,在下文中一共展示了SnackBar类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: updatePermanentNotification

import com.rey.material.widget.SnackBar; //导入依赖的package包/类
public static void updatePermanentNotification(@NonNull Activity activity, @NonNull PermanentNotification newPermanentNotification) {
    SnackBar toolbar = (SnackBar) activity.findViewById(R.id.toolbar_bottom_actionbar);
    if (toolbar == null) {
        throw new RuntimeException("No toolbar for notifications found!");
    }

    toolbar.stateChangeListener(stateChangeListener);

    // If toolbar is visible -> there is still a notification shown. Add this new one to a backlog list.
    if (toolbar.getState() == SnackBar.STATE_SHOWED) {
        permanentNotifications.add(newPermanentNotification);
        return;
    }

    doUpdatePermanentNotification(activity, toolbar, newPermanentNotification);
}
 
开发者ID:davidgraeff,项目名称:Android-NetPowerctrl,代码行数:17,代码来源:InAppNotifications.java


示例2: doUpdatePermanentNotification

import com.rey.material.widget.SnackBar; //导入依赖的package包/类
private static void doUpdatePermanentNotification(Activity activity, final SnackBar toolbar, final PermanentNotification newPermanentNotification) {
    if (newPermanentNotification.hasCloseButton())
        toolbar.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                toolbar.dismiss();
            }
        });
    toolbar.text(newPermanentNotification.getText());
    String actionText = newPermanentNotification.getActionButtonText();
    if (actionText != null) {
        toolbar.actionText(actionText);
        toolbar.actionClickListener(new SnackBar.OnActionClickListener() {
            @Override
            public void onActionClick(SnackBar snackBar, int i) {
                newPermanentNotification.action(snackBar);
            }
        });
    }
    toolbar.setTag(newPermanentNotification);
    toolbar.show();
}
 
开发者ID:davidgraeff,项目名称:Android-NetPowerctrl,代码行数:23,代码来源:InAppNotifications.java


示例3: handleNoInternet

import com.rey.material.widget.SnackBar; //导入依赖的package包/类
public void handleNoInternet() {
	if(mSnackbar.isShown()) {
		mSnackbar.dismiss();
		mSnackbar.clearAnimation();
	}

	if(isWebViewShown) {
		hideLoginView();
	}

	mContinueFABContainer.setClickable(false);

	new Handler().postDelayed(new Runnable() {
		@Override
		public void run() {
			mSnackbar
					.duration(0)
					.text(getResources().getString(R.string.login_user_no_internet))
					.actionText(getResources().getString(R.string.login_user_no_internet_action))
					.actionClickListener(new SnackBar.OnActionClickListener() {
						@Override
						public void onActionClick(SnackBar sb, int actionId) {
							mContinueFABContainer.setClickable(true);
							loginWebView.loadUrl(LOGIN_URL);
							sb.dismiss();
						}
					})
					.show(LoginActivity.this);
		}
	}, SHOW_SNACKBAR_DELAY);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:32,代码来源:LoginActivity.java


示例4: onStateChange

import com.rey.material.widget.SnackBar; //导入依赖的package包/类
@Override
public void onStateChange(SnackBar snackBar, int oldState, int newState) {
    if (newState == SnackBar.STATE_DISMISSED) {
        PermanentNotification current = (PermanentNotification) snackBar.getTag();
        current.onDismiss();
        if (permanentNotifications.isEmpty()) return;
        PermanentNotification n = permanentNotifications.get(0);
        permanentNotifications.remove(0);

        Activity activity = current.activityWeakReference.get();
        if (activity != null)
            doUpdatePermanentNotification(activity, snackBar, n);
    }
}
 
开发者ID:davidgraeff,项目名称:Android-NetPowerctrl,代码行数:15,代码来源:InAppNotifications.java


示例5: action

import com.rey.material.widget.SnackBar; //导入依赖的package包/类
@Override
public void action(SnackBar snackBar) {
    Activity activity = activityWeakReference.get();
    if (activity != null) {
        ChangeLogUtil.showChangeLog(activity);
    }
    snackBar.dismiss();
}
 
开发者ID:davidgraeff,项目名称:Android-NetPowerctrl,代码行数:9,代码来源:ChangeLogNotification.java


示例6: initSnackbar

import com.rey.material.widget.SnackBar; //导入依赖的package包/类
private void initSnackbar() {
	mSnackbar = new SnackBar(this)
						.applyStyle(R.style.snack_bar_style_mobile);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:5,代码来源:LoginActivity.java


示例7: onCreate

import com.rey.material.widget.SnackBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    dl_navigator = (DrawerLayout) findViewById(R.id.main_dl);
    fl_drawer = (FrameLayout) findViewById(R.id.main_fl_drawer);
    lv_drawer = (ListView) findViewById(R.id.main_lv_drawer);
    mToolbar = (Toolbar) findViewById(R.id.main_toolbar);
    vp = (CustomViewPager) findViewById(R.id.main_vp);
    tpi = (TabPageIndicator) findViewById(R.id.main_tpi);
    mSnackBar = (SnackBar) findViewById(R.id.main_sn);

    mToolbarManager = new ToolbarManager(getDelegate(), mToolbar, R.id.tb_group_main, R.style.ToolbarRippleStyle, R.anim.abc_fade_in, R.anim.abc_fade_out);
    mToolbarManager.setNavigationManager(new ToolbarManager.ThemableNavigationManager(R.array.navigation_drawer, getSupportFragmentManager(), mToolbar, dl_navigator) {
        @Override
        public void onNavigationClick() {
            if (mToolbarManager.getCurrentGroup() != R.id.tb_group_main)
                mToolbarManager.setCurrentGroup(R.id.tb_group_main);
            else
                dl_navigator.openDrawer(GravityCompat.START);
        }

        @Override
        public boolean isBackState() {
            return super.isBackState() || mToolbarManager.getCurrentGroup() != R.id.tb_group_main;
        }

        @Override
        protected boolean shouldSyncDrawerSlidingProgress() {
            return super.shouldSyncDrawerSlidingProgress() && mToolbarManager.getCurrentGroup() == R.id.tb_group_main;
        }

    });
    mToolbarManager.registerOnToolbarGroupChangedListener(this);

    mDrawerAdapter = new DrawerAdapter(this);
    lv_drawer.setAdapter(mDrawerAdapter);

    mPagerAdapter = new PagerAdapter(getSupportFragmentManager(), mItems);
    vp.setAdapter(mPagerAdapter);
    tpi.setViewPager(vp);
    tpi.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            mDrawerAdapter.setSelected(mItems[position]);
            mSnackBar.dismiss();
        }

        @Override
        public void onPageScrolled(int arg0, float arg1, int arg2) {
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }

    });

    mDrawerAdapter.setSelected(Tab.PROGRESS);
    vp.setCurrentItem(0);

    ViewUtil.setBackground(getWindow().getDecorView(), new ThemeDrawable(R.array.bg_window));
    ViewUtil.setBackground(mToolbar, new ThemeDrawable(R.array.bg_toolbar));
}
 
开发者ID:iamzhangdejian,项目名称:material-master,代码行数:68,代码来源:MainActivity.java


示例8: getSnackBar

import com.rey.material.widget.SnackBar; //导入依赖的package包/类
public SnackBar getSnackBar() {
    return mSnackBar;
}
 
开发者ID:iamzhangdejian,项目名称:material-master,代码行数:4,代码来源:MainActivity.java


示例9: onCreate

import com.rey.material.widget.SnackBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	setContentView(R.layout.activity_main);
			
	dl_navigator = (DrawerLayout)findViewById(R.id.main_dl);
	fl_drawer = (FrameLayout)findViewById(R.id.main_fl_drawer);
	lv_drawer = (ListView)findViewById(R.id.main_lv_drawer);
	mToolbar = (Toolbar)findViewById(R.id.main_toolbar);
	vp = (CustomViewPager)findViewById(R.id.main_vp);
	tpi = (TabPageIndicator)findViewById(R.id.main_tpi);
       mSnackBar = (SnackBar)findViewById(R.id.main_sn);

       mToolbarManager = new ToolbarManager(getDelegate(), mToolbar, R.id.tb_group_main, R.style.ToolbarRippleStyle, R.anim.abc_fade_in, R.anim.abc_fade_out);
       mToolbarManager.setNavigationManager(new ToolbarManager.ThemableNavigationManager(R.array.navigation_drawer, getSupportFragmentManager(), mToolbar, dl_navigator) {
           @Override
           public void onNavigationClick() {
               if(mToolbarManager.getCurrentGroup() != R.id.tb_group_main)
                   mToolbarManager.setCurrentGroup(R.id.tb_group_main);
               else
                   dl_navigator.openDrawer(GravityCompat.START);
           }

           @Override
           public boolean isBackState() {
               return super.isBackState() || mToolbarManager.getCurrentGroup() != R.id.tb_group_main;
           }

           @Override
           protected boolean shouldSyncDrawerSlidingProgress() {
               return super.shouldSyncDrawerSlidingProgress() && mToolbarManager.getCurrentGroup() == R.id.tb_group_main;
           }

       });
       mToolbarManager.registerOnToolbarGroupChangedListener(this);
	
	mDrawerAdapter = new DrawerAdapter(this);
	lv_drawer.setAdapter(mDrawerAdapter);
	
	mPagerAdapter = new PagerAdapter(getSupportFragmentManager(), mItems);
	vp.setAdapter(mPagerAdapter);
	tpi.setViewPager(vp);
	tpi.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

           @Override
           public void onPageSelected(int position) {
               mDrawerAdapter.setSelected(mItems[position]);
               mSnackBar.dismiss();
           }

           @Override
           public void onPageScrolled(int arg0, float arg1, int arg2) {
           }

           @Override
           public void onPageScrollStateChanged(int state) {
           }

       });

       mDrawerAdapter.setSelected(Tab.PROGRESS);
	vp.setCurrentItem(0);

       ViewUtil.setBackground(getWindow().getDecorView(), new ThemeDrawable(R.array.bg_window));
       ViewUtil.setBackground(mToolbar, new ThemeDrawable(R.array.bg_toolbar));
   }
 
开发者ID:ganeshkrishnan1,项目名称:material_fork,代码行数:68,代码来源:MainActivity.java


示例10: getSnackBar

import com.rey.material.widget.SnackBar; //导入依赖的package包/类
public SnackBar getSnackBar(){
    return mSnackBar;
}
 
开发者ID:ganeshkrishnan1,项目名称:material_fork,代码行数:4,代码来源:MainActivity.java


示例11: action

import com.rey.material.widget.SnackBar; //导入依赖的package包/类
public void action(SnackBar snackBar) {
}
 
开发者ID:davidgraeff,项目名称:Android-NetPowerctrl,代码行数:3,代码来源:PermanentNotification.java



注:本文中的com.rey.material.widget.SnackBar类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InlineActionHandler类代码示例发布时间:2022-05-22
下一篇:
Java PrincipalBearingCredential类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap