mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
color icons; book opening from new library view
This commit is contained in:
parent
b218f22e18
commit
97d0cbe046
6 changed files with 11 additions and 24 deletions
BIN
icons/library/library_by_author.png
Normal file
BIN
icons/library/library_by_author.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
icons/library/library_by_tag.png
Normal file
BIN
icons/library/library_by_tag.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
|
@ -101,7 +101,7 @@ public final class FBReader extends ZLAndroidActivity {
|
|||
@Override
|
||||
protected ZLFile fileFromIntent(Intent intent) {
|
||||
String fileToOpen = intent.getStringExtra(BOOK_PATH_KEY);
|
||||
//intent.putExtra(BOOK_PATH_KEY, (String)null);
|
||||
/*
|
||||
if (fileToOpen == null && Intent.ACTION_VIEW.equals(intent.getAction())) {
|
||||
final Uri uri = intent.getData();
|
||||
if (uri != null) {
|
||||
|
@ -116,6 +116,7 @@ public final class FBReader extends ZLAndroidActivity {
|
|||
}
|
||||
intent.setData(null);
|
||||
}
|
||||
*/
|
||||
return fileToOpen != null ? ZLFile.createFileByPath(fileToOpen) : null;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public class LibraryTopLevelActivity extends LibraryBaseActivity {
|
|||
));
|
||||
items.add(new TopLevelTree(
|
||||
myResource.getResource("byAuthor"),
|
||||
R.drawable.ic_tab_library_author,
|
||||
R.drawable.library_by_author,
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class LibraryTopLevelActivity extends LibraryBaseActivity {
|
|||
));
|
||||
items.add(new TopLevelTree(
|
||||
myResource.getResource("byTag"),
|
||||
R.drawable.ic_tab_library_tag,
|
||||
R.drawable.library_by_tag,
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
}
|
||||
|
|
|
@ -19,16 +19,11 @@
|
|||
|
||||
package org.geometerplus.android.fbreader.library;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||
|
||||
import org.geometerplus.fbreader.library.Book;
|
||||
import org.geometerplus.fbreader.library.LibraryTree;
|
||||
import org.geometerplus.fbreader.library.BookTree;
|
||||
|
||||
|
@ -39,21 +34,12 @@ abstract class LibraryTreeActivity extends LibraryBaseActivity {
|
|||
public void onListItemClick(ListView listView, View view, int position, long rowId) {
|
||||
LibraryTree tree = (LibraryTree)((LibraryAdapter)getListAdapter()).getItem(position);
|
||||
if (tree instanceof BookTree) {
|
||||
final Book book = ((BookTree)tree).Book;
|
||||
startActivity(getFBReaderIntent(book.File));
|
||||
startActivity(
|
||||
new Intent(getApplicationContext(), FBReader.class)
|
||||
.setAction(Intent.ACTION_VIEW)
|
||||
.putExtra(FBReader.BOOK_PATH_KEY, ((BookTree)tree).Book.File.getPath())
|
||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private Intent getFBReaderIntent(final ZLFile file) {
|
||||
final Intent intent = new Intent(getApplicationContext(), FBReader.class);
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
final ZLFile physicalFile = file.getPhysicalFile();
|
||||
if (physicalFile != null) {
|
||||
intent.setData(Uri.fromFile(new File(physicalFile.getPath())));
|
||||
} else {
|
||||
intent.setData(Uri.parse("file:///"));
|
||||
}
|
||||
intent.putExtra(FBReader.BOOK_PATH_KEY, file.getPath());
|
||||
return intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ public abstract class ZLAndroidActivity extends Activity {
|
|||
@Override
|
||||
public void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
ZLApplication.Instance().openFile(fileFromIntent(getIntent()));
|
||||
ZLApplication.Instance().openFile(fileFromIntent(intent));
|
||||
ZLApplication.Instance().repaintView();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue