Permalink
Browse files

slight code reformatting

  • Loading branch information...
1 parent 5a2a07d commit 669efe3b6364c455445dc1e0aa1a6aa342cf211a @commonsguy committed Jan 1, 2013
Showing with 16 additions and 15 deletions.
  1. +13 −10 src/com/commonsware/empub/EmPubActivity.java
  2. +3 −5 src/com/commonsware/empub/ModelFragment.java
@@ -183,21 +183,24 @@ else if (item.getItemId() == R.id.empub_help) {
@Override
public void onInternalLinkClicked(String url) {
String[] pieces=url.substring(CONTENT_PREFIX.length()).split("#");
- int position=getContents().getPositionForFile(pieces[0]);
- if (pieces.length == 2) {
- anchors.put(pieces[0].substring(5), pieces[1]);
+ if (pieces[0].length() > 5) {
+ int position=getContents().getPositionForFile(pieces[0]);
- ChapterFragment frag=
- (ChapterFragment)adapter.getActiveFragment(pager,
- position + 2);
+ if (pieces.length == 2) {
+ anchors.put(pieces[0].substring(5), pieces[1]);
- if (frag != null) {
- frag.jumpTo(pieces[1]);
+ ChapterFragment frag=
+ (ChapterFragment)adapter.getActiveFragment(pager,
+ position + 2);
+
+ if (frag != null) {
+ frag.jumpTo(pieces[1]);
+ }
}
- }
- pager.setCurrentItem(position + 2, false);
+ pager.setCurrentItem(position + 2, false);
+ }
}
@Override
@@ -11,19 +11,17 @@
package com.commonsware.empub;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.InputStream;
-import java.io.InputStreamReader;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
-import android.os.Environment;
import android.preference.PreferenceManager;
import android.util.Log;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import com.actionbarsherlock.app.SherlockFragment;
import org.json.JSONObject;

0 comments on commit 669efe3

Please sign in to comment.