Commit 8fb85b8b authored by kastner's avatar kastner

Tried to update deps and do some refactoring but it borked again

parent de4ec80a
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
</code_scheme>
</component>
\ No newline at end of file
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
public class ${NAME} {
}
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintLongLogTag" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
......@@ -7,7 +7,7 @@ android {
defaultConfig {
applicationId "edu.umd.umiacs.newsstand"
minSdkVersion 15
targetSdkVersion 19
targetSdkVersion 28
}
buildTypes {
......@@ -21,7 +21,7 @@ android {
dependencies {
implementation 'com.android.support:support-v4:21.0.3'
implementation 'com.google.android.gms:play-services:7.5.0'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation files('libs/KeenClient-Android.jar')
implementation files('libs/universal-image-loader-1.8.4-with-sources.jar')
implementation files('libs/YouTubeAndroidPlayerApi.jar')
......
......@@ -6,7 +6,7 @@
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="23"
android:targetSdkVersion="28"
/>
<permission
......
......@@ -11,8 +11,6 @@ public class NewsStandConstants {
public static final String FEED_SOURCES_FILENAME = "feed_sources_file";
public static final String QUERY_RECORDS_FILENAME = "query_records_file";
public static final String TRAINING_SESSION_FILENAME = "training_session_file";
public static final String SAMPLE_SESSION_FILENAME = "sample_session_file3";
public static final String ONE_HAND_MODE_KEY = "ONE_HAND_MODE";
......@@ -42,8 +40,6 @@ public class NewsStandConstants {
public static final float TEXT_MARKER_SIZE = 20.0f; // in dip
public static final double IMAGE_MARKER_SIZE = 35.0; // in dip
public static final int TIMEOUT_MILLISECONDS = 4000;
// public static String[] LAYER_STRINGS = new String[]{
// "Icon",
// "Disease",
......
......@@ -22,7 +22,7 @@ import static edu.umd.umiacs.newsstand.NewsStandConstants.TITLE;
*/
public class AboutDialogFragment extends DialogFragment {
private DialogInterface.OnClickListener moreInfoListener = new DialogInterface.OnClickListener() {
private final DialogInterface.OnClickListener moreInfoListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(getActivity(), WebViewActivity.class);
......
......@@ -14,10 +14,12 @@ import java.util.ArrayList;
public class DeviceGrid {
private final static String TAG = "edu.umd.umiacs.newsstand.cache.DeviceGrid";
private PointF mBounds;
private final PointF mBounds;
static final float[] gridDivision = {0.005f, 0.01f, 0.05f, 0.75f, 0.1f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f, 8.0f, 10.0f,
12.0f, 15.0f, 18.0f, 20.0f, 24.0f, 30.0f, 36.0f, 40.0f, 45.0f, 60.0f, 72.0f, 90.0f, 120.0f,
180.0f, 360.0f};
private float xDiv;
private float yDiv;
public DeviceGrid(PointF bounds) {
mBounds = bounds;
......@@ -27,13 +29,13 @@ public class DeviceGrid {
private void createGrid() {
for (float aGridDivision : gridDivision)
if (mBounds.x <= aGridDivision) {
float xDiv = aGridDivision;
xDiv = aGridDivision;
break;
}
for (float aGridDivision : gridDivision) {
if (mBounds.y <= aGridDivision) {
float yDiv = aGridDivision;
yDiv = aGridDivision;
break;
}
}
......
......@@ -4,16 +4,16 @@ package edu.umd.umiacs.newsstand.cache;
* Created by Brendan on 6/3/13.
*/
public class DeviceGridCell {
protected double lowerLeftX;
protected double lowerLeftY;
protected double upperRightX;
protected double upperRightY;
protected final double lowerLeftX;
protected final double lowerLeftY;
protected final double upperRightX;
protected final double upperRightY;
private boolean showOnScreen = true;
public static double EPSILON = 5.96e-08;
public static final double EPSILON = 5.96e-08;
public DeviceGridCell(DeviceGridCell deviceGridCell) {
protected DeviceGridCell(DeviceGridCell deviceGridCell) {
this(deviceGridCell.getLowerLeftX(),
deviceGridCell.getLowerLeftY(),
deviceGridCell.getUpperRightX(),
......
package edu.umd.umiacs.newsstand.cache;
public class DiscretizedGridCell {
private int lowX;
private int lowY;
private int dimX;
private int dimY;
private final int lowX;
private final int lowY;
private final int dimX;
private final int dimY;
public DiscretizedGridCell(int lowX, int lowY, int dimX, int dimY) {
this.lowX = lowX;
......
......@@ -12,7 +12,7 @@ import java.util.Map;
*/
public class Prediction {
private final static String TAG = "edu.umd.umiacs.newsstand.cache.Prediction";
private static int threshold = 50;
private static final int threshold = 50;
private static final float[] gridDivision = {0.005f, 0.01f, 0.05f, 0.1f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f, 8.0f, 10.0f,
12.0f, 15.0f, 18.0f, 20.0f, 24.0f, 30.0f, 36.0f, 40.0f, 45.0f, 60.0f, 72.0f, 90.0f, 120.0f,
......@@ -20,7 +20,7 @@ public class Prediction {
private float pStay = 0.431f;
private float pPan = 0.0283f;
private float[] pZin = {0.059f, 0.068f, 0.095f, 0.087f};
private final float[] pZin = {0.059f, 0.068f, 0.095f, 0.087f};
private float pZout = 0.027f;
private static void addProb(Map<DeviceGridCell, Double> maps, DeviceGridCell cell, double value) {
......
......@@ -6,10 +6,10 @@ import java.io.Serializable;
* Created by Brendan on 6/17/13.
*/
public class QueryRecord implements Serializable {
private double latLow;
private double lonLow;
private double latHigh;
private double lonHigh;
private final double latLow;
private final double lonLow;
private final double latHigh;
private final double lonHigh;
public QueryRecord(DeviceGridCell deviceGridCell) {
double lowX = deviceGridCell.lowerLeftX;
......
......@@ -45,7 +45,7 @@ public class NumberPickerDialogFragment extends DialogFragment {
}
}
private OnClickListener positiveListener = new OnClickListener() {
private final OnClickListener positiveListener = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String[] displayedValues = mNumberPicker.getDisplayedValues();
......
......@@ -3,8 +3,6 @@ package edu.umd.umiacs.newsstand.general;
import android.os.AsyncTask;
import android.util.Log;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
......@@ -15,7 +13,7 @@ import java.net.URL;
*/
public class NoResultsRequest extends AsyncTask<String, Void, String> {
private static String TAG = "edu.umd.umiacs.newsstand.general.NoResultsRequest";
private static final String TAG = "edu.umd.umiacs.newsstand.general.NoResultsRequest";
@Override
protected String doInBackground(String... urls) {
......
......@@ -29,7 +29,7 @@ import com.nostra13.universalimageloader.core.assist.PauseOnScrollListener;
*/
public class AbsListViewBaseActivity extends Activity {
private ImageLoader imageLoader = ImageLoader.getInstance();
private final ImageLoader imageLoader = ImageLoader.getInstance();
private static final String STATE_PAUSE_ON_SCROLL = "STATE_PAUSE_ON_SCROLL";
private static final String STATE_PAUSE_ON_FLING = "STATE_PAUSE_ON_FLING";
......
......@@ -28,7 +28,7 @@ import edu.umd.umiacs.newsstand.R;
*/
public abstract class BaseActivity extends Activity {
ImageLoader imageLoader = ImageLoader.getInstance();
final ImageLoader imageLoader = ImageLoader.getInstance();
@Override
public boolean onCreateOptionsMenu(Menu menu) {
......
......@@ -40,12 +40,12 @@ import static edu.umd.umiacs.newsstand.NewsStandConstants.TITLE;
public class GridFragment extends Fragment implements View.OnClickListener {
private final String TAG = "edu.umd.umiacs.newsstand.imageview.GridFragment";
private ImageLoader imageLoader = ImageLoader.getInstance();
private final ImageLoader imageLoader = ImageLoader.getInstance();
private DisplayImageOptions options;
private ImageGridActivity.ImageDisplayType mImageDisplayType;
private final ImageGridActivity.ImageDisplayType mImageDisplayType;
private ArrayList<Image> mImages;
private final ArrayList<Image> mImages;
private ArrayList<Boolean> mMultipleImagesInCluster; // For topic only ("More in Topic")
private int screenWidth;
......@@ -773,9 +773,9 @@ public class GridFragment extends Fragment implements View.OnClickListener {
// ================================================================================
class ImageAdapter extends BaseAdapter {
private ArrayList<String> imageUrls;
private final ArrayList<String> imageUrls;
public ImageAdapter() {
ImageAdapter() {
imageUrls = new ArrayList<>();
if (mImages != null) {
for (Image currentImage : mImages)
......
......@@ -8,19 +8,19 @@ import java.io.Serializable;
class Image implements Serializable {
private static final long serialVersionUID = 1L;
private String mImageURL;
private String mArticleURL;
private String mCaption;
private final String mImageURL;
private final String mArticleURL;
private final String mCaption;
private int mHeight;
private int mWidth;
private final int mHeight;
private final int mWidth;
private int mClusterID;
private int mImageClusterID;
private final int mClusterID;
private final int mImageClusterID;
private float mClusterScore;
private final float mClusterScore;
private boolean mIsDuplicate;
private final boolean mIsDuplicate;
public Image(String imageURL, String articleURL, String caption, int height, int width, int clusterID,
int imageClusterID, float clusterScore, boolean isDuplicate) {
......
......@@ -232,8 +232,8 @@ public class ImageGridActivity extends Activity implements ActionBar.TabListener
private void showMoreInTopic() {
Log.i(TAG, "Show more in topic");
int clusterID = mCurrentFragment.getCurrentClusterID();
mClusterImages = new ArrayList<Image>();
mClusterImagesNoDups = new ArrayList<Image>();
mClusterImages = new ArrayList<>();
mClusterImagesNoDups = new ArrayList<>();
mActionBar.setIcon(R.drawable.back_topics);
mTitleButton.setText("Images");
......@@ -388,7 +388,7 @@ public class ImageGridActivity extends Activity implements ActionBar.TabListener
mProgressBar.setVisibility(View.GONE);
mImagesNoDups = new ArrayList<Image>();
mImagesNoDups = new ArrayList<>();
for (Image currentImage : updatedImages)
if (!currentImage.isDuplicate())
mImagesNoDups.add(currentImage);
......@@ -413,10 +413,10 @@ public class ImageGridActivity extends Activity implements ActionBar.TabListener
mTopicsTab.setText("Topics");
mActionBar.addTab(mTopicsTab);
HashSet<Integer> clustersSeen = new HashSet<Integer>();
mTopicImages = new ArrayList<Image>();
HashSet<Integer> clustersSeen = new HashSet<>();
mTopicImages = new ArrayList<>();
HashMap<Integer, Integer> numImagesInCluster = new HashMap<Integer, Integer>();
HashMap<Integer, Integer> numImagesInCluster = new HashMap<>();
for (Image currentImage : updatedImages) {
Integer currentClusterID = currentImage.getClusterID();
......@@ -440,11 +440,11 @@ public class ImageGridActivity extends Activity implements ActionBar.TabListener
Collections.sort(mTopicImages, new Comparator<Image>() {
@Override
public int compare(Image lhs, Image rhs) {
return Float.valueOf(lhs.getClusterScore()).compareTo(Float.valueOf(rhs.getClusterScore()));
return Float.compare(lhs.getClusterScore(), rhs.getClusterScore());
}
});
mMultipleImagesInCluster = new ArrayList<Boolean>();
mMultipleImagesInCluster = new ArrayList<>();
for (Image currentImage : mTopicImages) {
Integer numImages = numImagesInCluster.get(currentImage.getClusterID());
if (numImages != null && numImages > 1)
......@@ -465,13 +465,12 @@ public class ImageGridActivity extends Activity implements ActionBar.TabListener
setShowMoreInTopic(false);
boolean setOffset = false;
boolean setOffset;
int offset = 0;
int index = 0;
if (mCurrentFragment != null
&& mCurrentFragment.getImageDisplayType() != ImageDisplayType.TOPICS
&& !tabText.equals("Topics")) {
setOffset = true;
offset = mCurrentFragment.getGridOffset();
index = mCurrentFragment.getFirstVisibleIndex();
Log.i(TAG, "index " + index + " offset " + offset);
......@@ -554,7 +553,7 @@ public class ImageGridActivity extends Activity implements ActionBar.TabListener
InputStream stream = null;
// Instantiate the parser
ImageRequest imageRequest = new ImageRequest();
ArrayList<Image> imagesFound = null;
ArrayList<Image> imagesFound;
try {
stream = downloadUrl(urlString);
......
......@@ -167,9 +167,9 @@ public class ImagePagerActivity extends BaseActivity implements View.OnClickList
private class ImagePagerAdapter extends PagerAdapter {
private String[] images;
private String[] captions;
private LayoutInflater inflater;
private final String[] images;
private final String[] captions;
private final LayoutInflater inflater;
TextView captionTextView;
ImagePagerAdapter(String[] images, String[] captions) {
......
......@@ -42,7 +42,7 @@ class ImageRequest {
private ArrayList<Image> readFeed(XmlPullParser parser)
throws XmlPullParserException, IOException {
ArrayList<Image> images = new ArrayList<Image>();
ArrayList<Image> images = new ArrayList<>();
int numImagesFound = 0;
while (parser.next() != XmlPullParser.END_TAG) {
......
......@@ -282,7 +282,7 @@ public class ImageViewTouch extends ImageViewTouchBase {
}
public class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
boolean mScaled = false;
......@@ -322,7 +322,7 @@ public class ImageViewTouch extends ImageViewTouchBase {
}
public interface OnImageViewTouchDoubleTapListener {
interface OnImageViewTouchDoubleTapListener {
void onDoubleTap();
}
......
......@@ -24,7 +24,7 @@ import edu.umd.umiacs.newsstand.imageview.ImageViewZoom.utils.IDisposable;
*/
public abstract class ImageViewTouchBase extends ImageView implements IDisposable {
public interface OnDrawableChangeListener {
interface OnDrawableChangeListener {
/**
* Callback invoked when a new drawable has been
......@@ -35,7 +35,7 @@ public abstract class ImageViewTouchBase extends ImageView implements IDisposabl
void onDrawableChanged(Drawable drawable);
}
public interface OnLayoutChangeListener {
interface OnLayoutChangeListener {
/**
* Callback invoked when the layout bounds changed
*
......@@ -75,11 +75,11 @@ public abstract class ImageViewTouchBase extends ImageView implements IDisposabl
private static final float ZOOM_INVALID = -1f;
private Easing mEasing = new Cubic();
private Matrix mBaseMatrix = new Matrix();
private final Easing mEasing = new Cubic();
private final Matrix mBaseMatrix = new Matrix();
private Matrix mSuppMatrix = new Matrix();
private Matrix mNextMatrix;
private Handler mHandler = new Handler();
private final Handler mHandler = new Handler();
private Runnable mLayoutRunnable = null;
boolean mUserScaled = false;
......@@ -95,7 +95,7 @@ public abstract class ImageViewTouchBase extends ImageView implements IDisposabl
private int mThisWidth = -1;
private int mThisHeight = -1;
private PointF mCenter = new PointF();
private final PointF mCenter = new PointF();
private DisplayType mScaleType = DisplayType.NONE;
private boolean mScaleTypeChanged;
......@@ -103,9 +103,9 @@ public abstract class ImageViewTouchBase extends ImageView implements IDisposabl
final int DEFAULT_ANIMATION_DURATION = 200;
private RectF mBitmapRect = new RectF();
private RectF mCenterRect = new RectF();
RectF mScrollRect = new RectF();
private final RectF mBitmapRect = new RectF();
private final RectF mCenterRect = new RectF();
final RectF mScrollRect = new RectF();
private OnDrawableChangeListener mDrawableChangeListener;
private OnLayoutChangeListener mOnLayoutChangeListener;
......@@ -359,15 +359,16 @@ public abstract class ImageViewTouchBase extends ImageView implements IDisposabl
}
private float getDefaultScale(DisplayType type) {
if (type == DisplayType.FIT_TO_SCREEN) {
// always fit to screen
return 1f;
} else if (type == DisplayType.FIT_IF_BIGGER) {
// normal scale if smaller, fit to screen otherwise
return Math.min(1f, 1f / getScale(mBaseMatrix));
} else {
// no scale
return 1f / getScale(mBaseMatrix);
switch (type) {
case FIT_TO_SCREEN:
// always fit to screen
return 1f;
case FIT_IF_BIGGER:
// normal scale if smaller, fit to screen otherwise
return Math.min(1f, 1f / getScale(mBaseMatrix));
default:
// no scale
return 1f / getScale(mBaseMatrix);
}
}
......
......@@ -20,9 +20,9 @@ import java.io.InputStream;
public class FastBitmapDrawable extends Drawable implements IBitmapDrawable {
private Bitmap mBitmap;
private Paint mPaint;
private int mIntrinsicWidth;
private int mIntrinsicHeight;
private final Paint mPaint;
private final int mIntrinsicWidth;
private final int mIntrinsicHeight;
public FastBitmapDrawable(Bitmap b) {
mBitmap = b;
......
......@@ -40,7 +40,7 @@ public class LayersAlertDialogFragment extends DialogFragment {
* which in turn invokes the method onPositiveClick(position)
* of the hosting activity which is supposed to implement it
*/
private OnClickListener positiveListener = new OnClickListener() {
private final OnClickListener positiveListener = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
AlertDialog alert = (AlertDialog) dialog;
......
......@@ -131,7 +131,7 @@ public class LocationActivity extends Activity implements OnItemClickListener, G
private final String TAG = "edu.umd.umiacs.newsstand.Location.LocationActivity";
private ImageLoader imageLoader = ImageLoader.getInstance();
private final ImageLoader imageLoader = ImageLoader.getInstance();
private StandMode mStandMode;
private StandMode mPreviousStandMode;
......@@ -146,7 +146,7 @@ public class LocationActivity extends Activity implements OnItemClickListener, G
private boolean retrievedCurrentWindow;
private int K = 5;
private final int K = 5;
private Prediction mPrediction;