| Chunk |
|---|
| Conflicting content |
|---|
private int mTabBarHeight;
private int mTabBarHorizontalPadding;
<<<<<<< HEAD
=======
View mWorkspaceDesc1;
View mWorkspaceDesc2;
View mAllAppsDesc;
>>>>>>> 2d6765a51001cb361bed91f15063d0557f9ac675
public Cling(Context context) {
this(context, null, 0);
} |
| Solution content |
|---|
private int mTabBarHeight;
private int mTabBarHorizontalPadding;
private int mButtonBarHeight;
private float mRevealRadius;
private int[] mPositionData;
private Paint mErasePaint;
public Cling(Context context) {
this(context, null, 0);
} |
| File |
|---|
| Cling.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Attribute |
| Chunk |
|---|
| Conflicting content |
|---|
mTabBarHorizontalPadding =
r.getDimensionPixelSize(R.dimen.toolbar_button_horizontal_padding);
<<<<<<< HEAD
mErasePaint = new Paint();
mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
mErasePaint.setColor(0xFFFFFF);
mErasePaint.setAlpha(0);
=======
mWorkspaceDesc1 = findViewById(R.id.workspace_cling_move_item);
mWorkspaceDesc2 = findViewById(R.id.workspace_cling_open_all_apps);
mAllAppsDesc = findViewById(R.id.all_apps_cling_add_item);
>>>>>>> 2d6765a51001cb361bed91f15063d0557f9ac675
mIsInitialized = true;
}
} |
| Solution content |
|---|
mTabBarHorizontalPadding =
r.getDimensionPixelSize(R.dimen.toolbar_button_horizontal_padding);
mButtonBarHeight = r.getDimensionPixelSize(R.dimen.button_bar_height);
mErasePaint = new Paint();
mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
mErasePaint.setColor(0xFFFFFF);
mErasePaint.setAlpha(0);
mIsInitialized = true;
}
} |
| File |
|---|
| Cling.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Attribute |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
@Override
public boolean onTouchEvent(android.view.MotionEvent event) {
<<<<<<< HEAD
if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) ||
mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) ||
mDrawIdentifier.equals(ALLAPPS_PORTRAIT) ||
mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
int[] pos = getPunchThroughPosition();
double diff = Math.sqrt(Math.pow(event.getX() - pos[0], 2) +
Math.pow(event.getY() - pos[1], 2));
if (diff < mRevealRadius) {
return false;
}
} else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) ||
mDrawIdentifier.equals(FOLDER_LANDSCAPE)) {
Folder f = mLauncher.getWorkspace().getOpenFolder();
if (f != null) {
Rect r = new Rect();
f.getHitRect(r);
if (r.contains((int) event.getX(), (int) event.getY())) {
return false;
}
}
}
=======
// Do nothing
>>>>>>> 2d6765a51001cb361bed91f15063d0557f9ac675
return true;
};
|
| Solution content |
|---|
@Override
public boolean onTouchEvent(android.view.MotionEvent event) {
if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) ||
mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) ||
mDrawIdentifier.equals(ALLAPPS_PORTRAIT) ||
mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
int[] pos = getPunchThroughPosition();
double diff = Math.sqrt(Math.pow(event.getX() - pos[0], 2) +
Math.pow(event.getY() - pos[1], 2));
if (diff < mRevealRadius) {
return false;
}
} else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) ||
mDrawIdentifier.equals(FOLDER_LANDSCAPE)) {
Folder f = mLauncher.getWorkspace().getOpenFolder();
if (f != null) {
Rect r = new Rect();
f.getHitRect(r);
if (r.contains((int) event.getX(), (int) event.getY())) {
return false;
}
}
}
return true;
};
|
| File |
|---|
| Cling.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
int[] loc = new int[2];
canvas.drawLine(p4.x, p4.y, p2.x, p2.y, p);
}
<<<<<<< HEAD
// Initialize the draw buffer (to allow punching through)
=======
/* Draw the move line */ {
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)
mWorkspaceDesc1.getLayoutParams();
mWorkspaceDesc1.getLocationInWindow(loc);
int x = loc[0];
int y = loc[1];
int w = mWorkspaceDesc1.getWidth();
int h = mWorkspaceDesc1.getHeight();
Point p1 = new Point(x + w, y - (2 * dotRadius));
Point p2 = new Point(getMeasuredWidth() - xOffset, y - (2 * dotRadius));
canvas.drawCircle(p1.x, p1.y, dotRadius, p);
canvas.drawCircle(p2.x, p2.y, dotRadius, p);
canvas.drawLine(p1.x, p1.y, p2.x, p2.y, p);
}
} else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT)) {
float r = mAppIconSize * 1.1f;
float scale = r / mPunchThroughGraphicCenterRadius;
int dw = (int) (scale * mPunchThroughGraphic.getIntrinsicWidth());
int dh = (int) (scale * mPunchThroughGraphic.getIntrinsicHeight());
int cx = getMeasuredWidth() / 2;
int cy = mTabBarHeight + ((getMeasuredHeight() - mTabBarHeight) / 2);
mPunchThroughGraphic.setBounds(cx - dw/2, cy - dh/2, cx + dw/2, cy + dh/2);
mPunchThroughGraphic.draw(canvas);
/* Draw the line */ {
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)
mAllAppsDesc.getLayoutParams();
int[] loc = new int[2];
mAllAppsDesc.getLocationInWindow(loc);
int x = loc[0];
int y = loc[1];
int yOffset = (int) (2.5f * metrics.density);
int w = mAllAppsDesc.getWidth();
int h = mAllAppsDesc.getHeight();
Point p1 = new Point(getMeasuredWidth() / 2, y + h + yOffset);
Point p2 = new Point(cx, cy);
canvas.drawCircle(p1.x, p1.y, dotRadius, p);
canvas.drawCircle(p2.x, p2.y, dotRadius, p);
canvas.drawLine(p1.x, p1.y, p2.x, p2.y, p);
}
} else if (mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
float r = mAppIconSize * 1.1f;
float scale = r / mPunchThroughGraphicCenterRadius;
int dw = (int) (scale * mPunchThroughGraphic.getIntrinsicWidth());
int dh = (int) (scale * mPunchThroughGraphic.getIntrinsicHeight());
int cx = getMeasuredWidth() / 2 + getMeasuredWidth() / 4;
int cy = mTabBarHeight + ((getMeasuredHeight() - mTabBarHeight) / 2);
mPunchThroughGraphic.setBounds(cx - dw/2, cy - dh/2, cx + dw/2, cy + dh/2);
mPunchThroughGraphic.draw(canvas);
/* Draw the line */ {
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)
mAllAppsDesc.getLayoutParams();
int[] loc = new int[2];
mAllAppsDesc.getLocationInWindow(loc);
int x = loc[0];
int y = loc[1];
int w = mAllAppsDesc.getWidth();
int h = mAllAppsDesc.getHeight();
Point p1 = new Point(x + w, y);
Point p2 = new Point(cx, cy);
canvas.drawCircle(p1.x, p1.y, dotRadius, p);
canvas.drawCircle(p2.x, p2.y, dotRadius, p);
canvas.drawLine(p1.x, p1.y, p2.x, p2.y, p);
}
}
/*
// Draw the background
>>>>>>> 2d6765a51001cb361bed91f15063d0557f9ac675
Bitmap b = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(),
Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b); |
| Solution content |
|---|
int[] pos = getPunchThroughPosition();
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.launcher2;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.FrameLayout;
import com.android.launcher.R;
public class Cling extends FrameLayout {
static final String WORKSPACE_CLING_DISMISSED_KEY = "cling.workspace.dismissed";
static final String ALLAPPS_CLING_DISMISSED_KEY = "cling.allapps.dismissed";
static final String FOLDER_CLING_DISMISSED_KEY = "cling.folder.dismissed";
private static String WORKSPACE_PORTRAIT = "workspace_portrait";
private static String WORKSPACE_LANDSCAPE = "workspace_landscape";
private static String ALLAPPS_PORTRAIT = "all_apps_portrait";
private static String ALLAPPS_LANDSCAPE = "all_apps_landscape";
private static String FOLDER_PORTRAIT = "folder_portrait";
private static String FOLDER_LANDSCAPE = "folder_landscape";
private Launcher mLauncher;
private boolean mIsInitialized;
private String mDrawIdentifier;
private Drawable mBackground;
private Drawable mPunchThroughGraphic;
private Drawable mHandTouchGraphic;
private int mPunchThroughGraphicCenterRadius;
private int mAppIconSize;
private int mTabBarHeight;
private int mTabBarHorizontalPadding;
private int mButtonBarHeight;
private float mRevealRadius;
private int[] mPositionData;
private Paint mErasePaint;
public Cling(Context context) {
this(context, null, 0);
}
public Cling(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public Cling(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Cling, defStyle, 0);
mDrawIdentifier = a.getString(R.styleable.Cling_drawIdentifier);
a.recycle();
}
void init(Launcher l, int[] positionData) {
if (!mIsInitialized) {
mLauncher = l;
mPositionData = positionData;
Resources r = getContext().getResources();
mPunchThroughGraphic = r.getDrawable(R.drawable.cling);
mPunchThroughGraphicCenterRadius =
r.getDimensionPixelSize(R.dimen.clingPunchThroughGraphicCenterRadius);
mAppIconSize = r.getDimensionPixelSize(R.dimen.app_icon_size);
mRevealRadius = mAppIconSize * 1f;
mTabBarHeight = r.getDimensionPixelSize(R.dimen.apps_customize_tab_bar_height);
mTabBarHorizontalPadding =
r.getDimensionPixelSize(R.dimen.toolbar_button_horizontal_padding);
mButtonBarHeight = r.getDimensionPixelSize(R.dimen.button_bar_height);
mErasePaint = new Paint();
mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
mErasePaint.setColor(0xFFFFFF);
mErasePaint.setAlpha(0);
mIsInitialized = true;
}
}
void cleanup() {
mBackground = null;
mPunchThroughGraphic = null;
mHandTouchGraphic = null;
mIsInitialized = false;
}
private int[] getPunchThroughPosition() {
if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT)) {
return new int[]{getMeasuredWidth() / 2, getMeasuredHeight() - (mButtonBarHeight / 2)};
} else if (mDrawIdentifier.equals(WORKSPACE_LANDSCAPE)) {
return new int[]{getMeasuredWidth() - (mButtonBarHeight / 2), getMeasuredHeight() / 2};
} else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT) ||
mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
return mPositionData;
}
return new int[]{-1, -1};
}
@Override
public boolean onTouchEvent(android.view.MotionEvent event) {
if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) ||
mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) ||
mDrawIdentifier.equals(ALLAPPS_PORTRAIT) ||
mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
double diff = Math.sqrt(Math.pow(event.getX() - pos[0], 2) +
Math.pow(event.getY() - pos[1], 2));
if (diff < mRevealRadius) {
return false;
}
} else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) ||
mDrawIdentifier.equals(FOLDER_LANDSCAPE)) {
Folder f = mLauncher.getWorkspace().getOpenFolder();
if (f != null) {
Rect r = new Rect();
f.getHitRect(r);
if (r.contains((int) event.getX(), (int) event.getY())) {
return false;
}
}
}
return true;
};
@Override
protected void dispatchDraw(Canvas canvas) {
if (mIsInitialized) {
DisplayMetrics metrics = new DisplayMetrics();
mLauncher.getWindowManager().getDefaultDisplay().getMetrics(metrics);
// Initialize the draw buffer (to allow punching through)
Bitmap b = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(),
Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b); |
| File |
|---|
| Cling.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Array access |
| Cast expression |
| Comment |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
public void run() {
parent.removeView(cling);
}
});
}
}
public void showFirstRunWorkspaceCling() {
anim.start();
}
}
<<<<<<< HEAD
private void removeCling(int id) {
final View cling = findViewById(id);
if (cling != null) {
final ViewGroup parent = (ViewGroup) cling.getParent();
parent.post(new Runnable() {
@Override
// Enable the clings only if they have not been dismissed before
SharedPreferences prefs =
getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
if (isClingsEnabled() && !prefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false)) {
initCling(R.id.workspace_cling, null, false, 0);
} else {
removeCling(R.id.workspace_cling);
}
}
public void showFirstRunAllAppsCling(int[] position) {
// Enable the clings only if they have not been dismissed before
SharedPreferences prefs =
getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
if (isClingsEnabled() && !prefs.getBoolean(Cling.ALLAPPS_CLING_DISMISSED_KEY, false)) {
initCling(R.id.all_apps_cling, position, true, 0);
} else {
removeCling(R.id.all_apps_cling);
}
}
public Cling showFirstRunFoldersCling() {
// Enable the clings only if they have not been dismissed before
SharedPreferences prefs =
getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
Cling cling = null;
if (isClingsEnabled() && !prefs.getBoolean(Cling.FOLDER_CLING_DISMISSED_KEY, false)) {
cling = initCling(R.id.folder_cling, null, true, 0);
} else {
removeCling(R.id.folder_cling);
}
return cling;
}
public boolean isFolderClingVisible() {
Cling cling = (Cling) findViewById(R.id.folder_cling);
if (cling != null) {
return cling.getVisibility() == View.VISIBLE;
}
return false;
}
=======
>>>>>>> 2d6765a51001cb361bed91f15063d0557f9ac675
public void dismissWorkspaceCling(View v) {
Cling cling = (Cling) findViewById(R.id.workspace_cling);
dismissCling(cling, WORKSPACE_CLING_DISMISSED_KEY); |
| Solution content |
|---|
anim.start();
}
}
private void removeCling(int id) {
final View cling = findViewById(id);
if (cling != null) {
final ViewGroup parent = (ViewGroup) cling.getParent();
parent.post(new Runnable() {
@Override
public void run() {
parent.removeView(cling);
}
});
}
}
public void showFirstRunWorkspaceCling() {
// Enable the clings only if they have not been dismissed before
SharedPreferences prefs =
getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
if (isClingsEnabled() && !prefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false)) {
initCling(R.id.workspace_cling, null, false, 0);
} else {
removeCling(R.id.workspace_cling);
}
}
public void showFirstRunAllAppsCling(int[] position) {
// Enable the clings only if they have not been dismissed before
SharedPreferences prefs =
getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
if (isClingsEnabled() && !prefs.getBoolean(Cling.ALLAPPS_CLING_DISMISSED_KEY, false)) {
initCling(R.id.all_apps_cling, position, true, 0);
} else {
removeCling(R.id.all_apps_cling);
}
}
public Cling showFirstRunFoldersCling() {
// Enable the clings only if they have not been dismissed before
SharedPreferences prefs =
getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
Cling cling = null;
if (isClingsEnabled() && !prefs.getBoolean(Cling.FOLDER_CLING_DISMISSED_KEY, false)) {
cling = initCling(R.id.folder_cling, null, true, 0);
} else {
removeCling(R.id.folder_cling);
}
return cling;
}
public boolean isFolderClingVisible() {
Cling cling = (Cling) findViewById(R.id.folder_cling);
if (cling != null) {
return cling.getVisibility() == View.VISIBLE;
}
return false;
}
public void dismissWorkspaceCling(View v) {
Cling cling = (Cling) findViewById(R.id.workspace_cling); |
| File |
|---|
| Launcher.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method declaration |