list = new ArrayList<>();
23 | String lrcText = lrcStr.replaceAll(":", ":")
24 | .replaceAll("
", "\n")
25 | .replaceAll(".", ".")
26 | .replaceAll(" ", " ")
27 | .replaceAll("-", "-")
28 | .replaceAll("
", "\r").replaceAll("'", "'");
29 | String[] split = lrcText.split("\n");
30 | if (split == null || split.length == 0) {
31 | return null;
32 | }
33 | for (int i = 0; i < split.length; i++) {
34 | String lrc = split[i];
35 | if (lrc.contains(".")) {
36 | String min = lrc.substring(lrc.indexOf("[") + 1, lrc.indexOf("[") + 3);
37 | String seconds = lrc.substring(lrc.indexOf(":") + 1, lrc.indexOf(":") + 3);
38 | String mills = lrc.substring(lrc.indexOf(".") + 1, lrc.indexOf(".") + 3);
39 | long startTime = Long.valueOf(min) * 60 * 1000 + Long.valueOf(seconds) * 1000 + Long.valueOf(mills) * 10;
40 | String text = lrc.substring(lrc.indexOf("]") + 1);
41 | if (text == null || "".equals(text)) {
42 | text = "music";
43 | }
44 | LrcBean lrcBean = new LrcBean();
45 | lrcBean.setStart(startTime);
46 | lrcBean.setLrc(text);
47 | list.add(lrcBean);
48 | if (list.size() > 1) {
49 | list.get(list.size() - 2).setEnd(startTime);
50 | }
51 | if (i == split.length - 1) {
52 | list.get(list.size() - 1).setEnd(startTime + 100000);
53 | }
54 | }
55 | }
56 | return list;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/lrcview/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/lrcview/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #31c17d
4 |
5 |
6 |
--------------------------------------------------------------------------------
/lrcview/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | LrcView
3 |
4 |
--------------------------------------------------------------------------------
/lrcview/src/test/java/org/sang/lrcview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package org.sang.lrcview;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':lrcview', ':sharesdk'
2 |
--------------------------------------------------------------------------------
/sharesdk/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/sharesdk/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 15
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 |
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | compile fileTree(dir: 'libs', include: ['*.jar'])
26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
27 | exclude group: 'com.android.support', module: 'support-annotations'
28 | })
29 | compile 'com.android.support:appcompat-v7:24.2.1'
30 | testCompile 'junit:junit:4.12'
31 | }
32 |
--------------------------------------------------------------------------------
/sharesdk/libs/MobCommons-2016.0830.1940.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lenve/QQMusic/0b0ed814d6b8db16c192cdf8f928c8944ccb145d/sharesdk/libs/MobCommons-2016.0830.1940.jar
--------------------------------------------------------------------------------
/sharesdk/libs/MobTools-2016.0830.1940.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lenve/QQMusic/0b0ed814d6b8db16c192cdf8f928c8944ccb145d/sharesdk/libs/MobTools-2016.0830.1940.jar
--------------------------------------------------------------------------------
/sharesdk/libs/ShareSDK-Core-2.7.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lenve/QQMusic/0b0ed814d6b8db16c192cdf8f928c8944ccb145d/sharesdk/libs/ShareSDK-Core-2.7.7.jar
--------------------------------------------------------------------------------
/sharesdk/libs/ShareSDK-QQ-2.7.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lenve/QQMusic/0b0ed814d6b8db16c192cdf8f928c8944ccb145d/sharesdk/libs/ShareSDK-QQ-2.7.7.jar
--------------------------------------------------------------------------------
/sharesdk/libs/ShareSDK-SinaWeibo-2.7.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lenve/QQMusic/0b0ed814d6b8db16c192cdf8f928c8944ccb145d/sharesdk/libs/ShareSDK-SinaWeibo-2.7.7.jar
--------------------------------------------------------------------------------
/sharesdk/libs/ShareSDK-Wechat-2.7.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lenve/QQMusic/0b0ed814d6b8db16c192cdf8f928c8944ccb145d/sharesdk/libs/ShareSDK-Wechat-2.7.7.jar
--------------------------------------------------------------------------------
/sharesdk/libs/ShareSDK-Wechat-Core-2.7.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lenve/QQMusic/0b0ed814d6b8db16c192cdf8f928c8944ccb145d/sharesdk/libs/ShareSDK-Wechat-Core-2.7.7.jar
--------------------------------------------------------------------------------
/sharesdk/libs/ShareSDK-Wechat-Moments-2.7.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lenve/QQMusic/0b0ed814d6b8db16c192cdf8f928c8944ccb145d/sharesdk/libs/ShareSDK-Wechat-Moments-2.7.7.jar
--------------------------------------------------------------------------------
/sharesdk/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Program\sdk\android-sdk-windows/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/sharesdk/src/androidTest/java/org/sang/sharesdk/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package org.sang.sharesdk;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("org.sang.sharesdk.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/sharesdk/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/demo/wxapi/WXEntryActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.demo.wxapi;
10 |
11 | import android.content.Intent;
12 | import android.widget.Toast;
13 | import cn.sharesdk.wechat.utils.WXAppExtendObject;
14 | import cn.sharesdk.wechat.utils.WXMediaMessage;
15 | import cn.sharesdk.wechat.utils.WechatHandlerActivity;
16 |
17 | /** 微信客户端回调activity示例 */
18 | public class WXEntryActivity extends WechatHandlerActivity {
19 |
20 | /**
21 | * 处理微信发出的向第三方应用请求app message
22 | *
23 | * 在微信客户端中的聊天页面有“添加工具”,可以将本应用的图标添加到其中
24 | * 此后点击图标,下面的代码会被执行。Demo仅仅只是打开自己而已,但你可
25 | * 做点其他的事情,包括根本不打开任何页面
26 | */
27 | public void onGetMessageFromWXReq(WXMediaMessage msg) {
28 | if (msg != null) {
29 | Intent iLaunchMyself = getPackageManager().getLaunchIntentForPackage(getPackageName());
30 | startActivity(iLaunchMyself);
31 | }
32 | }
33 |
34 | /**
35 | * 处理微信向第三方应用发起的消息
36 | *
37 | * 此处用来接收从微信发送过来的消息,比方说本demo在wechatpage里面分享
38 | * 应用时可以不分享应用文件,而分享一段应用的自定义信息。接受方的微信
39 | * 客户端会通过这个方法,将这个信息发送回接收方手机上的本demo中,当作
40 | * 回调。
41 | *
42 | * 本Demo只是将信息展示出来,但你可做点其他的事情,而不仅仅只是Toast
43 | */
44 | public void onShowMessageFromWXReq(WXMediaMessage msg) {
45 | if (msg != null && msg.mediaObject != null
46 | && (msg.mediaObject instanceof WXAppExtendObject)) {
47 | WXAppExtendObject obj = (WXAppExtendObject) msg.mediaObject;
48 | Toast.makeText(this, obj.extInfo, Toast.LENGTH_SHORT).show();
49 | }
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/CustomerLogo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare;
10 |
11 | import android.graphics.Bitmap;
12 | import android.view.View.OnClickListener;
13 |
14 | /** 九宫格自定义的图标对象 */
15 | public class CustomerLogo {
16 | public String label;
17 | public Bitmap logo;
18 | public OnClickListener listener;
19 | }
20 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/OnekeySharePage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare;
10 |
11 | import java.util.ArrayList;
12 | import java.util.HashMap;
13 |
14 | import cn.sharesdk.framework.Platform;
15 | import cn.sharesdk.framework.Platform.ShareParams;
16 | import cn.sharesdk.framework.PlatformActionListener;
17 |
18 | import com.mob.tools.FakeActivity;
19 |
20 | /** 快捷分享的基类 */
21 | public class OnekeySharePage extends FakeActivity {
22 | private OnekeyShareThemeImpl impl;
23 |
24 | public OnekeySharePage(OnekeyShareThemeImpl impl) {
25 | this.impl = impl;
26 | }
27 |
28 | /** 分享界面是否弹窗模式 */
29 | protected final boolean isDialogMode() {
30 | return impl.dialogMode;
31 | }
32 |
33 | protected final HashMap getShareParamsMap() {
34 | return impl.shareParamsMap;
35 | }
36 |
37 | /** 静默分享开关(没有界面,直接分享 )*/
38 | protected final boolean isSilent() {
39 | return impl.silent;
40 | }
41 |
42 | protected final ArrayList getCustomerLogos() {
43 | return impl.customerLogos;
44 | }
45 |
46 | protected final HashMap getHiddenPlatforms() {
47 | return impl.hiddenPlatforms;
48 | }
49 |
50 | protected final PlatformActionListener getCallback() {
51 | return impl.callback;
52 | }
53 |
54 | protected final ShareContentCustomizeCallback getCustomizeCallback() {
55 | return impl.customizeCallback;
56 | }
57 |
58 | protected final boolean isDisableSSO() {
59 | return impl.disableSSO;
60 | }
61 |
62 | protected final void shareSilently(Platform platform) {
63 | impl.shareSilently(platform);
64 | }
65 |
66 | protected final ShareParams formateShareData(Platform platform) {
67 | if (impl.formateShareData(platform)) {
68 | return impl.shareDataToShareParams(platform);
69 | }
70 | return null;
71 | }
72 |
73 | protected final boolean isUseClientToShare(Platform platform) {
74 | return impl.isUseClientToShare(platform);
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/OnekeyShareTheme.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare;
10 |
11 | import cn.sharesdk.onekeyshare.themes.classic.ClassicTheme;
12 |
13 | /** 快捷分享的主题样式 */
14 | public enum OnekeyShareTheme {
15 | /** 九格宫的主题样式 ,对应的实现类ClassicTheme */
16 | CLASSIC(0, new ClassicTheme());
17 |
18 | private final int value;
19 | private final OnekeyShareThemeImpl impl;
20 |
21 | private OnekeyShareTheme(int value, OnekeyShareThemeImpl impl) {
22 | this.value = value;
23 | this.impl = impl;
24 | }
25 |
26 | public int getValue() {
27 | return value;
28 | }
29 |
30 | public OnekeyShareThemeImpl getImpl() {
31 | return impl;
32 | }
33 |
34 | public static OnekeyShareTheme fromValue(int value) {
35 | for (OnekeyShareTheme theme : OnekeyShareTheme.values()) {
36 | if (theme.value == value) {
37 | return theme;
38 | }
39 | }
40 | return CLASSIC;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/ShareContentCustomizeCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare;
10 |
11 | import cn.sharesdk.framework.Platform;
12 | import cn.sharesdk.framework.Platform.ShareParams;
13 |
14 | /** 自定义不同平台分享不同内容的接口 */
15 | public interface ShareContentCustomizeCallback {
16 |
17 | public void onShare(Platform platform, ShareParams paramsToShare);
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/themes/classic/ClassicTheme.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare.themes.classic;
10 |
11 | import android.content.Context;
12 | import android.content.res.Configuration;
13 | import cn.sharesdk.framework.Platform;
14 | import cn.sharesdk.framework.Platform.ShareParams;
15 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl;
16 | import cn.sharesdk.onekeyshare.themes.classic.land.EditPageLand;
17 | import cn.sharesdk.onekeyshare.themes.classic.land.PlatformPageLand;
18 | import cn.sharesdk.onekeyshare.themes.classic.port.EditPagePort;
19 | import cn.sharesdk.onekeyshare.themes.classic.port.PlatformPagePort;
20 |
21 | /** 九宫格经典主题样式的实现类*/
22 | public class ClassicTheme extends OnekeyShareThemeImpl {
23 |
24 | /** 展示平台列表*/
25 | protected void showPlatformPage(Context context) {
26 | PlatformPage page;
27 | int orientation = context.getResources().getConfiguration().orientation;
28 | if (orientation == Configuration.ORIENTATION_PORTRAIT) {
29 | page = new PlatformPagePort(this);
30 | } else {
31 | page = new PlatformPageLand(this);
32 | }
33 | page.show(context, null);
34 | }
35 |
36 | /** 展示编辑界面*/
37 | protected void showEditPage(Context context, Platform platform, ShareParams sp) {
38 | EditPage page;
39 | int orientation = context.getResources().getConfiguration().orientation;
40 | if (orientation == Configuration.ORIENTATION_PORTRAIT) {
41 | page = new EditPagePort(this);
42 | } else {
43 | page = new EditPageLand(this);
44 | }
45 | page.setPlatform(platform);
46 | page.setShareParams(sp);
47 | page.show(context, null);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/themes/classic/FriendListItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare.themes.classic;
10 |
11 | import android.content.Context;
12 | import android.graphics.Bitmap;
13 | import android.graphics.BitmapFactory;
14 | import android.util.TypedValue;
15 | import android.view.Gravity;
16 | import android.widget.ImageView;
17 | import android.widget.LinearLayout;
18 | import android.widget.TextView;
19 | import cn.sharesdk.onekeyshare.themes.classic.FriendAdapter.Following;
20 |
21 | import com.mob.tools.gui.AsyncImageView;
22 | import com.mob.tools.gui.BitmapProcessor;
23 | import com.mob.tools.utils.R;
24 |
25 | /** 好友列表的item */
26 | public class FriendListItem extends LinearLayout {
27 | private static final int DESIGN_AVATAR_WIDTH = 64;
28 | private static final int DESIGN_AVATAR_PADDING = 24;
29 | private static final int DESIGN_ITEM_HEIGHT = 96;
30 | private static final int DESIGN_ITEM_PADDING = 20;
31 |
32 | private ImageView ivCheck;
33 | private AsyncImageView aivIcon;
34 | private TextView tvName;
35 | /** 好友列表中,被选中的checkbox图标 */
36 | private Bitmap bmChd;
37 | /** 好友列表中,没选中的checkbox图标 */
38 | private Bitmap bmUnch;
39 |
40 | public FriendListItem(Context context, float ratio) {
41 | super(context);
42 | int itemPadding = (int) (ratio * DESIGN_ITEM_PADDING);
43 | setPadding(itemPadding, 0, itemPadding, 0);
44 | setMinimumHeight((int) (ratio * DESIGN_ITEM_HEIGHT));
45 | setBackgroundColor(0xffffffff);
46 |
47 | ivCheck = new ImageView(context);
48 | LayoutParams lp = new LayoutParams(
49 | LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
50 | lp.gravity = Gravity.CENTER_VERTICAL;
51 | addView(ivCheck, lp);
52 |
53 | aivIcon = new AsyncImageView(context);
54 | int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
55 | lp = new LayoutParams(avatarWidth, avatarWidth);
56 | lp.gravity = Gravity.CENTER_VERTICAL;
57 | int avatarMargin = (int) (ratio * DESIGN_AVATAR_PADDING);
58 | lp.setMargins(avatarMargin, 0, avatarMargin, 0);
59 | addView(aivIcon, lp);
60 |
61 | tvName = new TextView(context);
62 | tvName.setTextColor(0xff000000);
63 | tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
64 | tvName.setSingleLine();
65 | lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
66 | lp.gravity = Gravity.CENTER_VERTICAL;
67 | lp.weight = 1;
68 | addView(tvName, lp);
69 |
70 | int resId = R.getBitmapRes(context, "ssdk_oks_classic_check_checked");
71 | if (resId > 0) {
72 | bmChd = BitmapFactory.decodeResource(context.getResources(), resId);
73 | }
74 | resId = R.getBitmapRes(getContext(), "ssdk_oks_classic_check_default");
75 | if (resId > 0) {
76 | bmUnch = BitmapFactory.decodeResource(context.getResources(), resId);
77 | }
78 | }
79 |
80 | public void update(Following following, boolean fling) {
81 | tvName.setText(following.screenName);
82 | ivCheck.setImageBitmap(following.checked ? bmChd : bmUnch);
83 | if (aivIcon != null) {
84 | if (fling) {
85 | Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon);
86 | if (bm != null && !bm.isRecycled()) {
87 | aivIcon.setImageBitmap(bm);
88 | } else {
89 | aivIcon.execute(null, 0);
90 | }
91 | } else {
92 | aivIcon.execute(following.icon, 0);
93 | }
94 | }
95 | }
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/themes/classic/IndicatorView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare.themes.classic;
10 |
11 | import android.content.Context;
12 | import android.graphics.Canvas;
13 | import android.graphics.Paint;
14 | import android.view.View;
15 |
16 | /** 九宫格滑动时,下面显示的圆圈 */
17 | public class IndicatorView extends View {
18 | private static final int DESIGN_INDICATOR_RADIUS = 6;
19 | private static final int DESIGN_INDICATOR_DISTANCE = 14;
20 | private static final int DESIGN_BOTTOM_HEIGHT = 52;
21 | /** 九格宫有多少页数 */
22 | private int count;
23 | /** 当前显示的是九格宫中的第几页 */
24 | private int current;
25 |
26 | public IndicatorView(Context context) {
27 | super(context);
28 | }
29 |
30 | public void setScreenCount(int count) {
31 | this.count = count;
32 | }
33 |
34 | public void onScreenChange(int currentScreen, int lastScreen) {
35 | if (currentScreen != current) {
36 | current = currentScreen;
37 | postInvalidate();
38 | }
39 | }
40 |
41 | protected void onDraw(Canvas canvas) {
42 | if (count <= 1) {
43 | this.setVisibility(View.GONE);
44 | return;
45 | }
46 | float height = getHeight();
47 | float radius = height * DESIGN_INDICATOR_RADIUS / DESIGN_BOTTOM_HEIGHT;
48 | float distance = height * DESIGN_INDICATOR_DISTANCE / DESIGN_BOTTOM_HEIGHT;
49 | float windowWidth = radius * 2 * count + distance * (count - 1);
50 | float left = (getWidth() - windowWidth) / 2;
51 | float cy = height / 2;
52 |
53 | canvas.drawColor(0xffffffff);
54 | Paint paint = new Paint();
55 | paint.setAntiAlias(true);
56 | for (int i = 0; i < count; i++) {
57 | if (i == current) {
58 | paint.setColor(0xff5d71a0);
59 | } else {
60 | paint.setColor(0xffafb1b7);
61 | }
62 | float cx = left + (radius * 2 + distance) * i;
63 | canvas.drawCircle(cx, cy, radius, paint);
64 | }
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/themes/classic/PRTHeader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare.themes.classic;
10 |
11 | import static com.mob.tools.utils.R.getStringRes;
12 | import android.content.Context;
13 | import android.graphics.drawable.Drawable;
14 | import android.util.TypedValue;
15 | import android.view.Gravity;
16 | import android.view.View;
17 | import android.widget.LinearLayout;
18 | import android.widget.ProgressBar;
19 | import android.widget.TextView;
20 |
21 | import com.mob.tools.utils.R;
22 |
23 | /** 下拉刷新的头部控件 */
24 | public class PRTHeader extends LinearLayout {
25 | private static final int DESIGN_SCREEN_WIDTH = 720;
26 | private static final int DESIGN_AVATAR_WIDTH = 64;
27 | private static final int DESIGN_AVATAR_PADDING = 24;
28 |
29 | private TextView tvHeader;
30 | private RotateImageView ivArrow;
31 | private ProgressBar pbRefreshing;
32 |
33 | public PRTHeader(Context context) {
34 | super(context);
35 | int[] size = R.getScreenSize(context);
36 | float screenWidth = size[0] < size[1] ? size[0] : size[1];
37 | float ratio = screenWidth / DESIGN_SCREEN_WIDTH;
38 |
39 | setOrientation(VERTICAL);
40 |
41 | LinearLayout llInner = new LinearLayout(context);
42 | LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
43 | lp.gravity = Gravity.CENTER_HORIZONTAL;
44 | addView(llInner, lp);
45 |
46 | ivArrow = new RotateImageView(context);
47 | int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr");
48 | if (resId > 0) {
49 | ivArrow.setImageResource(resId);
50 | }
51 | int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
52 | lp = new LayoutParams(avatarWidth, avatarWidth);
53 | lp.gravity = Gravity.CENTER_VERTICAL;
54 | int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING);
55 | lp.topMargin = lp.bottomMargin = avataPadding;
56 | llInner.addView(ivArrow, lp);
57 |
58 | pbRefreshing = new ProgressBar(context);
59 | resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar");
60 | Drawable pbdrawable = context.getResources().getDrawable(resId);
61 | pbRefreshing.setIndeterminateDrawable(pbdrawable);
62 | llInner.addView(pbRefreshing, lp);
63 | pbRefreshing.setVisibility(View.GONE);
64 |
65 | tvHeader = new TextView(getContext());
66 | tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
67 | tvHeader.setPadding(avataPadding, 0, avataPadding, 0);
68 | tvHeader.setTextColor(0xff09bb07);
69 | lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
70 | lp.gravity = Gravity.CENTER_VERTICAL;
71 | llInner.addView(tvHeader, lp);
72 | }
73 |
74 | public void onPullDown(int percent) {
75 | if (percent > 100) {
76 | int degree = (percent - 100) * 180 / 20;
77 | if (degree > 180) {
78 | degree = 180;
79 | }
80 | if (degree < 0) {
81 | degree = 0;
82 | }
83 | ivArrow.setRotation(degree);
84 | } else {
85 | ivArrow.setRotation(0);
86 | }
87 |
88 | if (percent < 100) {
89 | int resId = getStringRes(getContext(), "ssdk_oks_pull_to_refresh");
90 | if (resId > 0) {
91 | tvHeader.setText(resId);
92 | }
93 | } else {
94 | int resId = getStringRes(getContext(), "ssdk_oks_release_to_refresh");
95 | if (resId > 0) {
96 | tvHeader.setText(resId);
97 | }
98 | }
99 | }
100 |
101 | public void onRequest() {
102 | ivArrow.setVisibility(View.GONE);
103 | pbRefreshing.setVisibility(View.VISIBLE);
104 | int resId = getStringRes(getContext(), "ssdk_oks_refreshing");
105 | if (resId > 0) {
106 | tvHeader.setText(resId);
107 | }
108 | }
109 |
110 | public void reverse() {
111 | pbRefreshing.setVisibility(View.GONE);
112 | ivArrow.setRotation(180);
113 | ivArrow.setVisibility(View.VISIBLE);
114 | }
115 |
116 | }
117 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/themes/classic/PicViewerPage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare.themes.classic;
10 |
11 | import android.graphics.Bitmap;
12 | import android.graphics.drawable.ColorDrawable;
13 | import android.view.ViewTreeObserver.OnGlobalLayoutListener;
14 | import android.widget.ImageView.ScaleType;
15 | import cn.sharesdk.onekeyshare.OnekeySharePage;
16 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl;
17 |
18 | import com.mob.tools.gui.ScaledImageView;
19 |
20 | /** 图片浏览的视图类 */
21 | public class PicViewerPage extends OnekeySharePage implements OnGlobalLayoutListener {
22 | private Bitmap pic;
23 | /** 图片浏览的缩放控件 */
24 | private ScaledImageView sivViewer;
25 |
26 | public PicViewerPage(OnekeyShareThemeImpl impl) {
27 | super(impl);
28 | }
29 |
30 | /** 设置图片用于浏览 */
31 | public void setImageBitmap(Bitmap pic) {
32 | this.pic = pic;
33 | }
34 |
35 | public void onCreate() {
36 | activity.getWindow().setBackgroundDrawable(new ColorDrawable(0x4c000000));
37 |
38 | sivViewer = new ScaledImageView(activity);
39 | sivViewer.setScaleType(ScaleType.MATRIX);
40 | activity.setContentView(sivViewer);
41 | if (pic != null) {
42 | sivViewer.getViewTreeObserver().addOnGlobalLayoutListener(this);
43 | }
44 | }
45 |
46 | public void onGlobalLayout() {
47 | sivViewer.getViewTreeObserver().removeGlobalOnLayoutListener(this);
48 | sivViewer.post(new Runnable() {
49 | public void run() {
50 | sivViewer.setBitmap(pic);
51 | }
52 | });
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/themes/classic/RotateImageView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare.themes.classic;
10 |
11 | import android.content.Context;
12 | import android.graphics.Canvas;
13 | import android.widget.ImageView;
14 |
15 | /** 在At好友页面中,下拉刷新列表头部的旋转箭头 */
16 | public class RotateImageView extends ImageView {
17 | private float rotation;
18 |
19 | public RotateImageView(Context context) {
20 | super(context);
21 | }
22 |
23 | public void setRotation(float rotation) {
24 | this.rotation = rotation;
25 | invalidate();
26 | }
27 |
28 | protected void onDraw(Canvas canvas) {
29 | canvas.rotate(rotation, getWidth() / 2, getHeight() / 2);
30 | super.onDraw(canvas);
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/themes/classic/XView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare.themes.classic;
10 |
11 | import android.content.Context;
12 | import android.graphics.Canvas;
13 | import android.graphics.Paint;
14 | import android.view.View;
15 |
16 | /** 编辑页面中删除图片“X”按钮 */
17 | public class XView extends View {
18 | private float ratio;
19 |
20 | public XView(Context context) {
21 | super(context);
22 | }
23 |
24 | public void setRatio(float ratio) {
25 | this.ratio = ratio;
26 | }
27 |
28 | protected void onDraw(Canvas canvas) {
29 | int width = getWidth() / 2;
30 | int height = getHeight() / 2;
31 |
32 | Paint paint = new Paint();
33 | paint.setAntiAlias(true);
34 | paint.setColor(0xffa0a0a0);
35 | canvas.drawRect(width, 0, getWidth(), height, paint);
36 |
37 | paint = new Paint();
38 | paint.setAntiAlias(true);
39 | paint.setStrokeWidth(3f * ratio);
40 | paint.setColor(0xffffffff);
41 | float left = 8f * ratio;
42 | canvas.drawLine(width + left, left, getWidth() - left, width - left, paint);
43 | canvas.drawLine(width + left, width - left, getWidth() - left, left, paint);
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/themes/classic/land/FriendListPageLand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare.themes.classic.land;
10 |
11 | import com.mob.tools.utils.R;
12 |
13 | import cn.sharesdk.onekeyshare.OnekeyShareThemeImpl;
14 | import cn.sharesdk.onekeyshare.themes.classic.FriendListPage;
15 |
16 | /** 横屏的好友列表 */
17 | public class FriendListPageLand extends FriendListPage {
18 | private static final int DESIGN_SCREEN_WIDTH = 1280;
19 | private static final int DESIGN_TITLE_HEIGHT = 70;
20 |
21 | public FriendListPageLand(OnekeyShareThemeImpl impl) {
22 | super(impl);
23 | }
24 |
25 | protected float getRatio() {
26 | float screenWidth = R.getScreenWidth(activity);
27 | return screenWidth / DESIGN_SCREEN_WIDTH;
28 | }
29 |
30 | protected int getDesignTitleHeight() {
31 | return DESIGN_TITLE_HEIGHT;
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/sharesdk/src/main/java/cn/sharesdk/onekeyshare/themes/classic/land/PlatformPageAdapterLand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package cn.sharesdk.onekeyshare.themes.classic.land;
10 |
11 | import java.util.ArrayList;
12 |
13 | import android.content.Context;
14 | import cn.sharesdk.onekeyshare.themes.classic.PlatformPage;
15 | import cn.sharesdk.onekeyshare.themes.classic.PlatformPageAdapter;
16 |
17 | import com.mob.tools.utils.R;
18 |
19 | /** 横屏的九宫格页面适配器 */
20 | public class PlatformPageAdapterLand extends PlatformPageAdapter {
21 | private static final int DESIGN_SCREEN_WIDTH_L = 1280;
22 | private static final int DESIGN_CELL_WIDTH_L = 160;
23 | private static final int DESIGN_SEP_LINE_WIDTH = 1;
24 | private static final int DESIGN_LOGO_HEIGHT = 76;
25 | private static final int DESIGN_PADDING_TOP = 20;
26 |
27 | public PlatformPageAdapterLand(PlatformPage page, ArrayList