Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/src/main/java/com/totsp/crossword/BrowseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,7 @@ public void onItemClick(AdapterView<?> list, View view, int arg2, long arg3) {
//Only spawn a thread if there are a lot of puzzles.
// Using SDK rev as a proxy to decide whether you have a slow processor or not.

if (((android.os.Build.VERSION.SDK_INT >= 5) && directory.exists() && (directory.list().length > 500)) ||
((android.os.Build.VERSION.SDK_INT < 5) && directory.exists() && (directory.list().length > 160))) {
if (directory.exists() && (directory.list().length > 500)) {
Runnable r = new Runnable() {
public void run() {
currentAdapter = BrowseActivity.this.buildList(dialog, directory, BrowseActivity.this.accessor);
Expand Down
16 changes: 7 additions & 9 deletions app/src/main/java/com/totsp/crossword/net/DownloadReceiver.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
package com.totsp.crossword.net;

import java.util.HashMap;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

import com.totsp.crossword.puz.PuzzleMeta;

import java.util.HashMap;

public class DownloadReceiver extends BroadcastReceiver {

public static HashMap<Uri, PuzzleMeta> metas = new HashMap<Uri, PuzzleMeta>();


private BroadcastReceiver impl;
{
if(android.os.Build.VERSION.SDK_INT >= 9){
try{
BroadcastReceiver built = (BroadcastReceiver) Class.forName("com.totsp.crossword.net.DownloadReceiverGinger").newInstance();
impl = built;
} catch(Exception e){
e.printStackTrace();
}
try{
BroadcastReceiver built = (BroadcastReceiver) Class.forName("com.totsp.crossword.net.DownloadReceiverGinger").newInstance();
impl = built;
} catch(Exception e){
e.printStackTrace();
}
if(impl == null){
impl = new DownloadReceiverNoop();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.totsp.crossword.net;

import java.io.File;
import java.net.URI;

import android.annotation.SuppressLint;
import android.app.DownloadManager;
import android.app.DownloadManager.Query;
Expand All @@ -13,6 +10,9 @@
import android.database.CursorIndexOutOfBoundsException;
import android.net.Uri;

import java.io.File;
import java.net.URI;

public class DownloadReceiverGinger extends BroadcastReceiver {

@Override
Expand All @@ -22,9 +22,8 @@ public void onReceive(Context ctx, Intent intent) {
.getSystemService(Context.DOWNLOAD_SERVICE);
long id = intent.getLongExtra("extra_download_id", -1);

if (android.os.Build.VERSION.SDK_INT >= 11
&& !"application/x-crossword".equals(mgr
.getMimeTypeForDownloadedFile(id))) {
if (!"application/x-crossword".equals(
mgr.getMimeTypeForDownloadedFile(id))) {
return;
}
Uri uri = null;
Expand Down
53 changes: 0 additions & 53 deletions app/src/main/java/com/totsp/crossword/net/Downloaders.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.totsp.crossword.shortyz.ShortyzApplication;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
Expand Down Expand Up @@ -284,58 +283,6 @@ private void download(Map<Downloader, Date> puzzlesToDownload) {

}

{ // DO UPDATES

ArrayList<File> checkUpdate = new ArrayList<File>();

try {
for (File file : crosswords.listFiles()) {
if (file.getName()
.endsWith(".shortyz")) {
File puz = new File(file.getAbsolutePath().substring(0,
file.getAbsolutePath().lastIndexOf('.') + 1) + "puz");
System.out.println(puz.getAbsolutePath());

if (!newlyDownloaded.contains(puz)) {
checkUpdate.add(puz);
}
}
}

archive.mkdirs();

for (File file : archive.listFiles()) {
if (file.getName()
.endsWith(".shortyz")) {
checkUpdate.add(new File(file.getAbsolutePath().substring(0,
file.getAbsolutePath().lastIndexOf('.') + 1) + "puz"));
}
}
} catch (Exception e) {
e.printStackTrace();
}

for (File file : checkUpdate) {
try {
IO.meta(file);

// if ((meta != null) && meta.updatable && (nyt != null) &&
// nyt.getName().equals(meta.source)) {
// System.out.println("Trying update for " + file);
//
// File updated = nyt.update(file);
//
// if (updated != null) {
// this.postUpdatedNotification(i, nyt.getName(),
// updated);
// }
// }
} catch (IOException e) {
e.printStackTrace();
}
}
}

if (this.notificationManager != null) {
this.notificationManager.cancel(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ public static boolean isLandscape(DisplayMetrics metrics){
}

public static boolean isTabletish(DisplayMetrics metrics) {
if(android.os.Build.VERSION.SDK_INT > 12) {

double x = Math.pow(metrics.widthPixels / metrics.xdpi, 2);
double y = Math.pow(metrics.heightPixels / metrics.ydpi, 2);
double screenInches = Math.sqrt(x + y);
Expand All @@ -206,16 +204,10 @@ public static boolean isTabletish(DisplayMetrics metrics) {
} else {
return false;
}
} else {
return false;
}
}

public static boolean isMiniTabletish(DisplayMetrics metrics) {
switch (android.os.Build.VERSION.SDK_INT) {
case 12:
case 11:
case 13:
case 14:
case 15:
case 16:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
System.out.println("Using Honeycomb");
return INSTANCE = new HoneycombUtil();
} else {
System.out.println("Using Gingerbread");
return INSTANCE = new GingerbreadUtil();
System.out.println("Unsupported Version");
return INSTANCE = null;
}
}
}
Expand Down
106 changes: 0 additions & 106 deletions app/src/main/java/com/totsp/crossword/versions/GingerbreadUtil.java

This file was deleted.

41 changes: 39 additions & 2 deletions app/src/main/java/com/totsp/crossword/versions/HoneycombUtil.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.totsp.crossword.versions;

import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.net.Uri;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatDelegate;
Expand All @@ -11,15 +14,49 @@
import android.view.View.OnClickListener;

import com.totsp.crossword.ShortyzActivity;
import com.totsp.crossword.net.DownloadReceiver;
import com.totsp.crossword.puz.PuzzleMeta;


@TargetApi(11)
public class HoneycombUtil extends GingerbreadUtil {
public class HoneycombUtil extends DefaultUtil {

{
System.out.println("Honeycomb Utils.");
}



protected Context ctx;

public void setContext(Context ctx) {
this.ctx = ctx;
}

public void storeMetas(Uri uri, PuzzleMeta meta) {
DownloadReceiver.metas.put(uri, meta);

}

@Override
public boolean isBackgroundDownloadAvaliable() {
return false;
}

@Override
public boolean checkBackgroundDownload(SharedPreferences prefs, boolean hasWritePermissions) {
return false;
}

@Override
public void clearBackgroundDownload(SharedPreferences prefs) {

}

@Override
public void createNotificationChannel(Context context) {

}

@Override
public void finishOnHomeButton(final AppCompatActivity a) {
ActionBar bar = a.getSupportActionBar();
Expand Down
28 changes: 13 additions & 15 deletions app/src/main/java/com/totsp/crossword/view/ScrollingImageView.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.totsp.crossword.view;

import java.util.Timer;
import java.util.logging.Logger;

import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
Expand All @@ -12,6 +9,9 @@
import android.widget.FrameLayout;
import android.widget.ImageView;

import java.util.Timer;
import java.util.logging.Logger;


@SuppressWarnings("deprecation")
public class ScrollingImageView extends FrameLayout implements OnGestureListener {
Expand All @@ -35,18 +35,16 @@ public ScrollingImageView(Context context, AttributeSet as) {
imageView = new ImageView(context);


if (android.os.Build.VERSION.SDK_INT >= 8) {
try {
aux = (AuxTouchHandler) Class.forName("com.totsp.crossword.view.MultitouchHandler")
.newInstance();
aux.init(this);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
aux = (AuxTouchHandler) Class.forName("com.totsp.crossword.view.MultitouchHandler")
.newInstance();
aux.init(this);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}

Expand Down
Loading