本文整理汇总了Java中com.mob.tools.utils.DeviceHelper类的典型用法代码示例。如果您正苦于以下问题:Java DeviceHelper类的具体用法?Java DeviceHelper怎么用?Java DeviceHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DeviceHelper类属于com.mob.tools.utils包,在下文中一共展示了DeviceHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkPermissions
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
/**
*
* @return whether all permissions have been granted.
*/
private boolean checkPermissions() {
if (Build.VERSION.SDK_INT >= 23) {
try {
String[] permission = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.ACCESS_NETWORK_STATE,
Manifest.permission.ACCESS_WIFI_STATE};
ArrayList<String> list = new ArrayList<String>();
for (String p : permission) {
if (!DeviceHelper.getInstance(this).checkPermission(p)) {
list.add(p);
}
}
if (list.size() > 0) {
String[] permissions = list.toArray(new String[list.size()]);
if (permissions != null) {
requestPermissions(permissions, 1);
return false;
}
}
} catch (Throwable t) {
t.printStackTrace();
}
}
return true;
}
示例2: d
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
private void d() {
this.d = a();
try {
int stringRes = R.getStringRes(getContext(), "share_to_qzone");
if (stringRes > 0) {
this.d.c().getTvTitle().setText(stringRes);
}
} catch (Throwable th) {
Ln.e(th);
this.d.c().setVisibility(8);
}
this.i.setBodyView(this.d.d());
this.i.setWebView(this.d.b());
this.i.setTitleView(this.d.c());
this.i.onCreate();
this.activity.setContentView(this.d);
if ("none".equals(DeviceHelper.getInstance(this.activity).getDetailNetworkTypeForStatic())) {
this.h = true;
finish();
this.c.onError(null, 0, new Throwable("failed to load webpage, network disconnected."));
return;
}
this.d.b().loadUrl(this.a);
}
示例3: a
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
private void a(WXMediaMessage wXMediaMessage, String str, int i, k kVar) {
Class cls;
String str2 = DeviceHelper.getInstance(kVar.b().getContext()).getPackageName() + ".wxapi.WXEntryActivity";
try {
cls = Class.forName(str2);
} catch (Throwable th) {
Ln.e(th);
cls = null;
}
if (!(cls == null || WechatHandlerActivity.class.isAssignableFrom(cls))) {
String str3 = str2 + " does not extend from " + WechatHandlerActivity.class.getName();
if (a) {
throw new Throwable(str3);
}
new Throwable(str3).printStackTrace();
}
m dVar = new d();
dVar.c = str + System.currentTimeMillis();
dVar.a = wXMediaMessage;
dVar.b = i;
this.d = kVar;
this.c.a(dVar);
}
示例4: run
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
public void run() {
try {
Message message = new Message();
message.what = 2;
if ("none".equals(DeviceHelper.getInstance(this.a.activity).getDetailNetworkTypeForStatic())) {
message.arg1 = 1;
UIHandler.sendMessage(message, this.a);
return;
}
if (ShareSDK.isRemoveCookieOnAuthorize()) {
CookieSyncManager.createInstance(this.a.activity);
CookieManager.getInstance().removeAllCookie();
}
message.obj = this.a.a.getAuthorizeUrl();
UIHandler.sendMessage(message, this.a);
} catch (Throwable th) {
Ln.e(th);
}
}
示例5: i
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
private JSONObject i() {
JSONObject jSONObject = new JSONObject();
DeviceHelper instance = DeviceHelper.getInstance(this.a);
try {
jSONObject.put(SocializeProtocolConstants.PROTOCOL_KEY_MAC, instance.getMacAddress());
jSONObject.put(SocializeProtocolConstants.PROTOCOL_KEY_UDID, instance.getDeviceId());
jSONObject.put("model", instance.getModel());
jSONObject.put("factory", instance.getManufacturer());
jSONObject.put("plat", instance.getPlatformCode());
jSONObject.put("sysver", instance.getOSVersion());
jSONObject.put("breaked", false);
jSONObject.put("screensize", instance.getScreenSize());
jSONObject.put("androidid", instance.getAndroidID());
CharSequence advertisingID = instance.getAdvertisingID();
if (!TextUtils.isEmpty(advertisingID)) {
jSONObject.put("adsid", advertisingID);
}
} catch (Throwable e) {
Ln.e(e);
}
return jSONObject;
}
示例6: j
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
private String j(String str) {
JSONObject i = i();
DeviceHelper instance = DeviceHelper.getInstance(this.a);
try {
i.put("type", "DEVICE");
i.put("key", instance.getDeviceKey());
i.put("carrier", instance.getCarrier());
i.put("appkey", str);
i.put("apppkg", instance.getPackageName());
i.put("appver", String.valueOf(instance.getAppVersion()));
i.put("sdkver", 50000 + ShareSDK.getSDKVersionCode());
i.put("networktype", instance.getDetailNetworkTypeForStatic());
} catch (Throwable e) {
Ln.e(e);
}
return i.toString();
}
示例7: a
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
public void a(String str, ArrayList<HashMap<String, String>> arrayList) {
if (f.h()) {
HashMap hashMap = new HashMap();
hashMap.put("type", str);
DeviceHelper instance = DeviceHelper.getInstance(this.a);
hashMap.put("plat", Integer.valueOf(instance.getPlatformCode()));
hashMap.put("device", instance.getDeviceKey());
hashMap.put("list", arrayList);
Ln.d(" upload apps info == %s", new Hashon().fromHashMap(hashMap));
ArrayList arrayList2 = new ArrayList();
arrayList2.add(new KVPair("m", Data.Base64AES(r0, "sdk.sharesdk.sdk")));
ArrayList arrayList3 = new ArrayList();
arrayList3.add(new KVPair(Network.USER_AGENT, c));
ArrayList arrayList4 = new ArrayList();
arrayList4.add(new KVPair("http.socket.timeout", Integer.valueOf(30000)));
arrayList4.add(new KVPair("http.connection.timeout", Integer.valueOf(30000)));
String httpPost = this.k.httpPost(d(), arrayList2, null, arrayList3, arrayList4);
Ln.i("> APPS_UNFINISHED resp: %s", httpPost);
}
}
示例8: a
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
public a(Context context) {
try {
DeviceHelper instance = DeviceHelper.getInstance(context);
String cachePath = R.getCachePath(context, null);
if (instance.getSdcardState()) {
File file = new File(instance.getSdcardPath(), "ShareSDK");
if (file.exists()) {
this.a = new LocalDB();
this.a.open(new File(file, ".ba").getAbsolutePath());
return;
}
}
this.a = new LocalDB();
File file2 = new File(cachePath, ".ba");
if (!file2.getParentFile().exists()) {
file2.getParentFile().mkdirs();
}
this.a.open(file2.getAbsolutePath());
} catch (Throwable e) {
Ln.e(e);
if (this.a == null) {
this.a = new LocalDB();
}
}
}
示例9: onReceive
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
public void onReceive(Context context, Intent intent) {
int i;
String str = null;
if (intent != null) {
str = intent.getAction();
}
if ("cn.sharesdk.START_UP".equals(str)) {
String packageName = DeviceHelper.getInstance(context).getPackageName();
String stringExtra = intent.getStringExtra("packageName");
if (stringExtra != null && stringExtra.equals(packageName)) {
i = 1;
}
i = 0;
} else {
if (a(str)) {
i = 1;
}
i = 0;
}
if (i != 0) {
Ln.d("========= receive broadcast: " + str, new Object[0]);
this.e.removeMessages(1);
this.e.sendEmptyMessageDelayed(1, 60000);
}
}
示例10: smoothSwitchStatusBar
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
protected void smoothSwitchStatusBar(int height) {
if (Build.VERSION.SDK_INT >= 19) {
LayoutParams layoutParams = (LayoutParams) viewBackground.getLayoutParams();
layoutParams.height = ScreenUtils.dpToPx(40) + DeviceHelper.getInstance(getContext()).getStatusBarHeight();
viewBackground.setLayoutParams(layoutParams);
LayoutParams lp = (LayoutParams) viewTitle.getLayoutParams();
lp.height = ScreenUtils.dpToPx(40) + DeviceHelper.getInstance(getContext()).getStatusBarHeight();
viewTitle.setLayoutParams(lp);
if (height > 20) {
StatusBarCompat.translucentStatusBar((Activity) getContext(),true);
} else {
StatusBarCompat.translucentStatusBar((Activity) getContext(),false);
}
}
}
示例11: smoothSwitchStatusBar
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
protected void smoothSwitchStatusBar(int height) {
if (Build.VERSION.SDK_INT >= 19) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) viewBackground.getLayoutParams();
layoutParams.height = ScreenUtils.dpToPx(44) + DeviceHelper.getInstance(getContext()).getStatusBarHeight();
viewBackground.setLayoutParams(layoutParams);
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) viewTitle.getLayoutParams();
lp.setMargins(0,DeviceHelper.getInstance(getContext()).getStatusBarHeight(),0,0);
viewTitle.setLayoutParams(lp);
if (height > 20) {
StatusBarCompat.translucentStatusBar((Activity) getContext(),true);
} else {
StatusBarCompat.translucentStatusBar((Activity) getContext(),false);
}
}
}
示例12: a
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
public void a(String str, String str2, String str3, String str4, String str5, boolean z, PlatformActionListener platformActionListener) {
if (TextUtils.isEmpty(str2)) {
throw new Throwable("titleUrl is needed");
} else if (TextUtils.isEmpty(str3)) {
throw new Throwable("text is needed");
} else {
CharSequence substring;
String string;
if (str.length() > 200) {
substring = str.substring(0, 200);
}
String substring2 = str3.length() > Record.TTL_MIN_SECONDS ? str3.substring(0, Record.TTL_MIN_SECONDS) : str3;
if (TextUtils.isEmpty(str5)) {
str5 = DeviceHelper.getInstance(this.a.getContext()).getAppName();
}
String str6 = str5.length() > 20 ? str5.substring(0, 20) + "..." : str5;
if (TextUtils.isEmpty(substring)) {
int stringRes = R.getStringRes(this.a.getContext(), "share_to_qzone_default");
string = stringRes > 0 ? this.a.getContext().getString(stringRes, new Object[]{str6}) : str6;
} else {
CharSequence charSequence = substring;
}
if (z) {
a(string, str2, substring2, str4, str6, platformActionListener);
} else {
b(string, str2, substring2, str4, str6, platformActionListener);
}
}
}
示例13: l
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
l(WechatHelper wechatHelper, DeviceHelper deviceHelper, String str, PlatformActionListener platformActionListener, Platform platform, HashMap hashMap) {
this.g = wechatHelper;
this.b = deviceHelper;
this.c = str;
this.d = platformActionListener;
this.e = platform;
this.f = hashMap;
}
示例14: initSDK
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
public static void initSDK(Context context, String str, boolean z) {
Ln.close();
DeviceHelper instance = DeviceHelper.getInstance(context);
if (instance == null) {
throw new NullPointerException("Please call ShareSDK.initSDK(Context) in the main process!");
} else if (instance.isMainProcess(context) && a == null) {
k kVar = new k(context);
kVar.a(str);
kVar.a(z);
kVar.startThread();
a = kVar;
}
}
示例15: toMap
import com.mob.tools.utils.DeviceHelper; //导入依赖的package包/类
protected HashMap<String, Object> toMap() {
HashMap<String, Object> hashMap = new HashMap();
DeviceHelper instance = DeviceHelper.getInstance(this.service.a);
hashMap.put("deviceid", instance.getDeviceKey());
hashMap.put("appkey", this.service.getAppKey());
hashMap.put("apppkg", instance.getPackageName());
hashMap.put("appver", Integer.valueOf(instance.getAppVersion()));
hashMap.put("sdkver", Integer.valueOf(this.service.getServiceVersionInt()));
hashMap.put("plat", Integer.valueOf(1));
hashMap.put("networktype", instance.getDetailNetworkTypeForStatic());
hashMap.put("deviceData", instance.getDeviceDataNotAES());
return hashMap;
}