ripples with probe

today, i was having a discussion with Mostafa Gazar about android animations and his Widgets library, and Lucas Rocha’s probe project came to mind.

i decided to experiment and see if i could use probe to automatically add a ripple effect to a set of views without having to touch existing code. turns out it’s fairly easy to do! i did two separate implementations.

the first image is using Markus Hi’s android-ui library. the second image is using Mostafa’s Widgets.

the code using Mostafa’s Widgets is a lot simpler (due to RippleView doing most of the heavy lifting) - you can see it here. the code for wrapping android-ui is a bit more complicated (and mimics what Mostafa does in RippleView) and can be found here.

the general idea for both probe implementations is the same - we take any given view, and replace it with a FrameLayout containing the view, and an underlying “ripple view.”

now to apply either of these methods, we can do something like this:

RippleActivity.java
1
2
3
4
5
6
7
8
9
10
11
public class RippleActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
Probe.deploy(this, new RevealInterceptor(this),
new Filter.ParentId(R.id.ripple_main));
// can also use RippleInterceptor instead
super.onCreate(savedInstanceState);
setContentView(R.layout.ripples);
}
}
ripples.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ripple_main"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View android:id="@+id/button"
android:layout_width="128dp"
android:layout_height="128dp"
android:background="#aa00aaff"
android:layout_gravity="center" />
<View android:layout_gravity="bottom"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#aaff" />
</FrameLayout>

one interesting point - if you remove the filter and just let probe work on any view (both interceptors enforce non-ViewGroups only), the ripple effect ends up working on all views, including views in the ActionBar as well (which is really neat!)

quran plugin for alfred and launchbar

several months ago, i posted a plugin for searching the quran with alfred. i was playing with launchbar 6 recently, and while trying to figure out whether i want to use alfred or launchbar, i decided to write a plugin for searching the quran,
with suggestions, for launchbar.

download the launchbar plugin

i also decided to update the plugin for alfred (to have autocomplete). note that the current search api supports in:en (in english), in:tl (in transliteration), etc.

download the alfred plugin.

migrating from octopress to hexo

it’s been a long time since my last blog post, but i am hoping to become better about blogging. anyhow, the other day, i found nikola, a python blogging engine. i played with it and thought, “it would be cool to migrate my blog to it.” someone had written a migration script from octopress, and so i played with a migrated version locally.

unfortunately, some things (like pagination) would break the existing model that i’ve been using on this site in the past. so after much searching, i found hexo.

hexo is “a fast, simple & powerful blog framework, powered by Node.js.” it’s also a static blogging engine.

migrating from octopress was extremely simple - just a matter of copying pieces of my source directory to hexo’s source directory. then it was just a matter of tweaking some settings, finding a theme, and so on.

why migrate? first, it seems that octopress development has slowed down (at least relative to some of these other engines). secondly, some things, like tags, were only supported via a third party script. third, i am hoping it helps me blog more.

there you have it. enjoy!

quranicaudio.com web update for ios7

since ios7 brings such a huge change to the ui of ios, i’ve updated the web interface for quranicaudio.com for the iphone. here are the before/after pictures:

this was made a lot easier thanks to ios7 templates. i realize that there is no support for android at the moment, but insha’Allah will hopefully get to this eventually since it is important to do (and nice to have).

quran android 2.4.0

quran android 2.4.0 should be going live shortly insha’Allah. the most notable changes are tablet support while reading, better images for the s4/htc one, support for multiple sdcards, and various improvements.

euro matches for android

the latest project i’ve been working on is matches for android, done in conjunction with khalid al sudairy, batoulapps, bandar raffah, and taylor ling. the app is free and can be downloaded from the google play store here.

qamardeen for android

another thing i didn’t get a chance to write about earlier is the public beta of qamardeen for android. qamardeen is an application that lets you “taste your islam.” i think the official qamardeen page gives a pretty good explanation of what it is and how it is useful.

the android version uses a whole slew of custom views to make the views appear the way they do (while making it easy to manipulate the data). it also uses some open source libraries - mainly actionbarsherlock and achartengine. in addition, it uses a listview with pinned headers similar to the contacts app. you can see the code in use by the contacts app here, or you can read this blog post for more details.

give it a try - you’ll find it for free on google play.

