Skip to content

Commit fe7a0f8

Browse files
authored
Merge pull request PhilJay#4018 from RobertZagorski/feature/remove-redundant-findViewById-casts
[Enhancement] Remove redundant findViewById casts in example application
2 parents 536a35a + 75dd04c commit fe7a0f8

File tree

56 files changed

+130
-130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+130
-130
lines changed

MPChartExample/src/com/xxmassdeveloper/mpchartexample/AnotherBarActivity.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ protected void onCreate(Bundle savedInstanceState) {
3636
WindowManager.LayoutParams.FLAG_FULLSCREEN);
3737
setContentView(R.layout.activity_barchart);
3838

39-
tvX = (TextView) findViewById(R.id.tvXMax);
40-
tvY = (TextView) findViewById(R.id.tvYMax);
39+
tvX = findViewById(R.id.tvXMax);
40+
tvY = findViewById(R.id.tvYMax);
4141

42-
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
42+
mSeekBarX = findViewById(R.id.seekBar1);
4343
mSeekBarX.setOnSeekBarChangeListener(this);
4444

45-
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
45+
mSeekBarY = findViewById(R.id.seekBar2);
4646
mSeekBarY.setOnSeekBarChangeListener(this);
4747

48-
mChart = (BarChart) findViewById(R.id.chart1);
48+
mChart = findViewById(R.id.chart1);
4949

5050
mChart.getDescription().setEnabled(false);
5151

MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivity.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ protected void onCreate(Bundle savedInstanceState) {
5656
WindowManager.LayoutParams.FLAG_FULLSCREEN);
5757
setContentView(R.layout.activity_barchart);
5858

59-
tvX = (TextView) findViewById(R.id.tvXMax);
60-
tvY = (TextView) findViewById(R.id.tvYMax);
59+
tvX = findViewById(R.id.tvXMax);
60+
tvY = findViewById(R.id.tvYMax);
6161

62-
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
63-
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
62+
mSeekBarX = findViewById(R.id.seekBar1);
63+
mSeekBarY = findViewById(R.id.seekBar2);
6464

65-
mChart = (BarChart) findViewById(R.id.chart1);
65+
mChart = findViewById(R.id.chart1);
6666
mChart.setOnChartValueSelectedListener(this);
6767

6868
mChart.setDrawBarShadow(false);

MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ protected void onCreate(Bundle savedInstanceState) {
4444
WindowManager.LayoutParams.FLAG_FULLSCREEN);
4545
setContentView(R.layout.activity_barchart);
4646

47-
tvX = (TextView) findViewById(R.id.tvXMax);
47+
tvX = findViewById(R.id.tvXMax);
4848
tvX.setTextSize(10);
49-
tvY = (TextView) findViewById(R.id.tvYMax);
49+
tvY = findViewById(R.id.tvYMax);
5050

51-
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
51+
mSeekBarX = findViewById(R.id.seekBar1);
5252
mSeekBarX.setOnSeekBarChangeListener(this);
5353

54-
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
54+
mSeekBarY = findViewById(R.id.seekBar2);
5555
mSeekBarY.setOnSeekBarChangeListener(this);
5656

57-
mChart = (BarChart) findViewById(R.id.chart1);
57+
mChart = findViewById(R.id.chart1);
5858
mChart.setOnChartValueSelectedListener(this);
5959
mChart.getDescription().setEnabled(false);
6060

MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivitySinus.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ protected void onCreate(Bundle savedInstanceState) {
4444

4545
mSinusData = FileUtils.loadBarEntriesFromAssets(getAssets(), "othersine.txt");
4646

47-
tvX = (TextView) findViewById(R.id.tvValueCount);
47+
tvX = findViewById(R.id.tvValueCount);
4848

49-
mSeekBarX = (SeekBar) findViewById(R.id.seekbarValues);
49+
mSeekBarX = findViewById(R.id.seekbarValues);
5050

51-
mChart = (BarChart) findViewById(R.id.chart1);
51+
mChart = findViewById(R.id.chart1);
5252

5353
mChart.setDrawBarShadow(false);
5454
mChart.setDrawValueAboveBar(true);

MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartPositiveNegative.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected void onCreate(Bundle savedInstanceState) {
3737
setContentView(R.layout.activity_barchart_noseekbar);
3838

3939
mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
40-
mChart = (BarChart) findViewById(R.id.chart1);
40+
mChart = findViewById(R.id.chart1);
4141
mChart.setBackgroundColor(Color.WHITE);
4242
mChart.setExtraTopOffset(-30f);
4343
mChart.setExtraBottomOffset(10f);

MPChartExample/src/com/xxmassdeveloper/mpchartexample/BubbleChartActivity.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ protected void onCreate(Bundle savedInstanceState) {
4444
WindowManager.LayoutParams.FLAG_FULLSCREEN);
4545
setContentView(R.layout.activity_bubblechart);
4646

47-
tvX = (TextView) findViewById(R.id.tvXMax);
48-
tvY = (TextView) findViewById(R.id.tvYMax);
47+
tvX = findViewById(R.id.tvXMax);
48+
tvY = findViewById(R.id.tvYMax);
4949

50-
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
50+
mSeekBarX = findViewById(R.id.seekBar1);
5151
mSeekBarX.setOnSeekBarChangeListener(this);
5252

53-
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
53+
mSeekBarY = findViewById(R.id.seekBar2);
5454
mSeekBarY.setOnSeekBarChangeListener(this);
5555

56-
mChart = (BubbleChart) findViewById(R.id.chart1);
56+
mChart = findViewById(R.id.chart1);
5757
mChart.getDescription().setEnabled(false);
5858

5959
mChart.setOnChartValueSelectedListener(this);

MPChartExample/src/com/xxmassdeveloper/mpchartexample/CandleStickChartActivity.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ protected void onCreate(Bundle savedInstanceState) {
3939
WindowManager.LayoutParams.FLAG_FULLSCREEN);
4040
setContentView(R.layout.activity_candlechart);
4141

42-
tvX = (TextView) findViewById(R.id.tvXMax);
43-
tvY = (TextView) findViewById(R.id.tvYMax);
42+
tvX = findViewById(R.id.tvXMax);
43+
tvY = findViewById(R.id.tvYMax);
4444

45-
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
45+
mSeekBarX = findViewById(R.id.seekBar1);
4646
mSeekBarX.setOnSeekBarChangeListener(this);
4747

48-
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
48+
mSeekBarY = findViewById(R.id.seekBar2);
4949
mSeekBarY.setOnSeekBarChangeListener(this);
5050

51-
mChart = (CandleStickChart) findViewById(R.id.chart1);
51+
mChart = findViewById(R.id.chart1);
5252
mChart.setBackgroundColor(Color.WHITE);
5353

5454
mChart.getDescription().setEnabled(false);

MPChartExample/src/com/xxmassdeveloper/mpchartexample/CombinedChartActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected void onCreate(Bundle savedInstanceState) {
4848
WindowManager.LayoutParams.FLAG_FULLSCREEN);
4949
setContentView(R.layout.activity_combined);
5050

51-
mChart = (CombinedChart) findViewById(R.id.chart1);
51+
mChart = findViewById(R.id.chart1);
5252
mChart.getDescription().setEnabled(false);
5353
mChart.setBackgroundColor(Color.WHITE);
5454
mChart.setDrawGridBackground(false);

MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ protected void onCreate(Bundle savedInstanceState) {
3939
WindowManager.LayoutParams.FLAG_FULLSCREEN);
4040
setContentView(R.layout.activity_linechart);
4141

42-
tvX = (TextView) findViewById(R.id.tvXMax);
43-
tvY = (TextView) findViewById(R.id.tvYMax);
42+
tvX = findViewById(R.id.tvXMax);
43+
tvY = findViewById(R.id.tvYMax);
4444

45-
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
46-
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
45+
mSeekBarX = findViewById(R.id.seekBar1);
46+
mSeekBarY = findViewById(R.id.seekBar2);
4747

4848
mSeekBarX.setProgress(45);
4949
mSeekBarY.setProgress(100);
5050

5151
mSeekBarY.setOnSeekBarChangeListener(this);
5252
mSeekBarX.setOnSeekBarChangeListener(this);
5353

54-
mChart = (LineChart) findViewById(R.id.chart1);
54+
mChart = findViewById(R.id.chart1);
5555
mChart.setViewPortOffsets(0, 0, 0, 0);
5656
mChart.setBackgroundColor(Color.rgb(104, 241, 175));
5757

MPChartExample/src/com/xxmassdeveloper/mpchartexample/DrawChartActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected void onCreate(Bundle savedInstanceState) {
4343
WindowManager.LayoutParams.FLAG_FULLSCREEN);
4444
setContentView(R.layout.activity_draw_chart);
4545

46-
mChart = (LineChart) findViewById(R.id.chart1);
46+
mChart = findViewById(R.id.chart1);
4747

4848
// listener for selecting and drawing
4949
mChart.setOnChartValueSelectedListener(this);

0 commit comments

Comments
 (0)