public static interface Listener {
public void onClick(int id);
}
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(product.id);
}
}
});
productsAdapter.setListener(new ProductsAdapter.Listener() {
public void onClick(int id) {
Intent intent = new Intent(MainActivity.this, InnerActivity.class);
intent.putExtra(InnerActivity.EXTRA_PRODUCT, id);
startActivity(intent);
}
});
final Cursor cursor = db.query ("products", null, "id = ?", new String[] { id }, null, null, null);
public function afterSave($insert, $changedAttributes)
{
if ($insert && $this->role_id === 2) {
$profile = $this->module->manager->createProfile([
'user_id' => $this->id,
'gravatar_email' => $this->email
]);
$profile->save(false);
}
parent::afterSave($insert, $changedAttributes);
}
if((Build.VERSION.SDK_INT < Build.VERSION_CODES.M || Settings.canDrawOverlays(this))) {
new NotificationPopupView(intent, pushNotification.getTitle(), pushNotification.getBody());
}
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
const configureStore = history => {
const store = createStore(
rootReducer(history),
composeWithDevTools(
applyMiddleware(routerMiddleware(history), sagaMiddleware, logger)
)
);
sagaMiddleware.run(rootSaga);
return store;
};
const withProductsAndCustomers = Component => {
class ProductsAndCustomers extends React.Component {
// методы
render() {
return <Component {...this.props}/>;
}
}
return connect(mapStateToProps, mapDispatchToProps)(ProductsAndCustomers);
}
const mapStateToProps = state => {
return {
ProductsAndCustomers: state
}
}
const mapDispatchToProps = dispatch => {
return {
onRequestProducts: () => dispatch()
};
}