This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sohu.tv.ui.util; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.os.Build; | |
import android.support.v4.view.ViewCompat; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.view.Window; | |
import android.view.WindowManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IsInstalled { | |
public static boolean isIntalled(Context context, String packageName) { | |
boolean exist = false; | |
PackageManager pm = context.getPackageManager(); | |
Intent intent = new Intent(Intent.ACTION_MAIN, null); | |
intent.addCategory(Intent.CATEGORY_LAUNCHER); | |
List<ResolveInfo> resolveInfoList = pm.queryIntentActivities(intent, 0); | |
for (ResolveInfo resolveInfo : resolveInfoList) { | |
if (resolveInfo.activityInfo.packageName.equals(packageName)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | |
<uses-sdk tools:overrideLibrary="com.facebook.drawee, | |
com.facebook.drawee.backends.pipeline, | |
com.facebook.fbcore, com.facebook.imagepipeline, | |
com.facebook.imagepipelinebase, com.facebook.animated.webp, | |
com.facebook.imagepipeline.animated" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void deleteBars() { | |
this.requestWindowFeature(Window.FEATURE_NO_TITLE); | |
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); | |
View decorView = getWindow().getDecorView(); | |
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; | |
decorView.setSystemUiVisibility(uiOptions); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oldActvity="" | |
displayName="" | |
currentActivity=`adb shell dumpsys window windows | grep -E 'mCurrentFocus'` | |
while true | |
do | |
if [[ $oldActvity != $currentActivity && $currentActivity != *"=null"* ]]; then | |
displayName=${currentActivity##* } // 删除最后一个空格,及其左面的字符串 | |
displayName=${displayName%%\}*} // 删掉第一个\ } 及其右面字符串 | |
echo $displayName | |
oldActvity=$currentActivity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. 项目根目录下 build.gradle 配置 | |
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:1.3.0' | |
classpath 'com.tencent.bugly:symtabfileuploader:latest.release' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 获取中间的方形图片,超出时截取两边 | |
* | |
* @param srcBitmap | |
* @param size 最终正方形的边长 | |
* @return | |
* @throws OutOfMemoryError | |
*/ | |
public static Bitmap getCenterInBitmap(Bitmap srcBitmap, int dstWidth, int dstHeight) { | |
Bitmap finalBm = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
for i in {1..300}; | |
do | |
adb shell input tap 800 800 | |
sleep 10 | |
adb shell input keyevent 4 | |
adb shell input keyevent 4 | |
echo "================" | |
#adb shell dumpsys meminfo com.sohuvideo.sdk_open |grep TOTAL | |
#echo "----------------" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
不使用 AIDL的情况下,进行跨进程通信IPC跨进程通信,通过messager 传递 | |
以下代码是client向RemoteService发送消息,并返回给client | |
参考地址:http://mp.weixin.qq.com/s?__biz=MzA5MzI3NjE2MA==&mid=2650236008&idx=1&sn=c7a1f1de9ee92e6d7a2d00f04821a8c3&scene=0#wechat_redirect | |
http://www.cnblogs.com/freeliver54/archive/2012/06/13/2547739.html | |
1. Activity ============== | |
public class MainActivity extends AppCompatActivity { |
NewerOlder