<commit_before>package com.sometrik.framework;

import java.util.ArrayList;

import android.app.ActionBar;
import android.view.MenuItem;
import android.view.View;

public class FWActionBar implements NativeCommandHandler {
  
  int id;
  ActionBar actionBar;
  ArrayList<ActionBarItem> itemList;
  

  public FWActionBar(FrameWork frame, String title, int id){
    actionBar = frame.getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(title);
    actionBar.show();
    itemList = new ArrayList<ActionBarItem>();
    this.id = id;
  }
  
  public ArrayList<ActionBarItem> getItemList(){
    return itemList;
  }
  
  @Override
  public void onScreenOrientationChange(boolean isLandscape) {
    // TODO Auto-generated method stub
    
  }

  @Override
  public void addChild(View view) {
    System.out.println("Command couldn't be handled by FWActionBar");
  }

  @Override
  public void addOption(int optionId, String text) {
    itemList.add(new ActionBarItem(optionId, text, "default"));
  }

  @Override
  public void addData(String text, int row, int column, int sheet) {
    System.out.println("Command couldn't be handled by FWActionBar");
  }

  @Override
  public void setValue(String v) {
    actionBar.setTitle(v);
  }

  @Override
  public void setValue(int v) {
    if (v == 0){
      actionBar.hide();
    } else if (v == 1){
      actionBar.show();
    }
  }

  @Override
  public void setViewEnabled(Boolean enabled) {
    if (!enabled){
      actionBar.hide();
    } else {
      actionBar.show();
    }
  }

  @Override
  public void setViewVisibility(boolean visible) {
    if (!visible){
      actionBar.hide();
    } else {
      actionBar.show();
    }
  }

  @Override
  public void setStyle(String key, String value) {
    // TODO Auto-generated method stub
    
  }

  @Override
  public void setError(boolean hasError, String errorText) {
    System.out.println("Command couldn't be handled by FWActionBar");
  }

  @Override
  public int getElementId() {
    return id;
  }

  
  public class ActionBarItem {
<commit_msg>Add icon style<commit_after>package com.sometrik.framework;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

import android.app.ActionBar;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.view.View;

public class FWActionBar implements NativeCommandHandler {
  
  int id;
  ActionBar actionBar;
  ArrayList<ActionBarItem> itemList;
  FrameWork frame;
  

  public FWActionBar(FrameWork frame, String title, int id){
    this.frame = frame;
    actionBar = frame.getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(title);
    actionBar.show();
    itemList = new ArrayList<ActionBarItem>();
    this.id = id;
  }
  
  public ArrayList<ActionBarItem> getItemList(){
    return itemList;
  }
  
  @Override
  public void onScreenOrientationChange(boolean isLandscape) {
    // TODO Auto-generated method stub
    
  }

  @Override
  public void addChild(View view) {
    System.out.println("Command couldn't be handled by FWActionBar");
  }

  @Override
  public void addOption(int optionId, String text) {
    itemList.add(new ActionBarItem(optionId, text, "default"));
  }

  @Override
  public void addData(String text, int row, int column, int sheet) {
    System.out.println("Command couldn't be handled by FWActionBar");
  }

  @Override
  public void setValue(String v) {
    actionBar.setTitle(v);
  }

  @Override
  public void setValue(int v) {
    if (v == 0){
      actionBar.hide();
    } else if (v == 1){
      actionBar.show();
    }
  }

  @Override
  public void setViewEnabled(Boolean enabled) {
    if (!enabled){
      actionBar.hide();
    } else {
      actionBar.show();
    }
  }

  @Override
  public void setViewVisibility(boolean visible) {
    if (!visible){
      actionBar.hide();
    } else {
      actionBar.show();
    }
  }

  @Override
  public void setStyle(String key, String value) {
    if (key.equals("icon")){
      try {
	InputStream stream = frame.getAssets().open(value);
	Bitmap b = BitmapFactory.decodeStream(stream);
	;
	Drawable d = new BitmapDrawable(b);
	actionBar.setIcon(d);
      } catch (IOException e) {
	e.printStackTrace();
      }
    }
  }

  @Override
  public void setError(boolean hasError, String errorText) {
    System.out.println("Command couldn't be handled by FWActionBar");
  }

  @Override
  public int getElementId() {
    return id;
  }

  
  public class ActionBarItem {

{'fraction_non_alphanumeric': 0.10786856895806313, 'fraction_numerical': 0.0008646779074794639, 'mean_word_length': 3.3122087604846224, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3013460', 'n_tokens_mistral': 1458, 'n_tokens_neox': 1411, 'n_words': 358}