Skip to content

Commit

Permalink
Merge pull request PhilJay#4018 from RobertZagorski/feature/remove-re…
Browse files Browse the repository at this point in the history
…dundant-findViewById-casts

[Enhancement] Remove redundant findViewById casts in example application
  • Loading branch information
almic authored May 13, 2018
2 parents b6c14d5 + 646f0fb commit 1917664
Show file tree
Hide file tree
Showing 56 changed files with 130 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart);

tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);

mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX = findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);

mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY = findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);

mChart = (BarChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);

mChart.getDescription().setEnabled(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart);

tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);

mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX = findViewById(R.id.seekBar1);
mSeekBarY = findViewById(R.id.seekBar2);

mChart = (BarChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);

mChart.setDrawBarShadow(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart);

tvX = (TextView) findViewById(R.id.tvXMax);
tvX = findViewById(R.id.tvXMax);
tvX.setTextSize(10);
tvY = (TextView) findViewById(R.id.tvYMax);
tvY = findViewById(R.id.tvYMax);

mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX = findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);

mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY = findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);

mChart = (BarChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.getDescription().setEnabled(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ protected void onCreate(Bundle savedInstanceState) {

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

tvX = (TextView) findViewById(R.id.tvValueCount);
tvX = findViewById(R.id.tvValueCount);

mSeekBarX = (SeekBar) findViewById(R.id.seekbarValues);
mSeekBarX = findViewById(R.id.seekbarValues);

mChart = (BarChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);

mChart.setDrawBarShadow(false);
mChart.setDrawValueAboveBar(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_barchart_noseekbar);

mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
mChart = (BarChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setBackgroundColor(Color.WHITE);
mChart.setExtraTopOffset(-30f);
mChart.setExtraBottomOffset(10f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_bubblechart);

tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);

mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX = findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);

mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY = findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);

mChart = (BubbleChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.getDescription().setEnabled(false);

mChart.setOnChartValueSelectedListener(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_candlechart);

tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);

mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX = findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);

mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY = findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);

mChart = (CandleStickChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setBackgroundColor(Color.WHITE);

mChart.getDescription().setEnabled(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_combined);

mChart = (CombinedChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.getDescription().setEnabled(false);
mChart.setBackgroundColor(Color.WHITE);
mChart.setDrawGridBackground(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart);

tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);

mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX = findViewById(R.id.seekBar1);
mSeekBarY = findViewById(R.id.seekBar2);

mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);

mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);

mChart = (LineChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setViewPortOffsets(0, 0, 0, 0);
mChart.setBackgroundColor(Color.rgb(104, 241, 175));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_draw_chart);

mChart = (LineChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);

// listener for selecting and drawing
mChart.setOnChartValueSelectedListener(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart_noseekbar);

mChart = (LineChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.setDrawGridBackground(false);
mChart.getDescription().setEnabled(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart_noseekbar);

mChart = (LineChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setBackgroundColor(Color.WHITE);
mChart.setGridBackgroundColor(mFillColor);
mChart.setDrawGridBackground(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_piechart_half);

mChart = (PieChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setBackgroundColor(Color.WHITE);

moveOffScreen();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_horizontalbarchart);

tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);

mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX = findViewById(R.id.seekBar1);
mSeekBarY = findViewById(R.id.seekBar2);

mChart = (HorizontalBarChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
// mChart.setHighlightEnabled(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart);

tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);

mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX = findViewById(R.id.seekBar1);
mSeekBarY = findViewById(R.id.seekBar2);

mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);

mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);

mChart = (LineChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.setDrawGridBackground(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart);

tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);

mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX = findViewById(R.id.seekBar1);
mSeekBarY = findViewById(R.id.seekBar2);

mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);

mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);

mChart = (LineChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setOnChartGestureListener(this);
mChart.setOnChartValueSelectedListener(this);
mChart.setDrawGridBackground(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart);

tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);
mSeekBarX = findViewById(R.id.seekBar1);
mSeekBarY = findViewById(R.id.seekBar2);

mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);

mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);

mChart = (LineChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);

// no description text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_colored_lines);

mCharts[0] = (LineChart) findViewById(R.id.chart1);
mCharts[1] = (LineChart) findViewById(R.id.chart2);
mCharts[2] = (LineChart) findViewById(R.id.chart3);
mCharts[3] = (LineChart) findViewById(R.id.chart4);
mCharts[0] = findViewById(R.id.chart1);
mCharts[1] = findViewById(R.id.chart2);
mCharts[2] = findViewById(R.id.chart3);
mCharts[3] = findViewById(R.id.chart4);

mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Bold.ttf");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart_time);

tvX = (TextView) findViewById(R.id.tvXMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
tvX = findViewById(R.id.tvXMax);
mSeekBarX = findViewById(R.id.seekBar1);
mSeekBarX.setProgress(100);
tvX.setText("100");

mSeekBarX.setOnSeekBarChangeListener(this);

mChart = (LineChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);

// no description text
mChart.getDescription().setEnabled(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_listview_chart);

ListView lv = (ListView) findViewById(R.id.listView1);
ListView lv = findViewById(R.id.listView1);

ArrayList<BarData> list = new ArrayList<BarData>();

Expand Down Expand Up @@ -73,7 +73,7 @@ public View getView(int position, View convertView, ViewGroup parent) {

convertView = LayoutInflater.from(getContext()).inflate(
R.layout.list_item_barchart, null);
holder.chart = (BarChart) convertView.findViewById(R.id.chart);
holder.chart = convertView.findViewById(R.id.chart);

convertView.setTag(holder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_listview_chart);

ListView lv = (ListView) findViewById(R.id.listView1);
ListView lv = findViewById(R.id.listView1);

ArrayList<ChartItem> list = new ArrayList<ChartItem>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart);

tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
tvX = findViewById(R.id.tvXMax);
tvY = findViewById(R.id.tvYMax);

mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX = findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);

mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY = findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);

mChart = (LineChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);

mChart.setDrawGridBackground(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ protected void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_performance_linechart);

mTvCount = (TextView) findViewById(R.id.tvValueCount);
mSeekBarValues = (SeekBar) findViewById(R.id.seekbarValues);
mTvCount = findViewById(R.id.tvValueCount);
mSeekBarValues = findViewById(R.id.seekbarValues);
mTvCount.setText("500");

mSeekBarValues.setProgress(500);

mSeekBarValues.setOnSeekBarChangeListener(this);

mChart = (LineChart) findViewById(R.id.chart1);
mChart = findViewById(R.id.chart1);
mChart.setDrawGridBackground(false);

// no description text
Expand Down
Loading

0 comments on commit 1917664

Please sign in to comment.