Skip to content

Commit

Permalink
Card photo#15 (Remove the Latest Activity (Home) and make Gallery as …
Browse files Browse the repository at this point in the history
…the main

screen)
app:
- HomeFragment.StartNowHandler: moved
- HomeFragment: removed
- GalleryFragment.StartNowHandler: moved from HomeFragment
- GalleryFragment: added showStartNowNotification method which is moved
from HomeFragment
- MainActivity: changed reference to StartNowHandler
- MainActivity: updated index to Gallery in the syncStarted method
- MainActivity: removed HomeFragment handling from the photoDeleted,
photoUpdated, photoUploaded methods
- NavigationHandlerFragment: removed HOME_INDEX constant and adjusted
values for other index constants
- NavigationHandlerFragment: removed adding of HomeFragment in the
initPager method
- NavigationHandlerFragment: getHomeFragment method removed

test:
- MainActivityTest: removed HomeFragment references
  • Loading branch information
httpdispatch committed Oct 2, 2013
1 parent 9ccd491 commit 390a434
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 711 deletions.
49 changes: 47 additions & 2 deletions app/src/com/trovebox/android/app/GalleryFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import org.holoeverywhere.LayoutInflater;
import org.holoeverywhere.app.Activity;
import org.holoeverywhere.app.Fragment;

import android.content.Context;
import android.content.Intent;
Expand All @@ -15,7 +16,6 @@
import android.widget.ImageView;
import android.widget.ListView;

import com.trovebox.android.app.HomeFragment.StartNowHandler;
import com.trovebox.android.app.bitmapfun.util.ImageCache;
import com.trovebox.android.app.bitmapfun.util.ImageFetcher;
import com.trovebox.android.app.common.CommonRefreshableFragmentWithImageWorker;
Expand Down Expand Up @@ -456,7 +456,7 @@ public LoadResponse loadItems(int page) {
LoadResponse result = super.loadItems(page);
// show start now notification in case response returned no items
// and there are no already loaded items
HomeFragment.showStartNowNotification(startNowHandler,
GalleryFragment.showStartNowNotification(startNowHandler,
GalleryFragment.this, result.items != null && result.items.isEmpty()
&& getItems().isEmpty() && mTags == null && mAlbum == null);
return result;
Expand Down Expand Up @@ -506,4 +506,49 @@ public void pageDeactivated() {
public void photoUploaded() {
refreshImmediatelyOrScheduleIfNecessary();
}

/**
* Adjust start now notification visibility state and init it in case it is
* visible. When user clicked on int startNowHandler.startNow will be
* executed
*
* @param startNowHandler
* @param fragment
* @param show
*/
public static void showStartNowNotification(final StartNowHandler startNowHandler,
final Fragment fragment,
final boolean show)
{
GuiUtils.runOnUiThread(
new Runnable() {

@Override
public void run() {
View view = fragment.getView();
if (view != null)
{
view = view.findViewById(R.id.upload_new_images);
if (show)
{
view.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
startNowHandler.startNow();
}
});
}
view.setVisibility(
show ? View.VISIBLE : View.GONE);
}

}
});
}

public static interface StartNowHandler
{
void startNow();
}
}
Loading

0 comments on commit 390a434

Please sign in to comment.