本文整理汇总了Java中com.melnykov.fab.FloatingActionButton.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java FloatingActionButton.setVisibility方法的具体用法?Java FloatingActionButton.setVisibility怎么用?Java FloatingActionButton.setVisibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.melnykov.fab.FloatingActionButton
的用法示例。
在下文中一共展示了FloatingActionButton.setVisibility方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpFAB
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
/**
* Setup utility for the FAB
*
* @param context
* @param icon the icon to apply
* @param button the FAB button
* @param mFABlistener the listener to apply
*/
public static void setUpFAB(Activity context, int icon, FloatingActionButton button, View.OnClickListener mFABlistener) {
button.setVisibility(View.VISIBLE);
button.setType(FloatingActionButton.TYPE_NORMAL);
if (ThemeUtils.getAppTheme3(context) < 6) {
button.setColorNormal(context.getResources().getColor(
ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context)));
button.setColorPressed(context.getResources().getColor(
ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context)));
} else {
button.setColorNormal(ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context));
button.setColorPressed(ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context));
}
button.setImageDrawable(context.getResources().getDrawable(icon));
button.setOnClickListener(mFABlistener);
}
示例2: initFloatingActionButton
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
/**
* Initialize the floating action button to add new grade entries.
*/
private void initFloatingActionButton(View rootView) {
fabAddGradeEntry = (FloatingActionButton) rootView.findViewById(R.id.fab_add_grade_entry);
fabAddGradeEntry.attachToRecyclerView(rvGrades);
fabAddGradeEntry.hide();
fabAddGradeEntry.setVisibility(View.GONE);
fabAddGradeEntry.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
adapter.enableEditMode(false);
fabAddGradeEntry.hide(true);
fabAddGradeEntry.setVisibility(View.GONE);
getActivity().invalidateOptionsMenu();
final Intent intent = new Intent(v.getContext(), GradeDetailedActivity.class);
intent.putExtra(GradeDetailedActivity.EXTRA_GRADE_HASH, "");
intent.putExtra(GradeDetailedActivity.EXTRA_ADD_NEW_GRADE_ENTRY, true);
v.getContext().startActivity(intent);
}
});
}
示例3: onPostExecute
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
protected void onPostExecute(Void v) {
Log.e("made post search", "yay");
stationListView = (ListView) findViewById(R.id.listView);
String[] testArray = new String[stationList.size()];
//stationList.toArray(testArray);
Log.e("made post search", "ya2y");
fabChannel = (FloatingActionButton) findViewById(R.id.fabChannel);
fabChannel.setVisibility(View.GONE);
progressSpinner1 = (ProgressBar) findViewById(R.id.progressBar1);
progressSpinner1.setVisibility(ProgressBar.INVISIBLE);
stationAdapter addStationArrayAdapter = new stationAdapter(StationActivity.this, R.layout.list_item, foundStationsList);
stationListView.setAdapter(addStationArrayAdapter);
stationListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
//String item = ((TextView) view).getText().toString();
outputString = "CREATE STATION FROM SUGGESTION " + foundStationsList.get(i).stationID;
Log.d("test", Integer.toString(i));
Log.d("test", foundStationsList.get(i).stationArtist);
Log.d("test", foundStationsList.get(i).stationSong);
Log.d("test", outputString);
runStation executor = new runStation();
doStop = false;
executor.execute();
openStations();
}
});
}
示例4: onCreate
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.setStatusBarColor(0xff303f9f);
}
//do before loading stations
setContentView(R.layout.activity_station);
Toolbar toolbarStation = (Toolbar) findViewById(R.id.toolbarstation);
toolbarStation.setTitle("Stations");
setSupportActionBar(toolbarStation);
stationListView = (ListView) findViewById(R.id.listView);
fabChannel = (FloatingActionButton) findViewById(R.id.fabChannel);
fabChannel.setVisibility(View.GONE);
progressSpinner1 = (ProgressBar) findViewById(R.id.progressBar1);
progressSpinner1.setVisibility(ProgressBar.VISIBLE);
//load stations automatically
loadStations loader = new loadStations();
loader.execute();
//todo timeout for station loading
}
示例5: setupMenuItem
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
private static FloatingActionButton setupMenuItem(FloatingActionButton menuBase, int id,
int drawable,
int style,
View.OnClickListener menuItemClickListener) {
int[] styleValues = new int[]{com.melnykov.fab.R.attr.fab_colorNormal,
com.melnykov.fab.R.attr.fab_colorPressed,
com.melnykov.fab.R.attr.fab_colorRipple,
com.melnykov.fab.R.attr.fab_shadow};
Context context = menuBase.getContext();
TypedArray array = context.obtainStyledAttributes(style, styleValues);
int color;
FloatingActionButton button = new FloatingActionButton(menuBase.getContext(), null, style);
button.setId(id);
button.setType(menuBase.getType());
if ((color = array.getColor(0, -1)) != -1)
button.setColorNormal(color);
if ((color = array.getColor(1, -1)) != -1)
button.setColorPressed(color);
if ((color = array.getColor(2, -1)) != -1)
button.setColorRipple(color);
if (array.getBoolean(3, false))
button.setShadow(true);
else
button.setShadow(false);
array.recycle();
button.setImageResource(drawable);
button.setLayoutParams(menuBase.getLayoutParams());
button.setVisibility(View.GONE);
button.setOnClickListener(menuItemClickListener);
((ViewGroup) menuBase.getParent()).addView(button);
return button;
}
示例6: onCreate
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// load layout with activity
ViewStub stub = (ViewStub) findViewById(R.id.layout_stub);
stub.setLayoutResource(R.layout.layout_all_articles_list_view);
View inflated = stub.inflate();
// listview with articles
articlesListViewItems = (ListView) findViewById(R.id.listViewArticles);
// database init
mDbHelper = new ArticlesDataSource(getApplicationContext());
mDbHelper.createDatabase();
mDbHelper.open();
// get data from intent to define what's group to show
long groupId = this.getIntent().getLongExtra("group_id", -1);
statusToShow = (ActivityArticlesStatusToShow) this.getIntent().getSerializableExtra("status_what_show");
String groupName = this.getIntent().getStringExtra("group_name");
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(getString(R.string.all_articles_menu_title));
// if there is start activity, so show drawer
if (groupId == 0 || groupId == -1) {
initDrawer();
articlesCursor = mDbHelper.getAllArticles();
} else {
// ... but if this activity is used to show short listview with articles, just show toolbar with back button
initToolbarWithBackButton(groupName);
articlesCursor = mDbHelper.getArticlesByGroup(groupId);
sequenceIds = mDbHelper.getIdsOfGroup(groupId);
}
// listener of row click
articlesListViewItems.setOnItemClickListener(listViewClickListener);
// if we just open application - adapter has never been used, so create this
if (articlesViewAdapter == null) {
articlesViewAdapter = new ArticleCursorAdapter(this, articlesCursor, 0);
} else
/**
* otherwise it means that this activity is used inside app - to show short list of articles
* just change cursor
*/
articlesViewAdapter.changeCursor(articlesCursor);
// Attach cursor adapter to the ListView
articlesListViewItems.setAdapter(articlesViewAdapter);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
// if row's count greater that limit ,,,
if (articlesListViewItems.getCount() > LIMIT_TO_SHOW_SEARCH_FIELD) {
// fab link to listview
fab.attachToListView(articlesListViewItems);
fab.setVisibility(View.VISIBLE);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// go to top of listview
articlesListViewItems.setSelectionAfterHeaderView();
}
});
}
else {
// otherwise - hide fab
fab.setVisibility(View.INVISIBLE);
}
}
示例7: initFab
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
protected void initFab(View rootView) {
FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fabbutton);
fab.setVisibility(View.GONE);
}
示例8: initializeViews
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
private void initializeViews(View contentView, Bundle savedInstanceState) {
mToolbar = (Toolbar) contentView.findViewById(R.id.my_awesome_toolbar);
mAddFABButton = (FloatingActionButton) contentView.findViewById(R.id.fabbutton);
mAddFABButton.setOnClickListener(this);
mUserImageView = (OkulusImageView) contentView.findViewById(R.id.profile_image);
mUserSubText = (TextView) contentView.findViewById(R.id.user_subText);
mUserNameText = (TextView) contentView.findViewById(R.id.user_name);
mProfileLayout = (LinearLayout) contentView.findViewById(R.id.profile_layout);
mPagerdapter = new AboutMePagerAdapter(getChildFragmentManager(), Arrays.asList(getResources().getStringArray(R.array.about_me_pager_screen_titles)));
mPager = (ViewPager) contentView.findViewById(R.id.pager);
mPager.setAdapter(mPagerdapter);
mSlidingTabLayout = (SlidingTabLayout) contentView.findViewById(R.id.sliding_tabs);
mSlidingTabLayout.setCustomTabView(R.layout.tab_home, R.id.label_tab);
mSlidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.dark_yelo));
mSlidingTabLayout.setDistributeEvenly(true);
mSlidingTabLayout.setOnPageChangeListener(this);
mSlidingTabLayout.setOnMyTabClickListener(this);
mSlidingTabLayout.setViewPager(mPager);
mPager.setCurrentItem(0);
if (!mIsMyProfileScreen) {
mAddFABButton.setVisibility(View.GONE);
} else {
mAddFABButton.setVisibility(View.VISIBLE);
}
if (mFromPagerScreen) {
mToolbar.setVisibility(View.GONE);
mAddFABButton.setVisibility(View.GONE);
mSlidingTabLayout.setBackgroundColor(getResources().getColor(R.color.white));
mProfileLayout.setBackgroundColor(getResources().getColor(R.color.white));
}
if (mUserId.equals(AppConstants.UserInfo.INSTANCE.getId())) {
setHasOptionsMenu(true);
} else {
loadOtherUserDetails();
setHasOptionsMenu(true);
}
}
示例9: initUI
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
protected void initUI() {
super.initUI();
Intent intent = getIntent();
StringBuilder txtCaption = new StringBuilder(128);
String author = intent.getStringExtra(EXTRA_AUTHOR);
if (!TextUtils.isEmpty(author)) {
txtCaption.append(author);
txtCaption.append('\n');
}
txtCaption.append(DateTime.formatDateTime(this, intent.getLongExtra(EXTRA_DATE, 0), ", "));
TextView tvDate = (TextView) findViewById(R.id.news_caption);
tvDate.setText(txtCaption);
TextView tvTitle = (TextView) findViewById(R.id.news_title);
tvTitle.setText(intent.getStringExtra(EXTRA_TITLE));
TextView tvContent = (TextView) findViewById(R.id.news_content);
String txt = intent.getStringExtra(EXTRA_CONTENT_VALUES);
tvContent.setText(Html.fromHtml(txt, null, new HtmlTagHandler()));
// tvContent.setText(Html.fromHtml("Hello € <b>world</b>!<br>This is only a <a href=\"http://www.google.com\">test</a>."));
tvContent.setMovementMethod(LinkMovementMethod.getInstance());
// Log.i("NOVELTY", "types: ", intent.getStringExtra(EXTRA_CONTENT_TYPES));
Log.i("NOVELTY", "values: ", txt);
// Log.i("NOVELTY", "url: ", intent.getStringExtra(EXTRA_URL));
// Log.i("NOVELTY", "id: ", intent.getStringExtra(EXTRA_ID));
final String url = getIntent().getStringExtra(EXTRA_URL);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_open_in_browser);
if (TextUtils.isEmpty(url)) {
fab.setVisibility(View.GONE);
} else {
fab.setVisibility(View.VISIBLE);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent iBrowser = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
iBrowser.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(iBrowser);
}
});
fab.attachToScrollView((ObservableScrollView) findViewById(R.id.news_container));
}
}