Migrate to @Override to remove warnings.
Bug: 6303344 Change-Id: I8f17edc3b12d50cedab2c5f555c63bc07d85bca2
This commit is contained in:
@@ -560,9 +560,9 @@ public class DataUsageSummary extends Fragment {
|
|||||||
* Listener to setup {@link LayoutTransition} after first layout pass.
|
* Listener to setup {@link LayoutTransition} after first layout pass.
|
||||||
*/
|
*/
|
||||||
private OnGlobalLayoutListener mFirstLayoutListener = new OnGlobalLayoutListener() {
|
private OnGlobalLayoutListener mFirstLayoutListener = new OnGlobalLayoutListener() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
mListView.getViewTreeObserver().removeGlobalOnLayoutListener(mFirstLayoutListener);
|
mListView.getViewTreeObserver().removeOnGlobalLayoutListener(mFirstLayoutListener);
|
||||||
|
|
||||||
mTabsContainer.setLayoutTransition(buildLayoutTransition());
|
mTabsContainer.setLayoutTransition(buildLayoutTransition());
|
||||||
mHeader.setLayoutTransition(buildLayoutTransition());
|
mHeader.setLayoutTransition(buildLayoutTransition());
|
||||||
@@ -628,7 +628,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
* Factory that provide empty {@link View} to make {@link TabHost} happy.
|
* Factory that provide empty {@link View} to make {@link TabHost} happy.
|
||||||
*/
|
*/
|
||||||
private TabContentFactory mEmptyTabContent = new TabContentFactory() {
|
private TabContentFactory mEmptyTabContent = new TabContentFactory() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public View createTabContent(String tag) {
|
public View createTabContent(String tag) {
|
||||||
return new View(mTabHost.getContext());
|
return new View(mTabHost.getContext());
|
||||||
}
|
}
|
||||||
@@ -643,7 +643,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private OnTabChangeListener mTabListener = new OnTabChangeListener() {
|
private OnTabChangeListener mTabListener = new OnTabChangeListener() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onTabChanged(String tabId) {
|
public void onTabChanged(String tabId) {
|
||||||
// user changed tab; update body
|
// user changed tab; update body
|
||||||
updateBody();
|
updateBody();
|
||||||
@@ -990,7 +990,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private OnCheckedChangeListener mDataEnabledListener = new OnCheckedChangeListener() {
|
private OnCheckedChangeListener mDataEnabledListener = new OnCheckedChangeListener() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (mBinding) return;
|
if (mBinding) return;
|
||||||
|
|
||||||
@@ -1011,7 +1011,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private View.OnClickListener mDisableAtLimitListener = new View.OnClickListener() {
|
private View.OnClickListener mDisableAtLimitListener = new View.OnClickListener() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final boolean disableAtLimit = !mDisableAtLimit.isChecked();
|
final boolean disableAtLimit = !mDisableAtLimit.isChecked();
|
||||||
if (disableAtLimit) {
|
if (disableAtLimit) {
|
||||||
@@ -1025,7 +1025,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private View.OnClickListener mAppRestrictListener = new View.OnClickListener() {
|
private View.OnClickListener mAppRestrictListener = new View.OnClickListener() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final boolean restrictBackground = !mAppRestrict.isChecked();
|
final boolean restrictBackground = !mAppRestrict.isChecked();
|
||||||
|
|
||||||
@@ -1041,7 +1041,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private OnClickListener mAppSettingsListener = new OnClickListener() {
|
private OnClickListener mAppSettingsListener = new OnClickListener() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
// TODO: target torwards entire UID instead of just first package
|
// TODO: target torwards entire UID instead of just first package
|
||||||
startActivity(mAppSettingsIntent);
|
startActivity(mAppSettingsIntent);
|
||||||
@@ -1049,7 +1049,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private OnItemClickListener mListListener = new OnItemClickListener() {
|
private OnItemClickListener mListListener = new OnItemClickListener() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
final Context context = view.getContext();
|
final Context context = view.getContext();
|
||||||
final AppItem app = (AppItem) parent.getItemAtPosition(position);
|
final AppItem app = (AppItem) parent.getItemAtPosition(position);
|
||||||
@@ -1059,7 +1059,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private OnItemSelectedListener mCycleListener = new OnItemSelectedListener() {
|
private OnItemSelectedListener mCycleListener = new OnItemSelectedListener() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
final CycleItem cycle = (CycleItem) parent.getItemAtPosition(position);
|
final CycleItem cycle = (CycleItem) parent.getItemAtPosition(position);
|
||||||
if (cycle instanceof CycleChangeItem) {
|
if (cycle instanceof CycleChangeItem) {
|
||||||
@@ -1084,7 +1084,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
@@ -1149,12 +1149,12 @@ public class DataUsageSummary extends Fragment {
|
|||||||
|
|
||||||
private final LoaderCallbacks<ChartData> mChartDataCallbacks = new LoaderCallbacks<
|
private final LoaderCallbacks<ChartData> mChartDataCallbacks = new LoaderCallbacks<
|
||||||
ChartData>() {
|
ChartData>() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public Loader<ChartData> onCreateLoader(int id, Bundle args) {
|
public Loader<ChartData> onCreateLoader(int id, Bundle args) {
|
||||||
return new ChartDataLoader(getActivity(), mStatsSession, args);
|
return new ChartDataLoader(getActivity(), mStatsSession, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onLoadFinished(Loader<ChartData> loader, ChartData data) {
|
public void onLoadFinished(Loader<ChartData> loader, ChartData data) {
|
||||||
mChartData = data;
|
mChartData = data;
|
||||||
mChart.bindNetworkStats(mChartData.network);
|
mChart.bindNetworkStats(mChartData.network);
|
||||||
@@ -1170,7 +1170,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onLoaderReset(Loader<ChartData> loader) {
|
public void onLoaderReset(Loader<ChartData> loader) {
|
||||||
mChartData = null;
|
mChartData = null;
|
||||||
mChart.bindNetworkStats(null);
|
mChart.bindNetworkStats(null);
|
||||||
@@ -1180,18 +1180,18 @@ public class DataUsageSummary extends Fragment {
|
|||||||
|
|
||||||
private final LoaderCallbacks<NetworkStats> mSummaryCallbacks = new LoaderCallbacks<
|
private final LoaderCallbacks<NetworkStats> mSummaryCallbacks = new LoaderCallbacks<
|
||||||
NetworkStats>() {
|
NetworkStats>() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public Loader<NetworkStats> onCreateLoader(int id, Bundle args) {
|
public Loader<NetworkStats> onCreateLoader(int id, Bundle args) {
|
||||||
return new SummaryForAllUidLoader(getActivity(), mStatsSession, args);
|
return new SummaryForAllUidLoader(getActivity(), mStatsSession, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onLoadFinished(Loader<NetworkStats> loader, NetworkStats data) {
|
public void onLoadFinished(Loader<NetworkStats> loader, NetworkStats data) {
|
||||||
mAdapter.bindStats(data);
|
mAdapter.bindStats(data);
|
||||||
updateEmptyVisible();
|
updateEmptyVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onLoaderReset(Loader<NetworkStats> loader) {
|
public void onLoaderReset(Loader<NetworkStats> loader) {
|
||||||
mAdapter.bindStats(null);
|
mAdapter.bindStats(null);
|
||||||
updateEmptyVisible();
|
updateEmptyVisible();
|
||||||
@@ -1203,6 +1203,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
private boolean isMobilePolicySplit() {
|
private boolean isMobilePolicySplit() {
|
||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
if (hasReadyMobileRadio(context)) {
|
if (hasReadyMobileRadio(context)) {
|
||||||
@@ -1213,6 +1214,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
private void setMobilePolicySplit(boolean split) {
|
private void setMobilePolicySplit(boolean split) {
|
||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
if (hasReadyMobileRadio(context)) {
|
if (hasReadyMobileRadio(context)) {
|
||||||
@@ -1228,28 +1230,28 @@ public class DataUsageSummary extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DataUsageChartListener mChartListener = new DataUsageChartListener() {
|
private DataUsageChartListener mChartListener = new DataUsageChartListener() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onInspectRangeChanged() {
|
public void onInspectRangeChanged() {
|
||||||
if (LOGD) Log.d(TAG, "onInspectRangeChanged()");
|
if (LOGD) Log.d(TAG, "onInspectRangeChanged()");
|
||||||
updateDetailData();
|
updateDetailData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onWarningChanged() {
|
public void onWarningChanged() {
|
||||||
setPolicyWarningBytes(mChart.getWarningBytes());
|
setPolicyWarningBytes(mChart.getWarningBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onLimitChanged() {
|
public void onLimitChanged() {
|
||||||
setPolicyLimitBytes(mChart.getLimitBytes());
|
setPolicyLimitBytes(mChart.getLimitBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void requestWarningEdit() {
|
public void requestWarningEdit() {
|
||||||
WarningEditorFragment.show(DataUsageSummary.this);
|
WarningEditorFragment.show(DataUsageSummary.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void requestLimitEdit() {
|
public void requestLimitEdit() {
|
||||||
LimitEditorFragment.show(DataUsageSummary.this);
|
LimitEditorFragment.show(DataUsageSummary.this);
|
||||||
}
|
}
|
||||||
@@ -1287,7 +1289,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public int compareTo(CycleItem another) {
|
public int compareTo(CycleItem another) {
|
||||||
return Long.compare(start, another.start);
|
return Long.compare(start, another.start);
|
||||||
}
|
}
|
||||||
@@ -1615,6 +1617,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
builder.setMessage(message);
|
builder.setMessage(message);
|
||||||
|
|
||||||
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
|
final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
@@ -1670,6 +1673,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
|
|
||||||
builder.setPositiveButton(R.string.data_usage_cycle_editor_positive,
|
builder.setPositiveButton(R.string.data_usage_cycle_editor_positive,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
final int cycleDay = cycleDayPicker.getValue();
|
final int cycleDay = cycleDayPicker.getValue();
|
||||||
final String cycleTimezone = new Time().timezone;
|
final String cycleTimezone = new Time().timezone;
|
||||||
@@ -1730,6 +1734,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
|
|
||||||
builder.setPositiveButton(R.string.data_usage_cycle_editor_positive,
|
builder.setPositiveButton(R.string.data_usage_cycle_editor_positive,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
// clear focus to finish pending text edits
|
// clear focus to finish pending text edits
|
||||||
bytesPicker.clearFocus();
|
bytesPicker.clearFocus();
|
||||||
@@ -1792,6 +1797,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
|
|
||||||
builder.setPositiveButton(R.string.data_usage_cycle_editor_positive,
|
builder.setPositiveButton(R.string.data_usage_cycle_editor_positive,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
// clear focus to finish pending text edits
|
// clear focus to finish pending text edits
|
||||||
bytesPicker.clearFocus();
|
bytesPicker.clearFocus();
|
||||||
@@ -1825,6 +1831,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
builder.setMessage(R.string.data_usage_disable_mobile);
|
builder.setMessage(R.string.data_usage_disable_mobile);
|
||||||
|
|
||||||
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
|
final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
@@ -1841,7 +1848,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialog to request user confirmation before setting
|
* Dialog to request user confirmation before setting
|
||||||
* {@link Settings.Secure#DATA_ROAMING}.
|
* {@link android.provider.Settings.Secure#DATA_ROAMING}.
|
||||||
*/
|
*/
|
||||||
public static class ConfirmDataRoamingFragment extends DialogFragment {
|
public static class ConfirmDataRoamingFragment extends DialogFragment {
|
||||||
public static void show(DataUsageSummary parent) {
|
public static void show(DataUsageSummary parent) {
|
||||||
@@ -1861,6 +1868,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
builder.setMessage(R.string.roaming_warning);
|
builder.setMessage(R.string.roaming_warning);
|
||||||
|
|
||||||
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
|
final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
@@ -1896,6 +1904,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
builder.setMessage(getString(R.string.data_usage_restrict_background));
|
builder.setMessage(getString(R.string.data_usage_restrict_background));
|
||||||
|
|
||||||
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
|
final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
@@ -1958,6 +1967,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
builder.setMessage(R.string.data_usage_app_restrict_dialog);
|
builder.setMessage(R.string.data_usage_app_restrict_dialog);
|
||||||
|
|
||||||
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
|
final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
|
@@ -296,7 +296,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private OnSweepListener mHorizListener = new OnSweepListener() {
|
private OnSweepListener mHorizListener = new OnSweepListener() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onSweep(ChartSweepView sweep, boolean sweepDone) {
|
public void onSweep(ChartSweepView sweep, boolean sweepDone) {
|
||||||
updatePrimaryRange();
|
updatePrimaryRange();
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void requestEdit(ChartSweepView sweep) {
|
public void requestEdit(ChartSweepView sweep) {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
@@ -324,7 +324,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private OnSweepListener mVertListener = new OnSweepListener() {
|
private OnSweepListener mVertListener = new OnSweepListener() {
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void onSweep(ChartSweepView sweep, boolean sweepDone) {
|
public void onSweep(ChartSweepView sweep, boolean sweepDone) {
|
||||||
if (sweepDone) {
|
if (sweepDone) {
|
||||||
clearUpdateAxisDelayed(sweep);
|
clearUpdateAxisDelayed(sweep);
|
||||||
@@ -341,7 +341,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public void requestEdit(ChartSweepView sweep) {
|
public void requestEdit(ChartSweepView sweep) {
|
||||||
if (sweep == mSweepWarning && mListener != null) {
|
if (sweep == mSweepWarning && mListener != null) {
|
||||||
mListener.requestWarningEdit();
|
mListener.requestWarningEdit();
|
||||||
@@ -469,7 +469,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
return Objects.hashCode(mMin, mMax, mSize);
|
return Objects.hashCode(mMin, mMax, mSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public boolean setBounds(long min, long max) {
|
public boolean setBounds(long min, long max) {
|
||||||
if (mMin != min || mMax != max) {
|
if (mMin != min || mMax != max) {
|
||||||
mMin = min;
|
mMin = min;
|
||||||
@@ -480,7 +480,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public boolean setSize(float size) {
|
public boolean setSize(float size) {
|
||||||
if (mSize != size) {
|
if (mSize != size) {
|
||||||
mSize = size;
|
mSize = size;
|
||||||
@@ -490,24 +490,24 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public float convertToPoint(long value) {
|
public float convertToPoint(long value) {
|
||||||
return (mSize * (value - mMin)) / (mMax - mMin);
|
return (mSize * (value - mMin)) / (mMax - mMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public long convertToValue(float point) {
|
public long convertToValue(float point) {
|
||||||
return (long) (mMin + ((point * (mMax - mMin)) / mSize));
|
return (long) (mMin + ((point * (mMax - mMin)) / mSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
|
public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
|
||||||
// TODO: convert to better string
|
// TODO: convert to better string
|
||||||
builder.replace(0, builder.length(), Long.toString(value));
|
builder.replace(0, builder.length(), Long.toString(value));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public float[] getTickPoints() {
|
public float[] getTickPoints() {
|
||||||
final float[] ticks = new float[32];
|
final float[] ticks = new float[32];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -532,7 +532,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
return Arrays.copyOf(ticks, i);
|
return Arrays.copyOf(ticks, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public int shouldAdjustAxis(long value) {
|
public int shouldAdjustAxis(long value) {
|
||||||
// time axis never adjusts
|
// time axis never adjusts
|
||||||
return 0;
|
return 0;
|
||||||
@@ -551,7 +551,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
return Objects.hashCode(mMin, mMax, mSize);
|
return Objects.hashCode(mMin, mMax, mSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public boolean setBounds(long min, long max) {
|
public boolean setBounds(long min, long max) {
|
||||||
if (mMin != min || mMax != max) {
|
if (mMin != min || mMax != max) {
|
||||||
mMin = min;
|
mMin = min;
|
||||||
@@ -562,7 +562,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public boolean setSize(float size) {
|
public boolean setSize(float size) {
|
||||||
if (mSize != size) {
|
if (mSize != size) {
|
||||||
mSize = size;
|
mSize = size;
|
||||||
@@ -572,7 +572,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public float convertToPoint(long value) {
|
public float convertToPoint(long value) {
|
||||||
if (LOG_SCALE) {
|
if (LOG_SCALE) {
|
||||||
// derived polynomial fit to make lower values more visible
|
// derived polynomial fit to make lower values more visible
|
||||||
@@ -585,7 +585,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public long convertToValue(float point) {
|
public long convertToValue(float point) {
|
||||||
if (LOG_SCALE) {
|
if (LOG_SCALE) {
|
||||||
final double normalized = point / mSize;
|
final double normalized = point / mSize;
|
||||||
@@ -600,7 +600,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
private static final Object sSpanSize = new Object();
|
private static final Object sSpanSize = new Object();
|
||||||
private static final Object sSpanUnit = new Object();
|
private static final Object sSpanUnit = new Object();
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
|
public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
|
||||||
|
|
||||||
final CharSequence unit;
|
final CharSequence unit;
|
||||||
@@ -633,7 +633,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
return (long) resultRounded;
|
return (long) resultRounded;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public float[] getTickPoints() {
|
public float[] getTickPoints() {
|
||||||
final long range = mMax - mMin;
|
final long range = mMax - mMin;
|
||||||
|
|
||||||
@@ -650,7 +650,7 @@ public class ChartDataUsageView extends ChartView {
|
|||||||
return tickPoints;
|
return tickPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public int shouldAdjustAxis(long value) {
|
public int shouldAdjustAxis(long value) {
|
||||||
final float point = convertToPoint(value);
|
final float point = convertToPoint(value);
|
||||||
if (point < mSize * 0.1) {
|
if (point < mSize * 0.1) {
|
||||||
|
@@ -30,33 +30,33 @@ public class InvertedChartAxis implements ChartAxis {
|
|||||||
mWrapped = wrapped;
|
mWrapped = wrapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public boolean setBounds(long min, long max) {
|
public boolean setBounds(long min, long max) {
|
||||||
return mWrapped.setBounds(min, max);
|
return mWrapped.setBounds(min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public boolean setSize(float size) {
|
public boolean setSize(float size) {
|
||||||
mSize = size;
|
mSize = size;
|
||||||
return mWrapped.setSize(size);
|
return mWrapped.setSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public float convertToPoint(long value) {
|
public float convertToPoint(long value) {
|
||||||
return mSize - mWrapped.convertToPoint(value);
|
return mSize - mWrapped.convertToPoint(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public long convertToValue(float point) {
|
public long convertToValue(float point) {
|
||||||
return mWrapped.convertToValue(mSize - point);
|
return mWrapped.convertToValue(mSize - point);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
|
public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
|
||||||
return mWrapped.buildLabel(res, builder, value);
|
return mWrapped.buildLabel(res, builder, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public float[] getTickPoints() {
|
public float[] getTickPoints() {
|
||||||
final float[] points = mWrapped.getTickPoints();
|
final float[] points = mWrapped.getTickPoints();
|
||||||
for (int i = 0; i < points.length; i++) {
|
for (int i = 0; i < points.length; i++) {
|
||||||
@@ -65,7 +65,7 @@ public class InvertedChartAxis implements ChartAxis {
|
|||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Override
|
||||||
public int shouldAdjustAxis(long value) {
|
public int shouldAdjustAxis(long value) {
|
||||||
return mWrapped.shouldAdjustAxis(value);
|
return mWrapped.shouldAdjustAxis(value);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user