This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Foobar { | |
private User user; | |
private void showAvatar(){ | |
Image image = user.getAccount().getImage(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Foobar { | |
private User user; | |
private void showAvatar(){ | |
if (user != null){ | |
Account account = user.getAccount(); | |
if (account != null){ | |
Image image = account.getImage(); | |
//MORE? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Foobar{ | |
public void showAvatar() { | |
Image image = user.getProfile().getImage(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductListFragment extends Fragment { | |
private String uuid; | |
@Override public void onCreate() { | |
uuid = UUID.randomUUID().toString(); | |
} | |
@Override void onCreateView(...) { | |
listener.onRefreshData(uuid); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductListFragment extends Fragment { | |
@Override public void onCreateView(...) { | |
listener.onRefreshData(); | |
} | |
public void onEvent(ProductListSuccessEvent event) { | |
doSomething(event); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductListActivity extends Activity implements FragmentListener{ | |
@Override public void onRefreshData() { | |
apiService.getProducts(new Callback() { | |
@Override void onSuccess(List<Product> list){ | |
EventBus.getDefault().post(new ProductListSuccessEvent(list)); | |
} | |
@Override void onFail(Error error){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductListActivity extends Activity implements FragmentListener{ | |
@Override public void onRefreshData(String uuid) { | |
apiService.getProducts(new Callback() { | |
@Override void onSuccess(List<Product> list){ | |
EventBus.getDefault().post(new ProductListSuccessEvent(uuid, list)); | |
} | |
@Override void onFail(Error error){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductListFragment extends Fragment { | |
private String uuid; | |
@Override public void onCreateView(...) { | |
listener.onRefreshData(); | |
} | |
public void onEvent(ProductListSuccessEvent event) { | |
if (!TextUtils.equals(uuid, event.uuid) { | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductListFragment extends Fragment { | |
private static final String KEY_UUUID = "KEY_UUID"; | |
private String uuid; | |
@Override public void onCreate(Bundle bundle) { | |
super.onCreate(bundle); | |
if (bundle != null && bundle.containsKey(KEY_UUID)) { | |
uuid = bundle.getString(KEY_UUID); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseFragment extends Fragment { | |
private static final String KEY_UUUID = "KEY_UUID"; | |
private String uuid; | |
@Override public void onCreate(Bundle bundle) { | |
super.onCreate(bundle); | |
if (bundle != null && bundle.containsKey(KEY_UUID)) { | |
uuid = bundle.getString(KEY_UUID); |