use of android.support.design.widget.CoordinatorLayout in project xRecyclerViewF by Dsiner.
the class XRecyclerView method onAttachedToWindow.
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
// 解决和CollapsingToolbarLayout冲突的问题
AppBarLayout appBarLayout = null;
ViewParent p = getParent();
while (p != null) {
if (p instanceof CoordinatorLayout) {
break;
}
p = p.getParent();
}
if (p instanceof CoordinatorLayout) {
CoordinatorLayout coordinatorLayout = (CoordinatorLayout) p;
final int childCount = coordinatorLayout.getChildCount();
for (int i = childCount - 1; i >= 0; i--) {
final View child = coordinatorLayout.getChildAt(i);
if (child instanceof AppBarLayout) {
appBarLayout = (AppBarLayout) child;
break;
}
}
if (appBarLayout != null) {
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
@Override
public void onStateChanged(AppBarLayout appBarLayout, State state) {
appbarState = state;
}
});
}
}
}
use of android.support.design.widget.CoordinatorLayout in project gh4a by slapperwan.
the class IssueMilestoneEditActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!Gh4Application.get().isAuthorized()) {
Intent intent = new Intent(this, Github4AndroidActivity.class);
startActivity(intent);
finish();
return;
}
LayoutInflater headerInflater = LayoutInflater.from(UiUtils.makeHeaderThemedContext(this));
View header = headerInflater.inflate(R.layout.issue_create_header, null);
addHeaderView(header, false);
mTitleWrapper = header.findViewById(R.id.title_wrapper);
mTitleView = header.findViewById(R.id.et_title);
mTitleView.setOnFocusChangeListener(this);
mDescriptionView = findViewById(R.id.editor);
mDueView = findViewById(R.id.tv_due);
mMarkdownButtons = findViewById(R.id.markdown_buttons);
mMarkdownButtons.setEditText(mDescriptionView);
MarkdownPreviewWebView preview = findViewById(R.id.preview);
preview.setEditText(mDescriptionView);
CoordinatorLayout rootLayout = getRootLayout();
mSaveFab = (IssueStateTrackingFloatingActionButton) getLayoutInflater().inflate(R.layout.accept_fab, rootLayout, false);
mSaveFab.setOnClickListener(this);
rootLayout.addView(mSaveFab);
findViewById(R.id.due_container).setOnClickListener(this);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(true);
if (mMilestone == null) {
mMilestone = Milestone.builder().state(IssueState.Open).build();
}
mTitleView.addTextChangedListener(new UiUtils.ButtonEnableTextWatcher(mTitleView, mSaveFab));
mTitleView.addTextChangedListener(new UiUtils.EmptinessWatchingTextWatcher(mTitleView) {
@Override
public void onIsEmpty(boolean isEmpty) {
if (isEmpty) {
mTitleWrapper.setError(getString(R.string.issue_error_milestone_title));
} else {
mTitleWrapper.setErrorEnabled(false);
}
}
});
mTitleView.setText(mMilestone.title());
mDescriptionView.setText(mMilestone.description());
updateHighlightColor();
updateLabels();
setToolbarScrollable(false);
adjustTabsForHeaderAlignedFab(true);
}
use of android.support.design.widget.CoordinatorLayout in project gh4a by slapperwan.
the class IssueMilestoneListActivity method onCreate.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Gh4Application.get().isAuthorized()) {
CoordinatorLayout rootLayout = getRootLayout();
mCreateFab = (FloatingActionButton) getLayoutInflater().inflate(R.layout.add_fab, rootLayout, false);
mCreateFab.setOnClickListener(this);
rootLayout.addView(mCreateFab);
}
}
use of android.support.design.widget.CoordinatorLayout in project gh4a by slapperwan.
the class IssueLabelListActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.generic_list);
setContentShown(false);
mAdapter = new IssueLabelAdapter(this);
mAdapter.setOnItemClickListener(this);
RecyclerView recyclerView = findViewById(R.id.list);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new DividerItemDecoration(this));
recyclerView.setTag(R.id.FloatingActionButtonScrollEnabled, new Object());
recyclerView.setAdapter(mAdapter);
CoordinatorLayout rootLayout = getRootLayout();
mFab = (FloatingActionButton) getLayoutInflater().inflate(R.layout.add_fab, rootLayout, false);
mFab.setOnClickListener(this);
rootLayout.addView(mFab);
updateFabVisibility();
loadLabels(false);
if (savedInstanceState != null) {
if (savedInstanceState.containsKey(STATE_KEY_ADDED_LABEL)) {
mAddedLabel = savedInstanceState.getParcelable(STATE_KEY_EDITING_LABEL);
mAdapter.add(mAddedLabel);
startEditing(mAddedLabel);
} else if (savedInstanceState.containsKey(STATE_KEY_EDITING_LABEL)) {
IssueLabelAdapter.EditableLabel label = savedInstanceState.getParcelable(STATE_KEY_EDITING_LABEL);
int count = mAdapter.getCount();
for (int i = 0; i < count; i++) {
IssueLabelAdapter.EditableLabel item = mAdapter.getItem(i);
if (item.name().equals(label.name())) {
item.editedName = label.editedName;
item.editedColor = label.editedColor;
startEditing(item);
break;
}
}
}
}
}
use of android.support.design.widget.CoordinatorLayout in project teamward-client by Neamar.
the class SnackBarActivity method displaySnack.
public void displaySnack(String snack) {
CoordinatorLayout coordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinatorLayout);
assert coordinatorLayout != null;
try {
Snackbar snackbar = Snackbar.make(coordinatorLayout, snack, Snackbar.LENGTH_LONG);
snackbar.show();
} catch (NullPointerException | IllegalArgumentException e) {
// If the activity is not visible anymore, this will throw.
e.printStackTrace();
}
}
Aggregations