diff options
author | Renard | 2016-05-08 17:47:07 -0300 |
---|---|---|
committer | Renard | 2016-05-08 17:47:07 -0300 |
commit | 22e5b86dcf7bd8e20abf7ab0de197a29f77e78d7 (patch) | |
tree | 48bef72964fe0009be4b125f51809f1233415739 | |
parent | 19e44b5af8549fe7c45677df967f0d0b9b1f1eb6 (diff) | |
download | BaiApp-22e5b86dcf7bd8e20abf7ab0de197a29f77e78d7.tar.gz BaiApp-22e5b86dcf7bd8e20abf7ab0de197a29f77e78d7.tar.xz BaiApp-22e5b86dcf7bd8e20abf7ab0de197a29f77e78d7.zip |
1.8v1.8
-rw-r--r-- | app/build.gradle | 4 | ||||
-rw-r--r-- | app/src/main/assets/html/licenses.html | 4 | ||||
-rw-r--r-- | app/src/main/java/layout/FragmentBoardItemList.java | 37 | ||||
-rw-r--r-- | app/src/main/java/org/bienvenidoainternet/app/MainActivity.java | 10 | ||||
-rw-r--r-- | app/src/main/java/org/bienvenidoainternet/app/ResponseActivity.java | 8 | ||||
-rw-r--r-- | app/src/main/java/org/bienvenidoainternet/app/ThemeManager.java | 5 | ||||
-rw-r--r-- | app/src/main/java/org/bienvenidoainternet/app/ThreadListAdapter.java | 5 | ||||
-rw-r--r-- | app/src/main/java/org/bienvenidoainternet/app/structure/BoardItem.java | 3 | ||||
-rw-r--r-- | app/src/main/res/layout/app_bar_main.xml | 2 | ||||
-rw-r--r-- | app/src/main/res/layout/fragment_fragment_thread_list.xml | 5 | ||||
-rw-r--r-- | app/src/main/res/values/attrs.xml | 1 | ||||
-rw-r--r-- | app/src/main/res/values/colors.xml | 4 | ||||
-rw-r--r-- | app/src/main/res/values/styles.xml | 5 | ||||
-rw-r--r-- | app/src/main/res/xml/preferences.xml | 4 |
14 files changed, 78 insertions, 19 deletions
diff --git a/app/build.gradle b/app/build.gradle index 074b7f0..11071a8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "org.bienvenidoainternet.app" minSdkVersion 15 targetSdkVersion 23 - versionCode 10 - versionName "1.7.1" + versionCode 11 + versionName "1.8" } buildTypes { release { diff --git a/app/src/main/assets/html/licenses.html b/app/src/main/assets/html/licenses.html index a366004..9c70bec 100644 --- a/app/src/main/assets/html/licenses.html +++ b/app/src/main/assets/html/licenses.html @@ -18,6 +18,10 @@ </style> </head> <body> + <h3>Bienvenido a Internet - BaiApp</h3> + <code>Gracias a todos aquellos que han reportado bugs y/o dado sugencias para esta aplicación.<br>Código fuente en https://github.com/Renard1911/BaiApp</code> + </br> + <h3>This software includes several Android classes from the Android Open Source Project.</h3> <pre> <code> diff --git a/app/src/main/java/layout/FragmentBoardItemList.java b/app/src/main/java/layout/FragmentBoardItemList.java index b172728..9128d3e 100644 --- a/app/src/main/java/layout/FragmentBoardItemList.java +++ b/app/src/main/java/layout/FragmentBoardItemList.java @@ -23,6 +23,7 @@ import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.view.Window; import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.LinearLayout; @@ -46,6 +47,8 @@ import org.bienvenidoainternet.app.structure.ReplyID; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; import java.io.File; import java.io.FileInputStream; @@ -192,13 +195,14 @@ public class FragmentBoardItemList extends Fragment { if (imMainFragment && !recentPostMode) { BoardItem bi = listViewAdapter.getItem(position); mListener.showThread(currentBoard, bi); - }else if (imMainFragment && recentPostMode){ + } else if (imMainFragment && recentPostMode) { BoardItem bi = boardItems.get(position); mListener.showThread(bi.getParentBoard(), bi); } } }); + listViewBoardItems.setOnScrollListener(new AbsListView.OnScrollListener() { private int lastFirstVisibleItem = 0; @Override @@ -209,9 +213,11 @@ public class FragmentBoardItemList extends Fragment { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if(lastFirstVisibleItem < firstVisibleItem) { // Scrolling down - mListener.hideActionButton(); + mListener.hideActionButton(); +// ((MainActivity)getActivity()).getSupportActionBar().hide(); }else if(lastFirstVisibleItem > firstVisibleItem) { // Scrolling Up - mListener.showActionButton(); + mListener.showActionButton(); +// ((MainActivity)getActivity()).getSupportActionBar().show(); } lastFirstVisibleItem = firstVisibleItem; for (int i = firstVisibleItem; i < firstVisibleItem + visibleItemCount; i++) { @@ -226,7 +232,8 @@ public class FragmentBoardItemList extends Fragment { loadingMoreThreads = true; currentOffset += 10; System.out.println("[Scroll] loading more threads! currentThreadCount " + totalItemCount); - getThreadList(currentOffset); // TODO: Offset incorrecto + getThreadList(currentOffset); +// Toast.makeText(getActivity().getApplicationContext(), "Cargando más hilos ...", Toast.LENGTH_SHORT).show(); } } }); @@ -315,11 +322,12 @@ public class FragmentBoardItemList extends Fragment { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); if (info.targetView.getParent() == listViewBoardItems){ BoardItem bi = boardItems.get(info.position); + Document doc = Jsoup.parse(bi.getMessage()); + String parsedMessage = doc.text(); switch (item.getItemId()){ case R.id.menu_copy: - System.out.println("Post copiado"); ClipboardManager cm = (ClipboardManager)getActivity().getSystemService(Context.CLIPBOARD_SERVICE); - ClipData cd = ClipData.newPlainText("Reply", boardItems.get(info.position).getMessage()); + ClipData cd = ClipData.newPlainText("Reply", parsedMessage); cm.setPrimaryClip(cd); break; case R.id.menu_reply: @@ -335,7 +343,7 @@ public class FragmentBoardItemList extends Fragment { File txt = new File(Environment.getExternalStorageDirectory().getPath() + "/Bai/" + bi.getParentBoard().getBoardDir() + "_" + bi.getId() + ".txt"); FileOutputStream stream = new FileOutputStream(txt); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(stream); - outputStreamWriter.write(bi.getMessage()); + outputStreamWriter.write(parsedMessage); outputStreamWriter.close(); stream.close(); Toast.makeText(getContext(), bi.getParentBoard().getBoardDir() + "_" + bi.getId() + ".txt guardado.", Toast.LENGTH_SHORT).show(); @@ -431,6 +439,7 @@ public class FragmentBoardItemList extends Fragment { loadingMoreThreads = true; showProgressBar(); String strOffset = ""; + if (offset == 0){ currentOffset = 0; boardItems.clear(); @@ -449,6 +458,7 @@ public class FragmentBoardItemList extends Fragment { @Override public void onCompleted(Exception e, String result) { hideProgressBar(); + int threadCount = 0; if (e != null) { e.printStackTrace(); displayError(e.getMessage()); @@ -456,6 +466,7 @@ public class FragmentBoardItemList extends Fragment { try { JSONObject json = new JSONObject(result); JSONArray threads = json.getJSONArray("threads"); + threadCount = threads.length(); for (int i = 0; i < threads.length(); i++) { JSONObject thread = threads.getJSONObject(i); BoardItem item = new BoardItem(); @@ -536,7 +547,9 @@ public class FragmentBoardItemList extends Fragment { listViewAdapter.notifyDataSetChanged(); listViewAdapter.updateBoardItems(boardItems); mListener.onThreadList(); - loadingMoreThreads = false; + if (threadCount != 0){ + loadingMoreThreads = false; + } if (boardItems.isEmpty()){ mListener.updateToolbar(currentBoard, currentThread); } @@ -717,7 +730,8 @@ public class FragmentBoardItemList extends Fragment { if (mypath.exists()){ try { Bitmap b = BitmapFactory.decodeStream(new FileInputStream(mypath)); - bi.setThumbBitmap(Bitmap.createScaledBitmap(b, 128, 128, false)); +// bi.setThumbBitmap(Bitmap.createScaledBitmap(b, 128, 128, false)); + bi.setThumbBitmap(b); listViewAdapter.notifyDataSetChanged(); Log.i("getThumb", bi.getThumb() + " from cache"); return; @@ -730,7 +744,8 @@ public class FragmentBoardItemList extends Fragment { Log.i("getThumb", "Not using wifi"); return; } - String imgURL = "http://bienvenidoainternet.org/" + bi.getParentBoard().getBoardDir() + "/thumb/" + bi.getThumb(); + boolean mobileThumbs = settings.getBoolean("pref_usemobilethumbs", true); + String imgURL = "http://bienvenidoainternet.org/" + bi.getParentBoard().getBoardDir() + (mobileThumbs ? "/mobile/" : "/thumb/") + bi.getThumb(); if (bi.getThumb().startsWith("http")){ imgURL = bi.getThumb(); } @@ -745,7 +760,7 @@ public class FragmentBoardItemList extends Fragment { displayError(e.getMessage()); e.printStackTrace(); }else{ - bi.setThumbBitmap(Bitmap.createScaledBitmap(result, 128, 128, false)); + bi.setThumbBitmap(result);//Bitmap.createScaledBitmap(result, 128, 128, false)); listViewAdapter.notifyDataSetChanged(); FileOutputStream out; try{ diff --git a/app/src/main/java/org/bienvenidoainternet/app/MainActivity.java b/app/src/main/java/org/bienvenidoainternet/app/MainActivity.java index 0d266fc..3a1890e 100644 --- a/app/src/main/java/org/bienvenidoainternet/app/MainActivity.java +++ b/app/src/main/java/org/bienvenidoainternet/app/MainActivity.java @@ -14,10 +14,12 @@ import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; +import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.SubMenu; import android.view.View; +import android.view.Window; import android.widget.BaseAdapter; import android.widget.HeaderViewListAdapter; import android.widget.ListView; @@ -93,7 +95,9 @@ public class MainActivity extends AppCompatActivity @Override protected void onCreate(Bundle savedInstanceState) { + getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); super.onCreate(savedInstanceState); + Ion.getDefault(getApplicationContext()).configure().setLogging("IonLog", Log.DEBUG); ThemeManager tm = new ThemeManager(this); this.setTheme(tm.getThemeForMainActivity()); @@ -231,7 +235,7 @@ public class MainActivity extends AppCompatActivity } if (tm.isDarkTheme()){ - navigationView.setBackgroundColor(0xFF888888); +// navigationView.setBackgroundColor(0xFF888888); } } @@ -437,6 +441,10 @@ public class MainActivity extends AppCompatActivity sub.add(parsedBoard.getBoardName()); boardList.add(parsedBoard); } +// Board polka = new Board("Testing", "polka", 0, true); +// boardList.add(polka); +// sub.add("Testing"); + }catch (JSONException e1) { Toast.makeText(getApplicationContext(), e1.getMessage(), Toast.LENGTH_LONG).show(); e1.printStackTrace(); diff --git a/app/src/main/java/org/bienvenidoainternet/app/ResponseActivity.java b/app/src/main/java/org/bienvenidoainternet/app/ResponseActivity.java index 74ac04b..3e74573 100644 --- a/app/src/main/java/org/bienvenidoainternet/app/ResponseActivity.java +++ b/app/src/main/java/org/bienvenidoainternet/app/ResponseActivity.java @@ -113,6 +113,14 @@ public class ResponseActivity extends AppCompatActivity { Button bItalic = (Button) findViewById(R.id.buttonItalic); Button select = (Button) findViewById(R.id.btnSelectFiles); + bBold.setVisibility(View.GONE); + bStrike.setVisibility(View.GONE); + bList.setVisibility(View.GONE); + bCode.setVisibility(View.GONE); + bUnder.setVisibility(View.GONE); + bItalic.setVisibility(View.GONE); + + bBold.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/app/src/main/java/org/bienvenidoainternet/app/ThemeManager.java b/app/src/main/java/org/bienvenidoainternet/app/ThemeManager.java index 04ed3fd..3c6722d 100644 --- a/app/src/main/java/org/bienvenidoainternet/app/ThemeManager.java +++ b/app/src/main/java/org/bienvenidoainternet/app/ThemeManager.java @@ -137,4 +137,9 @@ public class ThemeManager { public int getCurrentThemeId() { return currentThemeId; } + + public int getQuoteColor() { + TypedArray a = activity.getTheme().obtainStyledAttributes(currentThemeId, new int[]{R.attr.quoteColor}); + return a.getColor(0, Color.CYAN); + } } diff --git a/app/src/main/java/org/bienvenidoainternet/app/ThreadListAdapter.java b/app/src/main/java/org/bienvenidoainternet/app/ThreadListAdapter.java index d5f8a71..4e6e9cb 100644 --- a/app/src/main/java/org/bienvenidoainternet/app/ThreadListAdapter.java +++ b/app/src/main/java/org/bienvenidoainternet/app/ThreadListAdapter.java @@ -113,10 +113,12 @@ public class ThreadListAdapter extends ArrayAdapter<BoardItem>{ int sageColor = tm.getSageColor(); int nameColor = tm.getNameColor(); int tripcodeColor = tm.getTripcodeColor(); + int quoteColor = tm.getQuoteColor(); String hexColor =intToHexString(boardItem.getIdColor()); String sageHexColor = intToHexString(sageColor); String nameHexColor = intToHexString(nameColor); String tripcodeHexColor = intToHexString(tripcodeColor); + String quoteHexColor = intToHexString(quoteColor); String strId = ""; TextView txtTitle = (TextView)listItemView.findViewById(R.id.lv_txtTitle); @@ -251,7 +253,8 @@ public class ThreadListAdapter extends ArrayAdapter<BoardItem>{ txtPoster.setText(Html.fromHtml("<b>No. " + idToDisplay + "</b> por <font color=" + (boardItem.isSage() ? sageHexColor : nameHexColor) + ">" + boardItem.getName() + "</font> " + (boardItem.getTripcode() == "" ? "" : "<font color=" + tripcodeHexColor + ">" + boardItem.getTripcode() + "</font>") + strId + " " + strTimeDiff)); - txtBody.setText(Html.fromHtml(boardItem.getMessage())); + String fixedMessage = boardItem.getMessage().replace("$_QUOTECOLOR_$", quoteHexColor); + txtBody.setText(Html.fromHtml(fixedMessage)); txtReplies.setVisibility(boardItem.isReply ? View.GONE : View.VISIBLE); txtReplies.setText(boardItem.getTotalReplies() + " respuestas " + (boardItem.getTotalFiles() == 0 ? "" : ", " + boardItem.getTotalFiles() + " archivos")); diff --git a/app/src/main/java/org/bienvenidoainternet/app/structure/BoardItem.java b/app/src/main/java/org/bienvenidoainternet/app/structure/BoardItem.java index 9b81e8b..7a7cb02 100644 --- a/app/src/main/java/org/bienvenidoainternet/app/structure/BoardItem.java +++ b/app/src/main/java/org/bienvenidoainternet/app/structure/BoardItem.java @@ -5,6 +5,7 @@ import android.os.Parcel; import android.os.Parcelable; import android.util.Log; +import org.bienvenidoainternet.app.ThemeManager; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; @@ -147,7 +148,7 @@ public class BoardItem implements Parcelable { } } msg.select("img[src]").remove(); - msg.select("span[class=unkfunc]").tagName("font").attr("color", "#8fb56c").wrap("<i></i>"); + msg.select("span[class=unkfunc]").tagName("font").attr("color", "$_QUOTECOLOR_$").wrap("<i></i>"); msg.select("div[class=yt]").wrap("<font color=red'><i></i></font>"); this.message = msg.html(); } diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index 088b082..9202c71 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -29,7 +29,7 @@ android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" - android:src="@drawable/ic_edit" + android:src="@drawable/ic_action_add" android:alpha="128" /> </android.support.design.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout/fragment_fragment_thread_list.xml b/app/src/main/res/layout/fragment_fragment_thread_list.xml index 477c236..f83f48c 100644 --- a/app/src/main/res/layout/fragment_fragment_thread_list.xml +++ b/app/src/main/res/layout/fragment_fragment_thread_list.xml @@ -54,7 +54,10 @@ android:layout_weight="1" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" /> + android:layout_alignParentStart="true" + android:cacheColorHint="@android:color/transparent" + android:fastScrollEnabled="true" + android:persistentDrawingCache="scrolling"/> </RelativeLayout> </RelativeLayout> diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index ad73763..8badacd 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -5,4 +5,5 @@ <attr name="nameColor" format="reference"/> <attr name="tripcodeColor" format="reference"/> <attr name="isDarkTheme" format="boolean"/> + <attr name="quoteColor" format="reference"/> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 8274b32..7df736f 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -9,6 +9,7 @@ <color name="defaultNameColor">#008000</color> <color name="defaultMarginColor">#CCCCCC</color> <color name="defaultTripcodeColor">#FF0000</color> + <color name="defaultQuote">#000000</color> <color name="nightBackground">#2F3D48</color> <!-- 1 --> <color name="nightMarginColor">#58636c</color> <!-- 3 58636c--> @@ -17,6 +18,7 @@ <color name="nightNameColor">#5f962e</color> <color name="nightSageColor">#2e5f96</color> <color name="nightTripcodeColor">#962e5f</color> + <color name="nightQuote">#7eab57</color> <color name="headlineBackground">#DDDDDD</color> <!-- 1 --> <color name="headlineMarginColor">#EEEEEE</color> <!-- 3 58636c--> @@ -25,6 +27,7 @@ <color name="headlineNameColor">#004A99</color> <color name="headlineSageColor">#FF6600</color> <color name="headlineTripcodeColor">#d279ef</color> + <color name="headlineQuote">#ff8533</color> <color name="blackBackground">#282A2E</color> <!-- 1 --> <color name="blackMarginColor">#1D1F21</color> <!-- 3 58636c--> @@ -33,4 +36,5 @@ <color name="blackNameColor">#c5c8c6</color> <color name="blackSageColor">#81a2be</color> <color name="blackTripcodeColor">#b294bb</color> + <color name="blackQuote">#9dbb94</color> </resources> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 40acf9b..5fb2316 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -17,6 +17,7 @@ <item name="marginColor">@color/defaultMarginColor</item> <item name="tripcodeColor">@color/defaultTripcodeColor</item> <item name="isDarkTheme">false</item> + <item name="quoteColor">@color/defaultQuote</item> </style> <style name="AppTheme.Dark" parent="AppTheme.NoActionBar"> @@ -29,6 +30,7 @@ <item name="marginColor">@color/nightMarginColor</item> <item name="tripcodeColor">@color/nightTripcodeColor</item> <item name="isDarkTheme">true</item> + <item name="quoteColor">@color/nightQuote</item> </style> <style name="AppTheme.HeadLineActionBar.NoActionBar" parent="AppTheme.HeadLineActionBar"> @@ -56,6 +58,7 @@ <item name="colorPrimaryDark">@color/headlineLinkColor</item> <item name="colorAccent">@color/headlineLinkColor</item> <item name="isDarkTheme">false</item> + <item name="quoteColor">@color/headlineQuote</item> </style> <style name="AppTheme.BlackActionBar.NoActionBar" parent="AppTheme.BlackActionBar"> @@ -83,6 +86,7 @@ <item name="colorPrimaryDark">@color/blackMarginColor</item> <item name="colorAccent">@color/blackSageColor</item> <item name="isDarkTheme">true</item> + <item name="quoteColor">@color/blackQuote</item> </style> <style name="AppTheme.NoActionBar"> @@ -94,5 +98,4 @@ <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> - </resources> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 7226743..29161cf 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -29,6 +29,10 @@ android:key="setting_downloadOnlyWithWifi" android:defaultValue="true" /> <SwitchPreference + android:title="Utilizar miniaturas de versión movil" + android:key="pref_usemobilethumbs" + android:defaultValue="true"/> + <SwitchPreference android:title="Ir al final al abrir un hilo" android:key="setting_scrollatnewthread" android:defaultValue="false" /> |