<commit_before>package com.fruit.launcher;

import com.fruit.launcher.LauncherSettings.Applications;
import com.fruit.launcher.LauncherSettings.BaseLauncherColumns;
import com.fruit.launcher.LauncherSettings.Favorites;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import java.net.URISyntaxException;

public class DockButton extends ImageView implements DropTarget, DragSource,
		LauncherMonitor.InfoCallback {

	private static final String TAG = "DockButton";

	public boolean mIsEmpty;
	public boolean mIsHold;
	public boolean mIsHome;

	private Launcher mLauncher;

	private ShortcutInfo mBackupDockButtonInfo;
	private Paint mTrashPaint;

	private Paint mPaint;

	private Bitmap mCueBitmap;
	private CueNumber mCueNumber;

	public DockButton(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
		mIsEmpty = true;
		mIsHold = false;
		mIsHome = false;
		mLauncher = null;

		mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG);
		mPaint.setColor(Color.WHITE);
		mPaint.setTextSize(18);
		mPaint.setTypeface(Typeface.SANS_SERIF);

		mCueNumber = new CueNumber();
		mCueNumber.mbNumber = false;
		mCueNumber.mMonitorType = LauncherMonitor.MONITOR_NONE;
	}

	@Override
	public void draw(Canvas canvas) {
		super.draw(canvas);

		if (mCueNumber.mbNumber) {
			mCueNumber.drawCueNumber(canvas, mPaint, this.getWidth(), this.getHeight(),
					mCueBitmap);
		}
	}

	public void setDrawCueNumberState(boolean draw, int type) {
		if (draw) {
			if (mCueBitmap == null) {
				BitmapDrawable drawable = (BitmapDrawable) getResources()
						.getDrawable(R.drawable.ic_cue_bg);
				mCueBitmap = drawable.getBitmap();
			}
			if (mLauncher != null) {
				mLauncher.registerMonitor(type, this);
			}
		} else {
			if (mLauncher != null) {
				mLauncher.unregisterMonitor(type, this);
			}
		}

		mCueNumber.mMonitorType = type;
		mCueNumber.mbNumber = draw;
	}

	@Override
	public boolean acceptDrop(DragSource source, int x, int y, int xOffset,
			int yOffset, DragView dragView, Object dragInfo) {
		// TODO Auto-generated method stub
		final int itemType = ((ItemInfo) dragInfo).itemType;
		// Only support ITEM_TYPE_APPLICATION and ITEM_TYPE_SHORTCUT
		return (itemType == BaseLauncherColumns.ITEM_TYPE_APPLICATION
				|| itemType == BaseLauncherColumns.ITEM_TYPE_SHORTCUT
				|| itemType == Applications.APPS_TYPE_APP || itemType == Applications.APPS_TYPE_FOLDERAPP);
	}

	@Override
	public void onDrop(DragSource source, int x, int y, int xOffset,
			int yOffset, DragView dragView, Object dragInfo) {
		Log.d(TAG, "drag sequence,dockbutton onDrop");

		// TODO Auto-generated method stub
		final int itemType = ((ItemInfo) dragInfo).itemType;
		final int index = ((DockBar.LayoutParams) getLayoutParams()).index;
<commit_msg>Refactoring.<commit_after>package com.fruit.launcher;

import com.fruit.launcher.LauncherSettings.Applications;
import com.fruit.launcher.LauncherSettings.BaseLauncherColumns;
import com.fruit.launcher.LauncherSettings.Favorites;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import java.net.URISyntaxException;

public class DockButton extends ImageView implements DropTarget, DragSource,
		LauncherMonitor.InfoCallback {

	private static final String TAG = "DockButton";

	public boolean mIsEmpty;
	public boolean mIsHold;
	public boolean mIsHome;

	private Launcher mLauncher;

	private ShortcutInfo mBackupDockButtonInfo;
	private Paint mTrashPaint;

	private Paint mPaint;

	private Bitmap mCueBitmap;
	private CueNumber mCueNumber;

	public DockButton(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
		mIsEmpty = true;
		mIsHold = false;
		mIsHome = false;
		mLauncher = null;

		mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG);
		mPaint.setColor(Color.WHITE);
		mPaint.setTextSize(18);
		mPaint.setTypeface(Typeface.SANS_SERIF);

		mCueNumber = new CueNumber();
		mCueNumber.mbNumber = false;
		mCueNumber.mMonitorType = LauncherMonitor.MONITOR_NONE;
	}

	@Override
	public void draw(Canvas canvas) {
		super.draw(canvas);

		if (mCueNumber.mbNumber) {
			mCueNumber.drawCueNumber(canvas, mPaint, this.getWidth(), this.getHeight(),
					mCueBitmap);
		}
	}

	public void setDrawCueNumberState(boolean draw, int type) {
		if (draw) {
			if (mCueBitmap == null) {
				BitmapDrawable drawable = (BitmapDrawable) getResources()
						.getDrawable(R.drawable.ic_cue_bg);
				mCueBitmap = drawable.getBitmap();
			}
			if (mLauncher != null) {
				mLauncher.registerMonitor(type, this);
			}
		} else {
			if (mLauncher != null) {
				mLauncher.unregisterMonitor(type, this);
			}
		}

		mCueNumber.mMonitorType = type;
		mCueNumber.mbNumber = draw;
	}

	@Override
	public boolean acceptDrop(DragSource source, int x, int y, int xOffset,
			int yOffset, DragView dragView, Object dragInfo) {
		// TODO Auto-generated method stub
		final int itemType = ((ItemInfo) dragInfo).itemType;
		// Only support ITEM_TYPE_APPLICATION and ITEM_TYPE_SHORTCUT
		return (itemType == BaseLauncherColumns.ITEM_TYPE_APPLICATION
				|| itemType == BaseLauncherColumns.ITEM_TYPE_SHORTCUT
				|| itemType == Applications.APPS_TYPE_APP || itemType == Applications.APPS_TYPE_FOLDERAPP);
	}

	@Override
	public void onDrop(DragSource source, int x, int y, int xOffset,
			int yOffset, DragView dragView, Object dragInfo) {
		Log.d(TAG, "drag sequence,dockbutton onDrop");

		// TODO Auto-generated method stub
		final ItemInfo info = (ItemInfo) dragInfo;
		final int itemType = info.itemType;
		final int index = ((DockBar.LayoutParams) getLayoutParams()).index;
		
{'fraction_non_alphanumeric': 0.09569005756962813, 'fraction_numerical': 0.0006223743581764431, 'mean_word_length': 4.9026629935720845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4808925', 'n_tokens_mistral': 2287, 'n_tokens_neox': 2051, 'n_words': 472}