quran android 2.x

quran for android has seen many changes before ramadan in bringing up the 2.0 release. i just wanted to highlight some of them here, seeing as though i have blog posts talking about other releases of quran android.

what’s new?

  • complete code re-write to make the code cleaner and easier to maintain.
  • fragment based architecture - pages, translations, bookmarks, etc are all in Fragments, which will make it easier to have a tablet version.
  • new, improved ui
  • gapless audio playback support
  • per-ayah actions (share ayah, show tafseer, etc)
  • supports versions 2.1+. older versions (1.5, 1.6) still run the older version.

what happened to the source?

we get lots of support emails. one thing we noticed was a few strange emails about “great app, but please remove ads,” and so on. we would always ask these users, “what are you talking about? our app doesn’t have ads! what are you talking about? please send us a link to the app you are using?”

finally, after a few months, someone sent us a link to an app on the store. the app was our exact 1.6 version of the application, with one major difference - ads. ads everywhere - even on top of each quran page as you were reading it.

this is a problem for several reasons:

  1. it is not befitting of the book of Allah to have Quran pages with ads on the top of each page. imagine reading a page and seeing an ad about a brand of alcohol, for example.
  2. it is someone making money off our work and effort.
  3. if we wanted to make money off our app, we would have sold a premium version with more features.
  4. whenever you want to make money off something, an issue of copyrights, etc comes into question (are we legally allowed to distribute these translations, audio files, etc?).

this is also the reason why quranworks for ipad has a light version which only gives you the 30th juz’, and you can either pay (in-app purchase) for the full quran or you can just buy their separate paid app. while i don’t think this as a good solution, i think it’s certainly a lot better than ads on each page. by the way, those guys have an awesome intro video masha’Allah.

so as a result of this, and in addition to the fact that we had very few contributors (and most of those contributors are people who are friends in real life), we removed the code from github.

statistics

due to a bug in google’s algorithms, we were completely unranked between january and august. after numerous emails during ramadan and much du3a, al7amdulillah, they finally fixed our rankings. by the grace of Allah, we were in the top 25 free books & reference applications during ramadan. today, in the us store, we are in the top 70 free books & reference applications. al7amdulillah.

screenshots

double standards

tl;dr edition

to any egyptian reading this - vote for whoever you think is best for egypt’s future, but in the process, never forget the importance of respect and character in such difficult times. i find these verses particularly relevant to the situation in egypt today and important for every egyptian to contemplate over (irrespective of who they support in the elections).

i am really saddened by the double standards we are seeing in egypt. we stood in tahrir, had shifts of nightly patrols guarding our homes and suffered a period of instability and turmoil to dispose of a tyrant and bring about better conditions and human rights.

here we are today - you support x and i support y - but guess what, we’re both egyptians, and we both want the best for this country. i completely disagree with you that ‘x’ is best for the country, but you know what, that doesn’t matter - it’s my opinion and i am entitled to it, and that’s what’s awesome - i respect you and you respect me, but we each vote for whoever we think is best.

what’s not awesome, however, is double standards. consider “a person is innocent until proven guilty,” and “a person is entitled to a speedy and public trial with an impartial jury.” should these be part of our new egyptian government or not?

if no, then why did we have a revolution to start with? if yes, then why do we think this should only apply to “those we agree with?”

so regardless of who you or i think is best for egypt’s future, it behooves us as egyptians to ascertain that an unbiased, honorable committee oversees the elections - so that your candidate has a fair shot of winning rather than having fixed elections.

what does this means? it means not believing everything we hear and making these people accountable. take for example dr. 7azem’s case - there are only two possibilities - his mother (ra7imaha Allah) had the us citizenship or she didn’t. it’s a very easy thing for the egyptian government to find out - all they have to do is contact the us department of homeland security and find out.

suppose the department of homeland security says, “yes, she was a citizen, and she gained her citizenship on this particular date.” great - then advertise and make this information publicly available to everyone so there remains no doubt about the matter - fitnah averted and people can move on with their lives. the fact that they refuse to present any evidence to people that is acceptable suggests that this election committee still has ties to the previous government.

speaking of the previous government, they still have their money, their contacts, and they are neither dead nor banished from the country. irrespective of who becomes president, the bigger question is “why aren’t these people being brought to justice?”