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 AccountActivity extends ImageActivity { | |
@Override public void onCreate(Bundle bundle){ | |
// init | |
} | |
public void onAvatarClicked() { | |
showGalery(); | |
} | |
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 ImageActivity extends Activity { | |
@Override public void onCreate(Bundle bundle){ | |
super.onCreate(bundle); | |
// init image operations | |
} | |
@Override public void onDestroy() { | |
// release allocations |
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 interface ApiService { | |
<T> void login(Callback<T> callback); | |
<T> void register(Callback<T> callback); | |
} |
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 LoginActivity extends Activity | |
implements LoginFragment.LoginListener { | |
@Override public void onLogin() { | |
login(new Callback<User>() { | |
@Override public void onSuccess(User user){ | |
EventBus.getDefault().post(new UserEvent(user)); | |
} | |
} |
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 LoginActivity extends Activity implements LoginFragment.LoginListener { | |
@Override public void onLogin() { | |
login(); | |
} | |
@Override public void onRegister() { | |
displayRegister(); | |
} | |
} |
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 LoginFragment extends Fragment { | |
private LoginListener listener; | |
@Override public void onAttach(Activity activity) { | |
super.onAttach(activity); | |
loginListener = (LoginListener) activity; | |
} | |
void onLoginClicked() { |
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 MyView extends View { | |
private boolean editMode; | |
public MyView(Context context, boolean editMode){ | |
super(context); | |
this.editMode = editMode; | |
} | |
//a new method |
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 MyView extends View { | |
private boolean editMode; | |
public MyView(Context context, boolean editMode){ | |
super(context); | |
this.editMode = editMode; | |
} | |
@Override |
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 BaseActivity extends Activity { | |
ApiService apiService = new ApiManager(new GsonParser()); | |
} |
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 ApiManager implements ApiService { | |
private final Parser parser; | |
public ApiManager(Parser parser) { | |
this.parser = parser; | |
} | |
@Override | |
public void login(Callback callback) { |