本文整理汇总了Java中trikita.anvil.Anvil类的典型用法代码示例。如果您正苦于以下问题:Java Anvil类的具体用法?Java Anvil怎么用?Java Anvil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Anvil类属于trikita.anvil包,在下文中一共展示了Anvil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onCreate
import trikita.anvil.Anvil; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
App.instance = this;
this.windowController = new WindowController();
PersistanceController persistanceController = new PersistanceController(this);
State initialState = persistanceController.getSavedState();
if (initialState == null) {
initialState = State.Default.build(this);
}
StorageController sc = new StorageController(this);
this.store = new Store<>(new State.Reducer(),
initialState,
// new Logger<>("Slide"),
persistanceController,
this.windowController,
sc);
sc.dumpToFile(false); // false - with no delay
this.store.subscribe(Anvil::render);
}
开发者ID:trikita,项目名称:slide,代码行数:26,代码来源:App.java
示例2: onCreate
import trikita.anvil.Anvil; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
App.instance = this;
PersistanceController persistanceController = new PersistanceController(this);
State initialState = persistanceController.getSavedState();
if (initialState == null) {
initialState = State.Default.build();
}
this.store = new Store<>(new State.Reducer(),
initialState,
new Logger<>("Talalarmo"),
persistanceController,
new AlarmController(this));
this.store.subscribe(Anvil::render);
}
开发者ID:trikita,项目名称:talalarmo,代码行数:20,代码来源:App.java
示例3: list
import trikita.anvil.Anvil; //导入依赖的package包/类
private void list() {
expandableListView(() -> {
size(0, FILL);
weight(1);
adapter(mAdapter);
for (int i = 0; i < GROUP.length; i++) {
if (expanded[i]) {
((ExpandableListView) Anvil.currentView()).expandGroup(i);
} else {
((ExpandableListView) Anvil.currentView()).collapseGroup(i);
}
}
onGroupCollapse(this::onColapsed);
onGroupExpand(this::onExpanded);
});
}
开发者ID:zserge,项目名称:anvil-examples,代码行数:17,代码来源:ExpandableListLayout.java
示例4: taskName
import trikita.anvil.Anvil; //导入依赖的package包/类
public static void taskName(String name, boolean editable, SimpleTextWatcher watcher) {
editText(() -> {
id(TASK_NAME_EDITTEXT_ID);
size(FILL, WRAP);
margin(0, dip(20));
gravity(Gravity.CENTER);
focusable(editable);
focusableInTouchMode(editable);
clickable(editable);
cursorVisible(editable);
backgroundDrawable(null);
hint(R.string.task_name_hint);
text(name);
textColor(Color.WHITE);
textSize(sip(isPortrait() ? 42 : 36));
typeface("RobotoCondensed-Light.ttf");
singleLine(true);
onTextChanged(watcher);
init(() -> {
((EditText) Anvil.currentView()).requestFocus();
});
});
}
开发者ID:zserge,项目名称:anvil-examples,代码行数:24,代码来源:Style.java
示例5: slide
import trikita.anvil.Anvil; //导入依赖的package包/类
private void slide(int from, int to, float fromAlpha, float toAlpha) {
if (mRunningAnims == ANIMS_PER_NAVIGATION) {
return;
}
mRunningAnims++;
// Set initial values before animation and start animation
Anvil.currentView().setX(from);
Anvil.currentView().setAlpha(fromAlpha);
Anvil.currentView().animate()
.x(to)
.alpha(toAlpha)
.setDuration(ANIM_DURATION)
.withEndAction(() -> {
// When animation is finished - decrease the number of pending
// animations and if counted down to zero - pop current transition from
// the stack
mRunningAnims--;
if (mRunningAnims == 0) {
mIndex += (mNavQueue.poll() == Navigation.PREV ? -1 : +1);
Anvil.render();
}
});
}
开发者ID:zserge,项目名称:anvil-examples,代码行数:24,代码来源:AnimatedPickerView.java
示例6: editor
import trikita.anvil.Anvil; //导入依赖的package包/类
private void editor() {
relativeLayout(() -> {
Style.Editor.background();
v(Editor.class, () -> {
size(FILL, FILL);
gravity(TOP | START);
text(App.getState().text());
Style.Editor.textStyle();
backgroundDrawable(null);
init(() -> {
mEditor = Anvil.currentView();
mEditor.setOnSelectionChangedListener(pos -> {
App.dispatch(new Action<>(ActionType.SET_CURSOR, pos));
});
});
onTextChanged(chars -> {
String s = chars.toString();
App.dispatch(new Action<>(ActionType.SET_TEXT, s));
App.dispatch(new Action<>(ActionType.SET_CURSOR, mEditor.getSelectionStart()));
});
});
textView(() -> {
Style.Editor.menuButton();
onClick(this::onOpenMenu);
});
frameLayout(() -> {
Style.Editor.previewContainer();
v(Preview.class, () -> {
Style.Editor.previewSize();
onClick(v -> App.dispatch(new Action<>(ActionType.OPEN_PRESENTATION)));
Anvil.currentView().invalidate();
});
});
});
}
开发者ID:trikita,项目名称:slide,代码行数:40,代码来源:MainLayout.java
示例7: presentation
import trikita.anvil.Anvil; //导入依赖的package包/类
private void presentation() {
relativeLayout(() -> {
size(FILL, FILL);
Style.Preview.background(App.getState().colorScheme());
v(Preview.class, () -> {
size(FILL, WRAP);
centerInParent();
Anvil.currentView().invalidate();
});
linearLayout(() -> {
size(FILL, FILL);
Style.Preview.touchPlaceholder(v -> App.dispatch(new Action<>(ActionType.PREV_PAGE)));
Style.Preview.touchPlaceholder(v -> App.dispatch(new Action<>(ActionType.TOGGLE_TOOLBAR)));
Style.Preview.touchPlaceholder(v -> App.dispatch(new Action<>(ActionType.NEXT_PAGE)));
});
button(() -> {
Style.Preview.button(App.getState().colorScheme());
margin(0, 0, 0, dip(25));
alignParentBottom();
centerHorizontal();
visibility(App.getState().toolbarShown());
onClick(v -> App.dispatch(new Action<>(ActionType.CLOSE_PRESENTATION)));
});
});
}
开发者ID:trikita,项目名称:slide,代码行数:30,代码来源:MainLayout.java
示例8: onBitmapLoaded
import trikita.anvil.Anvil; //导入依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
cacheBitmap = bitmap;
if (from != Picasso.LoadedFrom.MEMORY) {
Anvil.render();
}
}
开发者ID:trikita,项目名称:slide,代码行数:8,代码来源:Slide.java
示例9: bindingViews
import trikita.anvil.Anvil; //导入依赖的package包/类
private void bindingViews() {
//Bindings Defaults
Anvil.mount(findViewById(R.id.activity_gif_list), () -> {
withId(R.id.loading, () -> visibility(mGifProgressVisibility));
if (mAnvilRenderListener != null) mAnvilRenderListener.onAnvilRendered();
});
}
开发者ID:Catbag,项目名称:redux-android-sample,代码行数:9,代码来源:GifListActivity.java
示例10: setupEndlessScrolling
import trikita.anvil.Anvil; //导入依赖的package包/类
private void setupEndlessScrolling() {
//TODO: PR on Anvil Recycler to exposes addOnScrollListener
((RecyclerView) Anvil.currentView())
.addOnScrollListener(new EndlessRecyclerScrollListener(mLayoutManager) {
@Override
public void onLoadMore(int page, int totalItemsCount, RecyclerView view) {
if (mHasMoreGifs) {
GifListActionCreator.getInstance().fetchGifs();
}
}
});
}
开发者ID:Catbag,项目名称:redux-android-sample,代码行数:13,代码来源:FeedView.java
示例11: onResume
import trikita.anvil.Anvil; //导入依赖的package包/类
public void onResume() {
super.onResume();
updateTheme();
Anvil.render();
Promote.after(7).days().every(7).days().rate(this);
Promote.after(3).days().every(14).days().share(this,
Promote.FACEBOOK_TWITTER,
"https://github.com/trikita/talalarmo",
"Talalarmo: elegant open-source alarm clock");
}
开发者ID:trikita,项目名称:talalarmo,代码行数:11,代码来源:MainActivity.java
示例12: bottomBar
import trikita.anvil.Anvil; //导入依赖的package包/类
private static void bottomBar() {
linearLayout(() -> {
size(FILL, dip(62));
backgroundColor(Theme.get(App.getState().settings().theme()).backgroundTranslucentColor);
Theme.materialIcon(() -> {
text("\ue857"); // ALARM OFF
textSize(dip(32));
textColor(Theme.get(App.getState().settings().theme()).secondaryTextColor);
padding(dip(15));
visibility(App.getState().alarm().on());
onClick(v -> App.dispatch(new Action<>(Actions.Alarm.OFF)));
});
textView(() -> {
size(0, FILL);
weight(1f);
margin(dip(10), 0);
typeface("fonts/Roboto-Light.ttf");
textSize(dip(16));
textColor(Theme.get(App.getState().settings().theme()).primaryTextColor);
gravity(CENTER | CENTER_VERTICAL);
text(formatAlarmTime(Anvil.currentView().getContext()));
});
Theme.materialIcon(() -> {
text("\ue5d4"); // "more vert"
textSize(dip(32));
textColor(Theme.get(App.getState().settings().theme()).secondaryTextColor);
padding(dip(15));
onClick(AlarmLayout::showSettingsMenu);
});
});
}
开发者ID:trikita,项目名称:talalarmo,代码行数:35,代码来源:AlarmLayout.java
示例13: deleteButton
import trikita.anvil.Anvil; //导入依赖的package包/类
public static void deleteButton(Anvil.Renderable r) {
textView(() -> {
size(dip(36), dip(36));
gravity(Gravity.CENTER);
margin(Base.margin);
text(R.string.clear_icon);
iconNormal();
r.view();
});
}
开发者ID:krugloid,项目名称:todo-jedux,代码行数:11,代码来源:Style.java
示例14: windowBackground
import trikita.anvil.Anvil; //导入依赖的package包/类
public static void windowBackground(Anvil.Renderable r) {
linearLayout(() -> {
size(FILL, FILL);
orientation(LinearLayout.VERTICAL);
backgroundResource(Base.background);
r.view();
});
}
开发者ID:krugloid,项目名称:todo-jedux,代码行数:9,代码来源:Style.java
示例15: bottomBar
import trikita.anvil.Anvil; //导入依赖的package包/类
public static void bottomBar(Anvil.Renderable r) {
button(() -> {
size(FILL, dip(64));
layoutGravity(Gravity.BOTTOM);
text(R.string.delete_icon);
textSize(Base.textSize * 1.5f);
textColor(Base.iconInverseColor);
typeface(Base.iconFont);
backgroundResource(R.drawable.bottom_bar_background);
r.view();
});
}
开发者ID:krugloid,项目名称:todo-jedux,代码行数:13,代码来源:Style.java
示例16: layout
import trikita.anvil.Anvil; //导入依赖的package包/类
public static void layout(Anvil.Renderable r) {
linearLayout(() -> {
size(FILL, dip(54));
margin(Base.margin * 3);
gravity(Gravity.CENTER_VERTICAL);
backgroundResource(R.drawable.input_background);
r.view();
});
}
开发者ID:krugloid,项目名称:todo-jedux,代码行数:10,代码来源:Style.java
示例17: text
import trikita.anvil.Anvil; //导入依赖的package包/类
public static void text(Anvil.Renderable r) {
editText(() -> {
size(0, WRAP);
weight(1);
padding(Base.padding);
hint(R.string.todo_input_hint);
imeOptions(EditorInfo.IME_ACTION_DONE);
singleLine(true);
textNormal();
r.view();
});
}
开发者ID:krugloid,项目名称:todo-jedux,代码行数:13,代码来源:Style.java
示例18: checkbox
import trikita.anvil.Anvil; //导入依赖的package包/类
public static void checkbox(Anvil.Renderable r) {
checkBox(() -> {
size(0, WRAP);
weight(1);
margin(Base.margin * 2, Base.margin * 5);
padding(Base.padding, 0, 0, 0);
textInverse();
r.view();
});
}
开发者ID:krugloid,项目名称:todo-jedux,代码行数:11,代码来源:Style.java
示例19: onCreate
import trikita.anvil.Anvil; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
sInstance = this;
PersistanceController persistanceController = new PersistanceController(this);
State initialState = persistanceController.getSavedState();
if (initialState == null) {
initialState = State.getDefault();
}
this.store = new Store<>(new State.Reducer(), initialState, persistanceController);
this.store.subscribe(Anvil::render);
}
开发者ID:krugloid,项目名称:todo-jedux,代码行数:16,代码来源:App.java
示例20: update
import trikita.anvil.Anvil; //导入依赖的package包/类
private void update(Mutable<Float> value) {
// If "dummy" value is the first sum,
// then set second sum's value,
// and set second sum as "reactive" value
if (value == mFirstSum) {
mSecondSum.set(mCurrencyManager.
exchange(mFirstIndex.get(), mSecondIndex.get(), value.get()));
// Vice versa
} else {
mFirstSum.set(mCurrencyManager.
exchange(mSecondIndex.get(), mFirstIndex.get(), value.get()));
}
// Re-render now
Anvil.render();
}
开发者ID:zserge,项目名称:anvil-examples,代码行数:16,代码来源:CurrencyView.java
注:本文中的trikita.anvil.Anvil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论