Updated icons and improved pinnedservice.

captchafix
Florens Douwes 12 years ago
parent aa0c4ec170
commit 64fdf2b3cc
  1. 2
      Chan/AndroidManifest.xml
  2. BIN
      Chan/res/drawable-hdpi/ic_launcher.png
  3. BIN
      Chan/res/drawable-mdpi/ic_launcher.png
  4. BIN
      Chan/res/drawable-xhdpi/ic_launcher.png
  5. BIN
      Chan/res/drawable-xxhdpi/ic_launcher.png
  6. BIN
      Chan/res/drawable-xxxhdpi/ic_launcher.png
  7. 3
      Chan/res/layout/pin_item.xml
  8. 8
      Chan/src/org/floens/chan/ChanApplication.java
  9. 15
      Chan/src/org/floens/chan/activity/BoardActivity.java
  10. 8
      Chan/src/org/floens/chan/manager/ThreadManager.java
  11. 3
      Chan/src/org/floens/chan/net/ThreadLoader.java
  12. 54
      Chan/src/org/floens/chan/service/PinnedService.java
  13. 4
      Chan/src/org/floens/chan/utils/IconCache.java
  14. 32
      Chan/src/org/floens/chan/watch/PinWatcher.java
  15. 17
      Chan/src/org/floens/chan/watch/WatchLogic.java
  16. 3020
      docs/images/chanlogo.ai
  17. BIN
      docs/images/logo144.png
  18. BIN
      docs/images/logo192.png
  19. BIN
      docs/images/logo48.png
  20. BIN
      docs/images/logo512.png
  21. BIN
      docs/images/logo72.png
  22. BIN
      docs/images/logo96.png
  23. 0
      docs/images/old/4chanlogo.png
  24. 0
      docs/images/old/Icon512.png
  25. 0
      docs/images/old/Icon512.psd
  26. 0
      docs/images/old/IconWhite24.png
  27. 0
      docs/images/old/IconWhite36.png
  28. 0
      docs/images/old/IconWhite400.png
  29. 0
      docs/images/old/IconWhite48.png
  30. 0
      docs/images/old/IconWhite512.psd
  31. 0
      docs/images/old/IconWhite72.png
  32. 0
      docs/images/old/Screenshot_1.png
  33. 0
      docs/images/old/Screenshot_2.png

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.floens.chan"
android:versionCode="12"
android:versionName="Chan v0.10"
android:versionName="v0.10"
android:installLocation="auto" >
<uses-sdk

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

@ -34,8 +34,7 @@
android:layout_height="match_parent"
android:gravity="center"
android:textSize="16dp"
android:textColor="#fff"
android:text="99" />
android:textColor="#fff" />
</FrameLayout>

@ -49,10 +49,7 @@ public class ChanApplication extends Application {
if (ChanApplication.DEVELOPER_MODE) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork()
.detectCustomSlowCalls()
.detectAll()
.penaltyLog()
.build());
@ -62,14 +59,11 @@ public class ChanApplication extends Application {
.build());
}
// VolleyLog.setTag(getPackageName());
IconCache.createIcons(this);
volleyRequestQueue = Volley.newRequestQueue(this);
imageLoader = new ImageLoader(volleyRequestQueue, new BitmapLruImageCache(1024 * 1024 * 8));
// These manager need a Context
new DatabaseManager(this);
new BoardManager(this);

