on 09-11-2014 2:49 PM
Lukas,
Guessing from your message about using RFID, I would probably create a new class extending the StringEditAdapter to interface with the RFID reader and return the read value back to Agentry in a field as a String.
--Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill, for test I change the color of the text:
_textView.setTextColor(Color.RED);
In MyStringEditAdapter, this class extends StrindEditAdater and I setup new class on Agentry side, but I dont see any change after deploy new apk on this fild.
Why?
BR
Lukas
/*
* MyStringEditAdapter.java
*/
package com.sap.mobile.platform.client.openui.extensions;
import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;
import android.widget.EditText;
import com.sap.mobile.platform.client.openui.adapters.StringEditAdapter;
import com.sap.mobile.platform.client.openui.models.StringEditModel;
import com.sap.mobile.platform.client.openui.utils.Helpers;
import com.sap.mobile.platform.core.openui.AutosizeBehavior;
public class MyStringEditAdapter extends StringEditAdapter
{
/** Core model */
StringEditModel _model;
/** App context */
Context _context;
/** Text view */
EditText _textView;
/** Allows auto height */
boolean _autoHeight;
/** Carriage return */
boolean _carriageReturn;
/** Word Wrapt */
boolean _wordWrap;
/*
* (non-Javadoc)
*
* @see
* com.sap.mobile.platform.client.openui.adapters.StringDisplayAdapter#initialize(com.sap.mobile.platform.client
* .openui.models.StringDisplayModel, android.content.Context)
*/
@Override
public void initialize(StringEditModel model, Context context)
{
_model = model;
_context = context;
_carriageReturn = _model.isCarriageReturnAllowed();
_wordWrap = _model.isWordWrapAllowed();
_autoHeight = _model.isAutosizeSupported();
}
/*
* (non-Javadoc)
*
* @see com.sap.mobile.platform.client.openui.adapters.FieldAdapter#getView()
*/
@Override
public View getView()
{
_textView = new EditText(_context);
_textView.setText(_model.getValue());
_textView.setTextColor(Color.RED); //LR
_textView.setGravity(Gravity.CENTER_VERTICAL);
if (!canHandleAutosizing())
{
_textView.setSingleLine();
}
_textView.setOnFocusChangeListener(new View.OnFocusChangeListener()
{
@Override
public void onFocusChange(View v, boolean hasFocus)
{
if (!hasFocus)
{
_model.processInput(_textView.getText().toString());
}
}// end onFocuschange
});// end setOnFocusChangeListener
return _textView;
}
/**
* Can we handle autosizing?
*
* @return if we can handle autosizing
*/
public boolean canHandleAutosizing()
{
if (_autoHeight && (_wordWrap || _carriageReturn))
{
return true;
}
return false;
}
@Override
public AutosizeBehavior getAutosizeBehavior()
{
if (canHandleAutosizing())
{
return AutosizeBehavior.Autosize_FillVisible;
}
return AutosizeBehavior.Autosize_None;
}
@Override
public void valueChanged(String value)
{
_textView.setText(_model.getValue());
}
@Override
public boolean isAgentryDisplayingLabel()
{
return true;
}
@Override
public int getContentHeightForAutosizing(int width)
{
int height = Helpers.AutosizeUtils.heightForMultiLineText(_textView, width, _carriageReturn, _wordWrap);
return height;
}
}
With Open UI you are adding additional classes to the Agentry client. All of the products utilize an Agentry client so yes it can be used with Work Manager.
Also, you need to make sure the field on the screen you are looking at is configured to use your Open UI class. It doesn't automatically change every field in your application you still need to configure it in the editor to use your new class. This gives you the flexibility to control exactly when it is used.
--Bill
Hi Lukas,
Please mark this Discussion with a Correct Answer and Helpful Answer where appropriate. See http://scn.sap.com/community/support/blog/2013/04/03/how-to-close-a-discussion-and-why Even if you discovered the solution without any outside contributions, it helps others to understand what the solution turned out to be.
Regards, Mike
SAP Customer Experience Group - CEG
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.