From b953aaafb671fea06bdbb265848ffbbc66bc26d1 Mon Sep 17 00:00:00 2001 From: Yuku on yuku8 Date: Wed, 27 Jan 2016 17:42:43 +0800 Subject: [PATCH 01/19] Uses Android Studio 2 --- .idea/encodings.xml | 6 ++++++ build.gradle | 2 +- extensions/example-imagesharer/build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .idea/encodings.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 000000000..97626ba45 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 8e3433bf5..dff9ab63b 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:1.5.0' + classpath 'com.android.tools.build:gradle:2.0.0-alpha7' } } diff --git a/extensions/example-imagesharer/build.gradle b/extensions/example-imagesharer/build.gradle index 9405f3fd1..469472dc2 100644 --- a/extensions/example-imagesharer/build.gradle +++ b/extensions/example-imagesharer/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.3' + classpath 'com.android.tools.build:gradle:2.0.0-alpha7' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c8ecc0c94..144c8f6f2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Nov 27 05:21:34 SGT 2014 +#Fri Jan 15 12:51:42 SGT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip From 2197407503418ae19c257a682dde8180317218f6 Mon Sep 17 00:00:00 2001 From: Yuku on yuku8 Date: Wed, 27 Jan 2016 17:43:13 +0800 Subject: [PATCH 02/19] Add copy/share primary/secondary/both versions --- .../java/yuku/alkitab/base/IsiActivity.java | 56 +++++++++++++++++-- .../src/main/java/yuku/alkitab/base/S.java | 16 +++--- Alkitab/src/main/res/menu/context_isi.xml | 36 ++++++++++++ Alkitab/src/main/res/values/strings.xml | 6 ++ 4 files changed, 100 insertions(+), 14 deletions(-) diff --git a/Alkitab/src/main/java/yuku/alkitab/base/IsiActivity.java b/Alkitab/src/main/java/yuku/alkitab/base/IsiActivity.java index 020974b7e..1e7701108 100644 --- a/Alkitab/src/main/java/yuku/alkitab/base/IsiActivity.java +++ b/Alkitab/src/main/java/yuku/alkitab/base/IsiActivity.java @@ -2124,6 +2124,28 @@ public void onClick(final Type type, final int arif, final Object source) { menuAddNote.setVisible(contiguous); menuCompare.setVisible(single); + // just "copy" or ("copy primary" "copy secondary" "copy both") + // same with "share". + final MenuItem menuCopy = menu.findItem(R.id.menuCopy); + final MenuItem menuCopySplit0 = menu.findItem(R.id.menuCopySplit0); + final MenuItem menuCopySplit1 = menu.findItem(R.id.menuCopySplit1); + final MenuItem menuCopyBothSplits = menu.findItem(R.id.menuCopyBothSplits); + final MenuItem menuShare = menu.findItem(R.id.menuShare); + final MenuItem menuShareSplit0 = menu.findItem(R.id.menuShareSplit0); + final MenuItem menuShareSplit1 = menu.findItem(R.id.menuShareSplit1); + final MenuItem menuShareBothSplits = menu.findItem(R.id.menuShareBothSplits); + + final boolean split = activeSplitVersion != null; + + menuCopy.setVisible(!split); + menuCopySplit0.setVisible(split); + menuCopySplit1.setVisible(split); + menuCopyBothSplits.setVisible(split); + menuShare.setVisible(!split); + menuShareSplit0.setVisible(split); + menuShareSplit1.setVisible(split); + menuShareBothSplits.setVisible(split); + // show selected verses if (single) { mode.setSubtitle(R.string.verse_select_one_verse_selected); @@ -2177,11 +2199,22 @@ public void onClick(final Type type, final int arif, final Object source) { final int itemId = item.getItemId(); switch (itemId) { - case R.id.menuCopy: { // copy, can be multiple - String[] t = prepareTextForCopyShare(selected, reference, false); - if (activeSplitVersion != null) { + case R.id.menuCopy: + case R.id.menuCopySplit0: + case R.id.menuCopySplit1: + case R.id.menuCopyBothSplits: { // copy, can be multiple verses + final String[] t; + + if (itemId == R.id.menuCopy || itemId == R.id.menuCopySplit0 || itemId == R.id.menuCopyBothSplits) { + t = prepareTextForCopyShare(selected, reference, false); + } else { // menuCopySplit1 + t = prepareTextForCopyShare(selected, reference, true); + } + + if (itemId == R.id.menuCopyBothSplits && activeSplitVersion != null) { // put guard on activeSplitVersion appendSplitTextForCopyShare(t); } + final String textToCopy = t[0]; final String textToSubmit = t[1]; @@ -2210,11 +2243,22 @@ public void onFinally() { } }); } return true; - case R.id.menuShare: { - String[] t = prepareTextForCopyShare(selected, reference, false); - if (activeSplitVersion != null) { + case R.id.menuShare: + case R.id.menuShareSplit0: + case R.id.menuShareSplit1: + case R.id.menuShareBothSplits: { // share, can be multiple verses + final String[] t; + + if (itemId == R.id.menuShare || itemId == R.id.menuShareSplit0 || itemId == R.id.menuShareBothSplits) { + t = prepareTextForCopyShare(selected, reference, false); + } else { // menuShareSplit1 + t = prepareTextForCopyShare(selected, reference, true); + } + + if (itemId == R.id.menuShareBothSplits && activeSplitVersion != null) { // put guard on activeSplitVersion appendSplitTextForCopyShare(t); } + final String textToShare = t[0]; final String textToSubmit = t[1]; diff --git a/Alkitab/src/main/java/yuku/alkitab/base/S.java b/Alkitab/src/main/java/yuku/alkitab/base/S.java index ccfd60b94..e261d5c24 100644 --- a/Alkitab/src/main/java/yuku/alkitab/base/S.java +++ b/Alkitab/src/main/java/yuku/alkitab/base/S.java @@ -80,15 +80,15 @@ public static void calculateAppliedValuesBasedOnPreferences() { //# configure text color, red text color, bg color, and verse color { if (Preferences.getBoolean(Prefkey.is_night_mode, false)) { - applied.fontColor = Preferences.getInt(App.context.getString(R.string.pref_textColor_night_key), App.context.getResources().getInteger(R.integer.pref_textColor_night_default)); - applied.backgroundColor = Preferences.getInt(App.context.getString(R.string.pref_backgroundColor_night_key), App.context.getResources().getInteger(R.integer.pref_backgroundColor_night_default)); - applied.verseNumberColor = Preferences.getInt(App.context.getString(R.string.pref_verseNumberColor_night_key), App.context.getResources().getInteger(R.integer.pref_verseNumberColor_night_default)); - applied.fontRedColor = Preferences.getInt(App.context.getString(R.string.pref_redTextColor_night_key), App.context.getResources().getInteger(R.integer.pref_redTextColor_night_default)); + applied.fontColor = Preferences.getInt(R.string.pref_textColor_night_key, R.integer.pref_textColor_night_default); + applied.backgroundColor = Preferences.getInt(R.string.pref_backgroundColor_night_key, R.integer.pref_backgroundColor_night_default); + applied.verseNumberColor = Preferences.getInt(R.string.pref_verseNumberColor_night_key, R.integer.pref_verseNumberColor_night_default); + applied.fontRedColor = Preferences.getInt(R.string.pref_redTextColor_night_key, R.integer.pref_redTextColor_night_default); } else { - applied.fontColor = Preferences.getInt(App.context.getString(R.string.pref_textColor_key), App.context.getResources().getInteger(R.integer.pref_textColor_default)); - applied.backgroundColor = Preferences.getInt(App.context.getString(R.string.pref_backgroundColor_key), App.context.getResources().getInteger(R.integer.pref_backgroundColor_default)); - applied.verseNumberColor = Preferences.getInt(App.context.getString(R.string.pref_verseNumberColor_key), App.context.getResources().getInteger(R.integer.pref_verseNumberColor_default)); - applied.fontRedColor = Preferences.getInt(App.context.getString(R.string.pref_redTextColor_key), App.context.getResources().getInteger(R.integer.pref_redTextColor_default)); + applied.fontColor = Preferences.getInt(R.string.pref_textColor_key, R.integer.pref_textColor_default); + applied.backgroundColor = Preferences.getInt(R.string.pref_backgroundColor_key, R.integer.pref_backgroundColor_default); + applied.verseNumberColor = Preferences.getInt(R.string.pref_verseNumberColor_key, R.integer.pref_verseNumberColor_default); + applied.fontRedColor = Preferences.getInt(R.string.pref_redTextColor_key, R.integer.pref_redTextColor_default); } // calculation of backgroundColor brightness. Used somewhere else. diff --git a/Alkitab/src/main/res/menu/context_isi.xml b/Alkitab/src/main/res/menu/context_isi.xml index 91087cd2c..0d28489e6 100644 --- a/Alkitab/src/main/res/menu/context_isi.xml +++ b/Alkitab/src/main/res/menu/context_isi.xml @@ -9,12 +9,48 @@ app:showAsAction="never" android:title="@string/salin_ayat" /> + + + + + + + + + + + + Markers Delete bookmark Share + Share primary version + Share secondary version + Share both versions Write note Add bookmark Copy verse + Copy primary version + Copy secondary version + Copy both versions Copy selected verses New Test. Old Test. From 637e12f26c1db5857934d68282eca97b7cd7fffd Mon Sep 17 00:00:00 2001 From: Yuku on yuku8 Date: Wed, 27 Jan 2016 18:01:57 +0800 Subject: [PATCH 03/19] Change text appearance panel in preparation of custom font size per version --- .../base/widget/TextAppearancePanel.java | 5 +- .../main/res/layout/panel_text_appearance.xml | 174 +++++++++--------- Alkitab/src/main/res/values-w360dp/dimens.xml | 2 +- Alkitab/src/main/res/values-w600dp/dimens.xml | 2 +- Alkitab/src/main/res/values/dimens.xml | 2 +- Alkitab/src/main/res/values/strings.xml | 1 + 6 files changed, 99 insertions(+), 87 deletions(-) diff --git a/Alkitab/src/main/java/yuku/alkitab/base/widget/TextAppearancePanel.java b/Alkitab/src/main/java/yuku/alkitab/base/widget/TextAppearancePanel.java index 86f0fdc79..c06dc3a73 100644 --- a/Alkitab/src/main/java/yuku/alkitab/base/widget/TextAppearancePanel.java +++ b/Alkitab/src/main/java/yuku/alkitab/base/widget/TextAppearancePanel.java @@ -6,6 +6,7 @@ import android.content.res.Resources; import android.graphics.Typeface; import android.text.SpannableStringBuilder; +import android.text.TextUtils; import android.text.style.ForegroundColorSpan; import android.view.LayoutInflater; import android.view.View; @@ -256,7 +257,9 @@ public void reload() { } @Override public void bindView(View view, int position, ViewGroup parent) { - TextView text1 = V.get(view, android.R.id.text1); + final TextView text1 = V.get(view, android.R.id.text1); + text1.setLines(1); // do not wrap long font names + text1.setEllipsize(TextUtils.TruncateAt.END); if (position < 3) { final String[] defaultFontNames = {"Roboto", "Droid Serif", "Droid Mono"}; diff --git a/Alkitab/src/main/res/layout/panel_text_appearance.xml b/Alkitab/src/main/res/layout/panel_text_appearance.xml index c296113bf..185c87fbc 100644 --- a/Alkitab/src/main/res/layout/panel_text_appearance.xml +++ b/Alkitab/src/main/res/layout/panel_text_appearance.xml @@ -6,26 +6,23 @@ android:layout_gravity="bottom|center_horizontal" android:background="#262626" android:orientation="vertical" - tools:context=".base.IsiActivity" tools:ignore="Overdraw"> - - - + android:gravity="center_vertical|left" + android:textAllCaps="true" + android:textStyle="bold" + android:text="@string/text_appearance_font" /> + android:layout_height="48dp"> - - - + android:layout_weight="1" + tools:listitem="@android:layout/simple_spinner_dropdown_item" /> + - + - + - + android:gravity="center_vertical|left" + android:text="@string/text_appearance_text_size" + android:textAllCaps="true" + android:textStyle="bold" /> - + - + - + + + - + + - + - + - + - - - - - - - + android:layout_gravity="center_vertical" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" + android:layout_weight="1" + android:max="20" /> + + diff --git a/Alkitab/src/main/res/values-w360dp/dimens.xml b/Alkitab/src/main/res/values-w360dp/dimens.xml index 36d5b8f3b..6a289d075 100644 --- a/Alkitab/src/main/res/values-w360dp/dimens.xml +++ b/Alkitab/src/main/res/values-w360dp/dimens.xml @@ -1,4 +1,4 @@ - 360dp + 320dp \ No newline at end of file diff --git a/Alkitab/src/main/res/values-w600dp/dimens.xml b/Alkitab/src/main/res/values-w600dp/dimens.xml index 110862e25..11b821175 100644 --- a/Alkitab/src/main/res/values-w600dp/dimens.xml +++ b/Alkitab/src/main/res/values-w600dp/dimens.xml @@ -1,4 +1,4 @@ - 480dp + 432dp \ No newline at end of file diff --git a/Alkitab/src/main/res/values/dimens.xml b/Alkitab/src/main/res/values/dimens.xml index 3df08011b..216cf593f 100644 --- a/Alkitab/src/main/res/values/dimens.xml +++ b/Alkitab/src/main/res/values/dimens.xml @@ -3,7 +3,7 @@ 24dp - 320dp + 240dp 0dp diff --git a/Alkitab/src/main/res/values/strings.xml b/Alkitab/src/main/res/values/strings.xml index b2d935d5d..16707c8fe 100644 --- a/Alkitab/src/main/res/values/strings.xml +++ b/Alkitab/src/main/res/values/strings.xml @@ -201,6 +201,7 @@ Colors Colors (Night mode) Display + Font Custom… Text size Line spacing From bd44965de491eba0076e067c975201a5572a9415 Mon Sep 17 00:00:00 2001 From: Yuku on yuku8 Date: Wed, 27 Jan 2016 18:46:30 +0800 Subject: [PATCH 04/19] Make nullable and nonnull annotations emit error when not followed --- .idea/inspectionProfiles/Project_Default.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index a288604fe..badc3694a 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -2,6 +2,10 @@