@ -11,6 +11,7 @@ import org.floens.chan.model.Loadable;
import org.floens.chan.model.Pin;
import org.floens.chan.model.Post;
import org.floens.chan.net.ChanUrls;
import org.floens.chan.service.PinnedService;
import android.app.ActionBar;
import android.app.AlertDialog;
@ -88,6 +89,20 @@ public class BoardActivity extends BaseActivity implements ActionBar.OnNavigatio
threadLoadable.writeToBundle(this, "thread", outState);
}
@Override
protected void onStart() {
super.onStart();
PinnedService.onActivityStart();
}
@Override
protected void onStop() {
super.onStop();
PinnedService.onActivityStop();
}
@Override
protected void onPause() {
super.onPause();

@ -73,6 +73,7 @@ public class ThreadManager implements ThreadLoader.ThreadLoaderListener, WatchLi
public void onDestroy() {
if (watchLogic != null) {
watchLogic.destroy();
watchLogic = null;
}
}
@ -94,6 +95,11 @@ public class ThreadManager implements ThreadLoader.ThreadLoaderListener, WatchLi
if (!threadLoader.isLoading()) {
threadLoader.start(loadable);
Pin pin = PinnedManager.getInstance().findPinByLoadable(loadable);
if (pin != null) {
PinnedManager.getInstance().onPinViewed(pin);
}
}
}
@ -113,7 +119,7 @@ public class ThreadManager implements ThreadLoader.ThreadLoaderListener, WatchLi
@Override
public void onData(List<Post> result) {
if (watchLogic != null) {
watchLogic.onLoaded(result.size());
watchLogic.onLoaded(result.size(), true);
}
threadListener.onThreadLoaded(result);

@ -53,9 +53,8 @@ public class ThreadLoader {
}
public void stop() {
Logger.i(TAG, "Stop loading");
if (loader != null) {
// Logger.i(TAG, "Stop loading");
loader.cancel();
loader = null;
}

@ -5,6 +5,7 @@ import java.util.List;
import org.floens.chan.R;
import org.floens.chan.manager.PinnedManager;
import org.floens.chan.model.Pin;
import org.floens.chan.utils.Logger;
import android.app.Notification;
import android.app.NotificationManager;
@ -15,9 +16,37 @@ import android.os.IBinder;
import android.os.Looper;
public class PinnedService extends Service {
private static final long FOREGROUND_INTERVAL = 10000L;
private static final long BACKGROUND_INTERVAL = 60000L;
private static PinnedService instance;
private static boolean activityInForeground = false;
private Thread loadThread;
private boolean running = true;
public PinnedService() {
instance = this;
}
/**
* Get the PinnedService instance
* @return the instance or null
*/
public static PinnedService getInstance() {
return instance;
}
public static void onActivityStart() {
Logger.test("onActivityStart");
activityInForeground = true;
}
public static void onActivityStop() {
Logger.test("onActivityStop");
activityInForeground = false;
}
@Override
public void onCreate() {
super.onCreate();
@ -30,26 +59,25 @@ public class PinnedService extends Service {
super.onDestroy();
running = false;
showNotification("Stop");
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
private void start() {
showNotification("Start");
loadThread = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
while (running) {
doUpdates();
long timeout = activityInForeground ? FOREGROUND_INTERVAL : BACKGROUND_INTERVAL;
try {
Thread.sleep(60000);
Thread.sleep(timeout);
} catch (InterruptedException e) {
e.printStackTrace();
}
@ -64,7 +92,6 @@ public class PinnedService extends Service {
List<Pin> pins = PinnedManager.getInstance().getPins();
for (Pin pin : pins) {
pin.updateWatch();
// pin.newPostCount++;
}
}
@ -89,6 +116,11 @@ public class PinnedService extends Service {
nm.notify(1, builder.getNotification());
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}

@ -14,11 +14,11 @@ public class IconCache {
* @param context
*/
public static void createIcons(final Context context) {
(new Thread(new Runnable() {
new Thread(new Runnable() {
@Override
public void run() {
stickyIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.sticky_icon);
}
})).start();
}).start();
}
}

@ -14,28 +14,32 @@ import com.android.volley.VolleyError;
public class PinWatcher implements ThreadLoader.ThreadLoaderListener {
private static final String TAG = "PinWatcher";
private final ThreadLoader watchLoader;
private final Loadable watchLoadable;
private final Pin pin;
private final Loadable loadable;
private final ThreadLoader loader;
private final WatchLogic watchLogic;
private long startTime;
public PinWatcher(Pin pin) {
this.pin = pin;
watchLoadable = pin.loadable.copy();
watchLoadable.simpleMode = true;
loadable = pin.loadable.copy();
loadable.simpleMode = true;
loader = new ThreadLoader(this);
watchLoader = new ThreadLoader(this);
watchLogic = new WatchLogic();
}
public void update() {
Logger.test("PinWatcher update");
startTime = System.currentTimeMillis();
watchLoader.start(watchLoadable);
if (watchLogic.timeLeft() < 0L) {
Logger.test("PinWatcher update");
startTime = System.currentTimeMillis();
loader.start(loadable);
}
}
@Override
@ -50,8 +54,14 @@ public class PinWatcher implements ThreadLoader.ThreadLoaderListener {
Logger.test("PinWatcher onData");
Logger.test("Post size: " + count);
if (pin.watchLastCount <= 0) {
pin.watchLastCount = pin.watchNewCount;
}
pin.watchNewCount = count;
watchLogic.onLoaded(count, false);
Logger.test("Load time: " + (System.currentTimeMillis() - startTime) + "ms");
PinnedService.callOnPinsChanged();

@ -4,6 +4,7 @@ import java.util.Timer;
import java.util.TimerTask;
import org.floens.chan.utils.Logger;
import org.floens.chan.utils.Utils;
public class WatchLogic {
private static final String TAG = "WatchLogic";
@ -17,6 +18,9 @@ public class WatchLogic {
private Timer timer = new Timer();
public WatchLogic() {
}
public WatchLogic(WatchListener listener) {
this.listener = listener;
}
@ -67,7 +71,7 @@ public class WatchLogic {
* Call this to notify of new posts.
* @param postCount how many posts there were loaded
*/
public void onLoaded(int postCount) {
public void onLoaded(int postCount, boolean scheduleTimer) {
Logger.d(TAG, "Loaded. Post count " + postCount + ", last " + lastPostCount);
if (postCount > lastPostCount) {
@ -79,7 +83,9 @@ public class WatchLogic {
lastLoadTime = now();
lastPostCount = postCount;
scheduleTimer();
if (scheduleTimer) {
scheduleTimer();
}
}
/**
@ -100,7 +106,12 @@ public class WatchLogic {
@Override
public void run() {
if (listener != null) {
listener.onWatchReloadRequested();
Utils.runOnUiThread(new Runnable() {
@Override
public void run() {
listener.onWatchReloadRequested();
}
});
}
}
}, Math.max(0, timeLeft()));

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Before

Width:  |  Height:  |  Size: 306 KiB

After

Width:  |  Height:  |  Size: 306 KiB

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Before

Width:  |  Height:  |  Size: 309 KiB

After

Width:  |  Height:  |  Size: 309 KiB

Before

Width:  |  Height:  |  Size: 229 KiB

After

Width:  |  Height:  |  Size: 229 KiB

Loading…
Cancel
Save