private void setDataFromTypedArray(
     Row parent,
     KeyboardDimens keyboardDimens,
     Resources askResources,
     TypedArray a,
     int remoteIndex,
     int localAttrId) {
   try {
     switch (localAttrId) {
       case android.R.attr.keyWidth:
         width =
             getDimensionOrFraction(a, remoteIndex, keyboard.mDisplayWidth, parent.defaultWidth);
         width = Math.min(keyboardDimens.getKeyMaxWidth(), width);
         break;
       case android.R.attr.keyHeight:
         int heightCode = getKeyHeightCode(a, remoteIndex, parent.defaultHeightCode);
         height =
             KeyboardSupport.getKeyHeightFromHeightCode(
                 keyboardDimens, heightCode, askResources.getConfiguration().orientation);
         break;
       case android.R.attr.horizontalGap:
         gap =
             getDimensionOrFraction(
                 a, remoteIndex, keyboard.mDisplayWidth, parent.defaultHorizontalGap);
         break;
       case android.R.attr.codes:
         codes = KeyboardSupport.getKeyCodesFromTypedArray(a, remoteIndex);
         break;
       case android.R.attr.iconPreview:
         iconPreview = a.getDrawable(remoteIndex);
         KeyboardSupport.updateDrawableBounds(iconPreview);
         break;
       case android.R.attr.popupCharacters:
         popupCharacters = a.getText(remoteIndex);
         break;
       case android.R.attr.popupKeyboard:
         popupResId = a.getResourceId(remoteIndex, 0);
         break;
       case android.R.attr.isRepeatable:
         repeatable = a.getBoolean(remoteIndex, false);
         break;
       case R.attr.showPreview:
         showPreview = a.getBoolean(remoteIndex, true);
         break;
       case R.attr.keyDynamicEmblem:
         dynamicEmblem = a.getInt(remoteIndex, KEY_EMBLEM_NONE);
         break;
       case android.R.attr.isModifier:
         modifier = a.getBoolean(remoteIndex, false);
         break;
       case android.R.attr.isSticky:
         sticky = a.getBoolean(remoteIndex, false);
         break;
       case android.R.attr.keyEdgeFlags:
         edgeFlags = a.getInt(remoteIndex, 0);
         edgeFlags |= parent.rowEdgeFlags;
         break;
       case android.R.attr.keyIcon:
         icon = a.getDrawable(remoteIndex);
         KeyboardSupport.updateDrawableBounds(icon);
         break;
       case android.R.attr.keyLabel:
         label = a.getText(remoteIndex);
         break;
       case android.R.attr.keyOutputText:
         text = a.getText(remoteIndex);
         break;
     }
   } catch (Exception e) {
     Log.w(TAG, "Failed to load keyboard layout! ", e);
   }
 }