| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.memconsumer; | 5 package org.chromium.memconsumer; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.ComponentName; | 8 import android.content.ComponentName; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.Intent; | 10 import android.content.Intent; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 public void onValueChange(NumberPicker picker, int oldVal, int newVa
l) { | 51 public void onValueChange(NumberPicker picker, int oldVal, int newVa
l) { |
| 52 updateMemoryConsumption(picker.getValue()); | 52 updateMemoryConsumption(picker.getValue()); |
| 53 } | 53 } |
| 54 }); | 54 }); |
| 55 for (int i = 0; i < mMemoryPicker.getChildCount(); i++) { | 55 for (int i = 0; i < mMemoryPicker.getChildCount(); i++) { |
| 56 View child = mMemoryPicker.getChildAt(i); | 56 View child = mMemoryPicker.getChildAt(i); |
| 57 if (child instanceof EditText) { | 57 if (child instanceof EditText) { |
| 58 EditText editText = (EditText) child; | 58 EditText editText = (EditText) child; |
| 59 editText.setOnEditorActionListener(new TextView.OnEditorActionLi
stener() { | 59 editText.setOnEditorActionListener(new TextView.OnEditorActionLi
stener() { |
| 60 @Override | 60 @Override |
| 61 public boolean onEditorAction (TextView v, int actionId, Key
Event event) { | 61 public boolean onEditorAction(TextView v, int actionId, KeyE
vent event) { |
| 62 if (v.getText().length() > 0) { | 62 if (v.getText().length() > 0) { |
| 63 updateMemoryConsumption(Integer.parseInt(v.getText()
.toString())); | 63 updateMemoryConsumption(Integer.parseInt(v.getText()
.toString())); |
| 64 } | 64 } |
| 65 return false; | 65 return false; |
| 66 } | 66 } |
| 67 }); | 67 }); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 setContentView(mMemoryPicker); | 70 setContentView(mMemoryPicker); |
| 71 onNewIntent(getIntent()); | 71 onNewIntent(getIntent()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 98 } else { | 98 } else { |
| 99 mResidentService.useMemory(mMemory); | 99 mResidentService.useMemory(mMemory); |
| 100 if (mMemory == 0) { | 100 if (mMemory == 0) { |
| 101 unbindService(mServiceConnection); | 101 unbindService(mServiceConnection); |
| 102 stopService(new Intent(this, ResidentService.class)); | 102 stopService(new Intent(this, ResidentService.class)); |
| 103 mResidentService = null; | 103 mResidentService = null; |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 } | 107 } |
| OLD | NEW |