Remove redundant casts

Android SDK 26 changed the signature of findViewById
pull/41/head
Alexander Bakker 7 years ago
parent f952ee7df9
commit 644a6d89fe

@ -30,11 +30,11 @@ public class AddProfileActivity extends AppCompatActivity {
setPreferredTheme();
setContentView(R.layout.activity_add_profile);
_profileName = (EditText) findViewById(R.id.addProfileName);
_textAlgorithm = (TextView) findViewById(R.id.tvAlgorithm);
_textIssuer = (TextView) findViewById(R.id.tvIssuer);
_textPeriod = (TextView) findViewById(R.id.tvPeriod);
_textOtp = (TextView) findViewById(R.id.tvOtp);
_profileName = findViewById(R.id.addProfileName);
_textAlgorithm = findViewById(R.id.tvAlgorithm);
_textIssuer = findViewById(R.id.tvIssuer);
_textPeriod = findViewById(R.id.tvPeriod);
_textOtp = findViewById(R.id.tvOtp);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
@ -43,7 +43,7 @@ public class AddProfileActivity extends AppCompatActivity {
initializeForm();
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

@ -47,10 +47,10 @@ public class AuthActivity extends AppCompatActivity implements FingerprintUiHelp
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_auth);
_textPassword = (EditText) findViewById(R.id.text_password);
LinearLayout boxFingerprint = (LinearLayout) findViewById(R.id.box_fingerprint);
SwirlView imgFingerprint = (SwirlView) findViewById(R.id.img_fingerprint);
TextView textFingerprint = (TextView) findViewById(R.id.text_fingerprint);
_textPassword = findViewById(R.id.text_password);
LinearLayout boxFingerprint = findViewById(R.id.box_fingerprint);
SwirlView imgFingerprint = findViewById(R.id.img_fingerprint);
TextView textFingerprint = findViewById(R.id.text_fingerprint);
Intent intent = getIntent();
_slots = (SlotCollection) intent.getSerializableExtra("slots");
@ -76,7 +76,7 @@ public class AuthActivity extends AppCompatActivity implements FingerprintUiHelp
}
}
Button button = (Button) findViewById(R.id.button_decrypt);
Button button = findViewById(R.id.button_decrypt);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

@ -45,11 +45,11 @@ public class CustomAuthenticatedSlide extends Fragment implements FingerprintUiH
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_authenticated_slide, container, false);
_textPassword = (EditText) view.findViewById(R.id.text_password);
_textPasswordConfirm = (EditText) view.findViewById(R.id.text_password_confirm);
_boxFingerprint = (LinearLayout) view.findViewById(R.id.box_fingerprint);
_imgFingerprint = (SwirlView) view.findViewById(R.id.img_fingerprint);
_textFingerprint = (TextView) view.findViewById(R.id.text_fingerprint);
_textPassword = view.findViewById(R.id.text_password);
_textPasswordConfirm = view.findViewById(R.id.text_password_confirm);
_boxFingerprint = view.findViewById(R.id.box_fingerprint);
_imgFingerprint = view.findViewById(R.id.img_fingerprint);
_textFingerprint = view.findViewById(R.id.text_fingerprint);
view.findViewById(R.id.main).setBackgroundColor(_bgColor);
return view;
}

@ -33,7 +33,7 @@ public class CustomAuthenticationSlide extends Fragment implements ISlidePolicy,
final View view = inflater.inflate(R.layout.fragment_authentication_slide, container, false);
final Context context = getContext();
_buttonGroup = (RadioGroup) view.findViewById(R.id.rg_authenticationMethod);
_buttonGroup = view.findViewById(R.id.rg_authenticationMethod);
_buttonGroup.setOnCheckedChangeListener(this);
onCheckedChanged(_buttonGroup, _buttonGroup.getCheckedRadioButtonId());
@ -41,8 +41,8 @@ public class CustomAuthenticationSlide extends Fragment implements ISlidePolicy,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
FingerprintManager fingerprintManager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) == PackageManager.PERMISSION_GRANTED && fingerprintManager.isHardwareDetected()) {
RadioButton button = (RadioButton) view.findViewById(R.id.rb_fingerprint);
TextView text = (TextView) view.findViewById(R.id.text_rb_fingerprint);
RadioButton button = view.findViewById(R.id.rb_fingerprint);
TextView text = view.findViewById(R.id.text_rb_fingerprint);
button.setVisibility(View.VISIBLE);
text.setVisibility(View.VISIBLE);
}

@ -108,11 +108,11 @@ public class KeyProfileAdapter extends RecyclerView.Adapter<KeyProfileAdapter.Ke
KeyProfileHolder(final View itemView) {
super(itemView);
_itemView = itemView;
_profileName = (TextView) itemView.findViewById(R.id.profile_name);
_profileCode = (TextView) itemView.findViewById(R.id.profile_code);
_profileIssuer = (TextView) itemView.findViewById(R.id.profile_issuer);
_profileDrawable = (ImageView) itemView.findViewById(R.id.ivTextDrawable);
_progressBar = (ProgressBar) itemView.findViewById(R.id.progressBar);
_profileName = itemView.findViewById(R.id.profile_name);
_profileCode = itemView.findViewById(R.id.profile_code);
_profileIssuer = itemView.findViewById(R.id.profile_issuer);
_profileDrawable = itemView.findViewById(R.id.ivTextDrawable);
_progressBar = itemView.findViewById(R.id.progressBar);
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);

@ -94,21 +94,21 @@ public class MainActivity extends AppCompatActivity implements KeyProfileAdapter
}
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// init the app shortcuts and execute any pending actions
initializeAppShortcuts();
doShortcutActions();
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setEnabled(true);
fab.setOnClickListener(view -> {
Intent scannerActivity = new Intent(getApplicationContext(), ScannerActivity.class);
startActivityForResult(scannerActivity, CODE_GET_KEYINFO);
});
RecyclerView rvKeyProfiles = (RecyclerView) findViewById(R.id.rvKeyProfiles);
RecyclerView rvKeyProfiles = findViewById(R.id.rvKeyProfiles);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
rvKeyProfiles.setLayoutManager(mLayoutManager);
@ -353,9 +353,9 @@ public class MainActivity extends AppCompatActivity implements KeyProfileAdapter
private BottomSheetDialog createBottomSheet(KeyProfile profile) {
View bottomSheetView = getLayoutInflater().inflate(R.layout.bottom_sheet_edit_profile, null);
LinearLayout copyLayout = (LinearLayout) bottomSheetView.findViewById(R.id.copy_button);
LinearLayout deleteLayout = (LinearLayout) bottomSheetView.findViewById(R.id.delete_button);
LinearLayout editLayout = (LinearLayout) bottomSheetView.findViewById(R.id.edit_button);
LinearLayout copyLayout = bottomSheetView.findViewById(R.id.copy_button);
LinearLayout deleteLayout = bottomSheetView.findViewById(R.id.delete_button);
LinearLayout editLayout = bottomSheetView.findViewById(R.id.edit_button);
bottomSheetView.findViewById(R.id.edit_button);
BottomSheetDialog bottomDialog = new BottomSheetDialog(this);
bottomDialog.setContentView(bottomSheetView);

Loading…
Cancel
Save