Skip to content

Commit

Permalink
Merge branch 'release/4.3-beta2'
Browse files Browse the repository at this point in the history
  • Loading branch information
yukuku committed Aug 17, 2015
2 parents df15a44 + 39e7a15 commit 76efe4a
Show file tree
Hide file tree
Showing 42 changed files with 573 additions and 145 deletions.
28 changes: 28 additions & 0 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Alkitab/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId 'yuku.alkitab.debug'
minSdkVersion 14
targetSdkVersion 22
versionCode 14000241
versionName '4.3-beta1'
versionCode 14000242
versionName '4.3-beta2'
}
buildTypes {
release {
Expand Down Expand Up @@ -67,17 +67,17 @@ dependencies {
compile project(':AmbilWarna')
compile project(':FileChooser')
compile project(':ImportedDesktopVerseUtil')
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.5.0-SNAPSHOT'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0-SNAPSHOT'
compile 'net.sf.trove4j:trove4j:3.0.3'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.android.gms:play-services-analytics:7.5.0'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services-analytics:7.8.0'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.afollestad:material-dialogs:0.7.6.0'
compile 'com.android.support:design:22.2.0'
compile 'com.android.support:design:22.2.1'
testCompile 'junit:junit:4.12'
}
2 changes: 1 addition & 1 deletion Alkitab/src/main/assets/help/credits.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<p style='font-size:14px;color:#888'>Interface Translators</p>

<p>Indonesian & English: Bible Team<br>
Malay: Wan Mohammad<br>
Malay: Wan Mohammad, Shafiq Jamzuri<br>
Chinese: Jandi Lau, Scribe<br>
Dutch: Jaap Kievit<br>
German: Michael Leimer<br>
Expand Down
107 changes: 82 additions & 25 deletions Alkitab/src/main/java/yuku/alkitab/base/IsiActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@
import yuku.alkitab.base.model.MVersion;
import yuku.alkitab.base.model.MVersionDb;
import yuku.alkitab.base.model.MVersionInternal;
import yuku.alkitab.base.model.SyncShadow;
import yuku.alkitab.base.model.VersionImpl;
import yuku.alkitab.base.storage.Prefkey;
import yuku.alkitab.base.sync.Sync;
import yuku.alkitab.base.util.Announce;
import yuku.alkitab.base.util.Appearances;
import yuku.alkitab.base.util.CurrentReading;
Expand Down Expand Up @@ -137,6 +135,7 @@ public class IsiActivity extends BaseLeftDrawerActivity implements XrefDialog.Xr
public static final String ACTION_ATTRIBUTE_MAP_CHANGED = "yuku.alkitab.action.ATTRIBUTE_MAP_CHANGED";
public static final String ACTION_ACTIVE_VERSION_CHANGED = IsiActivity.class.getName() + ".action.ACTIVE_VERSION_CHANGED";
public static final String ACTION_NIGHT_MODE_CHANGED = IsiActivity.class.getName() + ".action.NIGHT_MODE_CHANGED";
public static final String ACTION_NEEDS_RESTART = IsiActivity.class.getName() + ".action.NEEDS_RESTART";

private static final int REQCODE_goto = 1;
private static final int REQCODE_share = 7;
Expand All @@ -148,6 +147,8 @@ public class IsiActivity extends BaseLeftDrawerActivity implements XrefDialog.Xr
private static final String EXTRA_verseUrl = "verseUrl";
private boolean uncheckVersesWhenActionModeDestroyed = true;

private boolean needsRestart; // whether this activity needs to be restarted

private GotoButton.FloaterDragListener bGoto_floaterDrag = new GotoButton.FloaterDragListener() {
final int[] floaterLocationOnScreen = {0, 0};

Expand Down Expand Up @@ -269,6 +270,7 @@ public void onTwofingerEnd(final TwofingerLinearLayout.Mode mode) {

FrameLayout overlayContainer;
View root;
Toolbar toolbar;
VersesView lsSplit0;
VersesView lsSplit1;
TextView tSplitEmpty;
Expand Down Expand Up @@ -399,7 +401,7 @@ public void onReceive(final Context context, final Intent intent) {
leftDrawer = V.get(this, R.id.left_drawer);
leftDrawer.configure(this, drawerLayout);

final Toolbar toolbar = V.get(this, R.id.toolbar);
toolbar = V.get(this, R.id.toolbar);
setSupportActionBar(toolbar);
setTitle("");

Expand All @@ -420,6 +422,8 @@ public void onReceive(final Context context, final Intent intent) {
splitHandleButton = V.get(this, R.id.splitHandleButton);
floater = V.get(this, R.id.floater);

updateToolbarLocation();

lsSplit0.setName("lsSplit0");
lsSplit1.setName("lsSplit1");

Expand Down Expand Up @@ -564,8 +568,17 @@ && thereIsYukuAlkitabBackupFiles()) {
}

Announce.checkAnnouncements();

App.getLbm().registerReceiver(needsRestartReceiver, new IntentFilter(ACTION_NEEDS_RESTART));
}

final BroadcastReceiver needsRestartReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
needsRestart = true;
}
};

private boolean thereIsYukuAlkitabBackupFiles() {
final File dir = new File(Environment.getExternalStorageDirectory(), "bible");
if (!dir.exists()) return false;
Expand Down Expand Up @@ -606,6 +619,8 @@ protected void onDestroy() {
super.onDestroy();

App.getLbm().unregisterReceiver(reloadAttributeMapReceiver);

App.getLbm().unregisterReceiver(needsRestartReceiver);
}

/**
Expand Down Expand Up @@ -968,7 +983,7 @@ private CharSequence referenceFromSelectedVerses(IntArrayList selectedVerses, Bo
/**
* Construct text for copying or sharing (in plain text).
* @param isSplitVersion whether take the verse text from the main or from the split version.
* @return [0] text for copy/share, [1] text for share url
* @return [0] text for copy/share, [1] text to be submitted to the share url service
*/
String[] prepareTextForCopyShare(IntArrayList selectedVerses_1, CharSequence reference, boolean isSplitVersion) {
final StringBuilder res0 = new StringBuilder();
Expand Down Expand Up @@ -999,7 +1014,7 @@ String[] prepareTextForCopyShare(IntArrayList selectedVerses_1, CharSequence ref
final String verseTextPlain = U.removeSpecialCodes(verseText);

res0.append(verseTextPlain);
res1.append(verseTextPlain);
res1.append(verseText);

if (i != len - 1) {
res0.append('\n');
Expand All @@ -1020,7 +1035,7 @@ String[] prepareTextForCopyShare(IntArrayList selectedVerses_1, CharSequence ref
final String verseTextPlain = U.removeSpecialCodes(verseText);

res0.append(verseTextPlain);
res1.append(verseTextPlain);
res1.append(verseText);
}
}

Expand Down Expand Up @@ -1087,6 +1102,14 @@ private void applyPreferences() {
applyPreferences();

getWindow().getDecorView().setKeepScreenOn(Preferences.getBoolean(getString(R.string.pref_keepScreenOn_key), getResources().getBoolean(R.bool.pref_keepScreenOn_default)));

if (needsRestart) {
needsRestart = false;

final Intent originalIntent = getIntent();
finish();
startActivity(originalIntent);
}
}

@Override public void onBackPressed() {
Expand Down Expand Up @@ -1224,34 +1247,57 @@ void setFullScreen(boolean yes) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getSupportActionBar().hide();

final ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) root.getLayoutParams();
lp.topMargin = 0;
root.setLayoutParams(lp);

if (Build.VERSION.SDK_INT >= 19) {
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE
);
}

fullScreen = true;
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getSupportActionBar().show();

final ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) root.getLayoutParams();
if (Build.VERSION.SDK_INT >= 19) {
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}

fullScreen = yes;

updateToolbarLocation();
}

void updateToolbarLocation() {
// 3 kinds of possible layout:
// - fullscreen
// - not fullscreen, toolbar at bottom
// - not fullscreen, toolbar at top

final FrameLayout.LayoutParams lp_root = (FrameLayout.LayoutParams) root.getLayoutParams();

if (fullScreen) {
lp_root.topMargin = 0;
lp_root.bottomMargin = 0;
} else {
final TypedValue tv = new TypedValue();
getTheme().resolveAttribute(R.attr.actionBarSize, tv, true);
lp.topMargin = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
root.setLayoutParams(lp);
final int actionBarSize = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
final FrameLayout.LayoutParams lp_toolbar = (FrameLayout.LayoutParams) toolbar.getLayoutParams();

if (Build.VERSION.SDK_INT >= 19) {
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
if (Preferences.getBoolean(R.string.pref_bottomToolbarOnText_key, R.bool.pref_bottomToolbarOnText_default)) {
lp_toolbar.gravity = Gravity.BOTTOM;
lp_root.topMargin = 0;
lp_root.bottomMargin = actionBarSize;
} else {
lp_toolbar.gravity = Gravity.NO_GRAVITY;
lp_root.topMargin = actionBarSize;
lp_root.bottomMargin = 0;
}

fullScreen = false;
toolbar.setLayoutParams(lp_toolbar);
}

root.setLayoutParams(lp_root);
}

@Override
Expand Down Expand Up @@ -1593,7 +1639,7 @@ static boolean loadChapterToVersesView(VersesView versesView, Version version, B
int nblock = version.loadPericope(book.bookId, chapter_1, pericope_aris, pericope_blocks, max);

boolean retainSelectedVerses = (!uncheckAllVerses && chapter_1 == current_chapter_1);
versesView.setDataWithRetainSelectedVerses(retainSelectedVerses, book, chapter_1, pericope_aris, pericope_blocks, nblock, verses);
versesView.setDataWithRetainSelectedVerses(retainSelectedVerses, Ari.encode(book.bookId, chapter_1, 0), pericope_aris, pericope_blocks, nblock, verses);

return true;
}
Expand Down Expand Up @@ -1702,9 +1748,7 @@ void openBookmarkDialog(final long _id) {
}

@Override
public void onBookmarkAttributeClick(final Book book, final int chapter_1, final int verse_1) {
final int ari = Ari.encode(book.bookId, chapter_1, verse_1);

public void onBookmarkAttributeClick(final int ari) {
final List<Marker> markers = S.getDb().listMarkersForAriKind(ari, Marker.Kind.bookmark);
if (markers.size() == 1) {
openBookmarkDialog(markers.get(0)._id);
Expand All @@ -1727,10 +1771,9 @@ void openNoteDialog(final long _id) {
startActivityForResult(NoteActivity.createEditExistingIntent(_id), REQCODE_edit_note_1);
}

@Override
public void onNoteAttributeClick(final Book book, final int chapter_1, final int verse_1) {
final int ari = Ari.encode(book.bookId, chapter_1, verse_1);

@Override
public void onNoteAttributeClick(final int ari) {
final List<Marker> markers = S.getDb().listMarkersForAriKind(ari, Marker.Kind.note);
if (markers.size() == 1) {
openNoteDialog(markers.get(0)._id);
Expand Down Expand Up @@ -1843,6 +1886,20 @@ public void onDeleted() {
}
});
}

@Override
public void onHasMapsAttributeClick(final int ari) {
try {
startActivity(new Intent("palki.maps.action.SHOW_MAPS_DIALOG")
.putExtra("ari", ari)
);
} catch (ActivityNotFoundException e) {
new MaterialDialog.Builder(IsiActivity.this)
.content(R.string.maps_could_not_open)
.positiveText(R.string.ok)
.show();
}
}
};

class VerseInlineLinkSpanFactory implements VerseInlineLinkSpan.Factory {
Expand Down
16 changes: 14 additions & 2 deletions Alkitab/src/main/java/yuku/alkitab/base/ac/HelpActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.annotation.SuppressLint;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebSettings;
Expand All @@ -15,6 +16,7 @@
import yuku.alkitab.base.dialog.VersesDialog;
import yuku.alkitab.base.util.Announce;
import yuku.alkitab.base.util.TargetDecoder;
import yuku.alkitab.debug.BuildConfig;
import yuku.alkitab.debug.R;
import yuku.alkitab.util.IntArrayList;
import yuku.alkitabintegration.display.Launcher;
Expand All @@ -27,7 +29,6 @@ public class HelpActivity extends BaseActivity {
private static final String EXTRA_announcementIds = "announcementIds";

WebView webview;
long[] announcementIds;

public static Intent createIntent(final String page) {
return createIntent(page, null);
Expand All @@ -52,6 +53,12 @@ protected void onCreate(Bundle savedInstanceState) {

webview = V.get(this, R.id.webView);

if (BuildConfig.DEBUG) {
if (Build.VERSION.SDK_INT >= 19) {
WebView.setWebContentsDebuggingEnabled(true);
}
}

final WebSettings webSettings = webview.getSettings();
//noinspection deprecation
webSettings.setSavePassword(false);
Expand All @@ -60,6 +67,7 @@ protected void onCreate(Bundle savedInstanceState) {

final String page = getIntent().getStringExtra(EXTRA_page);
final String overrideTitle = getIntent().getStringExtra(EXTRA_overrideTitle);
final long[] announcementIds = getIntent().getLongArrayExtra(EXTRA_announcementIds);

if (overrideTitle != null) {
setTitle(overrideTitle);
Expand All @@ -73,7 +81,11 @@ protected void onCreate(Bundle savedInstanceState) {
}
} else if (announcementIds != null) {
final Locale locale = getResources().getConfiguration().locale;
webview.loadUrl("https://alkitab-host.appspot.com/announce/view?ids=" + App.getDefaultGson().toJson(announcementIds) + (locale == null ? "" : ("&locale=" + locale.toString())));
final String url = "https://alkitab-host.appspot.com/announce/view?ids=" + App.getDefaultGson().toJson(announcementIds) + (locale == null ? "" : ("&locale=" + locale.toString()));
if (BuildConfig.DEBUG) {
Log.d(TAG, "loading announce view url: " + url);
}
webview.loadUrl(url);
}

webview.setWebViewClient(new WebViewClient() {
Expand Down
Loading

0 comments on commit 76efe4a

Please sign in to comment.