From 0632c0f8236c64387b44d222c4c32dd1e7d01a1e Mon Sep 17 00:00:00 2001 From: Renjaya Raga Zenta Date: Fri, 2 Aug 2013 05:29:04 +0700 Subject: [PATCH 01/13] Move util class to other package --- .../dawne/{ => util}/CharsetDetector.java | 2 +- .../altakey/dawne/{ => util}/ConfigKey.java | 3 +- .../altakey/dawne/util/ObjectSerializer.java | 83 ++++++++++++++++ .../gmail/altakey/dawne/util/RecentFile.java | 48 +++++++++ .../altakey/dawne/util/StackRecentFiles.java | 99 +++++++++++++++++++ .../altakey/dawne/{ => util}/TextLoader.java | 2 +- .../altakey/dawne/{ => util}/TextPager.java | 2 +- .../altakey/dawne/{ => util}/TextStyler.java | 2 +- 8 files changed, 236 insertions(+), 5 deletions(-) rename src/com/gmail/altakey/dawne/{ => util}/CharsetDetector.java (99%) rename src/com/gmail/altakey/dawne/{ => util}/ConfigKey.java (92%) create mode 100644 src/com/gmail/altakey/dawne/util/ObjectSerializer.java create mode 100644 src/com/gmail/altakey/dawne/util/RecentFile.java create mode 100644 src/com/gmail/altakey/dawne/util/StackRecentFiles.java rename src/com/gmail/altakey/dawne/{ => util}/TextLoader.java (98%) rename src/com/gmail/altakey/dawne/{ => util}/TextPager.java (97%) rename src/com/gmail/altakey/dawne/{ => util}/TextStyler.java (98%) diff --git a/src/com/gmail/altakey/dawne/CharsetDetector.java b/src/com/gmail/altakey/dawne/util/CharsetDetector.java similarity index 99% rename from src/com/gmail/altakey/dawne/CharsetDetector.java rename to src/com/gmail/altakey/dawne/util/CharsetDetector.java index f072c44..de38a13 100644 --- a/src/com/gmail/altakey/dawne/CharsetDetector.java +++ b/src/com/gmail/altakey/dawne/util/CharsetDetector.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package com.gmail.altakey.dawne; +package com.gmail.altakey.dawne.util; import java.util.Arrays; import java.util.List; diff --git a/src/com/gmail/altakey/dawne/ConfigKey.java b/src/com/gmail/altakey/dawne/util/ConfigKey.java similarity index 92% rename from src/com/gmail/altakey/dawne/ConfigKey.java rename to src/com/gmail/altakey/dawne/util/ConfigKey.java index fdcc2e3..af52515 100644 --- a/src/com/gmail/altakey/dawne/ConfigKey.java +++ b/src/com/gmail/altakey/dawne/util/ConfigKey.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package com.gmail.altakey.dawne; +package com.gmail.altakey.dawne.util; public class ConfigKey { public static final String COLORTHEME = "colortheme"; @@ -25,4 +25,5 @@ public class ConfigKey { public static final String SCROLL_LINES = "scrolllines"; public static final String SHOW_TITLE = "showtitle"; public static final String CHARSET_PREFERENCE = "charsetpreference"; + public static final String RECENT_FILES = "recentfiles"; } diff --git a/src/com/gmail/altakey/dawne/util/ObjectSerializer.java b/src/com/gmail/altakey/dawne/util/ObjectSerializer.java new file mode 100644 index 0000000..e19ab81 --- /dev/null +++ b/src/com/gmail/altakey/dawne/util/ObjectSerializer.java @@ -0,0 +1,83 @@ +/** + * Copyright (C) 2013 Takahiro Yoshimura, Renjaya Raga Zenta + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.gmail.altakey.dawne.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; + +public class ObjectSerializer { + public static String serialize(Serializable obj) throws IOException { + if (obj == null) { + return ""; + } + try { + ByteArrayOutputStream serialObj = new ByteArrayOutputStream(); + ObjectOutputStream objStream = new ObjectOutputStream(serialObj); + objStream.writeObject(obj); + objStream.close(); + return encodeBytes(serialObj.toByteArray()); + } catch (Exception e) { + throw new IOException("Serialization error: " + e.getMessage()); + } + + } + + public static Object deserialize(String str) throws IOException { + if (str == null || str.length() == 0) { + return null; + } + try { + ByteArrayInputStream serialObj = new ByteArrayInputStream(decodeBytes(str)); + ObjectInputStream objStream = new ObjectInputStream(serialObj); + return objStream.readObject(); + } catch (Exception e) { + throw new IOException("Deserialization error: " + e.getMessage()); + } + + } + + public static String encodeBytes(byte[] bytes) { + final StringBuffer strBuf = new StringBuffer(); + + final int length = bytes.length; + for (int i = 0; i < length; i++) { + strBuf.append((char) (((bytes[i] >> 4) & 0xF) + ((int) 'a'))); + strBuf.append((char) (((bytes[i]) & 0xF) + ((int) 'a'))); + } + + return strBuf.toString(); + } + + public static byte[] decodeBytes(String str) { + final byte[] bytes = new byte[str.length() / 2]; + final int length = str.length(); + for (int i = 0; i < length; i += 2) { + char c = str.charAt(i); + bytes[i / 2] = (byte) ((c - 'a') << 4); + c = str.charAt(i + 1); + bytes[i / 2] += (c - 'a'); + } + return bytes; + + } + +} diff --git a/src/com/gmail/altakey/dawne/util/RecentFile.java b/src/com/gmail/altakey/dawne/util/RecentFile.java new file mode 100644 index 0000000..74f25ea --- /dev/null +++ b/src/com/gmail/altakey/dawne/util/RecentFile.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2013 Takahiro Yoshimura, Renjaya Raga Zenta + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.gmail.altakey.dawne.util; + +import java.io.Serializable; + +public class RecentFile implements Serializable { + + private String fileName; + private String uri; + private static final long serialVersionUID = 7359036288102114071L; + + public RecentFile(String fileName, String uri) { + this.setFileName(fileName); + this.setUri(uri); + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getUri() { + return uri; + } + + public void setUri(String uri) { + this.uri = uri; + } +} diff --git a/src/com/gmail/altakey/dawne/util/StackRecentFiles.java b/src/com/gmail/altakey/dawne/util/StackRecentFiles.java new file mode 100644 index 0000000..df3c150 --- /dev/null +++ b/src/com/gmail/altakey/dawne/util/StackRecentFiles.java @@ -0,0 +1,99 @@ +/** + * Copyright (C) 2013 Takahiro Yoshimura, Renjaya Raga Zenta + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.gmail.altakey.dawne.util; + +import java.io.Serializable; +import java.util.ArrayList; + +public class StackRecentFiles implements Serializable { + + public static final int MAX_CAPACITY = 10; + private ArrayList stack; + private int top; + private static final long serialVersionUID = 7977738208421002767L; + + public StackRecentFiles() { + this.stack = new ArrayList(MAX_CAPACITY); + this.top = -1; + } + + public void pushRecentFile(RecentFile recentFile) { + final int index = indexOf(recentFile); + if (index == -1) { + if (top >= MAX_CAPACITY - 1) { + shiftElementToBottom(); + stack.set(top, recentFile); + } else { + stack.add(++top, recentFile); + } + } else { + shiftElementToBottom(index); + } + } + + public RecentFile getRecentFile() { + if (top < 0) { + throw new IndexOutOfBoundsException(); + } + return stack.get(top); + } + + public RecentFile getRecentFileAt(int position) { + final int size = stack.size(); + if (position < 0 || position >= size) { + throw new IndexOutOfBoundsException(); + } + return stack.get(size - position - 1); + } + + public int size() { + return stack.size(); + } + + public void clear() { + stack.clear(); + top = -1; + } + + private int indexOf(RecentFile recentFile) { + final int size = stack.size(); + for (int i = 0; i < size; i++) { + final RecentFile rf = stack.get(i); + if (recentFile.getFileName().equals(rf.getFileName())) { + return i; + } + } + return -1; + } + + // Only called if stack is full! + private void shiftElementToBottom() { + for (int i = 0; i < top; i++) { + stack.set(i, stack.get(i + 1)); + } + stack.set(top, null); + } + + private void shiftElementToBottom(int index) { + final RecentFile rotated = stack.get(index); + for (int i = index; i < top; i++) { + stack.set(i, stack.get(i + 1)); + } + stack.set(top, rotated); + } +} diff --git a/src/com/gmail/altakey/dawne/TextLoader.java b/src/com/gmail/altakey/dawne/util/TextLoader.java similarity index 98% rename from src/com/gmail/altakey/dawne/TextLoader.java rename to src/com/gmail/altakey/dawne/util/TextLoader.java index 9727fa4..6a48ed6 100644 --- a/src/com/gmail/altakey/dawne/TextLoader.java +++ b/src/com/gmail/altakey/dawne/util/TextLoader.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package com.gmail.altakey.dawne; +package com.gmail.altakey.dawne.util; import java.io.ByteArrayOutputStream; import java.io.InputStream; diff --git a/src/com/gmail/altakey/dawne/TextPager.java b/src/com/gmail/altakey/dawne/util/TextPager.java similarity index 97% rename from src/com/gmail/altakey/dawne/TextPager.java rename to src/com/gmail/altakey/dawne/util/TextPager.java index 1fdaee4..8aa704e 100644 --- a/src/com/gmail/altakey/dawne/TextPager.java +++ b/src/com/gmail/altakey/dawne/util/TextPager.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package com.gmail.altakey.dawne; +package com.gmail.altakey.dawne.util; import android.widget.ScrollView; import android.widget.TextView; diff --git a/src/com/gmail/altakey/dawne/TextStyler.java b/src/com/gmail/altakey/dawne/util/TextStyler.java similarity index 98% rename from src/com/gmail/altakey/dawne/TextStyler.java rename to src/com/gmail/altakey/dawne/util/TextStyler.java index be0691f..eb80535 100644 --- a/src/com/gmail/altakey/dawne/TextStyler.java +++ b/src/com/gmail/altakey/dawne/util/TextStyler.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package com.gmail.altakey.dawne; +package com.gmail.altakey.dawne.util; import android.graphics.Typeface; import android.util.TypedValue; From c84b03d82a0d6ebf49d9c3cb520f02f107db4209 Mon Sep 17 00:00:00 2001 From: Renjaya Raga Zenta Date: Fri, 2 Aug 2013 05:51:41 +0700 Subject: [PATCH 02/13] Using ActionBarCompat Support v7 API, merge styles and icons. --- res/drawable-hdpi-v11/cancel.png | Bin 1285 -> 0 bytes res/drawable-hdpi-v11/next.png | Bin 1472 -> 0 bytes res/drawable-hdpi-v11/previous.png | Bin 1482 -> 0 bytes .../action_search.png | Bin res/drawable-hdpi/cancel.png | Bin 1358 -> 1285 bytes res/drawable-hdpi/next.png | Bin 1470 -> 1472 bytes res/drawable-hdpi/previous.png | Bin 1494 -> 1482 bytes res/drawable-mdpi-v11/cancel.png | Bin 1138 -> 0 bytes res/drawable-mdpi-v11/next.png | Bin 1241 -> 0 bytes res/drawable-mdpi-v11/previous.png | Bin 1240 -> 0 bytes .../action_search.png | Bin res/drawable-mdpi/cancel.png | Bin 1202 -> 1138 bytes res/drawable-mdpi/next.png | Bin 1253 -> 1241 bytes res/drawable-mdpi/previous.png | Bin 1275 -> 1240 bytes res/values-v11/styles.xml | 12 --------- res/values-v14/styles.xml | 12 --------- res/values/styles.xml | 25 ++++++++++++++++-- 17 files changed, 23 insertions(+), 26 deletions(-) delete mode 100644 res/drawable-hdpi-v11/cancel.png delete mode 100644 res/drawable-hdpi-v11/next.png delete mode 100644 res/drawable-hdpi-v11/previous.png rename res/{drawable-hdpi-v11 => drawable-hdpi}/action_search.png (100%) delete mode 100644 res/drawable-mdpi-v11/cancel.png delete mode 100644 res/drawable-mdpi-v11/next.png delete mode 100644 res/drawable-mdpi-v11/previous.png rename res/{drawable-mdpi-v11 => drawable-mdpi}/action_search.png (100%) delete mode 100644 res/values-v11/styles.xml delete mode 100644 res/values-v14/styles.xml diff --git a/res/drawable-hdpi-v11/cancel.png b/res/drawable-hdpi-v11/cancel.png deleted file mode 100644 index 094eea589246b46e26d3cf02285f26c1abb33700..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1285 zcmeAS@N?(olHy`uVBq!ia0vp^1|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ab1zmf!SFjDdm4$kW9! zq~g|_ncf;MfilP5?```i(KTt)W(SpNUYaLoEt=9gX==Ks;U}&2j-MhVQc~5sT6MXX zPFXXBgWK9vQ##Fn|9bhW;PU)ka}Qg7&E8dRSiHaZfB*aXV_R}>2UJG3J@V$hz_f)y z_dz~~2cztQGr5fORBGDAe`r1sDrpwq&N5^FnZPAxpVrn^n0sNCYMIHfDwX zI-qwW@kfV2SEJ7c2CtCJl+_P9uAWHH5N%+vUn;KPlrA>M+Qr3zbw=5p$+x`rG!=e0 zP+$}h_xivJt+*GQJdNoSo(Wv!`4wVVT%OQWIpNf&UyQpPR%_*b=?Oit=%M$9_#cu% zUN>GcZ*aVv9^{}kc~{KT%7n?ahfcrNsJ+6~`{2K9hK=6ez8QkI4p^_hY+=lCyH@$P zbOxjC8aFd@-y1zA@7wK>W^$?NF9`G4AjHYo{UGFf;o@mxu4pSH0(8E&T18uXXOL|D9VI jbRB@v_-|`NJ|i2$7Ug=LPPaENL1n6^tDnm{r-UW|e{T`} diff --git a/res/drawable-hdpi-v11/previous.png b/res/drawable-hdpi-v11/previous.png deleted file mode 100644 index 64538ce80be5ed2608fedb38230c0116ed35e968..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1482 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%qp275hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|8hm3bwJ6}oxF$}kgLQj3#|G7CyF^YauyCMG83 zmzLNn0bL65LT&-v*t}wBFaZNhzap_f-%!s00+w{G(#^lGsVi;$k5cp#lXbW$-vFf(ACh=#L&{!#L3yw z&D7A`#K{n**Cju>G&eP`1g19yq1P0rUQlAlEdbi=l3J8mmYU*Ll%J~r_Ow+dZnqfW zG!Lpb1-Dy_aq86vIz}H9wMbD769T3m5EGtofgE_!Pt60S_ab1zKFP;_n1O-G#?!?y zq~g|_ncf;MffC2x&;3{@;&sX?QXwcTXpzp1sDQ4iQ(JnUOf0|mDXJoEsgBFW4b!Fs zO;c%YojWP%VQyN?|Mma2r)gh4V`&-xcb0W|;qyQ5f1WGCe8fQPG>y(&#)ut?itThC7buL zXI!ya<8*x0?u#{gw=%dk?7Y0LA@=Iq63H1$=l|r|#2NHFyz~XT&B9M#CvLgSn!vlH zK0DItsUFEF1fec4$)!>iCoSzi2$ z#)->ISH?3{D|FsZ^<8q=F8x)Jmf^uEMXr0AWu$hd$g=Dy3XI<%UhsbEr3;mz;tGZS z;Z^5LA9PLlwkejKQRw;_r~ECFe3w@WUU{wH@JOWR^R3gDUM=6d?vi7}QM00%D^r3S z-iSLd@BpfPoiKat(xY>&M9*C8($;rK5|Y`lXP4RsF&npAXa1^P%J|S#xo6SUhj|6e wD(rEy7g{XbaQ6QZw+3)*{*OA)&%n&^&Zw?%d6zLT9WgL?y85}Sb4q9e0G}o&(*OVf diff --git a/res/drawable-hdpi-v11/action_search.png b/res/drawable-hdpi/action_search.png similarity index 100% rename from res/drawable-hdpi-v11/action_search.png rename to res/drawable-hdpi/action_search.png diff --git a/res/drawable-hdpi/cancel.png b/res/drawable-hdpi/cancel.png index cde36e1fa7b8fb99cd7cdb3dc1e18466196750b0..094eea589246b46e26d3cf02285f26c1abb33700 100644 GIT binary patch delta 490 zcmX@d)ylQOgNet<&C;|^P0G*b)f-+~R_olPBl)2Dy11fnUyR-N zO_~2EXnx^)azMg@sW?H_=1KhWC$nPQi=Ow0rV7Th`!veFpKH~XfAnga_#_UUZ;H3_ z7RR!9^d&8~x!~5ZqN3A9Ovxi=Pl#Hcl1^8}$)HE-js7+NWSsYu=$7O@;=A$bCi4eP zT{}0!@YypeJL^|wu^xRs=}~g%V&|?oK^0EQ`FrZ$ZI=4`{W;^+;1$zdZMszMiANou zSsj{F+~fmVh_vJR;6rbfT~NBLv_{AM#6Lj$OGTQ`FkGehL71PKW_?(Gaf;OXk; Jvd$@?2>^N7$UFc5 delta 563 zcmZqWI>)uagNet;z{uRt(ZJBu$-rgu117P_SxizeK_jr>1SS`VfTf!oRFwftg#lEB z=ww4?$9lK>Ny``*7!P>5IEGZ*dNcF9*I@^NW7`WivcGS7A6PYE)~(qK0zSmm82^7D zEF!WeQ@cW=mf!Kclc|~CgJ_P{YdN2Nms)VkYpR~9*+2L0S(Dr+mG8Dys^pz+XOw6F zp+ETy@n4UHtrmS}FTA(o-if$xuI-Dg1I_08y%f#ps;^p99B9wB?~%(l!QJgKB@MzC z9lof(>d^BLklSe0Ve6o0b-=~M?T~-qbOymQ<${-$kGJe&PubJ8&ec-rT!HQ}-;H_M zGv+7W>`6*KdM>VwWt|$!(LK?d|CB0bJd5r9x?7Ls>Ymj*8Iu)XJd=GWv4(45(mciw z(nnO+X+4W%IIU10bkTgDx9J&UMlr=pLM@k#&a-g{gfH6pA|sLC=HQ<@w=$1%wOm%y zQH)=8#!#(iSBntq=Y@vZiwvb78?R;zS$SYp@jeObC2Rq#2~&UWNx7EkP~rM{rjxig zYez1Bh{B(?Gpikc@XiWv{2*=S-`>G!AuxB5Yr+?^(^3c8UdZh~7{8K#lbMi6XSru@ zWP^laTANI6FPBY+-G_V6X5J8D>0r6K_vq!>d;wE_1a4^$@7_|!wy|wd`I8kgyA%Hh jNr3|x6vhvK2qrLaJv_VeY}d&E1|aZs^>bP0l+XkKEQamA diff --git a/res/drawable-hdpi/next.png b/res/drawable-hdpi/next.png index e6495b29cfe3acc6455414dd7edfd68926ba72c3..50b1587643a8d6f96f5844f9252384c4febedbfe 100644 GIT binary patch delta 678 zcmdnTeSmv|2NRF8p@or~k+ZR>lY!gh2TWp8;@sD0A%n-nNetU6VF#c2Jq-rFnAJqA9JDrlxxu ze$ra+_$fjnB~`tvRhN6|lr>X0xUEe!rPB=fub00HF3;aJ_ps&H>|N!C#ruo@_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?n|9RUzpU(uZ8an*Vp{izHGgTOK$0rnzEN0p85N{@7#NM4MX#+ z^y#Z}^n3e+ggT!_7+!vEp=cKHLt5%wtK31;`HwH@DZgQq;bnRfklmv^@8ECA`_Gmt z^`1I?u2EX=#&MTpnb-gM=debABJ#s})*4O&hFwM#cM{wqLm7a;)78&qol`;+0FO2w AyZ`_I diff --git a/res/drawable-hdpi/previous.png b/res/drawable-hdpi/previous.png index 23778ae9b73517818c0c37b0e268a328385c3836..64538ce80be5ed2608fedb38230c0116ed35e968 100644 GIT binary patch delta 688 zcmcb{eTsX72NRF8k)f%Hi-C!$lY!gh2TWp2}~|90VAj?1DJp@RE6kd zLuSYNlYIP#85o#sJY5_^DsH`*>8;@sC~^G#+>do4UZbPv&Fl|cEG?muYxs#F}=BCB`U;l4=n)c;0mX`5wTn2{Q~2;koY547fjvx?!(fb z2Oq?<%kwd+F6h6`_-`J^4950V(=WytunIN!bFp=>ODA}LtyN(5`EXfxa!~2FgH5lb zXY!P=h%{|qP_3R&-?MVbmWH^1gGHH!xp@xu6=8S1wlvOKaPaiAuMAcP=e~+t!DrIU zKkanJv;Pb`g6^L2JXNxJAA80Xn>9|ySM9!7qjxKVYs1dV>l$LOzAcfQv2^}Vu1%al z&%;Y!u-h#B^mXEv%d82!OA5s9$d((*Y!>J;E$~c!w)lKuL~WGAT0PzRr-HjzYb=`* zvMB!o^QqF8o#ivU3VoF2#lL8rxV&^_JX5to=lxXQC712eUlnN?9-LC-x~Ex2YG;Zp z%budZ_zmI(@26h6P#G$&Q0O0Cb-wgL*Mx7IV%ZsmuCH;*-y+F(d8Oc$*9s1gM0!5o zI(_NY^1bUWIW`T5rhX06l?M3-f%iO?23_Q+aDLM4 z7{F`S#9AO9$rdLWnZOa!SpUFSgHijz2{uOCpwb7k)-SE`nko9&_=D({MrmE?`hzYr zmj927T_IS~WUX-SBeO^I%?2jcY+W`EWCHphl#wVN^W9jJNs$tben${+Q$v0j{i881ILRib}|bynP# z)7%D}=X}hIbr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1OecUQlAlEdbi=l3J8mmYU*Ll%J~r_Ow+dHn$jB z7`Yiao8mMNsy79jTOfMPaO%|uIz}H9wMbD769T3m5EGtofgE_!Pt60S_ab1zUi#>L zCj$ecx2KC^NX4x;*Y|ocJBqYDbn#VDcp+NBs>Q{*%}ns>CLZu|(=$XegJ z=(_@!*sb=2$=V!~q5=e(6KnZvTyMor-`rvSK}2(st+ny<*`8(`O+J&7H70-X;Qmp} z`oyq*q6(MBg0|>2YJmrs%s#ZPvfC|I(4XCtB;h{eS1#kt364_^Tb}yi#x7d2murJz zBe&1(?-vh=+3mUYfp>R>tGw%*?8rMs3l{fn*#0h&)%u>}mnPdAQgunOF_S+CrgLe` z?#$Jxbl=E&dFiE#X^#b#)|X1GO$^?dkbBeN^6G|7*Y+;2P5AxrU^d&cf(6^RHNSFm z>RoaCl}exCvimy@uM8LI*X~Mx)bVJ8@r2;nXZd8@uCCzk4|0(0-X*-}^~2cpW-)R* zCVaV?mwR5O;@DI@74?cP<&HynhxXiBztr|YoWrmE3c3p4J}MtzSop#3%`2_mdKI;Vst0HD>jbpQYW diff --git a/res/drawable-mdpi-v11/previous.png b/res/drawable-mdpi-v11/previous.png deleted file mode 100644 index b8b3e1abe1d275c8bf3a5c9320f1c0ee6c2f1f25..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1240 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%qp275hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|8hm3bwJ6}oxF$}kgLQj3#|G7CyF^YauyCMG83 zmzLNn0bL65LT&-v*t}wBFaZNhzap_f-%!s00+w{G(#^lGsVi;$kN=<$=K4=$-vFf(ACh=#L&{!#L3yw z&D7A`#K{n**Cju>G&eP`1g19yq1O?oUQlAlEdbi=l3J8mmYU*Ll%J~r_Ow+dR<{_M znz$I4;WQ7bHwCv_EO6@82RcR{6tzfE4HE*U9}p9saDg0n(of9;ruQOX!k)OLDUX4H z(aY1tF{I+wo9p)8PJt4~3-gyMec_U-Vr^=1%F z@{AR>1qFT_%D;<$%l+WJH0AlBVuyE)=N~Ni_s+8ad~wesi*qe8$}NDuF(JTCX-`t&3`XY;-!Ahweht=$KnR*`cr0(Fa zJj52qzBXq5(`~;6F8^?nzTI3`If{_$w-PwGa?G|OL~<6hTfpTp+855)g0Sn~KpRGh~xu8VOdlsb_8m&<_REK|s9-k`uKpt8o()z4*} HQ$iB}_Fb^< diff --git a/res/drawable-mdpi-v11/action_search.png b/res/drawable-mdpi/action_search.png similarity index 100% rename from res/drawable-mdpi-v11/action_search.png rename to res/drawable-mdpi/action_search.png diff --git a/res/drawable-mdpi/cancel.png b/res/drawable-mdpi/cancel.png index 9f4c3d6a2b5bffc7529ef77789f4b9a1258c967e..3336760d5f3efdfefefd6899317c3a09264430f6 100644 GIT binary patch delta 342 zcmdnQ`H5qL2NREzo27-JrJK2_lY!gh2TWpwAIvgchY+CC3hFsC^LQHLkZ)nYofvQDjzjn8x}X1?eAE%zPCIthc5W-AxF2!_54~ zft~MwTGH=`Q!hOp=jM2=V5+`gstpR63Ytv8bcTZ3)eM< zw|Y5+*d(!BHn3aI8_}TrR`($1nuAl7(^?+yV2L(Z{+>Ic@pk-{M-?o*D-O`-ImM1z{v2qTtDFPrMHzp Q4>NeW`njxgVoGQN0047_?EnA( delta 406 zcmeywv59ko2NRExfswhPqk*ZZlYz_R2TWp}1_nkIPZ!6Kid%1{J90HSh_spBa!Yu?sZ{jvTxj|W9!GJH7YdEB4lj7* z4$tLQwQ9WJpuWNU1G}Eu+)62-GY8K1JU;Vh{+T_?cllnn2%a|6xNswbSVB=l<@K`~ zUE4z5dTPGR-0`ieL?yLyUbqg!jQ1YgK~6%mp2@v*spl$;E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>Le5H?p3@C*JWPzYFHiM z{fRx@&%MZJvTQ+Uq3h#PM~l|Y^QJzQH`J5X)A*_P{<`rg;tFlSYQ zC%4@pu|41RCzmvv4FO#ne#zGwgd diff --git a/res/drawable-mdpi/previous.png b/res/drawable-mdpi/previous.png index 8d19e3911e0d6d2098ad89121f3815b7fe50dc50..b8b3e1abe1d275c8bf3a5c9320f1c0ee6c2f1f25 100644 GIT binary patch delta 444 zcmey(d4qF<2NRF8k)^qzld+|#lY!gh2TWpDg&4b z3#baw$%f31^%J)=q8Ap41)um512k*w@C)f4c3rz~vuK(zl!IDkm|N>a2RPYt^4=q4E(E z%X9xS%B__O6pend^5L9SAAGD9TEB0bcT4u}PO1J#?LL(oIvGjviZM^uC*Q1+xcll( z@hawUe$m&N6{@Un+g5jHXx?YoH}`_+B4M2`ri*6z>vP=en(TAfy!V0lp9M=EpNNX{ zxW#obFz{UB`Co2d*35stJ?*g8v$gpy-!0zlo?sIZ>+#R;+9tMOeV2wW^^Q^pvj1`! ZFq~xydCeOXIE4WSJYD@<);T3K0RT-tyITMN delta 480 zcmcb?`I~ct2NRExv7wQvk)fNZlYz_R2TWp}f4B!MP`)B$Z>74^WyxD<3}Ub68Br+5gh?P4z+soZcTeKN~#M zOklb8WHtA>2Wl@*w~E=@F}%L8US>nDz0czXQ#rmIV&jQ6I&AwUnyHFo!_{?%ENTuL z=N!(CazC5rD7j3bjsHgL@-!J!;l{`r!N+FHuK32xcAF6>L+)QZOThDG20nzQ>o z+;mmSPg&uL>E*-9y$!2QooTsJpU9YI!^-liK>bxk*!%7>ze+BH-3`SruKnfespR4i zY0Y+Bw=5BOeX9AvKwq= zy*9E|TJ#3Tqmo2SXv2-Tqr~gec4!2qVa2PNMM<#6Ha10FRVE_V8 LS3j3^P6 - - - - - - - \ No newline at end of file diff --git a/res/values-v14/styles.xml b/res/values-v14/styles.xml deleted file mode 100644 index 7234bfc..0000000 --- a/res/values-v14/styles.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/res/values/styles.xml b/res/values/styles.xml index 66e522e..06fec7c 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -1,6 +1,27 @@ - + - + + + + + + + + + #333333 \ No newline at end of file From d349b7d5d0a092110a6598a6f8a594742e854a63 Mon Sep 17 00:00:00 2001 From: Renjaya Raga Zenta Date: Fri, 2 Aug 2013 08:00:28 +0700 Subject: [PATCH 03/13] Fix styles for older version --- res/values/styles.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/res/values/styles.xml b/res/values/styles.xml index 06fec7c..ed1a705 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -17,11 +17,16 @@ - + #333333 + #99000000 \ No newline at end of file From 03b65388010eb3bce3fda64754b4ab5c45fc8db6 Mon Sep 17 00:00:00 2001 From: Renjaya Raga Zenta Date: Fri, 2 Aug 2013 08:43:09 +0700 Subject: [PATCH 04/13] Using NavigationDrawer API for recently opened file. --- AndroidManifest.xml | 13 +- res/drawable-hdpi/drawer_shadow.9.png | Bin 0 -> 171 bytes res/drawable-hdpi/ic_drawer.png | Bin 0 -> 2842 bytes res/drawable-mdpi/drawer_shadow.9.png | Bin 0 -> 158 bytes res/drawable-mdpi/ic_drawer.png | Bin 0 -> 2837 bytes res/layout-v11/{main.xml => viewer.xml} | 59 +-- res/layout/drawer_list_item.xml | 14 + res/layout/main.xml | 92 +--- res/layout/viewer.xml | 98 ++++ res/menu-v11/main.xml | 13 - res/menu/main.xml | 6 +- res/menu/viewer.xml | 11 + res/values-ja/strings.xml | 2 +- res/values/arrays.xml | 4 + res/values/strings.xml | 11 +- .../gmail/altakey/dawne/ConfigActivity.java | 24 +- .../gmail/altakey/dawne/NewMainActivity.java | 323 ++++++++++++ .../altakey/dawne/RecentFilesAdapter.java | 74 +++ .../gmail/altakey/dawne/ViewerFragment.java | 491 ++++++++++++++++++ 19 files changed, 1111 insertions(+), 124 deletions(-) create mode 100644 res/drawable-hdpi/drawer_shadow.9.png create mode 100644 res/drawable-hdpi/ic_drawer.png create mode 100644 res/drawable-mdpi/drawer_shadow.9.png create mode 100644 res/drawable-mdpi/ic_drawer.png rename res/layout-v11/{main.xml => viewer.xml} (74%) create mode 100644 res/layout/drawer_list_item.xml create mode 100644 res/layout/viewer.xml delete mode 100644 res/menu-v11/main.xml create mode 100644 res/menu/viewer.xml create mode 100644 src/com/gmail/altakey/dawne/NewMainActivity.java create mode 100644 src/com/gmail/altakey/dawne/RecentFilesAdapter.java create mode 100644 src/com/gmail/altakey/dawne/ViewerFragment.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index ca5f575..4ac8205 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -6,35 +6,30 @@ + android:targetSdkVersion="18" /> - - - + diff --git a/res/drawable-hdpi/drawer_shadow.9.png b/res/drawable-hdpi/drawer_shadow.9.png new file mode 100644 index 0000000000000000000000000000000000000000..224cc4ff43a29c546ae50c654c20c58c2f4cdb75 GIT binary patch literal 171 zcmeAS@N?(olHy`uVBq!ia0vp^JV0#3!3HEVSgovp6icy_X9x!n)NrJ90QsB+9+AZi z4BVX{%xHe{^je^xucwP+h)3t!Yl?gg4m>OeUfNFiFU`@U5Xr+-Y2h+^&Fz!7ypldm za#4)fkaYOplLMWvd)czen2t>^YG&h=GRe5G;NW`))xgl;_^?U481>l1!)FR53IYvg N@O1TaS?83{1OO&fGZ_E? literal 0 HcmV?d00001 diff --git a/res/drawable-hdpi/ic_drawer.png b/res/drawable-hdpi/ic_drawer.png new file mode 100644 index 0000000000000000000000000000000000000000..ff7b1def9ac3f86488a855f502b965ac75b633fb GIT binary patch literal 2842 zcmV+#3+42QP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOK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git a/res/drawable-mdpi/drawer_shadow.9.png b/res/drawable-mdpi/drawer_shadow.9.png new file mode 100644 index 0000000000000000000000000000000000000000..3797f99c0ef9f657c2b0a1f84a4d0f16cc8ee5f4 GIT binary patch literal 158 zcmeAS@N?(olHy`uVBq!ia0vp^96+qZ!3HFgEN0vWQY^(zo*^7SP{WbZ0pxQQctjR6 zFmQK*Fr)d&(`$i(4xTQKAr`%FuWaOOaA06QaQd;(yN7D;?7i2paNm#nvBfgTEqd~o zcU{8lWjX#P6K=BftS@S075ic65$zclza&>r_mjZQ`zwzw1DeI)>FVdQ&MBb@0Ae69 AivR!s literal 0 HcmV?d00001 diff --git a/res/drawable-mdpi/ic_drawer.png b/res/drawable-mdpi/ic_drawer.png new file mode 100644 index 0000000000000000000000000000000000000000..fb681ba2639897cc4646d3784b97bbe16f5d4e91 GIT binary patch literal 2837 zcmV+w3+nWVP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ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%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0000$NklT0VPv57M=PzWeCfQ5m9fsqme7%2@z%Dpfe n3zWNnaWpS500000|NjF3akv#B{xHpr00000NkvXXu0mjfm;ygF literal 0 HcmV?d00001 diff --git a/res/layout-v11/main.xml b/res/layout-v11/viewer.xml similarity index 74% rename from res/layout-v11/main.xml rename to res/layout-v11/viewer.xml index c435ea7..e359b67 100644 --- a/res/layout-v11/main.xml +++ b/res/layout-v11/viewer.xml @@ -1,20 +1,39 @@ + android:layout_width="match_parent" + android:layout_height="match_parent" > + + + + + + android:background="?attr/dividerHorizontal" /> + android:background="?attr/dividerHorizontal" /> - - - - - \ No newline at end of file diff --git a/res/layout/drawer_list_item.xml b/res/layout/drawer_list_item.xml new file mode 100644 index 0000000..86f6ca7 --- /dev/null +++ b/res/layout/drawer_list_item.xml @@ -0,0 +1,14 @@ + + + + \ No newline at end of file diff --git a/res/layout/main.xml b/res/layout/main.xml index f4714aa..d4911d4 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml @@ -1,66 +1,30 @@ - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/res/layout/viewer.xml b/res/layout/viewer.xml new file mode 100644 index 0000000..3554bb2 --- /dev/null +++ b/res/layout/viewer.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/menu-v11/main.xml b/res/menu-v11/main.xml deleted file mode 100644 index f85b485..0000000 --- a/res/menu-v11/main.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/res/menu/main.xml b/res/menu/main.xml index 7881488..72ffcc3 100644 --- a/res/menu/main.xml +++ b/res/menu/main.xml @@ -2,12 +2,10 @@ + android:id="@+id/menu_main_open" + android:title="@string/menu_title_main_open"/> \ No newline at end of file diff --git a/res/menu/viewer.xml b/res/menu/viewer.xml new file mode 100644 index 0000000..4468da5 --- /dev/null +++ b/res/menu/viewer.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index 189fbe4..ad7e212 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -2,7 +2,7 @@ テキスト見本です。\nファイルマネージャなどのアプリを使用して、表示したいファイルを読み込んで下さい。 設定 - 探す + 探す 文字の配色 文字のサイズ 等幅フォントを使用する diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 466c05c..d821dba 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -3,10 +3,14 @@ White on black Black on white + Solarized Dark + Solarized Light black white + solarized_dark + solarized_light 8 diff --git a/res/values/strings.xml b/res/values/strings.xml index 8209322..6159411 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,10 +1,15 @@ Text Viewer - 0.1.8 + 0.2.0 This is an example text.\nPlease use something like file-manager to open a text-like file. - Preferences - Search + Browse text files + Recent files + Settings + Open File… + Search + Open navigation drawer + Close navigation drawer Color theme Font size Use monospace fonts diff --git a/src/com/gmail/altakey/dawne/ConfigActivity.java b/src/com/gmail/altakey/dawne/ConfigActivity.java index c32c294..bfceda9 100644 --- a/src/com/gmail/altakey/dawne/ConfigActivity.java +++ b/src/com/gmail/altakey/dawne/ConfigActivity.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Takahiro Yoshimura + * Copyright (C) 2011-2013 Takahiro Yoshimura * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,10 +17,15 @@ package com.gmail.altakey.dawne; +import android.annotation.SuppressLint; import android.content.SharedPreferences; +import android.os.Build; import android.os.Bundle; import android.preference.ListPreference; import android.preference.PreferenceActivity; +import android.view.MenuItem; + +import com.gmail.altakey.dawne.util.ConfigKey; public class ConfigActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener { @@ -29,10 +34,15 @@ public class ConfigActivity extends PreferenceActivity implements private ListPreference scrolllines; private ListPreference charsetpreference; + @SuppressLint("NewApi") + @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.config); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { + getActionBar().setHomeButtonEnabled(true); + } this.colortheme = (ListPreference) getPreferenceScreen() .findPreference(ConfigKey.COLORTHEME); @@ -44,6 +54,7 @@ protected void onCreate(Bundle savedInstanceState) { .findPreference(ConfigKey.CHARSET_PREFERENCE); } + @SuppressWarnings("deprecation") @Override protected void onResume() { super.onResume(); @@ -58,6 +69,7 @@ protected void onResume() { sharedPreferences.registerOnSharedPreferenceChangeListener(this); } + @SuppressWarnings("deprecation") @Override protected void onPause() { super.onPause(); @@ -85,4 +97,14 @@ private void updateSummary(SharedPreferences sharedPreferences, String key) { this.charsetpreference .setSummary(this.charsetpreference.getEntry()); } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == android.R.id.home) { + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } + } diff --git a/src/com/gmail/altakey/dawne/NewMainActivity.java b/src/com/gmail/altakey/dawne/NewMainActivity.java new file mode 100644 index 0000000..491816d --- /dev/null +++ b/src/com/gmail/altakey/dawne/NewMainActivity.java @@ -0,0 +1,323 @@ +/** + * Copyright (C) 2011-2013 Takahiro Yoshimura, Renjaya Raga Zenta + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.gmail.altakey.dawne; + +import android.app.Activity; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; +import android.content.res.Configuration; +import android.net.Uri; +import android.os.Bundle; +import android.os.Handler; +import android.preference.PreferenceManager; +import android.support.v4.app.ActionBarDrawerToggle; +import android.support.v4.app.FragmentManager; +import android.support.v4.view.GravityCompat; +import android.support.v4.widget.DrawerLayout; +import android.support.v7.app.ActionBar; +import android.support.v7.app.ActionBarActivity; +import android.util.Log; +import android.view.KeyEvent; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.View.OnClickListener; +import android.webkit.MimeTypeMap; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.ListView; +import android.widget.Toast; + +import com.gmail.altakey.dawne.ViewerFragment.OnContentTapListener; +import com.gmail.altakey.dawne.util.ConfigKey; +import com.gmail.altakey.dawne.util.ObjectSerializer; +import com.gmail.altakey.dawne.util.RecentFile; +import com.gmail.altakey.dawne.util.StackRecentFiles; + +import java.io.IOException; + +public class NewMainActivity extends ActionBarActivity implements OnContentTapListener { + + private static final int BROWSE_FILE_REQUEST_CODE = 4869; + private static final String TAG = "dawne"; + + private ActionBar mActionBar; + private DrawerLayout mDrawerLayout; + private ListView mDrawerList; + private ActionBarDrawerToggle mDrawerToggle; + private StackRecentFiles mStackRecentFiles; + private RecentFilesAdapter mDrawerAdapter; + + private Handler mHandler; + private final Runnable mHideActionBarDelayed = new Runnable() { + @Override + public void run() { + mActionBar.hide(); + } + }; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + + mHandler = new Handler(); + + SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); + String recentFiles = pref.getString(ConfigKey.RECENT_FILES, null); + if (recentFiles == null || recentFiles.equals("")) { + mStackRecentFiles = new StackRecentFiles(); + } else { + try { + mStackRecentFiles = (StackRecentFiles) ObjectSerializer.deserialize(recentFiles); + } catch (IOException e) { + e.printStackTrace(); + } + } + + mActionBar = getSupportActionBar(); + mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE + | ActionBar.DISPLAY_HOME_AS_UP); + + mDrawerAdapter = new RecentFilesAdapter(this, mStackRecentFiles); + mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); + mDrawerList = (ListView) findViewById(R.id.left_drawer); + mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); + mDrawerList.setAdapter(mDrawerAdapter); + mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); + mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, + R.string.drawer_open, R.string.drawer_close) { + + @Override + public void onDrawerClosed(View drawerView) { + final ViewerFragment f = (ViewerFragment) getSupportFragmentManager() + .findFragmentById(R.id.content_frame); + if (f != null) { + if (f.isSearching()) { + mActionBar.hide(); + } else { + hideActionBarDelayed(); + } + mActionBar.setTitle(""); + } else { + mActionBar.setTitle(getTitle()); + } + supportInvalidateOptionsMenu(); + + } + + @Override + public void onDrawerOpened(View drawerView) { + stopHideActionBarDelayed(); + if (!mActionBar.isShowing()) { + mActionBar.show(); + } + mActionBar.setTitle(R.string.recent_file); + supportInvalidateOptionsMenu(); + } + + }; + mDrawerLayout.setDrawerListener(mDrawerToggle); + + final Intent intent = getIntent(); + final String action = intent.getAction(); + final String type = intent.getType(); + if (Intent.ACTION_VIEW.equals(action) && type != null) { + if (type.startsWith("text/")) { + handleTextFile(intent.getData()); + } + } + + final Button buttonBrowse = (Button) findViewById(R.id.buttonBrowse); + buttonBrowse.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + browseFile(); + } + }); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (mDrawerToggle.onOptionsItemSelected(item)) { + return true; + } + switch (item.getItemId()) { + case R.id.menu_main_open: + browseFile(); + return true; + case R.id.menu_main_config: + startActivity(new Intent(this, ConfigActivity.class)); + return true; + } + return super.onOptionsItemSelected(item); + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + mDrawerToggle.onConfigurationChanged(newConfig); + } + + @Override + protected void onPostCreate(Bundle savedInstanceState) { + super.onPostCreate(savedInstanceState); + mDrawerToggle.syncState(); + } + + @Override + protected void onResume() { + super.onResume(); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (requestCode == BROWSE_FILE_REQUEST_CODE) { + if (resultCode == Activity.RESULT_OK) { + final Uri uri = data.getData(); + final String intentType = data.getType(); + final String mimeType = getContentResolver().getType(uri); + final String extension = MimeTypeMap.getFileExtensionFromUrl(uri.toString()); + Log.d(TAG, "File type: " + intentType + "::" + extension + "::" + mimeType); + if ((intentType != null && intentType.startsWith("text/")) || + (mimeType != null && mimeType.startsWith("text/")) || + (extension != null && extension.equals("txt"))) { + final ViewerFragment f = ViewerFragment.newInstance(uri.toString()); + getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, f) + .commit(); + // Save recent file + saveRecentFiles(uri); + hideActionBarDelayed(); + Log.d(TAG, "Opening file: " + uri.toString()); + } else { + Toast.makeText(this, "Unsupported file type", Toast.LENGTH_LONG).show(); + } + + } + } + } + + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); + boolean scrollerEnabled = pref.getBoolean(ConfigKey.SCROLL_BY_VOLUME_KEYS, false); + + if (scrollerEnabled) { + int divisor = Integer.parseInt(pref.getString(ConfigKey.SCROLL_LINES, "2")); + + int action = event.getAction(); + int keyCode = event.getKeyCode(); + final FragmentManager fm = getSupportFragmentManager(); + final ViewerFragment f = (ViewerFragment) fm.findFragmentById(R.id.content_frame); + if (f != null) { + switch (keyCode) { + case KeyEvent.KEYCODE_VOLUME_UP: + if (action == KeyEvent.ACTION_DOWN) { + f.onVolumeKeyUp(divisor); + } + return true; + case KeyEvent.KEYCODE_VOLUME_DOWN: + if (action == KeyEvent.ACTION_DOWN) { + f.onVolumeKeyDown(divisor); + } + return true; + } + } + } + return super.dispatchKeyEvent(event); + } + + void browseFile() { + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.addCategory(Intent.CATEGORY_OPENABLE); + intent.setType("text/*"); + if (intent.resolveActivity(getPackageManager()) != null) { + startActivityForResult(intent, BROWSE_FILE_REQUEST_CODE); + } else { + Toast.makeText(this, "Sorry, there's no file browser available", Toast.LENGTH_LONG) + .show(); + } + } + + void handleTextFile(Uri uri) { + final ViewerFragment f = ViewerFragment.newInstance(uri.toString()); + getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, f).commit(); + // Save recent file + saveRecentFiles(uri); + Log.d(TAG, "Viewing file: " + uri.getLastPathSegment()); + hideActionBarDelayed(); + } + + void saveRecentFiles(Uri uri) { + mStackRecentFiles.pushRecentFile(new RecentFile(uri.getLastPathSegment(), uri.toString())); + mDrawerAdapter.notifyDataSetChanged(); + SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); + Editor editor = pref.edit(); + try { + editor.putString(ConfigKey.RECENT_FILES, ObjectSerializer.serialize(mStackRecentFiles)); + } catch (IOException e) { + e.printStackTrace(); + } + editor.commit(); + } + + void hideActionBarDelayed() { + mHandler.postDelayed(mHideActionBarDelayed, 5000); + } + + void stopHideActionBarDelayed() { + mHandler.removeCallbacks(mHideActionBarDelayed); + } + + boolean isDrawerOpen() { + return mDrawerLayout.isDrawerOpen(mDrawerList); + } + + private class DrawerItemClickListener implements ListView.OnItemClickListener { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + final String uriString = ((RecentFile) mDrawerAdapter.getItem(position)).getUri(); + Log.d(TAG, "Re-opening file: " + uriString); + final ViewerFragment f = ViewerFragment.newInstance(uriString); + getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, f) + .commit(); + mDrawerLayout.closeDrawer(mDrawerList); + // Save recent file + saveRecentFiles(Uri.parse(uriString)); + } + } + + @Override + public void onContentTap() { + if (!mActionBar.isShowing()) { + mActionBar.show(); + hideActionBarDelayed(); + } + } +} diff --git a/src/com/gmail/altakey/dawne/RecentFilesAdapter.java b/src/com/gmail/altakey/dawne/RecentFilesAdapter.java new file mode 100644 index 0000000..bacb56b --- /dev/null +++ b/src/com/gmail/altakey/dawne/RecentFilesAdapter.java @@ -0,0 +1,74 @@ +/** + * Copyright (C) 2013 Takahiro Yoshimura, Renjaya Raga Zenta + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.gmail.altakey.dawne; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.TextView; + +import com.gmail.altakey.dawne.util.StackRecentFiles; + +public class RecentFilesAdapter extends BaseAdapter { + + private StackRecentFiles mStack; + private LayoutInflater mInflater; + + public RecentFilesAdapter(Context context, StackRecentFiles stack) { + mStack = stack; + mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + @Override + public int getCount() { + return mStack.size(); + } + + @Override + public Object getItem(int position) { + return mStack.getRecentFileAt(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + View view = convertView; + ViewHolder holder; + if (view == null) { + view = mInflater.inflate(R.layout.drawer_list_item, parent, false); + holder = new ViewHolder(); + holder.text = (TextView) view.findViewById(android.R.id.text1); + view.setTag(holder); + } else { + holder = (ViewHolder) view.getTag(); + } + holder.text.setText(mStack.getRecentFileAt(position).getFileName()); + return view; + } + + static class ViewHolder { + TextView text; + } + +} diff --git a/src/com/gmail/altakey/dawne/ViewerFragment.java b/src/com/gmail/altakey/dawne/ViewerFragment.java new file mode 100644 index 0000000..9c23bc5 --- /dev/null +++ b/src/com/gmail/altakey/dawne/ViewerFragment.java @@ -0,0 +1,491 @@ +/** + * Copyright (C) 2011-2013 Takahiro Yoshimura, Renjaya Raga Zenta + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.gmail.altakey.dawne; + +import android.annotation.SuppressLint; +import android.app.Activity; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.SharedPreferences; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Build; +import android.os.Bundle; +import android.preference.PreferenceManager; +import android.support.v4.app.Fragment; +import android.support.v7.app.ActionBarActivity; +import android.text.Selection; +import android.text.Spannable; +import android.util.Log; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.ScrollView; +import android.widget.TextView; + +import com.gmail.altakey.dawne.util.ConfigKey; +import com.gmail.altakey.dawne.util.TextLoader; +import com.gmail.altakey.dawne.util.TextPager; +import com.gmail.altakey.dawne.util.TextStyler; + +public class ViewerFragment extends Fragment { + + private View scrollView; + private TextView textView; + private View searchBar; + private EditText searchField; + private int selectionStart; + private int selectionEnd; + private Uri mUri; + private OnContentTapListener mCallback; + private boolean isSearching = false; + private String currentCharsetPreference; + + private final View.OnClickListener cancelButtonListener = new View.OnClickListener() { + + @Override + public void onClick(View v) { + showSearchBar(false); + } + }; + private final View.OnClickListener prevButtonListener = new View.OnClickListener() { + + @Override + public void onClick(View v) { + searchPrevious(); + } + }; + private final View.OnClickListener nextButtonListener = new View.OnClickListener() { + + @Override + public void onClick(View v) { + searchNext(); + } + }; + private final View.OnTouchListener contentTouchListener = new View.OnTouchListener() { + + @Override + public boolean onTouch(View v, MotionEvent event) { + if (!isSearching) { + mCallback.onContentTap(); + } + // call super listener (for selecting text) + return false; + } + }; + private final View.OnTouchListener dummyTouchListener = new View.OnTouchListener() { + + @Override + public boolean onTouch(View v, MotionEvent event) { + if (!isSearching) { + mCallback.onContentTap(); + } + // ignore super listener + return true; + } + }; + + private final View.OnKeyListener dummyKeyListener = new View.OnKeyListener() { + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + // disable alpha-numeric input key from physical keyboard + if (keyCode >= KeyEvent.KEYCODE_0 + && keyCode <= KeyEvent.KEYCODE_PLUS) { + if (keyCode >= KeyEvent.KEYCODE_DPAD_UP + && keyCode <= KeyEvent.KEYCODE_DPAD_RIGHT) { + return false; + } + return true; + } + // disable DEL + if (keyCode == KeyEvent.KEYCODE_FORWARD_DEL) { + return true; + } + return false; + } + }; + + private final View.OnKeyListener searchKeyListener = new View.OnKeyListener() { + + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_ENTER) { + searchNext(); + return true; + } + return false; + } + }; + + public ViewerFragment() { + } + + public static ViewerFragment newInstance(String uriString) { + final ViewerFragment f = new ViewerFragment(); + final Bundle args = new Bundle(1); + args.putString("uri", uriString); + f.setArguments(args); + return f; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mUri = getArguments() != null ? Uri.parse(getArguments().getString("uri")) : null; + setHasOptionsMenu(true); + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + try { + mCallback = (OnContentTapListener) activity; + } catch (ClassCastException e) { + throw new ClassCastException(activity.toString() + + " must implement OnContentClickListener"); + } + } + + @SuppressLint("NewApi") + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + final View rootView = inflater.inflate(R.layout.viewer, container, false); + scrollView = rootView.findViewById(R.id.view); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + // In Honeycomb or above, we can set TextView to be selectable + textView = (TextView) rootView.findViewById(R.id.textview); + textView.setTextIsSelectable(true); + textView.setOnTouchListener(contentTouchListener); + } else { + // Below Honeycomb we need EditText class + textView = (EditText) rootView.findViewById(R.id.textview); + // this is needed to make EditText behaves like simple TextView + // so the soft keyboard won't appear if user touches the text + textView.setOnTouchListener(dummyTouchListener); + // this is needed to make EditText won't be changed if user tries + // to edit the text with physical keyboard + textView.setOnKeyListener(dummyKeyListener); + } + textView.setSaveEnabled(false); + searchBar = rootView.findViewById(R.id.search); + searchField = (EditText) rootView.findViewById(R.id.edittext); + searchField.setOnKeyListener(searchKeyListener); + + ImageButton cancelButton = (ImageButton) rootView.findViewById(R.id.cancel); + cancelButton.setOnClickListener(cancelButtonListener); + ImageButton prevButton = (ImageButton) rootView.findViewById(R.id.previous); + prevButton.setOnClickListener(prevButtonListener); + ImageButton nextButton = (ImageButton) rootView.findViewById(R.id.next); + nextButton.setOnClickListener(nextButtonListener); + + return rootView; + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity()); + String charsetPreference = pref.getString(ConfigKey.CHARSET_PREFERENCE, "all"); + currentCharsetPreference = charsetPreference; + if (savedInstanceState != null) { + selectionStart = savedInstanceState.getInt("selectionStart", 0); + selectionEnd = savedInstanceState.getInt("selectionEnd", 0); + } + ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(""); + loadText(charsetPreference); + } + + @Override + public void onResume() { + super.onResume(); + SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity()); + String charsetPreference = pref.getString(ConfigKey.CHARSET_PREFERENCE, "all"); + if (!currentCharsetPreference.equals(charsetPreference)) { + loadText(charsetPreference); + currentCharsetPreference = charsetPreference; + } + ((NewMainActivity) getActivity()).hideActionBarDelayed(); + restyle(); + } + + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putInt("selectionStart", selectionStart); + outState.putInt("selectionEnd", selectionEnd); + } + + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + inflater.inflate(R.menu.viewer, menu); + super.onCreateOptionsMenu(menu, inflater); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.menu_viewer_search: + showSearchBar(true); + return true; + } + return super.onOptionsItemSelected(item); + } + + @Override + public void onPrepareOptionsMenu(Menu menu) { + menu.findItem(R.id.menu_viewer_search).setVisible( + !((NewMainActivity) getActivity()).isDrawerOpen()); + super.onPrepareOptionsMenu(menu); + } + + private void loadText(String charsetPreference) { + final TextLoaderParam param = new TextLoaderParam(); + param.context = getActivity().getApplicationContext(); + param.uri = mUri; + param.charset = charsetPreference; + new LoadTextTask().execute(param); + } + + private void restyle() { + if (getActivity() == null) { + Log.d("ASDF", "Activity null :("); + return; + } + SharedPreferences pref = PreferenceManager + .getDefaultSharedPreferences(getActivity()); + + String colortheme = pref.getString(ConfigKey.COLORTHEME, "black"); + int foreground = 0xffffffff; + int background = 0xff000000; + + float fontsize = Float.parseFloat(pref.getString(ConfigKey.FONTSIZE, + "14")); + boolean useMonospaceFonts = pref.getBoolean( + ConfigKey.USE_MONOSPACE_FONTS, false); + + if (colortheme.equals("white")) { + foreground = 0xff000000; + background = 0xffffffff; + } else if (colortheme.equals("solarized_dark")) { + foreground = 0xff839496; + background = 0xff002b36; + } else if (colortheme.equals("solarized_light")) { + foreground = 0xff657b83; + background = 0xfffdf6e3; + } + + TextStyler.create(scrollView, textView, background, foreground, + fontsize, useMonospaceFonts ? "monospace" : "default").style(); + } + + void hideSoftKeyboard() { + ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) + .hideSoftInputFromWindow(searchField.getWindowToken(), 0); + } + + void showSoftKeyBoard() { + ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) + .toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + } + + void showSearchBar(boolean shown) { + isSearching = shown; + if (searchBar == null) { + throw new IllegalStateException(); + } + if (shown) { + searchBar.setVisibility(View.VISIBLE); + searchBar.requestFocus(); + showSoftKeyBoard(); + ((ActionBarActivity) getActivity()).getSupportActionBar().hide(); + } else { + hideSoftKeyboard(); + ((ActionBarActivity) getActivity()).getSupportActionBar().show(); + ((NewMainActivity) getActivity()).hideActionBarDelayed(); + searchBar.setVisibility(View.GONE); + } + } + + boolean isSearching() { + return isSearching; + } + + @SuppressLint("DefaultLocale") + void searchNext() { + final String text = textView.getText().toString().toLowerCase(); + final String search = searchField.getText().toString().toLowerCase(); + if (search.length() == 0) { + return; + } + int selection = textView.getSelectionEnd(); + int next = text.indexOf(search, selection); + if (next > -1) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + Selection.setSelection((Spannable) textView.getText(), + selectionStart = next, + selectionEnd = next + search.length()); + } else { + // EditText class is needed here + ((EditText) textView).setSelection(selectionStart = next, + selectionEnd = next + search.length()); + } + if (!textView.isFocused()) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { + textView.setCursorVisible(true); + } + textView.requestFocus(); + } + } else { // wrap + next = text.indexOf(search); + if (next > -1) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + Selection.setSelection((Spannable) textView.getText(), + selectionStart = next, + selectionEnd = next + search.length()); + } else { + // EditText class is needed here + ((EditText) textView).setSelection(selectionStart = next, + selectionEnd = next + search.length()); + } + if (!textView.isFocused()) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { + textView.setCursorVisible(true); + } + textView.requestFocus(); + } + } + } + // Before Honeycomb: + // if text is selected (found), user can actually change it with + // soft keyboard, so we need to hide the soft keyboard + if (textView.isFocused()) { + hideSoftKeyboard(); + } + + } + + @SuppressLint("DefaultLocale") + void searchPrevious() { + final String text = textView.getText().toString().toLowerCase(); + final String search = searchField.getText().toString().toLowerCase(); + if (search.length() == 0) { + return; + } + int selection = textView.getSelectionStart() - 1; + int previous = text.lastIndexOf(search, selection); + if (previous > -1) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + Selection.setSelection((Spannable) textView.getText(), + selectionStart = previous, selectionEnd = previous + + search.length()); + } else { + // EditText class is needed here + ((EditText) textView).setSelection(selectionStart = previous, + selectionEnd = previous + search.length()); + } + if (!textView.isFocused()) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { + textView.setCursorVisible(true); + } + textView.requestFocus(); + } + } else { // wrap + previous = text.lastIndexOf(search); + if (previous > -1) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + Selection.setSelection((Spannable) textView.getText(), + selectionStart = previous, selectionEnd = previous + + search.length()); + } else { + // EditText class is needed here + ((EditText) textView).setSelection( + selectionStart = previous, selectionEnd = previous + + search.length()); + } + if (!textView.isFocused()) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { + textView.setCursorVisible(true); + } + textView.requestFocus(); + } + } + } + if (textView.isFocused()) { + hideSoftKeyboard(); + } + } + + private class LoadTextTask extends AsyncTask { + + ProgressDialog progressDialog; + + @Override + protected void onPreExecute() { + textView.setText(""); + progressDialog = ProgressDialog.show(getActivity(), "", + "Loading ...", true); + } + + @Override + protected String doInBackground(TextLoaderParam... params) { + final TextLoaderParam param = params[0]; + return TextLoader.create(param.context, param.uri, param.charset) + .read(); + } + + @Override + protected void onPostExecute(String result) { + restyle(); + textView.setText(result); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + Selection.setSelection( + (Spannable) textView.getText(), selectionStart, selectionEnd); + } else { + ((EditText) textView).setSelection(selectionStart, selectionEnd); + } + progressDialog.dismiss(); + } + + } + + static class TextLoaderParam { + Context context; + Uri uri; + String charset; + } + + public void onVolumeKeyUp(int divisor) { + (TextPager.create(textView, (ScrollView) scrollView, divisor)).up(); + } + + public void onVolumeKeyDown(int divisor) { + (TextPager.create(textView, (ScrollView) scrollView, divisor)).down(); + } + + public interface OnContentTapListener { + public void onContentTap(); + } +} From 12bf41586b5dc81ded5100be027431fb3c244715 Mon Sep 17 00:00:00 2001 From: Renjaya Raga Zenta Date: Fri, 2 Aug 2013 08:51:48 +0700 Subject: [PATCH 05/13] Delete old activity --- src/com/gmail/altakey/dawne/MainActivity.java | 405 ------------------ src/com/gmail/altakey/dawne/ViewActivity.java | 121 ------ 2 files changed, 526 deletions(-) delete mode 100644 src/com/gmail/altakey/dawne/MainActivity.java delete mode 100644 src/com/gmail/altakey/dawne/ViewActivity.java diff --git a/src/com/gmail/altakey/dawne/MainActivity.java b/src/com/gmail/altakey/dawne/MainActivity.java deleted file mode 100644 index d2d8949..0000000 --- a/src/com/gmail/altakey/dawne/MainActivity.java +++ /dev/null @@ -1,405 +0,0 @@ -/** - * Copyright (C) 2011-2012 Takahiro Yoshimura - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.gmail.altakey.dawne; - -import android.annotation.SuppressLint; -import android.app.ActionBar; -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.os.Build; -import android.os.Bundle; -import android.preference.PreferenceManager; -import android.text.Selection; -import android.text.Spannable; -import android.view.KeyEvent; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.MotionEvent; -import android.view.View; -import android.view.Window; -import android.view.inputmethod.InputMethodManager; -import android.widget.EditText; -import android.widget.ImageButton; -import android.widget.TextView; - -public class MainActivity extends Activity { - protected View rootView; - protected TextView textView; - protected View searchBar; - protected EditText searchField; - protected int selectionStart; - protected int selectionEnd; - private boolean titleHidden; - - private String currentCharsetpreference; - - private final View.OnClickListener cancelButtonListener = new View.OnClickListener() { - - @Override - public void onClick(View v) { - showSearchBar(false); - } - }; - private final View.OnClickListener prevButtonListener = new View.OnClickListener() { - - @Override - public void onClick(View v) { - searchPrevious(); - } - }; - private final View.OnClickListener nextButtonListener = new View.OnClickListener() { - - @Override - public void onClick(View v) { - searchNext(); - } - }; - private final View.OnTouchListener dummyTouchListener = new View.OnTouchListener() { - - @Override - public boolean onTouch(View v, MotionEvent event) { - // do nothing - return true; - } - }; - - private final View.OnKeyListener dummyKeyListener = new View.OnKeyListener() { - @Override - public boolean onKey(View v, int keyCode, KeyEvent event) { - // disable alpha-numeric input key from physical keyboard - if (keyCode >= KeyEvent.KEYCODE_0 - && keyCode <= KeyEvent.KEYCODE_PLUS) { - if (keyCode >= KeyEvent.KEYCODE_DPAD_UP - && keyCode <= KeyEvent.KEYCODE_DPAD_RIGHT) { - return false; - } - return true; - } - // disable DEL - if (keyCode == KeyEvent.KEYCODE_FORWARD_DEL) { - return true; - } - return false; - } - }; - - private final View.OnKeyListener searchKeyListener = new View.OnKeyListener() { - - @Override - public boolean onKey(View v, int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_ENTER) { - searchNext(); - return true; - } - return false; - } - }; - - /** Called when the activity is first created. */ - @SuppressLint("NewApi") - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - this.setupWindow(); - - setContentView(R.layout.main); - - this.rootView = findViewById(R.id.view); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - // In Honeycomb or above, we can set TextView to be selectable - this.textView = (TextView) findViewById(R.id.textview); - this.textView.setTextIsSelectable(true); - } else { - // Below Honeycomb we need EditText class - this.textView = (EditText) findViewById(R.id.textview); - // this is needed to make EditText behaves like simple TextView - // so the soft keyboard won't appear if user touches the text - this.textView.setOnTouchListener(dummyTouchListener); - // this is needed to make EditText won't be changed if user tries - // to edit the text with physical keyboard - this.textView.setOnKeyListener(dummyKeyListener); - } - this.textView.setSaveEnabled(false); - - this.searchBar = findViewById(R.id.search); - this.searchField = (EditText) findViewById(R.id.edittext); - this.searchField.setOnKeyListener(searchKeyListener); - - ImageButton cancelButton = (ImageButton) findViewById(R.id.cancel); - cancelButton.setOnClickListener(cancelButtonListener); - ImageButton prevButton = (ImageButton) findViewById(R.id.previous); - prevButton.setOnClickListener(prevButtonListener); - ImageButton nextButton = (ImageButton) findViewById(R.id.next); - nextButton.setOnClickListener(nextButtonListener); - - this.restyle(); - } - - @SuppressLint("InlinedApi") - protected void setupWindow() { - SharedPreferences pref = PreferenceManager - .getDefaultSharedPreferences(this); - boolean hideTitle = !pref.getBoolean(ConfigKey.SHOW_TITLE, true); - String charsetpreference = pref.getString(ConfigKey.CHARSET_PREFERENCE, - "all"); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - this.requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); - } - if (hideTitle) { - this.requestWindowFeature(Window.FEATURE_NO_TITLE); - } - - this.titleHidden = hideTitle; - this.currentCharsetpreference = charsetpreference; - } - - private void restyle() { - SharedPreferences pref = PreferenceManager - .getDefaultSharedPreferences(this); - - String colortheme = pref.getString(ConfigKey.COLORTHEME, "black"); - int foreground = 0xffffffff; - int background = 0xff000000; - - float fontsize = Float.parseFloat(pref.getString(ConfigKey.FONTSIZE, - "14")); - boolean useMonospaceFonts = pref.getBoolean( - ConfigKey.USE_MONOSPACE_FONTS, false); - - if (colortheme.equals("white")) { - foreground = 0xff000000; - background = 0xffffffff; - } - - TextStyler.create(this.rootView, this.textView, background, foreground, - fontsize, useMonospaceFonts ? "monospace" : "default").style(); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - if (titleHidden) { - rootView.setPadding(0, 0, 0, 0); - } - } - } - - @Override - public void onResume() { - super.onResume(); - - SharedPreferences pref = PreferenceManager - .getDefaultSharedPreferences(this); - boolean hideTitle = !pref.getBoolean(ConfigKey.SHOW_TITLE, true); - String charsetpreference = pref.getString(ConfigKey.CHARSET_PREFERENCE, - "all"); - - if (this.titleHidden != hideTitle - || this.currentCharsetpreference != charsetpreference) { - this.restart(); - return; - } - - this.restyle(); - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putInt("selectionStart", selectionStart); - outState.putInt("selectionEnd", selectionEnd); - } - - @Override - protected void onRestoreInstanceState(Bundle savedInstanceState) { - super.onRestoreInstanceState(savedInstanceState); - if (savedInstanceState != null) { - selectionStart = savedInstanceState.getInt("selectionStart", 0); - selectionEnd = savedInstanceState.getInt("selectionEnd", 0); - } - } - - private void restart() { - Intent intent = getIntent(); - finish(); - startActivity(intent); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.main, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.menu_main_search: - showSearchBar(true); - break; - case R.id.menu_main_config: - startActivity(new Intent(this, ConfigActivity.class)); - break; - } - return true; - } - - void hideSoftKeyboard() { - ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)) - .hideSoftInputFromWindow(searchField.getWindowToken(), 0); - } - - void showSoftKeyBoard() { - ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)) - .toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); - } - - @SuppressLint("NewApi") - void showSearchBar(boolean shown) { - if (searchBar == null) { - throw new IllegalStateException(); - } - if (shown) { - searchBar.setVisibility(View.VISIBLE); - searchBar.requestFocus(); - showSoftKeyBoard(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - if (!titleHidden) { - final ActionBar actionBar = getActionBar(); - rootView.setPadding(0, 0, 0, 0); - actionBar.hide(); - } - } - } else { - hideSoftKeyboard(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - if (!titleHidden) { - final ActionBar actionBar = getActionBar(); - rootView.setPadding(0, actionBar.getHeight(), 0, 0); - actionBar.show(); - } - } - searchBar.setVisibility(View.GONE); - } - } - - void searchNext() { - final String text = textView.getText().toString().toLowerCase(); - final String search = searchField.getText().toString().toLowerCase(); - if (search.length() == 0) { - return; - } - int selection = textView.getSelectionEnd(); - int next = text.indexOf(search, selection); - if (next > -1) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - Selection.setSelection((Spannable) textView.getText(), - selectionStart = next, - selectionEnd = next + search.length()); - } else { - // EditText class is needed here - ((EditText) textView).setSelection(selectionStart = next, - selectionEnd = next + search.length()); - } - if (!textView.isFocused()) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { - textView.setCursorVisible(true); - } - textView.requestFocus(); - } - } else { // wrap - next = text.indexOf(search); - if (next > -1) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - Selection.setSelection((Spannable) textView.getText(), - selectionStart = next, - selectionEnd = next + search.length()); - } else { - // EditText class is needed here - ((EditText) textView).setSelection(selectionStart = next, - selectionEnd = next + search.length()); - } - if (!textView.isFocused()) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { - textView.setCursorVisible(true); - } - textView.requestFocus(); - } - } - } - // Before Honeycomb: - // if text is selected (found), user can actually change it with - // soft keyboard, so we need to hide the soft keyboard - if (textView.isFocused()) { - hideSoftKeyboard(); - } - - } - - void searchPrevious() { - final String text = textView.getText().toString().toLowerCase(); - final String search = searchField.getText().toString().toLowerCase(); - if (search.length() == 0) { - return; - } - int selection = textView.getSelectionStart() - 1; - int previous = text.lastIndexOf(search, selection); - if (previous > -1) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - Selection.setSelection((Spannable) textView.getText(), - selectionStart = previous, selectionEnd = previous - + search.length()); - } else { - // EditText class is needed here - ((EditText) textView).setSelection(selectionStart = previous, - selectionEnd = previous + search.length()); - } - if (!textView.isFocused()) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { - textView.setCursorVisible(true); - } - textView.requestFocus(); - } - } else { // wrap - previous = text.lastIndexOf(search); - if (previous > -1) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - Selection.setSelection((Spannable) textView.getText(), - selectionStart = previous, selectionEnd = previous - + search.length()); - } else { - // EditText class is needed here - ((EditText) textView).setSelection( - selectionStart = previous, selectionEnd = previous - + search.length()); - } - if (!textView.isFocused()) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { - textView.setCursorVisible(true); - } - textView.requestFocus(); - } - } - } - if (textView.isFocused()) { - hideSoftKeyboard(); - } - } -} diff --git a/src/com/gmail/altakey/dawne/ViewActivity.java b/src/com/gmail/altakey/dawne/ViewActivity.java deleted file mode 100644 index a609ec0..0000000 --- a/src/com/gmail/altakey/dawne/ViewActivity.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Copyright (C) 2011-2012 Takahiro Yoshimura - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.gmail.altakey.dawne; - -import android.app.ProgressDialog; -import android.content.Context; -import android.content.SharedPreferences; -import android.net.Uri; -import android.os.AsyncTask; -import android.os.Build; -import android.os.Bundle; -import android.preference.PreferenceManager; -import android.text.Selection; -import android.text.Spannable; -import android.view.KeyEvent; -import android.widget.EditText; -import android.widget.ScrollView; - -public class ViewActivity extends MainActivity { - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - SharedPreferences pref = PreferenceManager - .getDefaultSharedPreferences(this); - - final TextLoaderParam param = new TextLoaderParam(); - param.context = getApplicationContext(); - param.uri = getIntent().getData(); - param.charset = pref - .getString(ConfigKey.CHARSET_PREFERENCE, "japanese"); - new LoadTextTask().execute(param); - } - - @Override - public boolean dispatchKeyEvent(KeyEvent event) { - SharedPreferences pref = PreferenceManager - .getDefaultSharedPreferences(this); - boolean scrollerEnabled = pref.getBoolean( - ConfigKey.SCROLL_BY_VOLUME_KEYS, false); - - if (scrollerEnabled) { - int divisor = Integer.parseInt(pref.getString( - ConfigKey.SCROLL_LINES, "2")); - - int action = event.getAction(); - int keyCode = event.getKeyCode(); - - final TextPager textPager = TextPager.create(this.textView, - (ScrollView) this.rootView, divisor); - switch (keyCode) { - case KeyEvent.KEYCODE_VOLUME_UP: - if (action == KeyEvent.ACTION_DOWN) - textPager.up(); - return true; - case KeyEvent.KEYCODE_VOLUME_DOWN: - if (action == KeyEvent.ACTION_DOWN) - textPager.down(); - return true; - } - } - - return super.dispatchKeyEvent(event); - } - - private class LoadTextTask extends AsyncTask { - - ProgressDialog progressDialog; - - @Override - protected void onPreExecute() { - ViewActivity.this.textView.setText(""); - progressDialog = ProgressDialog.show(ViewActivity.this, "", - "Loading ...", true); - } - - @Override - protected String doInBackground(TextLoaderParam... params) { - final TextLoaderParam param = params[0]; - return TextLoader.create(param.context, param.uri, param.charset) - .read(); - } - - @Override - protected void onPostExecute(String result) { - ViewActivity.this.textView.setText(result); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - Selection.setSelection( - (Spannable) ViewActivity.this.textView.getText(), - selectionStart, selectionEnd); - } else { - ((EditText) ViewActivity.this.textView).setSelection( - ViewActivity.this.selectionStart, - ViewActivity.this.selectionEnd); - } - progressDialog.dismiss(); - } - - } - - static class TextLoaderParam { - Context context; - Uri uri; - String charset; - } -} From f488822d0c360ed15963ef66bfd7ee85f13ff308 Mon Sep 17 00:00:00 2001 From: Renjaya Raga Zenta Date: Fri, 2 Aug 2013 08:54:27 +0700 Subject: [PATCH 06/13] Using SDK API 18 and library AppCompat v7 --- project.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/project.properties b/project.properties index 5b44c8c..f5544e2 100644 --- a/project.properties +++ b/project.properties @@ -11,4 +11,5 @@ proguard.config=etc/proguard/android.txt:etc/proguard/project.txt # Project target. -target=android-17 +target=android-18 +android.library.reference.1=../../android-sdk-linux/extras/android/support/v7/appcompat From 83c2924752bb6d4b3dd32a1363b39ba876c754f3 Mon Sep 17 00:00:00 2001 From: Renjaya Raga Zenta Date: Fri, 2 Aug 2013 08:56:43 +0700 Subject: [PATCH 07/13] Update .classpath --- .classpath | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.classpath b/.classpath index 609aa00..7bc01d9 100644 --- a/.classpath +++ b/.classpath @@ -3,5 +3,7 @@ - + + + From d7751e277736ce3c6947e0583e5f272482718bb7 Mon Sep 17 00:00:00 2001 From: Renjaya Raga Zenta Date: Fri, 2 Aug 2013 09:45:11 +0700 Subject: [PATCH 08/13] Remove show title bar option --- res/values-ja/strings.xml | 1 - res/values/strings.xml | 1 - res/xml/config.xml | 6 +----- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index ad7e212..3ced2ac 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -6,7 +6,6 @@ 文字の配色 文字のサイズ 等幅フォントを使用する - タイトルバーを表示する 音量キーでスクロール スクロール幅 主な言語 diff --git a/res/values/strings.xml b/res/values/strings.xml index 6159411..2030038 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -13,7 +13,6 @@ Color theme Font size Use monospace fonts - Show title bar Scroll by volume keys Scroll height Preferred Lang. diff --git a/res/xml/config.xml b/res/xml/config.xml index 3820874..5d9d891 100644 --- a/res/xml/config.xml +++ b/res/xml/config.xml @@ -11,16 +11,12 @@ - Date: Fri, 2 Aug 2013 09:48:20 +0700 Subject: [PATCH 09/13] Add color theme and some strings (need translation) --- res/values-ja/arrays.xml | 2 ++ res/values-ja/strings.xml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/res/values-ja/arrays.xml b/res/values-ja/arrays.xml index 1aef267..dca4e91 100644 --- a/res/values-ja/arrays.xml +++ b/res/values-ja/arrays.xml @@ -3,6 +3,8 @@ 黒地に白 白地に黒 + Solarizedさ暗い + Solarizedさ光 1画面 diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index 3ced2ac..4ecab8c 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -1,7 +1,10 @@ テキスト見本です。\nファイルマネージャなどのアプリを使用して、表示したいファイルを読み込んで下さい。 + テキストファイルをブラウズ + 最近使ったファイル 設定 + オープンファイル… 探す 文字の配色 文字のサイズ From df1d103d88b7869a24c3745d21e7c08267c8dc1d Mon Sep 17 00:00:00 2001 From: Renjaya Raga Zenta Date: Fri, 2 Aug 2013 10:16:07 +0700 Subject: [PATCH 10/13] Add option to clear recent files (need translation) --- res/menu/main.xml | 3 +++ res/values-ja/strings.xml | 3 ++- res/values/strings.xml | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/res/menu/main.xml b/res/menu/main.xml index 72ffcc3..67956a1 100644 --- a/res/menu/main.xml +++ b/res/menu/main.xml @@ -4,6 +4,9 @@ + diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index 4ecab8c..14d1a73 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -4,7 +4,8 @@ テキストファイルをブラウズ 最近使ったファイル 設定 - オープンファイル… + オープンファイル + 明確な最近のファイル 探す 文字の配色 文字のサイズ diff --git a/res/values/strings.xml b/res/values/strings.xml index 2030038..3898d5f 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -6,7 +6,8 @@ Browse text files Recent files Settings - Open File… + Open File + Clear Recent Files Search Open navigation drawer Close navigation drawer From 74f0ba9efafe624054d63a67e289dacc3d5b4cec Mon Sep 17 00:00:00 2001 From: Renjaya Raga Zenta Date: Fri, 2 Aug 2013 10:16:49 +0700 Subject: [PATCH 11/13] Update copyright year. --- src/com/gmail/altakey/dawne/NewMainActivity.java | 11 +++++++++++ src/com/gmail/altakey/dawne/ViewerFragment.java | 2 +- src/com/gmail/altakey/dawne/util/CharsetDetector.java | 2 +- src/com/gmail/altakey/dawne/util/ConfigKey.java | 3 +-- src/com/gmail/altakey/dawne/util/TextLoader.java | 2 +- src/com/gmail/altakey/dawne/util/TextPager.java | 2 +- src/com/gmail/altakey/dawne/util/TextStyler.java | 2 +- 7 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/com/gmail/altakey/dawne/NewMainActivity.java b/src/com/gmail/altakey/dawne/NewMainActivity.java index 491816d..160d80e 100644 --- a/src/com/gmail/altakey/dawne/NewMainActivity.java +++ b/src/com/gmail/altakey/dawne/NewMainActivity.java @@ -171,6 +171,9 @@ public boolean onOptionsItemSelected(MenuItem item) { case R.id.menu_main_open: browseFile(); return true; + case R.id.menu_main_clear_recent: + clearRecentFiles(); + return true; case R.id.menu_main_config: startActivity(new Intent(this, ConfigActivity.class)); return true; @@ -287,6 +290,14 @@ void saveRecentFiles(Uri uri) { editor.commit(); } + void clearRecentFiles() { + mStackRecentFiles.clear(); + mDrawerAdapter.notifyDataSetChanged(); + SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); + pref.edit().putString(ConfigKey.RECENT_FILES, "").commit(); + + } + void hideActionBarDelayed() { mHandler.postDelayed(mHideActionBarDelayed, 5000); } diff --git a/src/com/gmail/altakey/dawne/ViewerFragment.java b/src/com/gmail/altakey/dawne/ViewerFragment.java index 9c23bc5..55ac6e9 100644 --- a/src/com/gmail/altakey/dawne/ViewerFragment.java +++ b/src/com/gmail/altakey/dawne/ViewerFragment.java @@ -271,7 +271,7 @@ private void loadText(String charsetPreference) { private void restyle() { if (getActivity() == null) { - Log.d("ASDF", "Activity null :("); + Log.d("dawne.Viewer", "Activity null :("); return; } SharedPreferences pref = PreferenceManager diff --git a/src/com/gmail/altakey/dawne/util/CharsetDetector.java b/src/com/gmail/altakey/dawne/util/CharsetDetector.java index de38a13..15ca58b 100644 --- a/src/com/gmail/altakey/dawne/util/CharsetDetector.java +++ b/src/com/gmail/altakey/dawne/util/CharsetDetector.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Takahiro Yoshimura + * Copyright (C) 2011-2013 Takahiro Yoshimura * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/com/gmail/altakey/dawne/util/ConfigKey.java b/src/com/gmail/altakey/dawne/util/ConfigKey.java index af52515..33a9f27 100644 --- a/src/com/gmail/altakey/dawne/util/ConfigKey.java +++ b/src/com/gmail/altakey/dawne/util/ConfigKey.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Takahiro Yoshimura + * Copyright (C) 2011-2013 Takahiro Yoshimura * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ public class ConfigKey { public static final String USE_MONOSPACE_FONTS = "usemonospacefonts"; public static final String SCROLL_BY_VOLUME_KEYS = "scrollbyvolumekeys"; public static final String SCROLL_LINES = "scrolllines"; - public static final String SHOW_TITLE = "showtitle"; public static final String CHARSET_PREFERENCE = "charsetpreference"; public static final String RECENT_FILES = "recentfiles"; } diff --git a/src/com/gmail/altakey/dawne/util/TextLoader.java b/src/com/gmail/altakey/dawne/util/TextLoader.java index 6a48ed6..f04455b 100644 --- a/src/com/gmail/altakey/dawne/util/TextLoader.java +++ b/src/com/gmail/altakey/dawne/util/TextLoader.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Takahiro Yoshimura + * Copyright (C) 2011-2013 Takahiro Yoshimura * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/com/gmail/altakey/dawne/util/TextPager.java b/src/com/gmail/altakey/dawne/util/TextPager.java index 8aa704e..9faacdd 100644 --- a/src/com/gmail/altakey/dawne/util/TextPager.java +++ b/src/com/gmail/altakey/dawne/util/TextPager.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Takahiro Yoshimura + * Copyright (C) 2011-2013 Takahiro Yoshimura * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/com/gmail/altakey/dawne/util/TextStyler.java b/src/com/gmail/altakey/dawne/util/TextStyler.java index eb80535..dc07b62 100644 --- a/src/com/gmail/altakey/dawne/util/TextStyler.java +++ b/src/com/gmail/altakey/dawne/util/TextStyler.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Takahiro Yoshimura + * Copyright (C) 2011-2013 Takahiro Yoshimura * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 65003eee4b39cb7177952af815e962ad19977afd Mon Sep 17 00:00:00 2001 From: Renjaya Raga Zenta Date: Fri, 2 Aug 2013 10:28:19 +0700 Subject: [PATCH 12/13] Only enable option clear recent files if not empty. --- src/com/gmail/altakey/dawne/NewMainActivity.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/gmail/altakey/dawne/NewMainActivity.java b/src/com/gmail/altakey/dawne/NewMainActivity.java index 160d80e..ad421e0 100644 --- a/src/com/gmail/altakey/dawne/NewMainActivity.java +++ b/src/com/gmail/altakey/dawne/NewMainActivity.java @@ -162,6 +162,12 @@ public boolean onCreateOptionsMenu(Menu menu) { return true; } + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + menu.findItem(R.id.menu_main_clear_recent).setEnabled(!mDrawerAdapter.isEmpty()); + return super.onPrepareOptionsMenu(menu); + } + @Override public boolean onOptionsItemSelected(MenuItem item) { if (mDrawerToggle.onOptionsItemSelected(item)) { @@ -295,7 +301,7 @@ void clearRecentFiles() { mDrawerAdapter.notifyDataSetChanged(); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); pref.edit().putString(ConfigKey.RECENT_FILES, "").commit(); - + supportInvalidateOptionsMenu(); } void hideActionBarDelayed() { From 008c2622e557d4d42f0c0d60280d97b0fbc2dce3 Mon Sep 17 00:00:00 2001 From: Renjaya Raga Zenta Date: Fri, 2 Aug 2013 11:31:20 +0700 Subject: [PATCH 13/13] Update README.txt --- README.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.txt b/README.txt index 5a91d73..465fa9b 100644 --- a/README.txt +++ b/README.txt @@ -1,7 +1,7 @@ README ======= -Copyright (C) 2011-2012 Takahiro Yoshimura +Copyright (C) 2011-2013 Takahiro Yoshimura This is a simple text-like file viewer application for the Android platform. It is also my learning project. @@ -34,10 +34,11 @@ It is available at: https://gist.github.com/1223663 . Thanks to the jchardet project (http://jchardet.sourceforge.net/). - * 2 color themes + * 4 color themes White-on-black (energy saving on OLED display, and eye saver under dark conditions) and black-on-white are supported. + Update: Solarized Color theme (dark & light) * Configurable font size @@ -46,6 +47,10 @@ It is available at: https://gist.github.com/1223663 . * Words-searching/finding * Selectable/copyable text (only in Honeycomb or above) + + * Now, it can choose text file from installed file manager + + * Recent files 2. BUGS @@ -64,3 +69,8 @@ Character set detection is done with the jchardet project Word searching, text selection/copy feature is kindly contributed by Renjaya Raga Zenta . + +Solarized Color: Precision colors for machines and people +(http://ethanschoonover.com/solarized) + +Saving recent files use ObjectSerializer (https://github.com/apache/pig)