本文整理汇总了Java中android.os.Looper.prepare方法的典型用法代码示例。如果您正苦于以下问题:Java Looper.prepare方法的具体用法?Java Looper.prepare怎么用?Java Looper.prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Looper
的用法示例。
在下文中一共展示了Looper.prepare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import android.os.Looper; //导入方法依赖的package包/类
@Before
public void setup() {
if (Looper.myLooper() == null) {
Looper.prepare();
}
Context context = InstrumentationRegistry.getTargetContext();
manager = new BrickDataManager(MAX_SPANS);
View parentView = mock(View.class);
manager.setRecyclerView(context, new RecyclerView(context), GridLayoutManager.VERTICAL, false, parentView);
brickTestHelper = new BrickTestHelper(context);
manager.addLast(brickTestHelper.generateBrick());
manager.addLast(brickTestHelper.generateBrick());
manager.addLast(brickTestHelper.generateBrick());
manager.addLast(brickTestHelper.generateBrick());
footerBehavior = mock(StickyFooterBehavior.class);
manager.addBehavior(footerBehavior);
headerBehavior = mock(StickyHeaderBehavior.class);
manager.addBehavior(headerBehavior);
observer = new BrickTestHelper.TestAdapterDataObserver();
manager.getBrickRecyclerAdapter().registerAdapterDataObserver(observer);
}
开发者ID:wayfair,项目名称:brickkit-android,代码行数:26,代码来源:BrickDataManagerTest.java示例2: run
import android.os.Looper; //导入方法依赖的package包/类
public void run(){
// There are minimum OS version requirements
if(versionCheck()){
// Reference: http://developer.android.com/reference/android/os/Process.html#THREAD_PRIORITY_BACKGROUND
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
// We are running a Looper to allow the Cordova CallbackContext to be passed within the Thread as a message.
if(Looper.myLooper() == null){
_telephonyManager = (TelephonyManager) _cordova.getActivity().getSystemService(Context.TELEPHONY_SERVICE);
Looper.prepare();
startLocation();
Looper.loop();
}
}
else {
Log.e(TAG, ErrorMessages.CELL_DATA_MIN_VERSION().message);
sendCallback(PluginResult.Status.ERROR,
JSONHelper.errorJSON(CELLINFO_PROVIDER, ErrorMessages.CELL_DATA_MIN_VERSION()));
}
}
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:22,代码来源:CellLocationController.java示例3: run
import android.os.Looper; //导入方法依赖的package包/类
/**
* Thread entry point.
* <p>
* The thread should not be started until the Surface associated with the SurfaceHolder
* has been created. That way we don't have to wait for a separate "surface created"
* message to arrive.
*/
@Override
public void run() {
Looper.prepare();
mHandler = new RenderHandler(this);
mEglCore = new EglCore(null, 0);
synchronized (mStartLock) {
mReady = true;
mStartLock.notify(); // signal waitUntilReady()
}
Looper.loop();
Log.d(TAG, "looper quit");
releaseGl();
mEglCore.release();
synchronized (mStartLock) {
mReady = false;
}
}
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:28,代码来源:HardwareScalerActivity.java示例4: run
import android.os.Looper; //导入方法依赖的package包/类
public void run(){
// Reference: http://developer.android.com/reference/android/os/Process.html#THREAD_PRIORITY_BACKGROUND
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
// We are running a Looper to allow the Cordova CallbackContext to be passed within the Thread as a message.
if(Looper.myLooper() == null){
_locationManager = (LocationManager) _cordova.getActivity().getSystemService(Context.LOCATION_SERVICE);
Looper.prepare();
startLocation();
Looper.loop();
}
}
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:13,代码来源:GPSController.java示例5: run
import android.os.Looper; //导入方法依赖的package包/类
@Override
public void run() {
Looper.prepare();
handler = new DecodeHandler(activity, hints);
handlerInitLatch.countDown();
Looper.loop();
}
开发者ID:TommyLemon,项目名称:APIJSON-Android-RxJava,代码行数:8,代码来源:DecodeThread.java示例6: restartGame
import android.os.Looper; //导入方法依赖的package包/类
@Override
protected void restartGame() {
super.restartGame();
if (Looper.myLooper() == null) {
Looper.prepare();
}
Point dimens = new Point(gameView.getWidth(), gameView.getHeight());
onSurfaceChanged(getSurfaceHolder(), format, dimens.x, dimens.y);
}
开发者ID:StringMon,项目名称:homescreenarcade,代码行数:11,代码来源:MazeManWallpaper.java示例7: prepareTest
import android.os.Looper; //导入方法依赖的package包/类
@Override
public void prepareTest() {
Looper.prepare();
try {
Constructor<?> constructor = subscriberClass.getConstructor(PerfTestOtto.class);
for (int i = 0; i < params.getSubscriberCount(); i++) {
Object subscriber = constructor.newInstance(this);
subscribers.add(subscriber);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:PerfTestOtto.java示例8: removeAllCookiesV21
import android.os.Looper; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void removeAllCookiesV21() {
final CookieManager cookieManager = CookieManager.getInstance();
Looper looper = Looper.myLooper();
boolean prepared = false;
if (looper == null) {
Looper.prepare();
prepared = true;
}
// requires a looper
cookieManager.removeAllCookies(new ValueCallback<Boolean>() {
@Override
public void onReceiveValue(Boolean value) {
Thread thread = new Thread() {
@Override
public void run() {
// is synchronous, run in background
cookieManager.flush();
}
};
thread.start();
}
});
if (prepared) {
looper = Looper.myLooper();
if (looper != null) {
looper.quit();
}
}
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:34,代码来源:EvernoteUtil.java示例9: run
import android.os.Looper; //导入方法依赖的package包/类
@Override
public void run() {
Looper.prepare();
handler = new Handler();
syncLatch.countDown();
Looper.loop();
}
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:8,代码来源:DispatchQueue.java示例10: run
import android.os.Looper; //导入方法依赖的package包/类
@Override
public void run() {
Looper.prepare();
handler = new DecodeHandler(activity, hints);
handlerInitLatch.countDown();
Looper.loop();
}
开发者ID:CardInfoLink,项目名称:QRScanner,代码行数:8,代码来源:DecodeThread.java示例11: run
import android.os.Looper; //导入方法依赖的package包/类
@Override
public void run() {
Looper.prepare();
mHandler = new DecodeHandler(mActivity);
mHandlerInitLatch.countDown();
Looper.loop();
}
开发者ID:simplezhli,项目名称:Tesseract-OCR-Scanner,代码行数:8,代码来源:DecodeThread.java示例12: start
import android.os.Looper; //导入方法依赖的package包/类
public static Thread start(final Actionable actionable) {
Thread t=new Thread(new Runnable(){
public void run() {
actionable.doInThread();
Looper.prepare();
actionable.callback();
Looper.loop();
}
});
t.start();
return t;
}
开发者ID:TIIEHenry,项目名称:TIIEHenry-Android-SDK,代码行数:13,代码来源:Task.java示例13: run
import android.os.Looper; //导入方法依赖的package包/类
@Override
public void run() {
Looper.prepare();
handler = new DecodeHandler(barcodeReaderView, hints);
handlerInitLatch.countDown();
Looper.loop();
}
开发者ID:CoderChoy,项目名称:BarcodeReaderView,代码行数:8,代码来源:DecodeThread.java示例14: setup
import android.os.Looper; //导入方法依赖的package包/类
@Before
public void setup() {
if (Looper.myLooper() == null) {
Looper.prepare();
}
context = InstrumentationRegistry.getTargetContext();
recyclerView = mock(RecyclerView.class);
adapter = mock(BrickRecyclerAdapter.class);
view = mock(View.class);
dataManager = mock(BrickDataManager.class);
when(dataManager.getBrickRecyclerAdapter()).thenReturn(adapter);
when(adapter.getRecyclerView()).thenReturn(recyclerView);
itemView = new TextView(context);
((TextView) itemView).setText(TEST);
itemView.measure(MOCK_VIEW_SIZE, MOCK_VIEW_SIZE);
stickyViewHolder = new BrickViewHolder(itemView);
stickyHolderContainer = spy((ViewGroup) LayoutInflater.from(context).inflate(R.layout.vertical_header, new LinearLayout(context), false));
stickyHolderContainer.layout(0, 0, MOCK_VIEW_SIZE, MOCK_VIEW_SIZE);
stickyHolderContainer.setLayoutParams(new ViewGroup.LayoutParams(MOCK_VIEW_SIZE, MOCK_VIEW_SIZE));
View header = spy((ViewGroup) LayoutInflater.from(context).inflate(R.layout.text_brick, new LinearLayout(context), false));
header.layout(0, 0, MOCK_VIEW_SIZE, MOCK_VIEW_SIZE);
header.setLayoutParams(new ViewGroup.LayoutParams(MOCK_VIEW_SIZE, MOCK_VIEW_SIZE));
stickyHolderLayout = ((ViewGroup) stickyHolderContainer.findViewById(R.id.header_sticky_layout));
stickyHolderLayout.addView(header);
headerBehavior = spy(new TestStickyHeaderBehavior(dataManager, stickyHolderContainer));
headerBehavior.swapStickyView(stickyViewHolder);
headerBehavior.translateStickyView();
headerBehavior.setStickyBackgroundColor(Color.WHITE);
}
开发者ID:wayfair,项目名称:brickkit-android,代码行数:38,代码来源:StickyHeaderBehaviorTest.java示例15: initializeLooper
import android.os.Looper; //导入方法依赖的package包/类
private Looper initializeLooper() {
Looper looper = Looper.myLooper();
if (looper == null) {
Looper.prepare();
}
return Looper.myLooper();
}
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:10,代码来源:TelephonyServiceState.java本文标签属性:
示例:示例的拼音
代码:代码零九
java:java面试题
Looper:looper下载
prepare:preparefor