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

#780-[ENHANCEMENT] Replace "findViewById" by "@BindView" #788

Closed

Conversation

hafiz703
Copy link
Contributor

Description

Fixed most implementations of findviewById to @BindView in activities except those in ViewGroups / Fragments.

Fixes #780

Type of change

Just put an x in the [] which are valid.

  • Bug fix (non-breaking change which fixes an issue)
  • [x ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

  • [x ] ./gradlew assembleDebug assembleRelease
  • [x ] ./gradlew checkstyle

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@@ -81,7 +84,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hotels);

Toolbar toolbar = findViewById(R.id.toolbar);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this extra line

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont mark the conversation resolved, if you havent taken any action against it

@@ -119,7 +119,7 @@ public boolean onCreateOptionsMenu(Menu menu) {

public void createCode() {

ImageView qrCodeView = findViewById(R.id.im);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this being initialized?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??

@@ -102,4 +102,4 @@ private void onItemAutocompleteItemSelected() {
this.setSelectedText(TimeZone.getTimeZone(this.mAutoCompleteTextViewTimezone.getText().toString()));
}

}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??

@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.drawer_layout)
DrawerLayout Drawer;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable names shouldnt start with capital letter
drawerlayout

@BindView(R.id.drawer_layout)
DrawerLayout Drawer;
@BindView(R.id.nav_view)
NavigationView NavigationView;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also

@@ -19,6 +17,7 @@

@Override
protected void onCreate(Bundle savedInstanceState) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont see any relevant change in this file. Please remove this from commit


private MaterialSearchView mMaterialSearchView;

// private MaterialSearchView MaterialSearchView;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line

@@ -72,8 +73,11 @@
LottieAnimationView animationView;
@BindView(R.id.cities_list)
ListView lv;
@BindView(R.id.search_view)
MaterialSearchView MaterialSearchView;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change for all places - shouldnt start with capital letter

setSupportActionBar(toolbar);

ButterKnife.bind(this);

mHandler = new Handler(Looper.getMainLooper());
mMap = findViewById(R.id.map);
// mMap = findViewById(R.id.map);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line

@@ -119,7 +119,7 @@ public boolean onCreateOptionsMenu(Menu menu) {

public void createCode() {

ImageView qrCodeView = findViewById(R.id.im);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??

@@ -102,4 +102,4 @@ private void onItemAutocompleteItemSelected() {
this.setSelectedText(TimeZone.getTimeZone(this.mAutoCompleteTextViewTimezone.getText().toString()));
}

}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??

mAnalogHour = findViewById(R.id.hour);
mAnalogMinute = findViewById(R.id.minute);
mAnalogSecond = findViewById(R.id.second);
//
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove line

@BindView(R.id.minute)
AppCompatImageView AnalogMinute;
@BindView(R.id.second)
AppCompatImageView AnalogSecond;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no variable name should start with capital letter

@prabhakar267
Copy link
Member

Closing this due to inactivity. @hafiz703 reopen this if you address the comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Replace "findViewById" by "@BindView"
3 participants