This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//create a factory that creates types within a scope | |
StuppScope scope = new StuppScope(); | |
StuppType type = StuppType.getInstance(Book.class); | |
StuppFactory<Book, Long> factory = new StuppFactory(type, scope); | |
//then use it to create objects | |
Book book = factory.newInstance(1L); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Color; | |
import java.awt.Graphics2D; | |
import java.awt.RenderingHints; | |
import java.awt.geom.Ellipse2D; | |
import java.awt.image.BufferedImage; | |
import java.io.File; | |
import java.io.IOException; | |
import java.util.Arrays; | |
import javax.imageio.ImageIO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tomgibara.daisy.demo.provider; | |
import android.app.Activity; | |
import android.content.Intent; | |
import android.net.Uri; | |
import android.os.Bundle; | |
import android.text.format.DateUtils; | |
import android.view.View; | |
import android.view.View.OnClickListener; | |
import android.widget.ImageView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
FileOutputStream out = new FileOutputStream(file); | |
try { | |
bitmap.compress(CompressFormat.PNG, 100, out); | |
} finally { | |
try { | |
out.close(); | |
} catch (IOException e) { | |
Log.w(DaisyGardenApp.LOG_TAG, "Failed to close file: " + file); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tomgibara.android.util; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.view.ViewGroup; | |
/** | |
* A layout that arranges views into a grid of same-sized squares. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tomgibara.android.util; | |
/** | |
* <p> | |
* Writes ints into char array without generating any objects. This is typically | |
* useful in instances where numbers must be rendered within a game-loop or | |
* animation. Instances of this class are not safe for multithreaded use. | |
* </p> | |
* | |
* <p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tomgibara.android.util; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.EnumSet; | |
import android.os.AsyncTask; | |
import android.os.SystemClock; | |
import com.google.android.apps.analytics.GoogleAnalyticsTracker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example analytics | |
GoogleAnalyticsTracker gat = GoogleAnalyticsTracker.getInstance(); | |
gat.start(/* your analytics parameters */); | |
// example config | |
Tracker tracker = new Tracker(gat); | |
tracker.setAsynchronous(true); | |
tracker.disable(Tracker.Category.NET); | |
//example usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tomgibara.android.util; | |
import java.util.HashSet; | |
import java.util.LinkedHashMap; | |
import java.util.Map; | |
import java.util.WeakHashMap; | |
import java.util.concurrent.Callable; | |
import java.util.concurrent.Future; | |
import java.util.concurrent.FutureTask; | |
import java.util.concurrent.PriorityBlockingQueue; |
OlderNewer