I have this class which basically is a custom keyboard. now I have to implement it in a new screen and I need to reuse the same class to make the numbers appear randomly, each time, in a different layout .. for security reasons.
in practice I should reuse the variables "key1" "key2" "key3" etc, randomly allocated for a given screen where I need
private TextView key1, key2, key3, key4, key5, key6, key7, key8, key9, key0;
private TextView txtAdditionaLink, message;
private LinearLayout lytAdditionalLinkContainer;
public CustomPinKeyboard(Context context, AttributeSet attrs) throws PinViewInitializationException {
super(context, attrs);
this.context = context;
mAttrs = attrs;
init();
}
private void init() throws PinViewInitializationException {
log(TAG, "init called");
searchForCustomAttributes(mAttrs);
if(changePin){
//[key0,key1,key2,key3,key4,key5,key6,key7,key8,key9]
}
switch (numberOfDigit){
case 0:
inflate(getContext(), R.layout.keyboard_without_pin_layout, this);
break;
case 4:
inflate(getContext(), R.layout.keyboard_with_four_pin_layout, this);
break;
case 5:
inflate(getContext(), R.layout.keyboard_with_five_pin_layout, this);
break;
case 6:
inflate(getContext(), R.layout.keyboard_with_six_pin_layout, this);
break;
}
message = (TextView) findViewById(R.id.pin_point_text_view);
txtAdditionaLink = (TextView) findViewById(R.id.pin_additional_link_text_view);
lytAdditionalLinkContainer = (LinearLayout) findViewById(R.id.pin_additional_link_container);
pinMask = (LinearLayout) findViewById(R.id.pin_mask);
setKeyboardTitle();
evaluateAdditionlLink();
initPin();
initKey();
}
Aucun commentaire:
Enregistrer un commentaire