Skip to content

Commit

Permalink
Version 1.2.8b2 (for testing)
Browse files Browse the repository at this point in the history
- Multicolumn output (may be needed give auto-configuration yo user hand? and go to mediana?)
- Configurable font size
- Configurable close FAV, LRU and so on


Signed-off-by: Igor Dulevich <gamba69@gmail.com>
  • Loading branch information
gamba69 committed Dec 12, 2011
1 parent ec6e047 commit 405b9bc
Show file tree
Hide file tree
Showing 8 changed files with 530 additions and 319 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.harasoft.relaunch"
android:versionName="1.2.8b1" android:versionCode="100200801">
android:versionName="1.2.8b2" android:versionCode="100200802">
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_TASKS" />
Expand Down
7 changes: 2 additions & 5 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
URGENT (GRID MULTICOLUMN)
- check columns height align
- check columns quantity in align by param and remove autocolumn, so it don't have sense (by analysis of android sources)
CASUAL
- (DONE) add close fav, searchres, lru after file launched functionality
- add font size settings
- (DONE) add font size settings
- add "Not show known extensions" functionality
- add more "smart" buttons (change first screen buttons behavior and configuration)
-- for LRU button: open first, open second, open as menu(?), open as screen
-- for FAV button: open first, open second, open as menu(?), open as screen
-- for search button: search with input only serach string, repeat last search, open search window
-- may be some "smart" functionality for other buttons
-- may be some "smart" functionality for other buttons (bottom buttons too)
- may be some extended functionality for advanced screen
- reimport EInk support from CoolReader
- icons in Nook style, some redesign of layouts to more usabilility (for example, search
Expand Down
4 changes: 4 additions & 0 deletions res/values/changelog.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="whats_new">
&lt;b&gt;1.2.8b2&lt;/b&gt;&lt;br&gt;
- Multi-column output.&lt;br&gt;
- Close Fav, Lru and so on windows after start reader (configurable).&lt;br&gt;
- Font size for files and directory names (configurable).&lt;br&gt;
&lt;b&gt;1.2.8b1&lt;/b&gt;&lt;br&gt;
- Fixed invocation dir from favorites and search results, now shown in main window.&lt;br&gt;
- Fixed search results representation when search from root.&lt;br&gt;
Expand Down
697 changes: 419 additions & 278 deletions res/xml-ru/prefs.xml

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions res/xml/prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,24 @@

<PreferenceCategory android:title="Appearance" >

<EditTextPreference
android:defaultValue="8"
android:enabled="true"
android:key="firstLineFontSize"
android:persistent="true"
android:selectable="true"
android:summary="Font size for files and directories names in all lists"
android:title="Files and directories names font size" />

<EditTextPreference
android:defaultValue="6"
android:enabled="true"
android:key="secondLineFontSize"
android:persistent="true"
android:selectable="true"
android:summary="Font size for additional directories names in Favorites and so on lists"
android:title="Additional directories names font size" />

<ListPreference
android:defaultValue="-1"
android:enabled="true"
Expand Down
2 changes: 2 additions & 0 deletions src/com/harasoft/relaunch/PrefsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ private void setDefaults()
defItems.add(new PrefItem("gl16Mode", "5"));

// Columns settings
defItems.add(new PrefItem("firstLineFontSize","8"));
defItems.add(new PrefItem("secondLineFontSize","6"));
defItems.add(new PrefItem("columnsDirsFiles","-1"));
defItems.add(new PrefItem("columnsHomeList","-1"));
defItems.add(new PrefItem("columnsLRU","-1"));
Expand Down
76 changes: 51 additions & 25 deletions src/com/harasoft/relaunch/ReLaunch.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public class ReLaunch extends Activity {

// multicolumns per directory configuration
List<String[]> columnsArray = new ArrayList<String[]>();
Integer currentColsNum = -1;

// Bottom info panel
BroadcastReceiver batteryLevelReceiver = null;
Expand Down Expand Up @@ -207,7 +208,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
boolean setBold = false;
boolean useFaces = prefs.getBoolean("showNew", true);

tv.setTextSize(TypedValue.COMPLEX_UNIT_PT,8);
tv.setTextSize(TypedValue.COMPLEX_UNIT_PT,Float.parseFloat(prefs.getString("firstLineFontSize", "8")));

if (item.get("type").equals("dir"))
{
if (useFaces)
Expand Down Expand Up @@ -295,29 +297,46 @@ else if (rdrName.startsWith("Intent:"))
tv.setText(sname);
}
}
// fixes on columns height in grid
GridView pgv = (GridView) parent;
Integer gcols=3; // from param !!!!!
Integer between_columns = 0;
Integer some_space = 0;
Integer colw = (pgv.getWidth() - (gcols - 1) * between_columns) / gcols;
Integer recalc_num = position;
Integer recalc_height=0;
while(recalc_num % gcols != 0) {
recalc_num = recalc_num - 1;
View temp_v = getView(recalc_num,null,parent);
temp_v.measure(MeasureSpec.EXACTLY | colw, MeasureSpec.UNSPECIFIED);
Integer p_height = temp_v.getMeasuredHeight();
if(p_height>recalc_height) recalc_height = p_height;
}
if(recalc_height>0) {
// 2 as some value
v.setMinimumHeight(recalc_height + some_space); // may be + some
}
// fixes on rows height in grid
if(currentColsNum != 1) {
GridView pgv = (GridView) parent;
Integer gcols = currentColsNum;
Integer between_columns = 0; // configure ???
Integer after_row_space = 0; // configure ???
Integer colw = (pgv.getWidth() - (gcols - 1) * between_columns) / gcols;
Integer recalc_num = position;
Integer recalc_height=0;
while(recalc_num % gcols != 0) {
recalc_num = recalc_num - 1;
View temp_v = getView(recalc_num,null,parent);
temp_v.measure(MeasureSpec.EXACTLY | colw, MeasureSpec.UNSPECIFIED);
Integer p_height = temp_v.getMeasuredHeight();
if(p_height>recalc_height) recalc_height = p_height;
}
if(recalc_height>0) {
v.setMinimumHeight(recalc_height + after_row_space);
}
}
return v;
}
}

