public void onCreate() { if (shareParamMap == null || platforms == null || platforms.size() < 1) { finish(); return; } getBackground(); activity.setContentView(getPageView()); onTextChanged(etContent.getText(), 0, etContent.length(), 0); showThumb(); // requests platform list and remove platforms share in their clients new Thread() { public void run() { try { platformList = ShareSDK.getPlatformList(); if (platformList == null) { return; } ArrayList<Platform> list = new ArrayList<Platform>(); for (Platform plat : platformList) { String name = plat.getName(); if ((plat instanceof CustomPlatform) || ShareCore.isUseClientToShare(name)) { continue; } list.add(plat); } platformList = new Platform[list.size()]; for (int i = 0; i < platformList.length; i++) { platformList[i] = list.get(i); } UIHandler.sendEmptyMessage( 1, new Callback() { public boolean handleMessage(Message msg) { afterPlatformListGot(); return false; } }); } catch (Throwable t) { t.printStackTrace(); } } }.start(); }
public void onTextChanged(CharSequence s, int start, int before, int count) { int remain = MAX_TEXT_COUNT - etContent.length(); tvCounter.setText(String.valueOf(remain)); tvCounter.setTextColor(remain > 0 ? 0xffcfcfcf : 0xffff0000); }