diff options
author | Jorge Ruesga <jorge@ruesga.com> | 2013-11-03 20:27:42 +0100 |
---|---|---|
committer | Jorge Ruesga <jorge@ruesga.com> | 2013-11-03 20:27:42 +0100 |
commit | cfa23b580d7d50eb4c1e739f590bedd6b0a84bd8 (patch) | |
tree | 8aeb1f472ba965913d0f06ec203db10e3515fd00 /src/org | |
parent | cf54b6212fdfd3bc0a0a1cab3b2d8415e07b382b (diff) | |
download | android_packages_wallpapers_PhotoPhase-cfa23b580d7d50eb4c1e739f590bedd6b0a84bd8.tar.gz android_packages_wallpapers_PhotoPhase-cfa23b580d7d50eb4c1e739f590bedd6b0a84bd8.tar.bz2 android_packages_wallpapers_PhotoPhase-cfa23b580d7d50eb4c1e739f590bedd6b0a84bd8.zip |
Dispositions templates
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/org')
7 files changed, 413 insertions, 54 deletions
diff --git a/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java b/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java index c4950a3..0fb489f 100644 --- a/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java +++ b/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java @@ -167,7 +167,7 @@ public class PhotoPhaseRenderer implements GLSurfaceView.Renderer { // Select a new transition mWorld.selectRandomTransition(); mLastRunningTransition = System.currentTimeMillis(); - + // Now force continuously render while transition is applied mDispatcher.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY); } @@ -514,7 +514,6 @@ public class PhotoPhaseRenderer implements GLSurfaceView.Renderer { * Recreate the world */ void recreateWorld() { -System.out.println("recreateWorld(): " + mIsPaused); if (mIsPaused) { mRecreateWorld = true; return; diff --git a/src/org/cyanogenmod/wallpapers/photophase/adapters/DispositionAdapter.java b/src/org/cyanogenmod/wallpapers/photophase/adapters/DispositionAdapter.java new file mode 100644 index 0000000..4fa4926 --- /dev/null +++ b/src/org/cyanogenmod/wallpapers/photophase/adapters/DispositionAdapter.java @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2013 The CyanogenMod 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 org.cyanogenmod.wallpapers.photophase.adapters; + +import android.content.Context; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.util.SparseArray; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import org.cyanogenmod.wallpapers.photophase.R; +import org.cyanogenmod.wallpapers.photophase.model.Dispositions; +import org.cyanogenmod.wallpapers.photophase.widgets.DispositionView; +import org.cyanogenmod.wallpapers.photophase.widgets.DispositionView.OnFrameSelectedListener; +import org.cyanogenmod.wallpapers.photophase.widgets.ResizeFrame; + +import java.util.List; + +/** + * An {@link PagerAdapter} implementation for display all current templates + */ +public class DispositionAdapter extends PagerAdapter { + + final List<Dispositions> mDispositions; + private final ResizeFrame mResizeFrame; + private final OnFrameSelectedListener mCallback; + + private final SparseArray<DispositionView> mCurrentViews; + + private LayoutInflater mInflater; + + boolean mFirstAnimation; + + /** + * Constructor of <code>DispositionAdapter</code>. + * + * @param ctx The current context + * @param dispositions An array with all dispositions + * @param resizeFrame The resize frame + * @param callback The callback where return selection events + */ + public DispositionAdapter(Context ctx, List<Dispositions> dispositions, + ResizeFrame resizeFrame, OnFrameSelectedListener callback) { + super(); + mDispositions = dispositions; + mResizeFrame = resizeFrame; + mCallback = callback; + mFirstAnimation = true; + mInflater = (LayoutInflater)ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + mCurrentViews = new SparseArray<DispositionView>(); + } + + /** + * {@inheritDoc} + */ + @Override + public int getCount() { + return mDispositions.size(); + } + + /** + * {@inheritDoc} + */ + @Override + public Object instantiateItem(ViewGroup container, final int position) { + final DispositionView view = (DispositionView)mInflater.inflate( + R.layout.disposition_view, null); + if (position == 0) { + view.setResizeFrame(mResizeFrame); + view.setOnFrameSelectedListener(mCallback); + } + view.post(new Runnable() { + @Override + public void run() { + view.setDispositions(mDispositions.get(position), + position == 0 && mFirstAnimation); + mFirstAnimation = false; + } + }); + ((ViewPager)container).addView(view, 0); + mCurrentViews.put(position, view); + return view; + } + + /** + * {@inheritDoc} + */ + @Override + public void destroyItem(ViewGroup container, int position, Object object) { + mCurrentViews.remove(position); + ((ViewPager)container).removeView((View)object); + } + + /** + * Method that returns the current view + * + * @param position The position of the item to return + * @return DispositionView The view or null if is not instance + */ + public DispositionView getView(int position) { + return mCurrentViews.get(position); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isViewFromObject(View view, Object object) { + return view == ((View)object) || view == mResizeFrame; + } + +} diff --git a/src/org/cyanogenmod/wallpapers/photophase/model/Dispositions.java b/src/org/cyanogenmod/wallpapers/photophase/model/Dispositions.java new file mode 100644 index 0000000..fc27853 --- /dev/null +++ b/src/org/cyanogenmod/wallpapers/photophase/model/Dispositions.java @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2013 The CyanogenMod 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 org.cyanogenmod.wallpapers.photophase.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * An array of {@link Disposition} classes. + */ +public class Dispositions { + + private final List<Disposition> mDispositions; + private final int mRows; + private final int mCols; + + /** + * Constructor of <code>Dispositions</code> + * + * @param dispositions List of all dispositions + * @param rows The number of rows of the dispositions + * @param cols The number of columns of the dispositions + */ + public Dispositions(List<Disposition> dispositions, int rows, int cols) { + super(); + mDispositions = dispositions; + mRows = rows; + mCols = cols; + } + + /** + * Method that returns an array of all the dispositions + * + * @return List<Disposition> All the dispositions + */ + public List<Disposition> getDispositions() { + return new ArrayList<Disposition>(mDispositions); + } + + /** + * Method that returns the number of rows of the dispositions + * + * @return int The number of rows of the dispositions + */ + public int getRows() { + return mRows; + } + + /** + * Method that returns the number of columns of the dispositions + * + * @return int The number of columns of the dispositions + */ + public int getCols() { + return mCols; + } + +} diff --git a/src/org/cyanogenmod/wallpapers/photophase/preferences/DispositionFragment.java b/src/org/cyanogenmod/wallpapers/photophase/preferences/DispositionFragment.java index 7071e76..5040178 100644 --- a/src/org/cyanogenmod/wallpapers/photophase/preferences/DispositionFragment.java +++ b/src/org/cyanogenmod/wallpapers/photophase/preferences/DispositionFragment.java @@ -20,41 +20,44 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.preference.PreferenceFragment; +import android.support.v4.view.ViewPager; +import android.support.v4.view.ViewPager.OnPageChangeListener; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; import org.cyanogenmod.wallpapers.photophase.R; +import org.cyanogenmod.wallpapers.photophase.adapters.DispositionAdapter; import org.cyanogenmod.wallpapers.photophase.model.Disposition; +import org.cyanogenmod.wallpapers.photophase.model.Dispositions; +import org.cyanogenmod.wallpapers.photophase.utils.DispositionUtil; import org.cyanogenmod.wallpapers.photophase.widgets.DispositionView; import org.cyanogenmod.wallpapers.photophase.widgets.DispositionView.OnFrameSelectedListener; import org.cyanogenmod.wallpapers.photophase.widgets.ResizeFrame; +import java.util.ArrayList; import java.util.List; /** * An abstract fragment class that allow to choose the layout disposition of the wallpaper. */ -public abstract class DispositionFragment - extends PreferenceFragment implements OnFrameSelectedListener { - - private Runnable mRedraw = new Runnable() { - @Override - public void run() { - if (getActivity() == null) return; - try { - mDispositionView.setDispositions(getUserDispositions(), getCols(), getRows()); - } catch (Exception ex) { - // Ignored - } - } - }; +public abstract class DispositionFragment extends PreferenceFragment + implements OnFrameSelectedListener, OnPageChangeListener { - DispositionView mDispositionView; + private ViewPager mPager; + private DispositionAdapter mAdapter; + private ResizeFrame mResizeFrame; + private TextView mAdvise; + private DispositionView mCurrentDispositionView; + private int mCurrentPage; + private int mNumberOfTemplates; + + private MenuItem mRestoreMenu; private MenuItem mDeleteMenu; /** @@ -79,6 +82,13 @@ public abstract class DispositionFragment public abstract List<Disposition> getDefaultDispositions(); /** + * Method that returns the system-defined dispositions templates + * + * @return String[] The system-defined dispositions templates + */ + public abstract String[] getDispositionsTemplates(); + + /** * Method that request to save the dispositions * * @param dispositions The dispositions to save @@ -93,9 +103,9 @@ public abstract class DispositionFragment public abstract int getRows(); /** - * Method that returns the number of cols to use + * Method that returns the number of columns to use * - * @return int The number of cols + * @return int The number of columns */ public abstract int getCols(); @@ -117,13 +127,24 @@ public abstract class DispositionFragment * {@inheritDoc} */ @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { // Inflate the layout for this fragment - ViewGroup v = (ViewGroup)inflater.inflate(R.layout.choose_disposition_fragment, container, false); - mDispositionView = (DispositionView)v.findViewById(R.id.disposition_view); - mDispositionView.setResizeFrame((ResizeFrame)v.findViewById(R.id.resize_frame)); - mDispositionView.setOnFrameSelectedListener(this); - mDispositionView.post(mRedraw); + ViewGroup v = (ViewGroup)inflater.inflate(R.layout.choose_disposition_fragment, + container, false); + + mCurrentPage = 0; + mNumberOfTemplates = getDispositionsTemplates().length; + + mAdvise = (TextView)v.findViewById(R.id.advise); + mResizeFrame = (ResizeFrame)v.findViewById(R.id.resize_frame); + + mAdapter = new DispositionAdapter(getActivity(), getAllDispositions(), mResizeFrame, this); + mPager = (ViewPager)v.findViewById(R.id.dispositions_pager); + mPager.setAdapter(mAdapter); + mPager.setOnPageChangeListener(this); + mPager.setCurrentItem(0); + return v; } @@ -132,21 +153,28 @@ public abstract class DispositionFragment */ @Override public void onDestroyView() { - super.onDestroyView(); - if (mDispositionView != null) { - mDispositionView.removeCallbacks(mRedraw); - if (mDispositionView.isChanged()) { - saveDispositions(mDispositionView.getDispositions()); - } + boolean saved = false; + + if (mCurrentDispositionView == null) { + mCurrentDispositionView = mAdapter.getView(0); } - // Notify that the settings was changed - Intent intent = new Intent(PreferencesProvider.ACTION_SETTINGS_CHANGED); - if (mDispositionView.isChanged()) { - intent.putExtra(PreferencesProvider.EXTRA_FLAG_REDRAW, Boolean.TRUE); - intent.putExtra(PreferencesProvider.EXTRA_FLAG_RECREATE_WORLD, Boolean.TRUE); + if (mCurrentDispositionView != null) { + if (mCurrentPage != 0 || mCurrentDispositionView.isChanged()) { + saveDispositions(mCurrentDispositionView.getDispositions()); + saved = true; + } + + // Notify that the settings was changed + Intent intent = new Intent(PreferencesProvider.ACTION_SETTINGS_CHANGED); + if (saved) { + intent.putExtra(PreferencesProvider.EXTRA_FLAG_REDRAW, Boolean.TRUE); + intent.putExtra(PreferencesProvider.EXTRA_FLAG_RECREATE_WORLD, Boolean.TRUE); + } + getActivity().sendBroadcast(intent); } - getActivity().sendBroadcast(intent); + + super.onDestroyView(); } /** @@ -155,10 +183,9 @@ public abstract class DispositionFragment @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.dispositions, menu); + mRestoreMenu = menu.findItem(R.id.mnu_restore); mDeleteMenu = menu.findItem(R.id.mnu_delete); - if (mDeleteMenu != null) { - mDeleteMenu.setVisible(false); - } + mDeleteMenu.setVisible(false); } /** @@ -185,14 +212,51 @@ public abstract class DispositionFragment * Method that restores the disposition view to the default state */ private void restoreData() { - mDispositionView.setDispositions(getUserDispositions(), getCols(), getRows()); + if (mCurrentDispositionView == null) { + mCurrentDispositionView = mAdapter.getView(0); + } + mCurrentDispositionView.setDispositions(getUserDispositions(), getCols(), getRows(), true); } /** * Method that restores the disposition view to the default state */ private void deleteFrame() { - mDispositionView.deleteCurrentFrame(); + if (mCurrentDispositionView == null) { + mCurrentDispositionView = mAdapter.getView(0); + } + mCurrentDispositionView.deleteCurrentFrame(); + } + + /** + * Method that returns the system-defined dispositions templates + * + * @return List<Dispositions> All the system-defined dispositions templates + */ + public List<Dispositions> getAllDispositions() { + final int rows = getRows(); + final int cols = getCols(); + + List<Dispositions> allDispositions = new ArrayList<Dispositions>(); + allDispositions.add(new Dispositions(getUserDispositions(), rows, cols)); + allDispositions.addAll(getSystemDefinedDispositions(rows, cols)); + return allDispositions; + } + /** + * Method that returns the system-defined dispositions templates + * + * @param rows The number of rows + * @param cols The number of columns + * @return List<Dispositions> All the system-defined dispositions templates + */ + private List<Dispositions> getSystemDefinedDispositions(int rows, int cols) { + String[] templates = getDispositionsTemplates(); + List<Dispositions> systemDispositions = new ArrayList<Dispositions>(templates.length); + for (String template : templates) { + systemDispositions.add(new Dispositions( + DispositionUtil.toDispositions(template), rows, cols)); + } + return systemDispositions; } /** @@ -214,4 +278,50 @@ public abstract class DispositionFragment mDeleteMenu.setVisible(false); } } + + /** + * {@inheritDoc} + */ + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + // Ignored + } + + /** + * {@inheritDoc} + */ + @Override + public void onPageSelected(int position) { + // Save state + mCurrentPage = position; + mCurrentDispositionView = mAdapter.getView(position); + + // Enable/Disable menus + if (mRestoreMenu != null) { + mRestoreMenu.setVisible(position == 0); + } + if (mDeleteMenu != null) { + mDeleteMenu.setVisible(false); + } + + // Set the title + if (position == 0) { + mAdvise.setText(getString(R.string.pref_disposition_description)); + } else { + mAdvise.setText(getString(R.string.pref_disposition_template, + String.valueOf(position), String.valueOf(mNumberOfTemplates))); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void onPageScrollStateChanged(int state) { + if (mDeleteMenu != null) { + mDeleteMenu.setVisible(false); + } + mResizeFrame.setVisibility(View.GONE); + } + } diff --git a/src/org/cyanogenmod/wallpapers/photophase/preferences/LandscapeDispositionFragment.java b/src/org/cyanogenmod/wallpapers/photophase/preferences/LandscapeDispositionFragment.java index 77267e6..b83c55f 100644 --- a/src/org/cyanogenmod/wallpapers/photophase/preferences/LandscapeDispositionFragment.java +++ b/src/org/cyanogenmod/wallpapers/photophase/preferences/LandscapeDispositionFragment.java @@ -19,6 +19,7 @@ package org.cyanogenmod.wallpapers.photophase.preferences; import android.content.pm.ActivityInfo; import android.os.Bundle; +import org.cyanogenmod.wallpapers.photophase.R; import org.cyanogenmod.wallpapers.photophase.preferences.PreferencesProvider.Preferences; import org.cyanogenmod.wallpapers.photophase.model.Disposition; import org.cyanogenmod.wallpapers.photophase.utils.DispositionUtil; @@ -68,6 +69,14 @@ public class LandscapeDispositionFragment extends DispositionFragment { * {@inheritDoc} */ @Override + public String[] getDispositionsTemplates() { + return getActivity().getResources().getStringArray(R.array.landscape_disposition_templates); + } + + /** + * {@inheritDoc} + */ + @Override public void saveDispositions(List<Disposition> dispositions) { Preferences.Layout.setLandscapeDisposition(getActivity(), dispositions); } diff --git a/src/org/cyanogenmod/wallpapers/photophase/preferences/PortraitDispositionFragment.java b/src/org/cyanogenmod/wallpapers/photophase/preferences/PortraitDispositionFragment.java index 8763e1e..a3a53d9 100644 --- a/src/org/cyanogenmod/wallpapers/photophase/preferences/PortraitDispositionFragment.java +++ b/src/org/cyanogenmod/wallpapers/photophase/preferences/PortraitDispositionFragment.java @@ -19,6 +19,7 @@ package org.cyanogenmod.wallpapers.photophase.preferences; import android.content.pm.ActivityInfo; import android.os.Bundle; +import org.cyanogenmod.wallpapers.photophase.R; import org.cyanogenmod.wallpapers.photophase.model.Disposition; import org.cyanogenmod.wallpapers.photophase.preferences.PreferencesProvider.Preferences; import org.cyanogenmod.wallpapers.photophase.utils.DispositionUtil; @@ -68,6 +69,14 @@ public class PortraitDispositionFragment extends DispositionFragment { * {@inheritDoc} */ @Override + public String[] getDispositionsTemplates() { + return getActivity().getResources().getStringArray(R.array.portrait_disposition_templates); + } + + /** + * {@inheritDoc} + */ + @Override public void saveDispositions(List<Disposition> dispositions) { Preferences.Layout.setPortraitDisposition(getActivity(), dispositions); } diff --git a/src/org/cyanogenmod/wallpapers/photophase/widgets/DispositionView.java b/src/org/cyanogenmod/wallpapers/photophase/widgets/DispositionView.java index 0bc462f..87e3999 100644 --- a/src/org/cyanogenmod/wallpapers/photophase/widgets/DispositionView.java +++ b/src/org/cyanogenmod/wallpapers/photophase/widgets/DispositionView.java @@ -40,6 +40,7 @@ import android.widget.ImageView.ScaleType; import org.cyanogenmod.wallpapers.photophase.R; import org.cyanogenmod.wallpapers.photophase.animations.Evaluators; import org.cyanogenmod.wallpapers.photophase.model.Disposition; +import org.cyanogenmod.wallpapers.photophase.model.Dispositions; import org.cyanogenmod.wallpapers.photophase.utils.DispositionUtil; import org.cyanogenmod.wallpapers.photophase.utils.MERAlgorithm; import org.cyanogenmod.wallpapers.photophase.widgets.ResizeFrame.OnResizeListener; @@ -140,18 +141,32 @@ public class DispositionView extends RelativeLayout implements OnLongClickListen * Method that sets the disposition to draw on this view * * @param dispositions The dispositions to draw - * @param cols The number of cols + * @param animate If should animate the view + */ + public void setDispositions(Dispositions dispositions, boolean animate) { + setDispositions(dispositions.getDispositions(), dispositions.getCols(), + dispositions.getRows(), animate); + } + + /** + * Method that sets the disposition to draw on this view + * + * @param dispositions The dispositions to draw + * @param cols The number of columns * @param rows The number of rows + * @param animate If should animate the view */ - public void setDispositions( - List<Disposition> dispositions, int cols, int rows) { + public void setDispositions(List<Disposition> dispositions, int cols, int rows, + boolean animate) { mDispositions = dispositions; mCols = cols; mRows = rows; // Remove all the current views and add the new ones - recreateDispositions(true); - mResizeFrame.setVisibility(View.GONE); + recreateDispositions(animate); + if (mResizeFrame != null) { + mResizeFrame.setVisibility(View.GONE); + } mChanged = false; } @@ -207,6 +222,7 @@ public class DispositionView extends RelativeLayout implements OnLongClickListen @SuppressWarnings("boxing") public void deleteCurrentFrame() { if (mTarget == null) return; + if (mResizeFrame == null) return; final Disposition targetDisposition = resizerToDisposition(); @@ -348,7 +364,13 @@ public class DispositionView extends RelativeLayout implements OnLongClickListen final ImageView v = new ImageView(getContext()); v.setImageResource(R.drawable.ic_camera); v.setScaleType(ScaleType.CENTER); - v.setBackgroundColor(getResources().getColor(R.color.disposition_frame_bg_color)); + + // Is locked? Then change the background color + v.setBackgroundColor(getResources().getColor( + mResizeFrame == null + ? R.color.disposition_locked_frame_bg_color + : R.color.disposition_frame_bg_color)); + RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(r.width() - padding, r.height() - padding); v.setX(r.left + padding); @@ -401,13 +423,15 @@ public class DispositionView extends RelativeLayout implements OnLongClickListen */ @Override public boolean onLongClick(View v) { - if (!selectTarget(v)) return false; - mVibrator.vibrate(300); + if (mResizeFrame != null && selectTarget(v)) { + mVibrator.vibrate(300); + } return true; } @Override public void onStartResize(int mode) { + if (mResizeFrame == null) return; mOldResizeFrameLocation = new Rect( mResizeFrame.getLeft(), mResizeFrame.getTop(), @@ -418,6 +442,7 @@ public class DispositionView extends RelativeLayout implements OnLongClickListen @Override public void onResize(int mode, int delta) { if (mTarget == null) return; + if (mResizeFrame == null) return; int w = getMeasuredWidth() - (getPaddingLeft() + getPaddingRight()); int h = getMeasuredHeight() - (getPaddingTop() + getPaddingBottom()); @@ -472,6 +497,7 @@ public class DispositionView extends RelativeLayout implements OnLongClickListen @Override public void onEndResize(final int mode) { if (mTarget == null) return; + if (mResizeFrame == null) return; // Compute the removed dispositions computeRemovedDispositions(mode); @@ -555,8 +581,10 @@ public class DispositionView extends RelativeLayout implements OnLongClickListen boolean selectTarget(View v) { //Do not do long click if we do not have a target if (mTarget != null && v.equals(mTarget)) return false; + if (mResizeFrame == null) return false; // Show the resize frame view just in place of the current clicked view + mResizeFrame.hide(); FrameLayout.LayoutParams frameParams = (FrameLayout.LayoutParams)mResizeFrame.getLayoutParams(); @@ -666,7 +694,8 @@ public class DispositionView extends RelativeLayout implements OnLongClickListen for (Disposition d : mDispositions) { if (d.compareTo(disposition) != 0) { if ((d.x + d.w) == disposition.x && - (d.y >= disposition.y) && ((d.y + d.h) <= (disposition.y + disposition.h))) { + (d.y >= disposition.y) && + ((d.y + d.h) <= (disposition.y + disposition.h))) { dispositions.add(d); } } @@ -686,7 +715,8 @@ public class DispositionView extends RelativeLayout implements OnLongClickListen for (Disposition d : mDispositions) { if (d.compareTo(disposition) != 0) { if ((d.y + d.h) == disposition.y && - (d.x >= disposition.x) && ((d.x + d.w) <= (disposition.x + disposition.w))) { + (d.x >= disposition.x) && + ((d.x + d.w) <= (disposition.x + disposition.w))) { dispositions.add(d); } } @@ -706,7 +736,8 @@ public class DispositionView extends RelativeLayout implements OnLongClickListen for (Disposition d : mDispositions) { if (d.compareTo(disposition) != 0) { if ((d.x) == (disposition.x + disposition.w) && - (d.y >= disposition.y) && ((d.y + d.h) <= (disposition.y + disposition.h))) { + (d.y >= disposition.y) && + ((d.y + d.h) <= (disposition.y + disposition.h))) { dispositions.add(d); } } @@ -726,7 +757,8 @@ public class DispositionView extends RelativeLayout implements OnLongClickListen for (Disposition d : mDispositions) { if (d.compareTo(disposition) != 0) { if ((d.y) == (disposition.y + disposition.h) && - (d.x >= disposition.x) && ((d.x + d.w) <= (disposition.x + disposition.w))) { + (d.x >= disposition.x) && + ((d.x + d.w) <= (disposition.x + disposition.w))) { dispositions.add(d); } } |