private Integer getAutoColsNum() {
// implementation - by content avg len
// may be median
Integer auto_cols = 1;
Integer avg = 0;
for(Integer i=0;i<itemsArray.size();i++) {
avg = avg + itemsArray.get(i).get("name").length();
}
if(itemsArray.size()>0) avg = avg / itemsArray.size();
if(avg<4) return 5;
if(avg<6) return 4;
if(avg<10) return 3;
if(avg<32) return 2;
return auto_cols;
}

private void redrawList()
{
if (prefs.getBoolean("filterResults", false))
Expand Down Expand Up @@ -551,7 +570,7 @@ public void onClick(View v){
}
Integer checked = -1;
if(app.columns.containsKey(currentRoot)) {
if(app.columns.get(currentRoot).equals("-1")) { checked=1;}
if(app.columns.get(currentRoot) == -1) { checked=1;}
else {
checked=app.columns.get(currentRoot)+1;
}
Expand Down Expand Up @@ -738,15 +757,22 @@ public void onClick(DialogInterface dialog, int i) {
*/
// ======================= 12345
final GridView gv = (GridView) findViewById(useDirViewer ? R.id.results_list : R.id.gl_list);
adapter = new FLSimpleAdapter(this, itemsArray, useDirViewer ? R.layout.results_layout : R.layout.flist_layout, from, to);
gv.setAdapter(adapter);
gv.setHorizontalSpacing(0);
Integer colsNum = -1;
if(getDirectoryColumns(currentRoot)!=0) {
gv.setNumColumns(getDirectoryColumns(currentRoot));
colsNum=getDirectoryColumns(currentRoot);
}
else {
gv.setNumColumns(Integer.parseInt(prefs.getString("columnsDirsFiles", "-1")));
colsNum=Integer.parseInt(prefs.getString("columnsDirsFiles", "-1"));
}
adapter = new FLSimpleAdapter(this, itemsArray, useDirViewer ? R.layout.results_layout : R.layout.flist_layout, from, to);
gv.setAdapter(adapter);
// override auto (not working fine in adnroid)
if(colsNum == -1) {
colsNum = getAutoColsNum();
}
currentColsNum = colsNum;
gv.setNumColumns(colsNum);
//if (prefs.getBoolean("customScroll", true))
if (prefs.getBoolean("customScroll", app.customScrollDef))
{
Expand Down
43 changes: 33 additions & 10 deletions src/com/harasoft/relaunch/ResultsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class ResultsActivity extends Activity {
FLSimpleAdapter adapter;
ListView lv;
GridView gv;
Integer currentColsNum = -1;
List<HashMap<String, String>> itemsArray = new ArrayList<HashMap<String, String>>();
Integer currentPosition = -1;
boolean addSView = true;
Expand Down Expand Up @@ -107,8 +108,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
TextView tv1 = holder.tv1;
TextView tv2 = holder.tv2;

tv2.setTextSize(TypedValue.COMPLEX_UNIT_PT,8);
tv1.setTextSize(TypedValue.COMPLEX_UNIT_PT,6);
tv2.setTextSize(TypedValue.COMPLEX_UNIT_PT,Float.parseFloat(prefs.getString("firstLineFontSize", "8")));
tv1.setTextSize(TypedValue.COMPLEX_UNIT_PT,Float.parseFloat(prefs.getString("secondLineFontSize", "8")));

LinearLayout tvHolder = holder.tvHolder;
ImageView iv = holder.iv;
Expand Down Expand Up @@ -226,11 +227,12 @@ public View getView(int position, View convertView, ViewGroup parent) {
tv2.setText(fname);
}
}
// fixes on columns height in grid
// fixes on rows height in grid
if(currentColsNum!=1) {
GridView pgv = (GridView) parent;
Integer gcols=3; // from param !!!!!
Integer between_columns = 0;
Integer some_space = 0;
Integer gcols = currentColsNum;
Integer between_columns = 0; // configure ???
Integer after_row_space = 0; // configure ???
Integer colw = (pgv.getWidth() - (gcols - 1) * between_columns) / gcols;
Integer recalc_num = position;
Integer recalc_height=0;
Expand All @@ -242,13 +244,29 @@ public View getView(int position, View convertView, ViewGroup parent) {
if(p_height>recalc_height) recalc_height = p_height;
}
if(recalc_height>0) {
// 2 as some value
v.setMinimumHeight(recalc_height + some_space); // may be + some
v.setMinimumHeight(recalc_height + after_row_space);
}
}
return v;
}
}

private Integer getAutoColsNum() {
// implementation - by content avg len
// may be median
Integer auto_cols = 1;
Integer avg = 0;
for(Integer i=0;i<itemsArray.size();i++) {
avg = avg + itemsArray.get(i).get("fname").length();
}
if(itemsArray.size()>0) avg = avg / itemsArray.size();
if(avg<4) return 5;
if(avg<6) return 4;
if(avg<10) return 3;
if(avg<32) return 2;
return auto_cols;
}

private void redrawList() {
if (prefs.getBoolean("filterResults", false)) {
List<HashMap<String, String>> newItemsArray = new ArrayList<HashMap<String, String>>();
Expand All @@ -271,8 +289,13 @@ private void redrawList() {
}
if(listName.equals("searchResults")) {
colsNum = Integer.parseInt(prefs.getString("columnsSearch", "-1"));
}
gv.setNumColumns(colsNum);
}
// override auto (not working fine in adnroid)
if(colsNum==-1) {
colsNum=getAutoColsNum();
}
currentColsNum=colsNum;
gv.setNumColumns(colsNum);
adapter.notifyDataSetChanged();
if (currentPosition != -1)
// lv.setSelection(currentPosition);
Expand Down

0 comments on commit 405b9bc

Please sign in to comment.