Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed warnings, redundancy, maintained package privacy #30

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public class AboutPresenter<V extends AboutMvpView> extends BasePresenter<V>
implements AboutMvpPresenter<V> {

@Inject
public AboutPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
AboutPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
super(dataManager, schedulerProvider, compositeDisposable);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ public void showMessage(@StringRes int resId) {

@Override
public boolean isNetworkConnected() {
if (mActivity != null) {
return mActivity.isNetworkConnected();
}
return false;
return mActivity != null && mActivity.isNetworkConnected();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,7 @@ public void showMessage(@StringRes int resId) {

@Override
public boolean isNetworkConnected() {
if (mActivity != null) {
return mActivity.isNetworkConnected();
}
return false;
return mActivity != null && mActivity.isNetworkConnected();
}

@Override
Expand Down Expand Up @@ -154,7 +151,7 @@ public void onDestroy() {
super.onDestroy();
}

public interface Callback {
interface Callback {

void onFragmentAttached();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ public void setUserAsLoggedOut() {
getDataManager().setAccessToken(null);
}

public static class MvpViewNotAttachedException extends RuntimeException {
public MvpViewNotAttachedException() {
private static class MvpViewNotAttachedException extends RuntimeException {
MvpViewNotAttachedException() {
super("Please call Presenter.onAttach(MvpView) before" +
" requesting data to the Presenter");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ public void hideKeyboard() {

@Override
public boolean isNetworkConnected() {
if (mParentMvpView != null) {
return mParentMvpView.isNetworkConnected();
}
return false;
return mParentMvpView != null && mParentMvpView.isNetworkConnected();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* pattern must implement. Generally this interface will be extended by a more specific interface
* that then usually will be implemented by an Activity or Fragment.
*/
public interface SubMvpView extends MvpView {
interface SubMvpView extends MvpView {

void onCreate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public class FeedActivity extends BaseActivity implements FeedMvpView {
TabLayout mTabLayout;

public static Intent getStartIntent(Context context) {
Intent intent = new Intent(context, FeedActivity.class);
return intent;
return new Intent(context, FeedActivity.class);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public int getCount() {
return mTabCount;
}

public void setCount(int count) {
void setCount(int count) {
mTabCount = count;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public class FeedPresenter<V extends MvpView> extends BasePresenter<V> implement
private static final String TAG = "FeedPresenter";

@Inject
public FeedPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
FeedPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
super(dataManager, schedulerProvider, compositeDisposable);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@

public class BlogAdapter extends RecyclerView.Adapter<BaseViewHolder> {

public static final int VIEW_TYPE_EMPTY = 0;
public static final int VIEW_TYPE_NORMAL = 1;
private static final int VIEW_TYPE_EMPTY = 0;
private static final int VIEW_TYPE_NORMAL = 1;

private Callback mCallback;
private List<BlogResponse.Blog> mBlogResponseList;
Expand All @@ -53,7 +53,7 @@ public BlogAdapter(List<BlogResponse.Blog> blogResponseList) {
mBlogResponseList = blogResponseList;
}

public void setCallback(Callback callback) {
void setCallback(Callback callback) {
mCallback = callback;
}

Expand Down Expand Up @@ -94,16 +94,16 @@ public int getItemCount() {
}
}

public void addItems(List<BlogResponse.Blog> blogList) {
void addItems(List<BlogResponse.Blog> blogList) {
mBlogResponseList.addAll(blogList);
notifyDataSetChanged();
}

public interface Callback {
interface Callback {
void onBlogEmptyViewRetryClick();
}

public class ViewHolder extends BaseViewHolder {
class ViewHolder extends BaseViewHolder {

@BindView(R.id.cover_image_view)
ImageView coverImageView;
Expand All @@ -120,7 +120,7 @@ public class ViewHolder extends BaseViewHolder {
@BindView(R.id.content_text_view)
TextView contentTextView;

public ViewHolder(View itemView) {
ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
Expand Down Expand Up @@ -179,15 +179,15 @@ public void onClick(View v) {
}
}

public class EmptyViewHolder extends BaseViewHolder {
class EmptyViewHolder extends BaseViewHolder {

@BindView(R.id.btn_retry)
Button retryButton;

@BindView(R.id.tv_message)
TextView messageTextView;

public EmptyViewHolder(View itemView) {
EmptyViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public class BlogPresenter<V extends BlogMvpView> extends BasePresenter<V>
implements BlogMvpPresenter<V> {

@Inject
public BlogPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
BlogPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
super(dataManager, schedulerProvider, compositeDisposable);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@

public class OpenSourceAdapter extends RecyclerView.Adapter<BaseViewHolder> {

public static final int VIEW_TYPE_EMPTY = 0;
public static final int VIEW_TYPE_NORMAL = 1;
private static final int VIEW_TYPE_EMPTY = 0;
private static final int VIEW_TYPE_NORMAL = 1;

private Callback mCallback;
private List<OpenSourceResponse.Repo> mOpenSourceResponseList;
Expand All @@ -52,7 +52,7 @@ public OpenSourceAdapter(List<OpenSourceResponse.Repo> openSourceResponseList) {
mOpenSourceResponseList = openSourceResponseList;
}

public void setCallback(Callback callback) {
void setCallback(Callback callback) {
mCallback = callback;
}

Expand Down Expand Up @@ -93,16 +93,16 @@ public int getItemCount() {
}
}

public void addItems(List<OpenSourceResponse.Repo> repoList) {
void addItems(List<OpenSourceResponse.Repo> repoList) {
mOpenSourceResponseList.addAll(repoList);
notifyDataSetChanged();
}

public interface Callback {
interface Callback {
void onRepoEmptyViewRetryClick();
}

public class ViewHolder extends BaseViewHolder {
class ViewHolder extends BaseViewHolder {

@BindView(R.id.cover_image_view)
ImageView coverImageView;
Expand All @@ -113,7 +113,7 @@ public class ViewHolder extends BaseViewHolder {
@BindView(R.id.content_text_view)
TextView contentTextView;

public ViewHolder(View itemView) {
ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
Expand Down Expand Up @@ -160,7 +160,7 @@ public void onClick(View v) {
}
}

public class EmptyViewHolder extends BaseViewHolder {
class EmptyViewHolder extends BaseViewHolder {

@BindView(R.id.btn_retry)
Button retryButton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
public class OpenSourceFragment extends BaseFragment implements
OpenSourceMvpView, OpenSourceAdapter.Callback {

@SuppressWarnings("unused")
private static final String TAG = "OpenSourceFragment";

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public class OpenSourcePresenter<V extends OpenSourceMvpView> extends BasePresen
implements OpenSourceMvpPresenter<V> {

@Inject
public OpenSourcePresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
OpenSourcePresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
super(dataManager, schedulerProvider, compositeDisposable);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public class LoginActivity extends BaseActivity implements LoginMvpView {
EditText mPasswordEditText;

public static Intent getStartIntent(Context context) {
Intent intent = new Intent(context, LoginActivity.class);
return intent;
return new Intent(context, LoginActivity.class);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public class LoginPresenter<V extends LoginMvpView> extends BasePresenter<V>
private static final String TAG = "LoginPresenter";

@Inject
public LoginPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
LoginPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
super(dataManager, schedulerProvider, compositeDisposable);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,8 @@ public class MainActivity extends BaseActivity implements MainMvpView {

private TextView mEmailTextView;

private RoundedImageView mProfileImageView;

private ActionBarDrawerToggle mDrawerToggle;

public static Intent getStartIntent(Context context) {
Intent intent = new Intent(context, MainActivity.class);
return intent;
return new Intent(context, MainActivity.class);
}

@Override
Expand Down Expand Up @@ -251,7 +246,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
protected void setUp() {
setSupportActionBar(mToolbar);
mDrawerToggle = new ActionBarDrawerToggle(
ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(
this,
mDrawer,
mToolbar,
Expand Down Expand Up @@ -310,7 +305,7 @@ public void run() {

void setupNavMenu() {
View headerLayout = mNavigationView.getHeaderView(0);
mProfileImageView = (RoundedImageView) headerLayout.findViewById(R.id.iv_profile_pic);
@SuppressWarnings("unused") RoundedImageView mProfileImageView = (RoundedImageView) headerLayout.findViewById(R.id.iv_profile_pic);
mNameTextView = (TextView) headerLayout.findViewById(R.id.tv_name);
mEmailTextView = (TextView) headerLayout.findViewById(R.id.tv_email);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@
public class MainPresenter<V extends MainMvpView> extends BasePresenter<V>
implements MainMvpPresenter<V> {

@SuppressWarnings("unused")
private static final String TAG = "MainPresenter";

@Inject
public MainPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
MainPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
super(dataManager, schedulerProvider, compositeDisposable);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ public class QuestionCard {

private Question mQuestion;

public QuestionCard(Question question) {
QuestionCard(Question question) {
mQuestion = question;
}

@SuppressWarnings("unused")
@Resolve
private void onResolved() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public class SplashActivity extends BaseActivity implements SplashMvpView {
SplashMvpPresenter<SplashMvpView> mPresenter;

public static Intent getStartIntent(Context context) {
Intent intent = new Intent(context, SplashActivity.class);
return intent;
return new Intent(context, SplashActivity.class);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public class SplashPresenter<V extends SplashMvpView> extends BasePresenter<V>
implements SplashMvpPresenter<V> {

@Inject
public SplashPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
SplashPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
super(dataManager, schedulerProvider, compositeDisposable);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Created by amitshekhar on 08/01/17.
*/

@SuppressWarnings("unused")
public final class AppConstants {

public static final String STATUS_CODE_SUCCESS = "success";
Expand All @@ -34,7 +35,7 @@ public final class AppConstants {
public static final String SEED_DATABASE_OPTIONS = "seed/options.json";
public static final String SEED_DATABASE_QUESTIONS = "seed/questions.json";

public static final String TIMESTAMP_FORMAT = "yyyyMMdd_HHmmss";
static final String TIMESTAMP_FORMAT = "yyyyMMdd_HHmmss";

private AppConstants() {
// This utility class is not publicly instantiable
Expand Down