Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public View onCreateInputView() {
- final File imagesDir = new File(getFilesDir(), "images");
- RelativeLayout KeyboardLayout = (RelativeLayout) getLayoutInflater().inflate(R.layout.keyboard_layout, null);
- LinearLayout ImageContainer = (LinearLayout) KeyboardLayout.findViewById(R.id.imageContainer);
- LinearLayout ImageContainerColumn = (LinearLayout) getLayoutInflater().inflate(R.layout.image_container_column, ImageContainer, false);
- for (int i = 0; i < rawFiles.length; i++) {
- System.out.println(i);
- if ((i % 2) == 0) {
- ImageContainerColumn = (LinearLayout) getLayoutInflater().inflate(R.layout.image_container_column, ImageContainer, false);
- }
- // Creating button
- ImageButton ImgButton = (ImageButton) getLayoutInflater().inflate(R.layout.image_button, ImageContainerColumn, false);
- ImgButton.setImageResource(getResources().getIdentifier(rawFiles[i], "raw", getPackageName()));
- ImgButton.setTag(rawFiles[i]);
- ImgButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- String emojiName = view.getTag().toString().replaceAll("_", "-");
- final File file = getFileForResource(ImageKeyboard.this, getResources().getIdentifier(view.getTag().toString(), "raw", getPackageName()), imagesDir, "${view.getTag().toString()}.png");
- ImageKeyboard.this.doCommitContent("A ${emojiName} logo", MIME_TYPE_PNG, file);
- }
- });
- ImageContainerColumn.addView(ImgButton);
- if ((i % 2) == 0) {
- ImageContainer.addView(ImageContainerColumn);
- }
- }
- return KeyboardLayout;
- }
Add Comment
Please, Sign In to add comment