Refactoring, and download layout alignment fixes

This commit is contained in:
DjBushido 2014-05-08 20:39:38 -04:00
parent 4da25f0e23
commit 1530364abc
11 changed files with 124 additions and 104 deletions

View File

@ -2,10 +2,6 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="org.bspeice.minimalbible.DownloadActivity$PlaceholderFragment" > tools:context="org.bspeice.minimalbible.DownloadActivity$PlaceholderFragment" >
<ListView <ListView

View File

@ -3,7 +3,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="2dip"> android:padding="8dp" >
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -18,9 +18,20 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/txt_download_item_name" android:id="@+id/txt_download_item_name"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_toRightOf="@+id/img_download_icon" android:layout_toRightOf="@+id/img_download_icon"
android:layout_toLeftOf="@+id/img_download_index_downloaded" /> android:layout_toLeftOf="@+id/img_download_index_downloaded" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/download_txt_item_acronym"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_toRightOf="@+id/img_download_icon"
android:layout_below="@+id/txt_download_item_name"/>
<ImageButton <ImageButton
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -35,7 +46,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/img_download_item_downloaded" android:id="@+id/img_download_item_downloaded"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
style="@style/AppBaseTheme.Borderless" /> style="@style/AppBaseTheme.Borderless" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,6 +1,6 @@
package org.bspeice.minimalbible.activities; package org.bspeice.minimalbible.activities;
import org.bspeice.minimalbible.activities.downloader.ActivityDownloaderModule; import org.bspeice.minimalbible.activities.downloader.manager.ActivityDownloaderModule;
import dagger.Module; import dagger.Module;

View File

@ -61,6 +61,7 @@ public class BookListAdapter extends BaseAdapter {
public class BookItemView extends RelativeLayout { public class BookItemView extends RelativeLayout {
@InjectView(R.id.img_download_icon) ImageView downloadIcon; @InjectView(R.id.img_download_icon) ImageView downloadIcon;
@InjectView(R.id.download_txt_item_acronym) TextView acronym;
@InjectView(R.id.txt_download_item_name) TextView itemName; @InjectView(R.id.txt_download_item_name) TextView itemName;
@InjectView(R.id.img_download_index_downloaded) ImageView isIndexedDownloaded; @InjectView(R.id.img_download_index_downloaded) ImageView isIndexedDownloaded;
@InjectView(R.id.img_download_item_downloaded) ImageView isDownloaded; @InjectView(R.id.img_download_item_downloaded) ImageView isDownloaded;
@ -72,6 +73,7 @@ public class BookListAdapter extends BaseAdapter {
} }
public void bind(Book b) { public void bind(Book b) {
acronym.setText(b.getInitials());
itemName.setText(b.getName()); itemName.setText(b.getName());
} }
} }

View File

@ -21,6 +21,8 @@ import com.readystatesoftware.systembartint.SystemBarTintManager;
import org.bspeice.minimalbible.MinimalBible; import org.bspeice.minimalbible.MinimalBible;
import org.bspeice.minimalbible.MinimalBibleConstants; import org.bspeice.minimalbible.MinimalBibleConstants;
import org.bspeice.minimalbible.R; import org.bspeice.minimalbible.R;
import org.bspeice.minimalbible.activities.downloader.manager.DownloadManager;
import org.bspeice.minimalbible.activities.downloader.manager.EventBookList;
import org.crosswire.jsword.book.Book; import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.BookCategory; import org.crosswire.jsword.book.BookCategory;
import org.crosswire.jsword.book.BookFilter; import org.crosswire.jsword.book.BookFilter;

View File

@ -3,6 +3,7 @@ package org.bspeice.minimalbible.activities.downloader;
import org.bspeice.minimalbible.R; import org.bspeice.minimalbible.R;
import org.bspeice.minimalbible.activities.BaseActivity; import org.bspeice.minimalbible.activities.BaseActivity;
import org.bspeice.minimalbible.activities.BaseNavigationDrawerFragment; import org.bspeice.minimalbible.activities.BaseNavigationDrawerFragment;
import org.bspeice.minimalbible.activities.downloader.manager.DownloadManager;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;

View File

@ -2,6 +2,7 @@ package org.bspeice.minimalbible.activities.downloader;
import org.bspeice.minimalbible.R; import org.bspeice.minimalbible.R;
import org.bspeice.minimalbible.activities.BaseNavigationDrawerFragment; import org.bspeice.minimalbible.activities.BaseNavigationDrawerFragment;
import org.bspeice.minimalbible.activities.downloader.manager.DownloadManager;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;

View File

@ -1,4 +1,6 @@
package org.bspeice.minimalbible.activities.downloader; package org.bspeice.minimalbible.activities.downloader.manager;
import org.bspeice.minimalbible.activities.downloader.BookListFragment;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -17,6 +19,12 @@ import de.greenrobot.event.EventBus;
) )
public class ActivityDownloaderModule { public class ActivityDownloaderModule {
/**
* Provide a Singleton DownloadManager for injection
* Note that we need to annotate Singleton here, only annotating on the
* DownloadManager itself is not enough.
* @return global DownloadManager instance
*/
@Provides @Singleton @Provides @Singleton
DownloadManager provideDownloadManager() { DownloadManager provideDownloadManager() {
return new DownloadManager(); return new DownloadManager();

View File

@ -1,4 +1,4 @@
package org.bspeice.minimalbible.activities.downloader; package org.bspeice.minimalbible.activities.downloader.manager;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package org.bspeice.minimalbible.activities.downloader; package org.bspeice.minimalbible.activities.downloader.manager;
import android.util.Log; import android.util.Log;

View File

@ -1,4 +1,4 @@
package org.bspeice.minimalbible.activities.downloader; package org.bspeice.minimalbible.activities.downloader.manager;
import java.util.List; import java.util.List;