Commit f12c4d34dc113a412d138f63d9a79a21a3858c46
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/newModuleStrike
# Conflicts: # app/strike/src/main/java/com/cnlive/strike/MainActivity.java
Showing
78 changed files
with
246 additions
and
1147 deletions
app/strike/build.gradle
| ... | ... | @@ -95,6 +95,7 @@ android { |
| 95 | 95 | release { |
| 96 | 96 | signingConfig signingConfigs.releaseConfig |
| 97 | 97 | zipAlignEnabled true |
| 98 | + debuggable = true | |
| 98 | 99 | resValue("string", "app_name", "网家家") |
| 99 | 100 | buildConfigField("boolean", "VERSION_AS_DEBUG", "false") |
| 100 | 101 | buildConfigField("String", "APP_ID", stringValue("769_jetj7bq525")) | ... | ... |
app/strike/src/BaseRequest.java deleted
100644 → 0
| 1 | -package com.cnlive.strike.user.network.api; | |
| 2 | - | |
| 3 | - | |
| 4 | -import android.text.TextUtils; | |
| 5 | - | |
| 6 | -import com.cnlive.core.libs.base.application.AppConfig; | |
| 7 | -import com.cnlive.core.network.BaseResult; | |
| 8 | -import com.cnlive.core.network.NetBuilder; | |
| 9 | -import com.cnlive.core.network.ServerException; | |
| 10 | - | |
| 11 | -import java.util.ArrayList; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -import io.reactivex.Observable; | |
| 15 | -import okhttp3.Interceptor; | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * 基本请求 | |
| 19 | - * ys | |
| 20 | - */ | |
| 21 | -public class BaseRequest { | |
| 22 | - private String userSetUrl; | |
| 23 | - private static BaseRequest request; | |
| 24 | - private long connectTimeout;//连接超时 | |
| 25 | - private long readTimeout;//读取超时 | |
| 26 | - private long writeTimeout;//写入超时 | |
| 27 | - private List<Interceptor> interceptorList;//拦截器 | |
| 28 | - private String baseUrl = "http://gank.io/api/data/"; | |
| 29 | - private final String SP_CMS_URL_DEBUT = "http://cmstest.cnlive.com:8768/"; | |
| 30 | - private final String SP_CMS_URL = "http://cms.cnlive.com:8768/"; | |
| 31 | - //网++ 接口域名 | |
| 32 | - public final String SP_BASE_URL = "https://apiwjj.cnlive.com/"; | |
| 33 | - //网++ 测试环境 接口域名 | |
| 34 | - public final String SP_DEBUG_URL = "http://apiwjjtest.cnlive.com/"; | |
| 35 | - //OPEN API 接口域名 | |
| 36 | - private final String OPEN_URL = "https://api.cnlive.com/"; | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 构造函数初始化 | |
| 40 | - */ | |
| 41 | - public BaseRequest() { | |
| 42 | - interceptorList = new ArrayList<>(); | |
| 43 | - } | |
| 44 | - | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 设置连接超时 | |
| 48 | - * | |
| 49 | - * @param connectTimeout | |
| 50 | - * @return | |
| 51 | - */ | |
| 52 | - public BaseRequest setConnectTimeout(long connectTimeout) { | |
| 53 | - init(); | |
| 54 | - connectTimeout = connectTimeout; | |
| 55 | - return request; | |
| 56 | - } | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * 设置读取超时 | |
| 60 | - * | |
| 61 | - * @param readTimeout | |
| 62 | - * @return | |
| 63 | - */ | |
| 64 | - public BaseRequest setReadTimeout(long readTimeout) { | |
| 65 | - init(); | |
| 66 | - readTimeout = readTimeout; | |
| 67 | - return request; | |
| 68 | - } | |
| 69 | - | |
| 70 | - /** | |
| 71 | - * 设置写入超时 | |
| 72 | - * | |
| 73 | - * @param writeTimeout | |
| 74 | - * @return | |
| 75 | - */ | |
| 76 | - public BaseRequest setWriteTimeout(long writeTimeout) { | |
| 77 | - init(); | |
| 78 | - writeTimeout = writeTimeout; | |
| 79 | - return request; | |
| 80 | - } | |
| 81 | - | |
| 82 | - | |
| 83 | - /** | |
| 84 | - * 初始化接口地址 | |
| 85 | - */ | |
| 86 | - private String initBaseUrl(Class clazz) { | |
| 87 | - if (AppConfig.isDebug()) { | |
| 88 | - baseUrl = SP_DEBUG_URL;//还原初始地址 | |
| 89 | - if (clazz == ApiBaseServiceOpen.class) { | |
| 90 | - return OPEN_URL; | |
| 91 | - } | |
| 92 | - } | |
| 93 | - return baseUrl; | |
| 94 | - } | |
| 95 | - | |
| 96 | - /** | |
| 97 | - * 设置连接地址 | |
| 98 | - * | |
| 99 | - * @param url | |
| 100 | - * @return | |
| 101 | - */ | |
| 102 | - public BaseRequest setUrl(String url) { | |
| 103 | - init(); | |
| 104 | - userSetUrl = url; | |
| 105 | - return request; | |
| 106 | - } | |
| 107 | - | |
| 108 | - /** | |
| 109 | - * 添加拦截器 | |
| 110 | - * | |
| 111 | - * @param interceptor | |
| 112 | - * @return | |
| 113 | - */ | |
| 114 | - public BaseRequest addInterceptor(Interceptor interceptor) { | |
| 115 | - if (null != interceptor) { | |
| 116 | - interceptorList.add(interceptor); | |
| 117 | - } | |
| 118 | - return request; | |
| 119 | - } | |
| 120 | - | |
| 121 | - /** | |
| 122 | - * @return | |
| 123 | - */ | |
| 124 | - public static synchronized BaseRequest init() { | |
| 125 | - if (null == request) { | |
| 126 | - request = new BaseRequest(); | |
| 127 | - } | |
| 128 | - return request; | |
| 129 | - } | |
| 130 | - | |
| 131 | - public <NetService> NetService service(Class<NetService> clz) { | |
| 132 | - NetService service = null; | |
| 133 | - NetBuilder builder = new NetBuilder(clz); | |
| 134 | - if (connectTimeout > 0) { | |
| 135 | - builder.setConnectTimeout(connectTimeout); | |
| 136 | - } | |
| 137 | - if (readTimeout > 0) { | |
| 138 | - builder.setReadTimeout(readTimeout); | |
| 139 | - } | |
| 140 | - if (writeTimeout > 0) { | |
| 141 | - builder.setWriteTimeout(writeTimeout); | |
| 142 | - } | |
| 143 | - if (null != interceptorList && interceptorList.size() > 0) { | |
| 144 | - builder.addInterceptors(interceptorList); | |
| 145 | - } | |
| 146 | - //设置接口请求头地址 | |
| 147 | - if (!TextUtils.isEmpty(userSetUrl)) { | |
| 148 | - builder.setBaseUrl(userSetUrl); | |
| 149 | - userSetUrl = ""; | |
| 150 | - } else { | |
| 151 | - builder.setBaseUrl(initBaseUrl(clz)); | |
| 152 | - } | |
| 153 | - service = (NetService) builder.getService(); | |
| 154 | - builder = null; | |
| 155 | - //重置属性 | |
| 156 | - resetData(); | |
| 157 | - return service; | |
| 158 | - | |
| 159 | - } | |
| 160 | - | |
| 161 | - private void resetData() { | |
| 162 | - interceptorList.clear(); | |
| 163 | - | |
| 164 | - connectTimeout = 0; | |
| 165 | - readTimeout = 0; | |
| 166 | - writeTimeout = 0; | |
| 167 | - } | |
| 168 | - | |
| 169 | - | |
| 170 | - | |
| 171 | - | |
| 172 | -} | |
| 173 | 0 | \ No newline at end of file |
app/strike/src/main/java/com/cnlive/strike/MainActivity.java
| ... | ... | @@ -11,6 +11,8 @@ import android.view.View; |
| 11 | 11 | |
| 12 | 12 | import com.cnlive.strike.demo.activity.DemoActivity; |
| 13 | 13 | import com.cnlive.strike.imgutil.ImgActivity; |
| 14 | +import com.cnlive.strike.user.ui.activity.LoginActivity; | |
| 15 | +import com.cnlive.strike.xiaojiaspeaker.ui.activity.AllDeviceActivity; | |
| 14 | 16 | |
| 15 | 17 | import androidx.annotation.NonNull; |
| 16 | 18 | import androidx.annotation.Nullable; |
| ... | ... | @@ -23,8 +25,14 @@ public class MainActivity extends AppCompatActivity { |
| 23 | 25 | protected void onCreate(@Nullable Bundle savedInstanceState) { |
| 24 | 26 | super.onCreate(savedInstanceState); |
| 25 | 27 | setContentView(R.layout.activity_main); |
| 26 | - findViewById(R.id.go_to).setOnClickListener(view -> startActivity(new Intent(this, DemoActivity.class)) ); | |
| 27 | - findViewById(R.id.to_img).setOnClickListener(view -> startActivity(new Intent(this, ImgActivity.class)) ); | |
| 28 | + findViewById(R.id.go_to).setOnClickListener(new View.OnClickListener() { | |
| 29 | + @Override | |
| 30 | + public void onClick(View v) { | |
| 31 | + startActivity(new Intent(MainActivity.this, DemoActivity.class)); | |
| 32 | +// finish(); | |
| 33 | + } | |
| 34 | + }); | |
| 35 | + findViewById(R.id.to_img).setOnClickListener(view -> startActivity(new Intent(this, ImgActivity.class))); | |
| 28 | 36 | } |
| 29 | 37 | |
| 30 | 38 | @Nullable | ... | ... |
app/strike/src/main/java/com/cnlive/strike/MyFragment.java
| ... | ... | @@ -19,6 +19,7 @@ import com.cnlive.strike.network.bean.LetHimNoSeeBean; |
| 19 | 19 | import com.cnlive.strike.network.bean.TestBean; |
| 20 | 20 | import com.me.yokeyword.fragmentation.anim.DefaultVerticalAnimator; |
| 21 | 21 | import com.me.yokeyword.fragmentation.anim.FragmentAnimator; |
| 22 | +import com.orhanobut.logger.Logger; | |
| 22 | 23 | |
| 23 | 24 | import java.util.HashMap; |
| 24 | 25 | import java.util.Map; |
| ... | ... | @@ -72,7 +73,7 @@ public class MyFragment extends BaseFragment<MyFragmentView, MyPresenter> { |
| 72 | 73 | // Log.e(TAG, "onFail: "); |
| 73 | 74 | // } |
| 74 | 75 | // }); |
| 75 | - startForResult(new MyFragment1(),1001); | |
| 76 | + startForResult(new MyFragment1(), 1001); | |
| 76 | 77 | } |
| 77 | 78 | }); |
| 78 | 79 | baseView.findViewById(R.id.btn_test).setOnClickListener(new View.OnClickListener() { |
| ... | ... | @@ -149,8 +150,12 @@ public class MyFragment extends BaseFragment<MyFragmentView, MyPresenter> { |
| 149 | 150 | @Override |
| 150 | 151 | public void onFragmentResult(int requestCode, int resultCode, Bundle data) { |
| 151 | 152 | super.onFragmentResult(requestCode, resultCode, data); |
| 152 | - if (requestCode==1001){ | |
| 153 | - setStatusBarColor(R.color.green,0); | |
| 153 | + if (requestCode == 1001) { | |
| 154 | + setStatusBarColor(R.color.green, 0); | |
| 155 | + | |
| 156 | + if (null != data) { | |
| 157 | + logError(data.getString("test")); | |
| 158 | + } | |
| 154 | 159 | } |
| 155 | 160 | } |
| 156 | 161 | } | ... | ... |
app/strike/src/main/java/com/cnlive/strike/MyFragment1.java
| 1 | 1 | package com.cnlive.strike; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import android.os.Build; | |
| 5 | +import android.os.Bundle; | |
| 4 | 6 | import android.util.Log; |
| 5 | 7 | import android.view.View; |
| 6 | 8 | |
| ... | ... | @@ -24,6 +26,10 @@ public class MyFragment1 extends BaseFragment { |
| 24 | 26 | @Override |
| 25 | 27 | protected void initView() { |
| 26 | 28 | super.initView(); |
| 29 | + Bundle bundle = new Bundle(); | |
| 30 | + bundle.putString("test", "你好"); | |
| 31 | + setFragmentResult(1001, bundle); | |
| 32 | + | |
| 27 | 33 | setStatusBarColor(R.color.qmui_config_color_red, 0); |
| 28 | 34 | setStatusBarTextColor(StatusBarConfig.BLACK); |
| 29 | 35 | baseView.findViewById(R.id.btn_test).setOnClickListener(new View.OnClickListener() { |
| ... | ... | @@ -54,5 +60,6 @@ public class MyFragment1 extends BaseFragment { |
| 54 | 60 | }); |
| 55 | 61 | } |
| 56 | 62 | }); |
| 63 | + | |
| 57 | 64 | } |
| 58 | 65 | } | ... | ... |
app/strike/src/main/res/layout/activity_my.xml
| ... | ... | @@ -5,10 +5,15 @@ |
| 5 | 5 | android:layout_width="match_parent" |
| 6 | 6 | android:layout_height="match_parent" |
| 7 | 7 | tools:context="com.cnlive.strike.MyActivity"> |
| 8 | + | |
| 8 | 9 | <RelativeLayout |
| 9 | 10 | android:id="@+id/fragment_container" |
| 10 | 11 | android:layout_width="match_parent" |
| 11 | 12 | android:layout_height="match_parent"> |
| 12 | 13 | |
| 14 | + <TextView | |
| 15 | + android:layout_width="wrap_content" | |
| 16 | + android:layout_height="wrap_content" | |
| 17 | + android:text="sfwerfwef" /> | |
| 13 | 18 | </RelativeLayout> |
| 14 | 19 | </RelativeLayout> | ... | ... |
app/strike/src/main/res/mipmap-hdpi/timgs.png
build.gradle
| ... | ... | @@ -97,10 +97,14 @@ allprojects { |
| 97 | 97 | keyPassword "www.cnlive.com" |
| 98 | 98 | } |
| 99 | 99 | releaseConfig { |
| 100 | - if (store_file != null) storeFile file(store_file) | |
| 101 | - if (store_password != null) storePassword store_password | |
| 102 | - if (key_alias != null) keyAlias key_alias | |
| 103 | - if (key_password != null) keyPassword key_password | |
| 100 | +// if (store_file != null) storeFile file(store_file) | |
| 101 | +// if (store_password != null) storePassword store_password | |
| 102 | +// if (key_alias != null) keyAlias key_alias | |
| 103 | +// if (key_password != null) keyPassword key_password | |
| 104 | + storeFile file("www.cnlive.com.key") | |
| 105 | + storePassword "www.cnlive.comPassw0rd" | |
| 106 | + keyAlias "strike" | |
| 107 | + keyPassword "www.cnlive.com" | |
| 104 | 108 | } |
| 105 | 109 | } |
| 106 | 110 | } | ... | ... |
cloud/user/src/main/java/com/cnlive/strike/user/frame/presenter/QuickLoginPresenter.java
| ... | ... | @@ -65,12 +65,8 @@ public class QuickLoginPresenter extends BasePresenter<QuickLoginView> { |
| 65 | 65 | Account account = accounts.length > 0 ? accounts[0] : null; |
| 66 | 66 | String name = account == null ? "" : account.name; |
| 67 | 67 | //页面填充数据 |
| 68 | - if (!TextUtils.isEmpty(name)) { | |
| 69 | 68 | ifViewAttached(view -> view.uploadInputData(name)); |
| 70 | - } | |
| 71 | - if (null != accounts) { | |
| 72 | 69 | ifViewAttached(view -> view.uploadListData(accounts)); |
| 73 | - } | |
| 74 | 70 | } |
| 75 | 71 | |
| 76 | 72 | private void startTimer() { | ... | ... |
cloud/user/src/main/java/com/cnlive/strike/user/frame/view/QuickLoginView.java
| ... | ... | @@ -78,7 +78,6 @@ public class QuickLoginView extends BaseView { |
| 78 | 78 | } |
| 79 | 79 | String contryCode = AppConfig.getCountryCode(); |
| 80 | 80 | //设置区号 |
| 81 | -// CNLiveUserInfo userInfo = UserService.getInstance(fragment.getActivity()).getAppAccount(); | |
| 82 | 81 | if (!TextUtils.isEmpty(contryCode)) { |
| 83 | 82 | fragment.binding.tvCountry.setText("+ " + contryCode); |
| 84 | 83 | } else { |
| ... | ... | @@ -209,6 +208,7 @@ public class QuickLoginView extends BaseView { |
| 209 | 208 | successInfo.setClickAd(fragment.clickAd); |
| 210 | 209 | successInfo.setTagShare(fragment.tagShare); |
| 211 | 210 | successInfo.setTagMsg(fragment.tagMsg); |
| 211 | + | |
| 212 | 212 | if (isNewUser) { |
| 213 | 213 | // HelperUtil.isNewUser(fragment.getActivity(), successInfo, isHasOtherUserInfo); |
| 214 | 214 | } else { | ... | ... |
cloud/user/src/main/java/com/cnlive/strike/user/ui/activity/FirstLoginActivity.java
| ... | ... | @@ -24,10 +24,6 @@ public class FirstLoginActivity extends BaseActivity { |
| 24 | 24 | private String tagMsg; |
| 25 | 25 | public static String TAG_CLICK_AD = "clickAd"; |
| 26 | 26 | |
| 27 | - @Override | |
| 28 | - protected int getViewLayoutId() { | |
| 29 | - return R.layout.activity_login; | |
| 30 | - } | |
| 31 | 27 | |
| 32 | 28 | @Override |
| 33 | 29 | protected void initParam() { |
| ... | ... | @@ -44,9 +40,9 @@ public class FirstLoginActivity extends BaseActivity { |
| 44 | 40 | @Override |
| 45 | 41 | protected void initView() { |
| 46 | 42 | super.initView(); |
| 47 | - FragmentManager fragmentManager = getSupportFragmentManager(); | |
| 48 | - FragmentUtil fragmentUtil = new FragmentUtil(R.id.loginContent); | |
| 49 | - fragmentUtil.initFragment(firstLoginFragment, fragmentManager); | |
| 43 | + if (null != firstLoginFragment) { | |
| 44 | + loadRootFragment(firstLoginFragment); | |
| 45 | + } | |
| 50 | 46 | } |
| 51 | 47 | |
| 52 | 48 | @Override |
| ... | ... | @@ -54,18 +50,6 @@ public class FirstLoginActivity extends BaseActivity { |
| 54 | 50 | super.onDestroy(); |
| 55 | 51 | } |
| 56 | 52 | |
| 57 | - @Override | |
| 58 | - protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
| 59 | - super.onActivityResult(requestCode, resultCode, data); | |
| 60 | - firstLoginFragment.onActivityResult(requestCode, resultCode, data); | |
| 61 | - } | |
| 62 | - | |
| 63 | - @Override | |
| 64 | - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |
| 65 | - super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |
| 66 | - if (firstLoginFragment != null) | |
| 67 | - firstLoginFragment.onRequestPermissionsResult(requestCode, permissions, grantResults); | |
| 68 | - } | |
| 69 | 53 | |
| 70 | 54 | @Override |
| 71 | 55 | public void onBackPressed() { | ... | ... |
cloud/user/src/main/java/com/cnlive/strike/user/ui/activity/LoginActivity.java
| ... | ... | @@ -11,6 +11,7 @@ import androidx.fragment.app.FragmentManager; |
| 11 | 11 | |
| 12 | 12 | import com.alibaba.android.arouter.facade.annotation.Route; |
| 13 | 13 | import com.cnlive.core.libs.base.frame.activity.BaseActivity; |
| 14 | +import com.cnlive.core.libs.base.frame.fragment.BaseFragment; | |
| 14 | 15 | import com.cnlive.core.libs.base.util.FragmentUtil; |
| 15 | 16 | import com.cnlive.strike.user.R; |
| 16 | 17 | import com.cnlive.strike.user.ui.fragment.QuickLoginFragment; |
| ... | ... | @@ -28,7 +29,7 @@ public class LoginActivity extends BaseActivity { |
| 28 | 29 | public static String TAG_MSG = "tagMsg"; |
| 29 | 30 | public static String TAG_SHARE = "tagValue"; |
| 30 | 31 | public static String TAG_CLICK_AD = "clickAd"; |
| 31 | - private Fragment quickLoginFragment; | |
| 32 | + private BaseFragment quickLoginFragment; | |
| 32 | 33 | private boolean fromTokenError; |
| 33 | 34 | private String tagMsg; |
| 34 | 35 | private String shareType; |
| ... | ... | @@ -72,11 +73,6 @@ public class LoginActivity extends BaseActivity { |
| 72 | 73 | |
| 73 | 74 | |
| 74 | 75 | @Override |
| 75 | - protected int getViewLayoutId() { | |
| 76 | - return R.layout.activity_login; | |
| 77 | - } | |
| 78 | - | |
| 79 | - @Override | |
| 80 | 76 | protected void initView() { |
| 81 | 77 | fromTokenError = getIntent().getBooleanExtra(FROM_TOKEN_ERROR, false); |
| 82 | 78 | tagMsg = getIntent().getStringExtra(TAG_MSG) == null ? "" : getIntent().getStringExtra(TAG_MSG); |
| ... | ... | @@ -85,17 +81,6 @@ public class LoginActivity extends BaseActivity { |
| 85 | 81 | addFragment(); |
| 86 | 82 | } |
| 87 | 83 | |
| 88 | - @Override | |
| 89 | - protected void initData() { | |
| 90 | - | |
| 91 | - } | |
| 92 | - | |
| 93 | - @Override | |
| 94 | - public void onActivityResult(int requestCode, int resultCode, Intent data) { | |
| 95 | - super.onActivityResult(requestCode, resultCode, data); | |
| 96 | - if (quickLoginFragment != null) | |
| 97 | - quickLoginFragment.onActivityResult(requestCode, resultCode, data); | |
| 98 | - } | |
| 99 | 84 | |
| 100 | 85 | @Override |
| 101 | 86 | protected void onNewIntent(Intent intent) { |
| ... | ... | @@ -111,10 +96,7 @@ public class LoginActivity extends BaseActivity { |
| 111 | 96 | } else { |
| 112 | 97 | quickLoginFragment = QuickLoginFragment.newInstance(fromTokenError, tagMsg, clickAd); |
| 113 | 98 | } |
| 114 | - | |
| 115 | - FragmentManager fragmentManager = getSupportFragmentManager(); | |
| 116 | - FragmentUtil fragmentUtil = new FragmentUtil(R.id.loginContent); | |
| 117 | - fragmentUtil.changeFragment(quickLoginFragment, fragmentManager); | |
| 99 | + loadRootFragment(quickLoginFragment); | |
| 118 | 100 | } |
| 119 | 101 | |
| 120 | 102 | @Override | ... | ... |
cloud/user/src/release/res/mipmap-hdpi/icon_account.png
0 → 100644
3.87 KB
cloud/user/src/release/res/mipmap-mdpi/icon_account.png
0 → 100644
2.94 KB
cloud/user/src/release/res/mipmap-xhdpi/icon_account.png
0 → 100644
5.19 KB
cloud/user/src/release/res/mipmap-xxhdpi/icon_account.png
0 → 100644
7.91 KB
cloud/user/src/release/res/mipmap-xxxhdpi/icon_account.png
0 → 100644
10.6 KB
core/base/src/main/java/com/cnlive/core/libs/base/application/BaseApplication.java
| ... | ... | @@ -4,7 +4,9 @@ import android.app.Application; |
| 4 | 4 | |
| 5 | 5 | import com.cnlive.strike.base.BuildConfig; |
| 6 | 6 | import com.orhanobut.logger.AndroidLogAdapter; |
| 7 | +import com.orhanobut.logger.FormatStrategy; | |
| 7 | 8 | import com.orhanobut.logger.Logger; |
| 9 | +import com.orhanobut.logger.PrettyFormatStrategy; | |
| 8 | 10 | |
| 9 | 11 | public class BaseApplication extends Application { |
| 10 | 12 | private static BaseApplication instance; |
| ... | ... | @@ -13,7 +15,14 @@ public class BaseApplication extends Application { |
| 13 | 15 | public void onCreate() { |
| 14 | 16 | super.onCreate(); |
| 15 | 17 | instance = this; |
| 16 | - Logger.addLogAdapter(new AndroidLogAdapter() { | |
| 18 | + FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder() | |
| 19 | +// .showThreadInfo(true) // (Optional) Whether to show thread info or not. Default true | |
| 20 | +// .methodCount(5) // (Optional) How many method line to show. Default 2 | |
| 21 | +// .methodOffset(0) // (Optional) Hides internal method calls up to offset. Default 5 | |
| 22 | +// .logStrategy(customLog) // (Optional) Changes the log strategy to print out. Default LogCat | |
| 23 | + .tag("TAG") // (Optional) Global tag for every log. Default PRETTY_LOGGER | |
| 24 | + .build(); | |
| 25 | + Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy) { | |
| 17 | 26 | @Override |
| 18 | 27 | public boolean isLoggable(int priority, String tag) { |
| 19 | 28 | return AppConfig.isDebug(); | ... | ... |
core/base/src/main/java/com/cnlive/core/libs/base/frame/activity/BaseActivity.java
| ... | ... | @@ -32,6 +32,7 @@ import androidx.core.app.ActivityCompat; |
| 32 | 32 | import androidx.core.content.ContextCompat; |
| 33 | 33 | import androidx.databinding.DataBindingUtil; |
| 34 | 34 | import androidx.databinding.ViewDataBinding; |
| 35 | +import androidx.fragment.app.Fragment; | |
| 35 | 36 | |
| 36 | 37 | import com.alibaba.android.arouter.launcher.ARouter; |
| 37 | 38 | import com.cnlive.core.libs.base.application.AppConfig; |
| ... | ... | @@ -266,8 +267,8 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 266 | 267 | |
| 267 | 268 | @Override |
| 268 | 269 | protected void onDestroy() { |
| 269 | - mDelegate.onDestroy(); | |
| 270 | 270 | super.onDestroy(); |
| 271 | + mDelegate.onDestroy(); | |
| 271 | 272 | if (null != baseBinding) { |
| 272 | 273 | baseBinding.unbind(); |
| 273 | 274 | } |
| ... | ... | @@ -275,6 +276,7 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 275 | 276 | AppManager.getInstance().deleteActivity(me); |
| 276 | 277 | //清除当前订阅 |
| 277 | 278 | SubscriptionManager.getInstance().cancel(TAG); |
| 279 | + | |
| 278 | 280 | } |
| 279 | 281 | |
| 280 | 282 | /** |
| ... | ... | @@ -703,24 +705,24 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 703 | 705 | // } |
| 704 | 706 | |
| 705 | 707 | |
| 706 | - public void logError(Object info) { | |
| 708 | + public void logError(String info) { | |
| 707 | 709 | Logger.e(TAG, info); |
| 708 | 710 | } |
| 709 | 711 | |
| 710 | - public void logDebug(Object info) { | |
| 711 | - Logger.d(TAG, info); | |
| 712 | + public void logDebug(String info) { | |
| 713 | + Logger.d(info); | |
| 712 | 714 | } |
| 713 | 715 | |
| 714 | - public void logWarn(Object info) { | |
| 715 | - Logger.w(TAG, info); | |
| 716 | + public void logWarn(String info) { | |
| 717 | + Logger.w(info); | |
| 716 | 718 | } |
| 717 | 719 | |
| 718 | - public void logInfo(Object info) { | |
| 719 | - Logger.i(TAG, info); | |
| 720 | + public void logInfo(String info) { | |
| 721 | + Logger.i(info); | |
| 720 | 722 | } |
| 721 | 723 | |
| 722 | - public void logVerbose(Object info) { | |
| 723 | - Logger.v(TAG, info); | |
| 724 | + public void logVerbose(String info) { | |
| 725 | + Logger.v(info); | |
| 724 | 726 | } |
| 725 | 727 | |
| 726 | 728 | public void logJson(String json) { |
| ... | ... | @@ -1014,4 +1016,16 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 1014 | 1016 | return mSwipeDelegate.getSwipeBackLayout(); |
| 1015 | 1017 | } |
| 1016 | 1018 | |
| 1019 | + | |
| 1020 | + @Override | |
| 1021 | + protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { | |
| 1022 | + super.onActivityResult(requestCode, resultCode, data); | |
| 1023 | + if (null != getSupportFragmentManager() && null != getSupportFragmentManager().getFragments()) { | |
| 1024 | + for (Fragment fragment : getSupportFragmentManager().getFragments()) { | |
| 1025 | + if (null != fragment) { | |
| 1026 | + fragment.onActivityResult(requestCode, resultCode, data); | |
| 1027 | + } | |
| 1028 | + } | |
| 1029 | + } | |
| 1030 | + } | |
| 1017 | 1031 | } |
| 1018 | 1032 | \ No newline at end of file | ... | ... |
core/base/src/main/java/com/cnlive/core/libs/base/frame/fragment/BaseFragment.java
| ... | ... | @@ -65,6 +65,8 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 65 | 65 | public void onCreate(Bundle savedInstanceState) { |
| 66 | 66 | super.onCreate(savedInstanceState); |
| 67 | 67 | if (getActivity() == null) return; |
| 68 | + //创建订阅映射 | |
| 69 | + SubscriptionManager.getInstance().setCurrentDisposables(TAG); | |
| 68 | 70 | me = (BaseActivity) getActivity(); |
| 69 | 71 | mDelegate.onCreate(savedInstanceState); |
| 70 | 72 | mSwipeDelegate.onCreate(savedInstanceState); |
| ... | ... | @@ -98,8 +100,6 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 98 | 100 | @Override |
| 99 | 101 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 100 | 102 | super.onViewCreated(view, savedInstanceState); |
| 101 | - //创建订阅映射 | |
| 102 | - SubscriptionManager.getInstance().setCurrentDisposables(TAG); | |
| 103 | 103 | mSwipeDelegate.onViewCreated(view, savedInstanceState); |
| 104 | 104 | if (null != getMvpView() && null != getPresenter()) { |
| 105 | 105 | initBindingData(); |
| ... | ... | @@ -199,14 +199,14 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 199 | 199 | |
| 200 | 200 | @Override |
| 201 | 201 | public void onDestroy() { |
| 202 | - mDelegate.onDestroy(); | |
| 203 | - mSwipeDelegate.onDestroyView(); | |
| 204 | - //清除当前订阅 | |
| 205 | - SubscriptionManager.getInstance().cancel(TAG); | |
| 206 | 202 | super.onDestroy(); |
| 207 | 203 | if (null != baseBinding) { |
| 208 | 204 | baseBinding.unbind(); |
| 209 | 205 | } |
| 206 | + mDelegate.onDestroy(); | |
| 207 | + mSwipeDelegate.onDestroyView(); | |
| 208 | + //清除当前订阅 | |
| 209 | + SubscriptionManager.getInstance().cancel(TAG); | |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
| ... | ... | @@ -333,6 +333,8 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 333 | 333 | public void onDestroyView() { |
| 334 | 334 | mDelegate.onDestroyView(); |
| 335 | 335 | super.onDestroyView(); |
| 336 | + //清除当前订阅 | |
| 337 | + SubscriptionManager.getInstance().cancel(TAG); | |
| 336 | 338 | } |
| 337 | 339 | |
| 338 | 340 | @Override |
| ... | ... | @@ -355,24 +357,24 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 355 | 357 | } |
| 356 | 358 | |
| 357 | 359 | /*************************************log******************************************/ |
| 358 | - public void logError(Object info) { | |
| 359 | - Logger.e(TAG, info); | |
| 360 | + public void logError(String info) { | |
| 361 | + Logger.e(info); | |
| 360 | 362 | } |
| 361 | 363 | |
| 362 | - public void logDebug(Object info) { | |
| 363 | - Logger.d(TAG, info); | |
| 364 | + public void logDebug(String info) { | |
| 365 | + Logger.d(info); | |
| 364 | 366 | } |
| 365 | 367 | |
| 366 | - public void logWarn(Object info) { | |
| 367 | - Logger.w(TAG, info); | |
| 368 | + public void logWarn(String info) { | |
| 369 | + Logger.w(info); | |
| 368 | 370 | } |
| 369 | 371 | |
| 370 | - public void logInfo(Object info) { | |
| 371 | - Logger.i(TAG, info); | |
| 372 | + public void logInfo(String info) { | |
| 373 | + Logger.i(info); | |
| 372 | 374 | } |
| 373 | 375 | |
| 374 | - public void logVerbose(Object info) { | |
| 375 | - Logger.v(TAG, info); | |
| 376 | + public void logVerbose(String info) { | |
| 377 | + Logger.v( info); | |
| 376 | 378 | } |
| 377 | 379 | |
| 378 | 380 | public void logJson(String json) { | ... | ... |
core/base/src/main/java/com/cnlive/core/libs/base/network/manager/SubscriptionManager.java
| ... | ... | @@ -18,18 +18,22 @@ public class SubscriptionManager { |
| 18 | 18 | public static SubscriptionManager instance; |
| 19 | 19 | public HashMap<String, CompositeDisposable> hashDisposable;//所有订阅关系 |
| 20 | 20 | public HashMap<Integer, String> hashTag;//当前activity |
| 21 | + public HashMap<String, Integer> hashTagIndex;//当前activity | |
| 21 | 22 | private String currentClassName; |
| 22 | 23 | |
| 23 | 24 | /** |
| 24 | 25 | * 构造函数 new CompositeDisposable对象 |
| 25 | 26 | */ |
| 26 | - public SubscriptionManager() { | |
| 27 | + public SubscriptionManager() { | |
| 27 | 28 | if (null == hashDisposable) { |
| 28 | 29 | hashDisposable = new HashMap<>(); |
| 29 | 30 | } |
| 30 | 31 | if (null == hashTag) { |
| 31 | 32 | hashTag = new HashMap<>(); |
| 32 | 33 | } |
| 34 | + if (null == hashTagIndex) { | |
| 35 | + hashTagIndex = new HashMap<>(); | |
| 36 | + } | |
| 33 | 37 | } |
| 34 | 38 | |
| 35 | 39 | /** |
| ... | ... | @@ -48,27 +52,44 @@ public class SubscriptionManager { |
| 48 | 52 | return instance; |
| 49 | 53 | } |
| 50 | 54 | |
| 51 | - public void setCurrentDisposables(String TAG) { | |
| 55 | + public synchronized void setCurrentDisposables(String TAG) { | |
| 52 | 56 | if (null == hashDisposable.get(TAG)) { |
| 53 | 57 | currentClassName = TAG; |
| 54 | 58 | hashDisposable.put(TAG, new CompositeDisposable()); |
| 55 | 59 | //存放当前class映射 |
| 56 | 60 | hashTag.put(hashDisposable.size() - 1, TAG); |
| 61 | + hashTagIndex.put(TAG, hashTag.size() - 1); | |
| 62 | + Log.e(TAG, "初始化: "); | |
| 57 | 63 | } |
| 58 | 64 | } |
| 59 | 65 | |
| 60 | 66 | /** |
| 61 | 67 | * 取消订阅事件 |
| 62 | 68 | */ |
| 63 | - public void cancel(String TAG) { | |
| 64 | - if (null != hashDisposable && hashDisposable.size() > 0) { | |
| 65 | - if (null != hashDisposable.get(TAG) && hashDisposable.get(TAG).size() > 0) { | |
| 66 | - CompositeDisposable mDisposables = hashDisposable.get(TAG); | |
| 67 | - if (!mDisposables.isDisposed()) { | |
| 68 | - Log.e(TAG, "cancel: 解除订阅"); | |
| 69 | - mDisposables.clear(); | |
| 69 | + public synchronized void cancel(String TAG) { | |
| 70 | + try { | |
| 71 | + if (null != hashDisposable && hashDisposable.size() > 0) { | |
| 72 | + if (null != hashDisposable.get(TAG) && hashDisposable.get(TAG).size() > 0) { | |
| 73 | + CompositeDisposable mDisposables = hashDisposable.get(TAG); | |
| 74 | + if (!mDisposables.isDisposed()) { | |
| 75 | + Log.e(TAG, "cancel: 解除订阅"); | |
| 76 | + mDisposables.clear(); | |
| 77 | + } | |
| 78 | + } | |
| 79 | + //移除 | |
| 80 | + hashDisposable.remove(TAG); | |
| 81 | + } | |
| 82 | + if (null != hashTagIndex.get(TAG)) { | |
| 83 | + int currentIndex = hashTagIndex.get(TAG); | |
| 84 | + //移除 | |
| 85 | + if (null != hashTag.get(currentIndex)) { | |
| 86 | + Log.e(TAG, "cancel: " + hashTag.get(currentIndex)); | |
| 87 | + hashTag.remove(currentIndex); | |
| 70 | 88 | } |
| 89 | + hashTagIndex.remove(TAG); | |
| 71 | 90 | } |
| 91 | + } catch (Exception e) { | |
| 92 | + Log.e(TAG, "cancel: " + e.getMessage()); | |
| 72 | 93 | } |
| 73 | 94 | } |
| 74 | 95 | |
| ... | ... | @@ -77,7 +98,7 @@ public class SubscriptionManager { |
| 77 | 98 | * |
| 78 | 99 | * @param disposable 订阅事件 |
| 79 | 100 | */ |
| 80 | - public void add(Disposable disposable) { | |
| 101 | + public synchronized void add(Disposable disposable) { | |
| 81 | 102 | if (disposable == null) return; |
| 82 | 103 | //每次去除最新的activity进行存放 |
| 83 | 104 | if (null != hashDisposable && hashDisposable.size() > 0) { |
| ... | ... | @@ -85,7 +106,7 @@ public class SubscriptionManager { |
| 85 | 106 | if (null != hashDisposable.get(currentClassName)) { |
| 86 | 107 | //存放当前activity对应的订阅 |
| 87 | 108 | hashDisposable.get(currentClassName).add(disposable); |
| 88 | - Log.e(currentClassName, "add: 添加订阅关系"); | |
| 109 | + Log.e(currentClassName, "add: 添加订阅关系" + hashDisposable.size()); | |
| 89 | 110 | } |
| 90 | 111 | } |
| 91 | 112 | } |
| ... | ... | @@ -105,7 +126,7 @@ public class SubscriptionManager { |
| 105 | 126 | /** |
| 106 | 127 | * 清除容器所有 |
| 107 | 128 | */ |
| 108 | - public void cancelAll() { | |
| 129 | + public synchronized void cancelAll() { | |
| 109 | 130 | //解除所有订阅 |
| 110 | 131 | if (null != hashDisposable && hashDisposable.size() > 0) { |
| 111 | 132 | if (null != hashTag && hashTag.size() > 0) { |
| ... | ... | @@ -118,5 +139,8 @@ public class SubscriptionManager { |
| 118 | 139 | } |
| 119 | 140 | } |
| 120 | 141 | } |
| 142 | + hashDisposable.clear(); | |
| 143 | + hashTag.clear(); | |
| 144 | + hashTagIndex.clear(); | |
| 121 | 145 | } |
| 122 | 146 | } | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/widget/SelectDialog.java renamed to core/base/src/main/java/com/cnlive/core/libs/base/ui/widget/SelectDialog.java
| 1 | -package com.cnlive.strike.xiaojiaspeaker.ui.widget; | |
| 1 | +package com.cnlive.core.libs.base.ui.widget; | |
| 2 | 2 | |
| 3 | 3 | import android.app.Dialog; |
| 4 | 4 | import android.content.Context; |
| ... | ... | @@ -15,7 +15,7 @@ import android.widget.TextView; |
| 15 | 15 | import androidx.annotation.NonNull; |
| 16 | 16 | import androidx.core.content.ContextCompat; |
| 17 | 17 | |
| 18 | -import com.cnlive.strike.xiaojiaspeaker.R; | |
| 18 | +import com.cnlive.strike.base.R; | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | /** |
| ... | ... | @@ -38,7 +38,7 @@ public class SelectDialog extends Dialog { |
| 38 | 38 | public SelectDialog(@NonNull Context context, String tipText, String btnCancelText, DialogInterface cancelInterface, String btnOkText, DialogInterface okInterface) { |
| 39 | 39 | super(context, R.style.MyDialog); |
| 40 | 40 | this.context = context; |
| 41 | - view = LayoutInflater.from(context).inflate(R.layout.dialog_select, null); | |
| 41 | + view = LayoutInflater.from(context).inflate(R.layout.my_dialog_select, null); | |
| 42 | 42 | initView(view); |
| 43 | 43 | layoutParams = new LinearLayout.LayoutParams((int) (getScreenWidth(context) * 0.8), ViewGroup.LayoutParams.WRAP_CONTENT); |
| 44 | 44 | ll_child.setLayoutParams(layoutParams); | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/widget/TipDialog.java renamed to core/base/src/main/java/com/cnlive/core/libs/base/ui/widget/TipDialog.java
| 1 | -package com.cnlive.strike.xiaojiaspeaker.ui.widget; | |
| 1 | +package com.cnlive.core.libs.base.ui.widget; | |
| 2 | 2 | |
| 3 | 3 | import android.app.Dialog; |
| 4 | 4 | import android.content.Context; |
| ... | ... | @@ -14,7 +14,7 @@ import android.widget.TextView; |
| 14 | 14 | |
| 15 | 15 | import androidx.annotation.NonNull; |
| 16 | 16 | |
| 17 | -import com.cnlive.strike.xiaojiaspeaker.R; | |
| 17 | +import com.cnlive.strike.base.R; | |
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | /** | ... | ... |
core/base/src/main/java/com/kongzue/dialog/v3/InputDialog.java
| ... | ... | @@ -68,7 +68,7 @@ public class InputDialog extends MessageDialog { |
| 68 | 68 | inputDialog.build(inputDialog, R.layout.dialog_select_ios); |
| 69 | 69 | break; |
| 70 | 70 | case STYLE_KONGZUE: |
| 71 | - inputDialog.build(inputDialog, R.layout.dialog_select); | |
| 71 | + inputDialog.build(inputDialog, R.layout.my_dialog_select); | |
| 72 | 72 | break; |
| 73 | 73 | case STYLE_MATERIAL: |
| 74 | 74 | inputDialog.build(inputDialog); |
| ... | ... | @@ -686,7 +686,7 @@ public class InputDialog extends MessageDialog { |
| 686 | 686 | build(this, R.layout.dialog_select_ios); |
| 687 | 687 | break; |
| 688 | 688 | case STYLE_KONGZUE: |
| 689 | - build(this, R.layout.dialog_select); | |
| 689 | + build(this, R.layout.my_dialog_select); | |
| 690 | 690 | break; |
| 691 | 691 | case STYLE_MATERIAL: |
| 692 | 692 | ... | ... |
core/base/src/main/java/com/kongzue/dialog/v3/MessageDialog.java
| ... | ... | @@ -97,7 +97,7 @@ public class MessageDialog extends BaseDialog { |
| 97 | 97 | messageDialog.build(messageDialog, R.layout.dialog_select_ios); |
| 98 | 98 | break; |
| 99 | 99 | case STYLE_KONGZUE: |
| 100 | - messageDialog.build(messageDialog, R.layout.dialog_select); | |
| 100 | + messageDialog.build(messageDialog, R.layout.my_dialog_select); | |
| 101 | 101 | break; |
| 102 | 102 | case STYLE_MATERIAL: |
| 103 | 103 | messageDialog.build(messageDialog); |
| ... | ... | @@ -880,7 +880,7 @@ public class MessageDialog extends BaseDialog { |
| 880 | 880 | build(this, R.layout.dialog_select_ios); |
| 881 | 881 | break; |
| 882 | 882 | case STYLE_KONGZUE: |
| 883 | - build(this, R.layout.dialog_select); | |
| 883 | + build(this, R.layout.my_dialog_select); | |
| 884 | 884 | break; |
| 885 | 885 | case STYLE_MATERIAL: |
| 886 | 886 | build(this); | ... | ... |
core/base/src/main/java/top/zibin/luban/Checker.java deleted
100644 → 0
| 1 | -package top.zibin.luban; | |
| 2 | - | |
| 3 | -import android.graphics.BitmapFactory; | |
| 4 | -import android.util.Log; | |
| 5 | - | |
| 6 | -import java.io.ByteArrayOutputStream; | |
| 7 | -import java.io.File; | |
| 8 | -import java.io.IOException; | |
| 9 | -import java.io.InputStream; | |
| 10 | -import java.util.ArrayList; | |
| 11 | -import java.util.Arrays; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -enum Checker { | |
| 15 | - SINGLE; | |
| 16 | - | |
| 17 | - private static final String TAG = "Luban"; | |
| 18 | - | |
| 19 | - private static List<String> format = new ArrayList<>(); | |
| 20 | - private static final String JPG = ".jpg"; | |
| 21 | - private static final String JPEG = ".jpeg"; | |
| 22 | - private static final String PNG = ".png"; | |
| 23 | - private static final String WEBP = ".webp"; | |
| 24 | - private static final String GIF = ".gif"; | |
| 25 | - | |
| 26 | - private final byte[] JPEG_SIGNATURE = new byte[]{(byte) 0xFF, (byte) 0xD8, (byte) 0xFF}; | |
| 27 | - | |
| 28 | - static { | |
| 29 | - format.add(JPG); | |
| 30 | - format.add(JPEG); | |
| 31 | - format.add(PNG); | |
| 32 | - format.add(WEBP); | |
| 33 | - format.add(GIF); | |
| 34 | - } | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * Determine if it is JPG. | |
| 38 | - * | |
| 39 | - * @param is image file input stream | |
| 40 | - */ | |
| 41 | - boolean isJPG(InputStream is) { | |
| 42 | - return isJPG(toByteArray(is)); | |
| 43 | - } | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * Returns the degrees in clockwise. Values are 0, 90, 180, or 270. | |
| 47 | - */ | |
| 48 | - int getOrientation(InputStream is) { | |
| 49 | - return getOrientation(toByteArray(is)); | |
| 50 | - } | |
| 51 | - | |
| 52 | - private boolean isJPG(byte[] data) { | |
| 53 | - if (data == null || data.length < 3) { | |
| 54 | - return false; | |
| 55 | - } | |
| 56 | - byte[] signatureB = new byte[]{data[0], data[1], data[2]}; | |
| 57 | - return Arrays.equals(JPEG_SIGNATURE, signatureB); | |
| 58 | - } | |
| 59 | - | |
| 60 | - private int getOrientation(byte[] jpeg) { | |
| 61 | - if (jpeg == null) { | |
| 62 | - return 0; | |
| 63 | - } | |
| 64 | - | |
| 65 | - int offset = 0; | |
| 66 | - int length = 0; | |
| 67 | - | |
| 68 | - // ISO/IEC 10918-1:1993(E) | |
| 69 | - while (offset + 3 < jpeg.length && (jpeg[offset++] & 0xFF) == 0xFF) { | |
| 70 | - int marker = jpeg[offset] & 0xFF; | |
| 71 | - | |
| 72 | - // Check if the marker is a padding. | |
| 73 | - if (marker == 0xFF) { | |
| 74 | - continue; | |
| 75 | - } | |
| 76 | - offset++; | |
| 77 | - | |
| 78 | - // Check if the marker is SOI or TEM. | |
| 79 | - if (marker == 0xD8 || marker == 0x01) { | |
| 80 | - continue; | |
| 81 | - } | |
| 82 | - // Check if the marker is EOI or SOS. | |
| 83 | - if (marker == 0xD9 || marker == 0xDA) { | |
| 84 | - break; | |
| 85 | - } | |
| 86 | - | |
| 87 | - // Get the length and check if it is reasonable. | |
| 88 | - length = pack(jpeg, offset, 2, false); | |
| 89 | - if (length < 2 || offset + length > jpeg.length) { | |
| 90 | - Log.e(TAG, "Invalid length"); | |
| 91 | - return 0; | |
| 92 | - } | |
| 93 | - | |
| 94 | - // Break if the marker is EXIF in APP1. | |
| 95 | - if (marker == 0xE1 && length >= 8 | |
| 96 | - && pack(jpeg, offset + 2, 4, false) == 0x45786966 | |
| 97 | - && pack(jpeg, offset + 6, 2, false) == 0) { | |
| 98 | - offset += 8; | |
| 99 | - length -= 8; | |
| 100 | - break; | |
| 101 | - } | |
| 102 | - | |
| 103 | - // Skip other markers. | |
| 104 | - offset += length; | |
| 105 | - length = 0; | |
| 106 | - } | |
| 107 | - | |
| 108 | - // JEITA CP-3451 Exif Version 2.2 | |
| 109 | - if (length > 8) { | |
| 110 | - // Identify the byte order. | |
| 111 | - int tag = pack(jpeg, offset, 4, false); | |
| 112 | - if (tag != 0x49492A00 && tag != 0x4D4D002A) { | |
| 113 | - Log.e(TAG, "Invalid byte order"); | |
| 114 | - return 0; | |
| 115 | - } | |
| 116 | - boolean littleEndian = (tag == 0x49492A00); | |
| 117 | - | |
| 118 | - // Get the offset and check if it is reasonable. | |
| 119 | - int count = pack(jpeg, offset + 4, 4, littleEndian) + 2; | |
| 120 | - if (count < 10 || count > length) { | |
| 121 | - Log.e(TAG, "Invalid offset"); | |
| 122 | - return 0; | |
| 123 | - } | |
| 124 | - offset += count; | |
| 125 | - length -= count; | |
| 126 | - | |
| 127 | - // Get the count and go through all the elements. | |
| 128 | - count = pack(jpeg, offset - 2, 2, littleEndian); | |
| 129 | - while (count-- > 0 && length >= 12) { | |
| 130 | - // Get the tag and check if it is orientation. | |
| 131 | - tag = pack(jpeg, offset, 2, littleEndian); | |
| 132 | - if (tag == 0x0112) { | |
| 133 | - int orientation = pack(jpeg, offset + 8, 2, littleEndian); | |
| 134 | - switch (orientation) { | |
| 135 | - case 1: | |
| 136 | - return 0; | |
| 137 | - case 3: | |
| 138 | - return 180; | |
| 139 | - case 6: | |
| 140 | - return 90; | |
| 141 | - case 8: | |
| 142 | - return 270; | |
| 143 | - } | |
| 144 | - Log.e(TAG, "Unsupported orientation"); | |
| 145 | - return 0; | |
| 146 | - } | |
| 147 | - offset += 12; | |
| 148 | - length -= 12; | |
| 149 | - } | |
| 150 | - } | |
| 151 | - | |
| 152 | - Log.e(TAG, "Orientation not found"); | |
| 153 | - return 0; | |
| 154 | - } | |
| 155 | - | |
| 156 | - String extSuffix(InputStreamProvider input) { | |
| 157 | - try { | |
| 158 | - BitmapFactory.Options options = new BitmapFactory.Options(); | |
| 159 | - options.inJustDecodeBounds = true; | |
| 160 | - BitmapFactory.decodeStream(input.open(), null, options); | |
| 161 | - return options.outMimeType.replace("image/", "."); | |
| 162 | - } catch (Exception e) { | |
| 163 | - return JPG; | |
| 164 | - } | |
| 165 | - } | |
| 166 | - | |
| 167 | - boolean needCompress(int leastCompressSize, String path) { | |
| 168 | - if (leastCompressSize > 0) { | |
| 169 | - File source = new File(path); | |
| 170 | - return source.exists() && source.length() > (leastCompressSize << 10); | |
| 171 | - } | |
| 172 | - return true; | |
| 173 | - } | |
| 174 | - | |
| 175 | - private int pack(byte[] bytes, int offset, int length, boolean littleEndian) { | |
| 176 | - int step = 1; | |
| 177 | - if (littleEndian) { | |
| 178 | - offset += length - 1; | |
| 179 | - step = -1; | |
| 180 | - } | |
| 181 | - | |
| 182 | - int value = 0; | |
| 183 | - while (length-- > 0) { | |
| 184 | - value = (value << 8) | (bytes[offset] & 0xFF); | |
| 185 | - offset += step; | |
| 186 | - } | |
| 187 | - return value; | |
| 188 | - } | |
| 189 | - | |
| 190 | - private byte[] toByteArray(InputStream is) { | |
| 191 | - if (is == null) { | |
| 192 | - return new byte[0]; | |
| 193 | - } | |
| 194 | - | |
| 195 | - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | |
| 196 | - | |
| 197 | - int read; | |
| 198 | - byte[] data = new byte[4096]; | |
| 199 | - | |
| 200 | - try { | |
| 201 | - while ((read = is.read(data, 0, data.length)) != -1) { | |
| 202 | - buffer.write(data, 0, read); | |
| 203 | - } | |
| 204 | - } catch (Exception ignored) { | |
| 205 | - return new byte[0]; | |
| 206 | - } finally { | |
| 207 | - try { | |
| 208 | - buffer.close(); | |
| 209 | - } catch (IOException ignored) { | |
| 210 | - } | |
| 211 | - } | |
| 212 | - | |
| 213 | - return buffer.toByteArray(); | |
| 214 | - } | |
| 215 | -} |
core/base/src/main/java/top/zibin/luban/CompressionPredicate.java deleted
100644 → 0
| 1 | -package top.zibin.luban; | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Created on 2018/1/3 19:43 | |
| 5 | - * | |
| 6 | - * @author andy | |
| 7 | - * | |
| 8 | - * A functional interface (callback) that returns true or false for the given input path should be compressed. | |
| 9 | - */ | |
| 10 | - | |
| 11 | -public interface CompressionPredicate { | |
| 12 | - | |
| 13 | - /** | |
| 14 | - * Determine the given input path should be compressed and return a boolean. | |
| 15 | - * @param path input path | |
| 16 | - * @return the boolean result | |
| 17 | - */ | |
| 18 | - boolean apply(String path); | |
| 19 | -} |
core/base/src/main/java/top/zibin/luban/Engine.java deleted
100644 → 0
| 1 | -package top.zibin.luban; | |
| 2 | - | |
| 3 | -import android.graphics.Bitmap; | |
| 4 | -import android.graphics.BitmapFactory; | |
| 5 | -import android.graphics.Matrix; | |
| 6 | - | |
| 7 | -import java.io.ByteArrayOutputStream; | |
| 8 | -import java.io.File; | |
| 9 | -import java.io.FileOutputStream; | |
| 10 | -import java.io.IOException; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * Responsible for starting compress and managing active and cached resources. | |
| 14 | - */ | |
| 15 | -class Engine { | |
| 16 | - private InputStreamProvider srcImg; | |
| 17 | - private File tagImg; | |
| 18 | - private int srcWidth; | |
| 19 | - private int srcHeight; | |
| 20 | - private boolean focusAlpha; | |
| 21 | - | |
| 22 | - Engine(InputStreamProvider srcImg, File tagImg, boolean focusAlpha) throws IOException { | |
| 23 | - this.tagImg = tagImg; | |
| 24 | - this.srcImg = srcImg; | |
| 25 | - this.focusAlpha = focusAlpha; | |
| 26 | - | |
| 27 | - BitmapFactory.Options options = new BitmapFactory.Options(); | |
| 28 | - options.inJustDecodeBounds = true; | |
| 29 | - options.inSampleSize = 1; | |
| 30 | - | |
| 31 | - BitmapFactory.decodeStream(srcImg.open(), null, options); | |
| 32 | - this.srcWidth = options.outWidth; | |
| 33 | - this.srcHeight = options.outHeight; | |
| 34 | - } | |
| 35 | - | |
| 36 | - private int computeSize() { | |
| 37 | - srcWidth = srcWidth % 2 == 1 ? srcWidth + 1 : srcWidth; | |
| 38 | - srcHeight = srcHeight % 2 == 1 ? srcHeight + 1 : srcHeight; | |
| 39 | - | |
| 40 | - int longSide = Math.max(srcWidth, srcHeight); | |
| 41 | - int shortSide = Math.min(srcWidth, srcHeight); | |
| 42 | - | |
| 43 | - float scale = ((float) shortSide / longSide); | |
| 44 | - if (scale <= 1 && scale > 0.5625) { | |
| 45 | - if (longSide < 1664) { | |
| 46 | - return 1; | |
| 47 | - } else if (longSide < 4990) { | |
| 48 | - return 2; | |
| 49 | - } else if (longSide > 4990 && longSide < 10240) { | |
| 50 | - return 4; | |
| 51 | - } else { | |
| 52 | - return longSide / 1280 == 0 ? 1 : longSide / 1280; | |
| 53 | - } | |
| 54 | - } else if (scale <= 0.5625 && scale > 0.5) { | |
| 55 | - return longSide / 1280 == 0 ? 1 : longSide / 1280; | |
| 56 | - } else { | |
| 57 | - //TODO 增加最大像素限制 | |
| 58 | - return Math.max((int) Math.ceil(longSide / (1280.0 / scale)), 1 + (longSide / 20480)); | |
| 59 | - } | |
| 60 | - } | |
| 61 | - | |
| 62 | - private Bitmap rotatingImage(Bitmap bitmap, int angle) { | |
| 63 | - Matrix matrix = new Matrix(); | |
| 64 | - | |
| 65 | - matrix.postRotate(angle); | |
| 66 | - | |
| 67 | - return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); | |
| 68 | - } | |
| 69 | - | |
| 70 | - File compress() throws IOException { | |
| 71 | - BitmapFactory.Options options = new BitmapFactory.Options(); | |
| 72 | - options.inSampleSize = computeSize(); | |
| 73 | - | |
| 74 | - Bitmap tagBitmap = BitmapFactory.decodeStream(srcImg.open(), null, options); | |
| 75 | - ByteArrayOutputStream stream = new ByteArrayOutputStream(); | |
| 76 | - | |
| 77 | - if (Checker.SINGLE.isJPG(srcImg.open())) { | |
| 78 | - tagBitmap = rotatingImage(tagBitmap, Checker.SINGLE.getOrientation(srcImg.open())); | |
| 79 | - } | |
| 80 | - tagBitmap.compress(focusAlpha ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, 60, stream); | |
| 81 | - tagBitmap.recycle(); | |
| 82 | - | |
| 83 | - FileOutputStream fos = new FileOutputStream(tagImg); | |
| 84 | - fos.write(stream.toByteArray()); | |
| 85 | - fos.flush(); | |
| 86 | - fos.close(); | |
| 87 | - stream.close(); | |
| 88 | - | |
| 89 | - return tagImg; | |
| 90 | - } | |
| 91 | -} | |
| 92 | 0 | \ No newline at end of file |
core/base/src/main/java/top/zibin/luban/InputStreamProvider.java deleted
100644 → 0
| 1 | -package top.zibin.luban; | |
| 2 | - | |
| 3 | -import java.io.IOException; | |
| 4 | -import java.io.InputStream; | |
| 5 | - | |
| 6 | -/** | |
| 7 | - * 通过此接口获取输入流,以兼容文件、FileProvider方式获取到的图片 | |
| 8 | - * <presenter> | |
| 9 | - * Get the input stream through this interface, and obtain the picture using compatible files and FileProvider | |
| 10 | - */ | |
| 11 | -public interface InputStreamProvider { | |
| 12 | - | |
| 13 | - InputStream open() throws IOException; | |
| 14 | - | |
| 15 | - String getPath(); | |
| 16 | -} |
core/base/src/main/java/top/zibin/luban/Luban.java deleted
100644 → 0
| 1 | -package top.zibin.luban; | |
| 2 | - | |
| 3 | -import android.content.Context; | |
| 4 | -import android.net.Uri; | |
| 5 | -import android.os.AsyncTask; | |
| 6 | -import android.os.Handler; | |
| 7 | -import android.os.Looper; | |
| 8 | -import android.os.Message; | |
| 9 | -import android.text.TextUtils; | |
| 10 | -import android.util.Log; | |
| 11 | - | |
| 12 | -import java.io.File; | |
| 13 | -import java.io.FileInputStream; | |
| 14 | -import java.io.IOException; | |
| 15 | -import java.io.InputStream; | |
| 16 | -import java.util.ArrayList; | |
| 17 | -import java.util.Iterator; | |
| 18 | -import java.util.List; | |
| 19 | - | |
| 20 | -@SuppressWarnings("unused") | |
| 21 | -public class Luban implements Handler.Callback { | |
| 22 | - private static final String TAG = "Luban"; | |
| 23 | - private static final String DEFAULT_DISK_CACHE_DIR = "luban_disk_cache"; | |
| 24 | - | |
| 25 | - private static final int MSG_COMPRESS_SUCCESS = 0; | |
| 26 | - private static final int MSG_COMPRESS_START = 1; | |
| 27 | - private static final int MSG_COMPRESS_ERROR = 2; | |
| 28 | - | |
| 29 | - private String mTargetDir; | |
| 30 | - private boolean focusAlpha; | |
| 31 | - private int mLeastCompressSize; | |
| 32 | - private OnRenameListener mRenameListener; | |
| 33 | - private OnCompressListener mCompressListener; | |
| 34 | - private CompressionPredicate mCompressionPredicate; | |
| 35 | - private List<InputStreamProvider> mStreamProviders; | |
| 36 | - | |
| 37 | - private Handler mHandler; | |
| 38 | - | |
| 39 | - private Luban(Builder builder) { | |
| 40 | - this.mTargetDir = builder.mTargetDir; | |
| 41 | - this.mRenameListener = builder.mRenameListener; | |
| 42 | - this.mStreamProviders = builder.mStreamProviders; | |
| 43 | - this.mCompressListener = builder.mCompressListener; | |
| 44 | - this.mLeastCompressSize = builder.mLeastCompressSize; | |
| 45 | - this.mCompressionPredicate = builder.mCompressionPredicate; | |
| 46 | - mHandler = new Handler(Looper.getMainLooper(), this); | |
| 47 | - } | |
| 48 | - | |
| 49 | - public static Builder with(Context context) { | |
| 50 | - return new Builder(context); | |
| 51 | - } | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * Returns a file with a cache image name in the private cache directory. | |
| 55 | - * | |
| 56 | - * @param context A context. | |
| 57 | - */ | |
| 58 | - private File getImageCacheFile(Context context, String suffix) { | |
| 59 | - if (TextUtils.isEmpty(mTargetDir)) { | |
| 60 | - mTargetDir = getImageCacheDir(context).getAbsolutePath(); | |
| 61 | - } | |
| 62 | - | |
| 63 | - String cacheBuilder = mTargetDir + "/" + | |
| 64 | - System.currentTimeMillis() + | |
| 65 | - (int) (Math.random() * 1000) + | |
| 66 | - (TextUtils.isEmpty(suffix) ? ".jpg" : suffix); | |
| 67 | - | |
| 68 | - return new File(cacheBuilder); | |
| 69 | - } | |
| 70 | - | |
| 71 | - private File getImageCustomFile(Context context, String filename) { | |
| 72 | - if (TextUtils.isEmpty(mTargetDir)) { | |
| 73 | - mTargetDir = getImageCacheDir(context).getAbsolutePath(); | |
| 74 | - } | |
| 75 | - | |
| 76 | - String cacheBuilder = mTargetDir + "/" + filename; | |
| 77 | - | |
| 78 | - return new File(cacheBuilder); | |
| 79 | - } | |
| 80 | - | |
| 81 | - /** | |
| 82 | - * Returns a directory with a default name in the private cache directory of the application to | |
| 83 | - * use to store retrieved audio. | |
| 84 | - * | |
| 85 | - * @param context A context. | |
| 86 | - * @see #getImageCacheDir(Context, String) | |
| 87 | - */ | |
| 88 | - private File getImageCacheDir(Context context) { | |
| 89 | - return getImageCacheDir(context, DEFAULT_DISK_CACHE_DIR); | |
| 90 | - } | |
| 91 | - | |
| 92 | - /** | |
| 93 | - * Returns a directory with the given name in the private cache directory of the application to | |
| 94 | - * use to store retrieved media and thumbnails. | |
| 95 | - * | |
| 96 | - * @param context A context. | |
| 97 | - * @param cacheName The name of the subdirectory in which to store the cache. | |
| 98 | - * @see #getImageCacheDir(Context) | |
| 99 | - */ | |
| 100 | - private static File getImageCacheDir(Context context, String cacheName) { | |
| 101 | - File cacheDir = context.getExternalCacheDir(); | |
| 102 | - if (cacheDir != null) { | |
| 103 | - File result = new File(cacheDir, cacheName); | |
| 104 | - if (!result.mkdirs() && (!result.exists() || !result.isDirectory())) { | |
| 105 | - // File wasn't able to create a directory, or the result exists but not a directory | |
| 106 | - return null; | |
| 107 | - } | |
| 108 | - return result; | |
| 109 | - } | |
| 110 | - if (Log.isLoggable(TAG, Log.ERROR)) { | |
| 111 | - Log.e(TAG, "default disk cache dir is null"); | |
| 112 | - } | |
| 113 | - return null; | |
| 114 | - } | |
| 115 | - | |
| 116 | - /** | |
| 117 | - * start asynchronous compress thread | |
| 118 | - */ | |
| 119 | - private void launch(final Context context) { | |
| 120 | - if (mStreamProviders == null || mStreamProviders.size() == 0 && mCompressListener != null) { | |
| 121 | - mCompressListener.onError(new NullPointerException("image file cannot be null")); | |
| 122 | - } | |
| 123 | - | |
| 124 | - Iterator<InputStreamProvider> iterator = mStreamProviders.iterator(); | |
| 125 | - | |
| 126 | - while (iterator.hasNext()) { | |
| 127 | - final InputStreamProvider path = iterator.next(); | |
| 128 | - | |
| 129 | - AsyncTask.SERIAL_EXECUTOR.execute(new Runnable() { | |
| 130 | - @Override | |
| 131 | - public void run() { | |
| 132 | - try { | |
| 133 | - mHandler.sendMessage(mHandler.obtainMessage(MSG_COMPRESS_START)); | |
| 134 | - | |
| 135 | - File result = compress(context, path); | |
| 136 | - | |
| 137 | - mHandler.sendMessage(mHandler.obtainMessage(MSG_COMPRESS_SUCCESS, result)); | |
| 138 | - } catch (IOException e) { | |
| 139 | - mHandler.sendMessage(mHandler.obtainMessage(MSG_COMPRESS_ERROR, e)); | |
| 140 | - } | |
| 141 | - } | |
| 142 | - }); | |
| 143 | - | |
| 144 | - iterator.remove(); | |
| 145 | - } | |
| 146 | - } | |
| 147 | - | |
| 148 | - /** | |
| 149 | - * start compress and return the file | |
| 150 | - */ | |
| 151 | - private File get(InputStreamProvider input, Context context) throws IOException { | |
| 152 | - return new Engine(input, getImageCacheFile(context, Checker.SINGLE.extSuffix(input)), focusAlpha).compress(); | |
| 153 | - } | |
| 154 | - | |
| 155 | - private List<File> get(Context context) throws IOException { | |
| 156 | - List<File> results = new ArrayList<>(); | |
| 157 | - Iterator<InputStreamProvider> iterator = mStreamProviders.iterator(); | |
| 158 | - | |
| 159 | - while (iterator.hasNext()) { | |
| 160 | - results.add(compress(context, iterator.next())); | |
| 161 | - iterator.remove(); | |
| 162 | - } | |
| 163 | - | |
| 164 | - return results; | |
| 165 | - } | |
| 166 | - | |
| 167 | - private File compress(Context context, InputStreamProvider path) throws IOException { | |
| 168 | - File result; | |
| 169 | - | |
| 170 | - File outFile = getImageCacheFile(context, Checker.SINGLE.extSuffix(path)); | |
| 171 | - | |
| 172 | - if (mRenameListener != null) { | |
| 173 | - String filename = mRenameListener.rename(path.getPath()); | |
| 174 | - outFile = getImageCustomFile(context, filename); | |
| 175 | - } | |
| 176 | - | |
| 177 | - if (mCompressionPredicate != null) { | |
| 178 | - if (mCompressionPredicate.apply(path.getPath()) | |
| 179 | - && Checker.SINGLE.needCompress(mLeastCompressSize, path.getPath())) { | |
| 180 | - result = new Engine(path, outFile, focusAlpha).compress(); | |
| 181 | - } else { | |
| 182 | - result = new File(path.getPath()); | |
| 183 | - } | |
| 184 | - } else { | |
| 185 | - result = Checker.SINGLE.needCompress(mLeastCompressSize, path.getPath()) ? | |
| 186 | - new Engine(path, outFile, focusAlpha).compress() : | |
| 187 | - new File(path.getPath()); | |
| 188 | - } | |
| 189 | - | |
| 190 | - return result; | |
| 191 | - } | |
| 192 | - | |
| 193 | - @Override | |
| 194 | - public boolean handleMessage(Message msg) { | |
| 195 | - if (mCompressListener == null) return false; | |
| 196 | - | |
| 197 | - switch (msg.what) { | |
| 198 | - case MSG_COMPRESS_START: | |
| 199 | - mCompressListener.onStart(); | |
| 200 | - break; | |
| 201 | - case MSG_COMPRESS_SUCCESS: | |
| 202 | - mCompressListener.onSuccess((File) msg.obj); | |
| 203 | - break; | |
| 204 | - case MSG_COMPRESS_ERROR: | |
| 205 | - mCompressListener.onError((Throwable) msg.obj); | |
| 206 | - break; | |
| 207 | - } | |
| 208 | - return false; | |
| 209 | - } | |
| 210 | - | |
| 211 | - public static class Builder { | |
| 212 | - private Context context; | |
| 213 | - private String mTargetDir; | |
| 214 | - private boolean focusAlpha; | |
| 215 | - private int mLeastCompressSize = 100; | |
| 216 | - private OnRenameListener mRenameListener; | |
| 217 | - private OnCompressListener mCompressListener; | |
| 218 | - private CompressionPredicate mCompressionPredicate; | |
| 219 | - private List<InputStreamProvider> mStreamProviders; | |
| 220 | - | |
| 221 | - Builder(Context context) { | |
| 222 | - this.context = context; | |
| 223 | - this.mStreamProviders = new ArrayList<>(); | |
| 224 | - } | |
| 225 | - | |
| 226 | - private Luban build() { | |
| 227 | - return new Luban(this); | |
| 228 | - } | |
| 229 | - | |
| 230 | - public Builder load(InputStreamProvider inputStreamProvider) { | |
| 231 | - mStreamProviders.add(inputStreamProvider); | |
| 232 | - return this; | |
| 233 | - } | |
| 234 | - | |
| 235 | - public Builder load(final File file) { | |
| 236 | - mStreamProviders.add(new InputStreamProvider() { | |
| 237 | - @Override | |
| 238 | - public InputStream open() throws IOException { | |
| 239 | - return new FileInputStream(file); | |
| 240 | - } | |
| 241 | - | |
| 242 | - @Override | |
| 243 | - public String getPath() { | |
| 244 | - return file.getAbsolutePath(); | |
| 245 | - } | |
| 246 | - }); | |
| 247 | - return this; | |
| 248 | - } | |
| 249 | - | |
| 250 | - public Builder load(final String string) { | |
| 251 | - mStreamProviders.add(new InputStreamProvider() { | |
| 252 | - @Override | |
| 253 | - public InputStream open() throws IOException { | |
| 254 | - return new FileInputStream(string); | |
| 255 | - } | |
| 256 | - | |
| 257 | - @Override | |
| 258 | - public String getPath() { | |
| 259 | - return string; | |
| 260 | - } | |
| 261 | - }); | |
| 262 | - return this; | |
| 263 | - } | |
| 264 | - | |
| 265 | - public <T> Builder load(List<T> list) { | |
| 266 | - for (T src : list) { | |
| 267 | - if (src instanceof String) { | |
| 268 | - load((String) src); | |
| 269 | - } else if (src instanceof File) { | |
| 270 | - load((File) src); | |
| 271 | - } else if (src instanceof Uri) { | |
| 272 | - load((Uri) src); | |
| 273 | - } else { | |
| 274 | - throw new IllegalArgumentException("Incoming data type exception, it must be String, File, Uri or Bitmap"); | |
| 275 | - } | |
| 276 | - } | |
| 277 | - return this; | |
| 278 | - } | |
| 279 | - | |
| 280 | - public Builder load(final Uri uri) { | |
| 281 | - mStreamProviders.add(new InputStreamProvider() { | |
| 282 | - @Override | |
| 283 | - public InputStream open() throws IOException { | |
| 284 | - return context.getContentResolver().openInputStream(uri); | |
| 285 | - } | |
| 286 | - | |
| 287 | - @Override | |
| 288 | - public String getPath() { | |
| 289 | - return uri.getPath(); | |
| 290 | - } | |
| 291 | - }); | |
| 292 | - return this; | |
| 293 | - } | |
| 294 | - | |
| 295 | - public Builder putGear(int gear) { | |
| 296 | - return this; | |
| 297 | - } | |
| 298 | - | |
| 299 | - public Builder setRenameListener(OnRenameListener listener) { | |
| 300 | - this.mRenameListener = listener; | |
| 301 | - return this; | |
| 302 | - } | |
| 303 | - | |
| 304 | - public Builder setCompressListener(OnCompressListener listener) { | |
| 305 | - this.mCompressListener = listener; | |
| 306 | - return this; | |
| 307 | - } | |
| 308 | - | |
| 309 | - public Builder setTargetDir(String targetDir) { | |
| 310 | - this.mTargetDir = targetDir; | |
| 311 | - return this; | |
| 312 | - } | |
| 313 | - | |
| 314 | - /** | |
| 315 | - * Do I need to keep the image's alpha channel | |
| 316 | - * | |
| 317 | - * @param focusAlpha <presenter> true - to keep alpha channel, the compress speed will be slow. </presenter> | |
| 318 | - * <presenter> false - don't keep alpha channel, it might have a black background.</presenter> | |
| 319 | - */ | |
| 320 | - public Builder setFocusAlpha(boolean focusAlpha) { | |
| 321 | - this.focusAlpha = focusAlpha; | |
| 322 | - return this; | |
| 323 | - } | |
| 324 | - | |
| 325 | - /** | |
| 326 | - * do not compress when the origin image file size less than one value | |
| 327 | - * | |
| 328 | - * @param size the value of file size, unit KB, default 100K | |
| 329 | - */ | |
| 330 | - public Builder ignoreBy(int size) { | |
| 331 | - this.mLeastCompressSize = size; | |
| 332 | - return this; | |
| 333 | - } | |
| 334 | - | |
| 335 | - /** | |
| 336 | - * do compress image when return value was true, otherwise, do not compress the image file | |
| 337 | - * | |
| 338 | - * @param compressionPredicate A predicate callback that returns true or false for the given input path should be compressed. | |
| 339 | - */ | |
| 340 | - public Builder filter(CompressionPredicate compressionPredicate) { | |
| 341 | - this.mCompressionPredicate = compressionPredicate; | |
| 342 | - return this; | |
| 343 | - } | |
| 344 | - | |
| 345 | - | |
| 346 | - /** | |
| 347 | - * begin compress image with asynchronous | |
| 348 | - */ | |
| 349 | - public void launch() { | |
| 350 | - build().launch(context); | |
| 351 | - } | |
| 352 | - | |
| 353 | - public File get(final String path) throws IOException { | |
| 354 | - return build().get(new InputStreamProvider() { | |
| 355 | - @Override | |
| 356 | - public InputStream open() throws IOException { | |
| 357 | - return new FileInputStream(path); | |
| 358 | - } | |
| 359 | - | |
| 360 | - @Override | |
| 361 | - public String getPath() { | |
| 362 | - return path; | |
| 363 | - } | |
| 364 | - }, context); | |
| 365 | - } | |
| 366 | - | |
| 367 | - /** | |
| 368 | - * begin compress image with synchronize | |
| 369 | - * | |
| 370 | - * @return the thumb image file list | |
| 371 | - */ | |
| 372 | - public List<File> get() throws IOException { | |
| 373 | - return build().get(context); | |
| 374 | - } | |
| 375 | - } | |
| 376 | -} | |
| 377 | 0 | \ No newline at end of file |
core/base/src/main/java/top/zibin/luban/OnCompressListener.java deleted
100644 → 0
| 1 | -package top.zibin.luban; | |
| 2 | - | |
| 3 | -import java.io.File; | |
| 4 | - | |
| 5 | -public interface OnCompressListener { | |
| 6 | - | |
| 7 | - /** | |
| 8 | - * Fired when the compression is started, override to handle in your own code | |
| 9 | - */ | |
| 10 | - void onStart(); | |
| 11 | - | |
| 12 | - /** | |
| 13 | - * Fired when a compression returns successfully, override to handle in your own code | |
| 14 | - */ | |
| 15 | - void onSuccess(File file); | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * Fired when a compression fails to complete, override to handle in your own code | |
| 19 | - */ | |
| 20 | - void onError(Throwable e); | |
| 21 | -} |
core/base/src/main/java/top/zibin/luban/OnRenameListener.java deleted
100644 → 0
| 1 | -package top.zibin.luban; | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Author: zibin | |
| 5 | - * Datetime: 2018/5/18 | |
| 6 | - * <presenter> | |
| 7 | - * 提供修改压缩图片命名接口 | |
| 8 | - * <presenter> | |
| 9 | - * A functional interface (callback) that used to rename the file after compress. | |
| 10 | - */ | |
| 11 | -public interface OnRenameListener { | |
| 12 | - | |
| 13 | - /** | |
| 14 | - * 压缩前调用该方法用于修改压缩后文件名 | |
| 15 | - * <presenter> | |
| 16 | - * Call before compression begins. | |
| 17 | - * | |
| 18 | - * @param filePath 传入文件路径/ file path | |
| 19 | - * @return 返回重命名后的字符串/ file name | |
| 20 | - */ | |
| 21 | - String rename(String filePath); | |
| 22 | -} |
module/xiaojiasoundbox/src/main/res/drawable/free_xiaojia_dialog_bg.xml renamed to core/base/src/main/res/drawable/my_dialog_bg.xml
module/xiaojiasoundbox/src/main/res/drawable/selector_xiaojia_dialog_btn_left.xml renamed to core/base/src/main/res/drawable/selector_my_dialog_btn_left.xml
module/xiaojiasoundbox/src/main/res/drawable/selector_xiaojia_dialog_btn_right.xml renamed to core/base/src/main/res/drawable/selector_my_dialog_btn_right.xml
module/xiaojiasoundbox/src/main/res/drawable/selector_xiaojia_tip_dialog_btn_bottom.xml renamed to core/base/src/main/res/drawable/selector_xiaojia_tip_dialog_btn_bottom.xml
module/xiaojiasoundbox/src/main/res/drawable/shape_xiaojia_tip_dialog_btn_bottom_press.xml renamed to core/base/src/main/res/drawable/shape_xiaojia_tip_dialog_btn_bottom_press.xml
module/xiaojiasoundbox/src/main/res/layout/dialog_tip.xml renamed to core/base/src/main/res/layout/dialog_tip.xml
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | android:id="@+id/ll_child" |
| 10 | 10 | android:layout_width="match_parent" |
| 11 | 11 | android:layout_height="wrap_content" |
| 12 | - android:background="@drawable/free_xiaojia_dialog_bg" | |
| 12 | + android:background="@drawable/my_dialog_bg" | |
| 13 | 13 | android:orientation="vertical" |
| 14 | 14 | android:paddingTop="10dp"> |
| 15 | 15 | |
| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | android:layout_width="match_parent" |
| 33 | 33 | android:layout_height="1dp" |
| 34 | 34 | android:layout_marginTop="3dp" |
| 35 | - android:background="@color/line" /> | |
| 35 | + android:background="@color/my_dialog_line" /> | |
| 36 | 36 | |
| 37 | 37 | <LinearLayout |
| 38 | 38 | android:layout_width="match_parent" |
| ... | ... | @@ -54,7 +54,7 @@ |
| 54 | 54 | android:layout_gravity="center" |
| 55 | 55 | android:background="@drawable/selector_xiaojia_tip_dialog_btn_bottom" |
| 56 | 56 | android:text="好的" |
| 57 | - android:textColor="@color/btn_green" | |
| 57 | + android:textColor="@color/my_dialog_btn_text_color" | |
| 58 | 58 | android:textSize="15sp" /> |
| 59 | 59 | </LinearLayout> |
| 60 | 60 | ... | ... |
module/xiaojiasoundbox/src/main/res/layout/dialog_select.xml renamed to core/base/src/main/res/layout/my_dialog_select.xml
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | android:id="@+id/ll_child" |
| 10 | 10 | android:layout_width="match_parent" |
| 11 | 11 | android:layout_height="wrap_content" |
| 12 | - android:background="@drawable/free_xiaojia_dialog_bg" | |
| 12 | + android:background="@drawable/my_dialog_bg" | |
| 13 | 13 | android:orientation="vertical" |
| 14 | 14 | android:paddingTop="10dp"> |
| 15 | 15 | |
| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | android:layout_width="match_parent" |
| 33 | 33 | android:layout_height="1dp" |
| 34 | 34 | android:layout_marginTop="3dp" |
| 35 | - android:background="@color/line" /> | |
| 35 | + android:background="@color/my_dialog_line" /> | |
| 36 | 36 | |
| 37 | 37 | <LinearLayout |
| 38 | 38 | android:layout_width="match_parent" |
| ... | ... | @@ -52,9 +52,9 @@ |
| 52 | 52 | android:layout_width="match_parent" |
| 53 | 53 | android:layout_height="match_parent" |
| 54 | 54 | android:layout_gravity="center" |
| 55 | - android:background="@drawable/selector_xiaojia_dialog_btn_left" | |
| 55 | + android:background="@drawable/selector_my_dialog_btn_left" | |
| 56 | 56 | android:text="否" |
| 57 | - android:textColor="@color/btn_green" | |
| 57 | + android:textColor="@color/my_dialog_btn_text_color" | |
| 58 | 58 | android:textSize="15sp" |
| 59 | 59 | android:textStyle="bold" /> |
| 60 | 60 | </LinearLayout> |
| ... | ... | @@ -62,7 +62,7 @@ |
| 62 | 62 | <View |
| 63 | 63 | android:layout_width="1dp" |
| 64 | 64 | android:layout_height="match_parent" |
| 65 | - android:background="@color/line" /> | |
| 65 | + android:background="@color/my_dialog_line" /> | |
| 66 | 66 | |
| 67 | 67 | <LinearLayout |
| 68 | 68 | android:layout_width="0dp" |
| ... | ... | @@ -76,9 +76,9 @@ |
| 76 | 76 | android:layout_width="match_parent" |
| 77 | 77 | android:layout_height="match_parent" |
| 78 | 78 | android:layout_gravity="center" |
| 79 | - android:background="@drawable/selector_xiaojia_dialog_btn_right" | |
| 79 | + android:background="@drawable/selector_my_dialog_btn_right" | |
| 80 | 80 | android:text="否" |
| 81 | - android:textColor="@color/btn_green" | |
| 81 | + android:textColor="@color/my_dialog_btn_text_color" | |
| 82 | 82 | android:textSize="15sp" |
| 83 | 83 | android:textStyle="bold" /> |
| 84 | 84 | </LinearLayout> | ... | ... |
core/base/src/main/res/values/colors.xml
| ... | ... | @@ -60,4 +60,7 @@ |
| 60 | 60 | <color name="tipTextColor">#8f8f8f</color> |
| 61 | 61 | <color name="menuSplitSpaceKongzue">#f1f2f4</color> |
| 62 | 62 | <!-- --> |
| 63 | + <color name="my_dialog_line">#80EEEEEE</color> | |
| 64 | + <color name="my_dialog_btn_text_color">#23D41E</color> | |
| 65 | + | |
| 63 | 66 | </resources> |
| 64 | 67 | \ No newline at end of file | ... | ... |
core/base/src/main/res/values/style.xml
| ... | ... | @@ -155,5 +155,16 @@ |
| 155 | 155 | <item name="android:windowEnterAnimation">@anim/top_menu_enter</item> |
| 156 | 156 | <item name="android:windowExitAnimation">@anim/top_menu_exit</item> |
| 157 | 157 | </style> |
| 158 | -<!-- --> | |
| 158 | + <!-- --> | |
| 159 | + <!-- 自定义对话框--> | |
| 160 | + <!--自定义Dialog背景全透明无边框theme--> | |
| 161 | + <style name="MyDialog" parent="android:style/Theme.Dialog"> | |
| 162 | + <item name="android:windowFrame">@null</item> | |
| 163 | + <item name="android:windowBackground">@android:color/transparent</item> | |
| 164 | + <item name="android:windowNoTitle">true</item> | |
| 165 | + <item name="android:windowIsFloating">true</item> | |
| 166 | + <item name="android:windowContentOverlay">@null</item> | |
| 167 | + <item name="android:background">@android:color/transparent</item> | |
| 168 | + </style> | |
| 169 | + <!-- --> | |
| 159 | 170 | </resources> |
| 160 | 171 | \ No newline at end of file | ... | ... |
core/network/src/main/java/com/cnlive/core/network/request/BaseRequest.java
| ... | ... | @@ -40,12 +40,12 @@ public class BaseRequest { |
| 40 | 40 | private String initBaseUrl(Class clazz) { |
| 41 | 41 | if (AppConfig.isDebug()) { |
| 42 | 42 | baseUrl = BASE_DEBUG_URL;//还原初始地址 |
| 43 | - if (clazz == ApiBaseServiceOpen.class) { | |
| 44 | - return OPEN_URL; | |
| 45 | - } | |
| 46 | 43 | } else { |
| 47 | 44 | baseUrl = BASE_URL; |
| 48 | 45 | } |
| 46 | + if (clazz == ApiBaseServiceOpen.class) { | |
| 47 | + return OPEN_URL; | |
| 48 | + } | |
| 49 | 49 | return baseUrl; |
| 50 | 50 | } |
| 51 | 51 | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/ChangeWifiFragmentView.java
| ... | ... | @@ -17,10 +17,9 @@ import com.cnlive.strike.xiaojiaspeaker.frame.presenter.ChangeWifiFragmentPresen |
| 17 | 17 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean; |
| 18 | 18 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.WifiRecycleAdapter; |
| 19 | 19 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.ChangeWifiFragment; |
| 20 | -import com.cnlive.strike.xiaojiaspeaker.ui.widget.TipDialog; | |
| 20 | +import com.cnlive.core.libs.base.ui.widget.TipDialog; | |
| 21 | 21 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.WifiPwdDialog; |
| 22 | 22 | import com.cnlive.strike.xiaojiaspeaker.util.WifiUtils; |
| 23 | -import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 24 | 23 | |
| 25 | 24 | import java.util.ArrayList; |
| 26 | 25 | import java.util.List; |
| ... | ... | @@ -87,7 +86,7 @@ public class ChangeWifiFragmentView extends BaseView { |
| 87 | 86 | } |
| 88 | 87 | |
| 89 | 88 | private void initErrorDialog() { |
| 90 | - errorDialog = new TipDialog(getContext(), "", "关闭", R.color.btn_green, new TipDialog.DialogInterface() { | |
| 89 | + errorDialog = new TipDialog(getContext(), "", "关闭", R.color.my_dialog_btn_text_color, new TipDialog.DialogInterface() { | |
| 91 | 90 | @Override |
| 92 | 91 | public void onClick(TipDialog dialog) { |
| 93 | 92 | dialog.dismiss(); |
| ... | ... | @@ -142,7 +141,7 @@ public class ChangeWifiFragmentView extends BaseView { |
| 142 | 141 | } |
| 143 | 142 | }); |
| 144 | 143 | wifiPwdDialog.setLeftBtnColor(R.color.color_999999); |
| 145 | - wifiPwdDialog.setRightBtnColor(R.color.btn_green); | |
| 144 | + wifiPwdDialog.setRightBtnColor(R.color.my_dialog_btn_text_color); | |
| 146 | 145 | wifiPwdDialog.setCancelable(false); |
| 147 | 146 | wifiPwdDialog.setCanceledOnTouchOutside(false); |
| 148 | 147 | } | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/DeviceManagerFragmentView.java
| ... | ... | @@ -25,10 +25,9 @@ import com.cnlive.strike.xiaojiaspeaker.ui.activity.ChangeWifiActivity; |
| 25 | 25 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.DeviceInfoActivity; |
| 26 | 26 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.FirmwareUpdateActivity; |
| 27 | 27 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.DeviceManagerFragment; |
| 28 | -import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog; | |
| 28 | +import com.cnlive.core.libs.base.ui.widget.SelectDialog; | |
| 29 | 29 | import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsListener; |
| 30 | 30 | import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsUtils; |
| 31 | -import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 32 | 31 | |
| 33 | 32 | public class DeviceManagerFragmentView extends BaseView { |
| 34 | 33 | private DeviceManagerFragment fragment; |
| ... | ... | @@ -143,7 +142,7 @@ public class DeviceManagerFragmentView extends BaseView { |
| 143 | 142 | selectDialog.setCancelable(false); |
| 144 | 143 | selectDialog.setCanceledOnTouchOutside(false); |
| 145 | 144 | selectDialog.setTipTextStyle(Typeface.DEFAULT); |
| 146 | - selectDialog.setRightBtnColor(R.color.btn_green); | |
| 145 | + selectDialog.setRightBtnColor(R.color.my_dialog_btn_text_color); | |
| 147 | 146 | if (!selectDialog.isShowing()) { |
| 148 | 147 | selectDialog.show(); |
| 149 | 148 | } | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SearchDevicefragmentView.java
| ... | ... | @@ -19,9 +19,8 @@ import com.cnlive.strike.xiaojiaspeaker.ui.activity.BlueToothHelpActivity; |
| 19 | 19 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.SelectWifiActivity; |
| 20 | 20 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.BluetoothDeviceAdapter; |
| 21 | 21 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SearchDevicefragment; |
| 22 | -import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog; | |
| 22 | +import com.cnlive.core.libs.base.ui.widget.SelectDialog; | |
| 23 | 23 | import com.cnlive.strike.xiaojiaspeaker.util.WifiUtils; |
| 24 | -import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 25 | 24 | |
| 26 | 25 | import java.util.ArrayList; |
| 27 | 26 | import java.util.List; |
| ... | ... | @@ -112,7 +111,7 @@ public class SearchDevicefragmentView extends BaseView { |
| 112 | 111 | dialog.dismiss(); |
| 113 | 112 | } |
| 114 | 113 | }); |
| 115 | - wifiDialog.setRightBtnColor(R.color.btn_green); | |
| 114 | + wifiDialog.setRightBtnColor(R.color.my_dialog_btn_text_color); | |
| 116 | 115 | wifiDialog.setCancelable(false); |
| 117 | 116 | wifiDialog.setCanceledOnTouchOutside(false); |
| 118 | 117 | } | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SelectWifiFragmentView.java
| ... | ... | @@ -30,12 +30,11 @@ import com.cnlive.strike.xiaojiaspeaker.ui.activity.ConnBluetoothSuccessActivity |
| 30 | 30 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.ConnFailActivity; |
| 31 | 31 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.WifiRecycleAdapter; |
| 32 | 32 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectWifiFragment; |
| 33 | -import com.cnlive.strike.xiaojiaspeaker.ui.widget.TipDialog; | |
| 33 | +import com.cnlive.core.libs.base.ui.widget.TipDialog; | |
| 34 | 34 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.WifiPwdDialog; |
| 35 | 35 | import com.cnlive.strike.xiaojiaspeaker.util.BlueToothUtil; |
| 36 | 36 | import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil; |
| 37 | 37 | import com.cnlive.strike.xiaojiaspeaker.util.WifiUtils; |
| 38 | -import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 39 | 38 | |
| 40 | 39 | import org.greenrobot.eventbus.EventBus; |
| 41 | 40 | |
| ... | ... | @@ -120,7 +119,7 @@ public class SelectWifiFragmentView extends BaseView { |
| 120 | 119 | } |
| 121 | 120 | |
| 122 | 121 | private void initErrorDialog() { |
| 123 | - errorDialog = new TipDialog(getContext(), "", "关闭", R.color.btn_green, new TipDialog.DialogInterface() { | |
| 122 | + errorDialog = new TipDialog(getContext(), "", "关闭", R.color.my_dialog_btn_text_color, new TipDialog.DialogInterface() { | |
| 124 | 123 | @Override |
| 125 | 124 | public void onClick(TipDialog dialog) { |
| 126 | 125 | dialog.dismiss(); |
| ... | ... | @@ -161,7 +160,7 @@ public class SelectWifiFragmentView extends BaseView { |
| 161 | 160 | } |
| 162 | 161 | }); |
| 163 | 162 | wifiPwdDialog.setLeftBtnColor(R.color.color_999999); |
| 164 | - wifiPwdDialog.setRightBtnColor(R.color.btn_green); | |
| 163 | + wifiPwdDialog.setRightBtnColor(R.color.my_dialog_btn_text_color); | |
| 165 | 164 | wifiPwdDialog.setCancelable(false); |
| 166 | 165 | wifiPwdDialog.setCanceledOnTouchOutside(false); |
| 167 | 166 | } | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/UserManagerView.java
| ... | ... | @@ -23,10 +23,9 @@ import com.cnlive.strike.xiaojiaspeaker.ui.activity.SelectIMFriendActivity; |
| 23 | 23 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.UserManagerAdapter; |
| 24 | 24 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.UserManagerFragment; |
| 25 | 25 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.EditRoleDialog; |
| 26 | -import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog; | |
| 26 | +import com.cnlive.core.libs.base.ui.widget.SelectDialog; | |
| 27 | 27 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.popmenu.PopMenu; |
| 28 | 28 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.popmenu.PopMenuInfo; |
| 29 | -import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 30 | 29 | |
| 31 | 30 | import java.util.ArrayList; |
| 32 | 31 | import java.util.List; |
| ... | ... | @@ -163,7 +162,7 @@ public class UserManagerView extends BaseView { |
| 163 | 162 | }); |
| 164 | 163 | } |
| 165 | 164 | }); |
| 166 | - deleteDialog.setRightBtnColor(R.color.btn_green); | |
| 165 | + deleteDialog.setRightBtnColor(R.color.my_dialog_btn_text_color); | |
| 167 | 166 | deleteDialog.setTipTextStyle(Typeface.DEFAULT); |
| 168 | 167 | if (!deleteDialog.isShowing()) { |
| 169 | 168 | deleteDialog.show(); | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/BlueToothStep2Activity.java
| ... | ... | @@ -7,15 +7,10 @@ import android.content.BroadcastReceiver; |
| 7 | 7 | import android.content.Context; |
| 8 | 8 | import android.content.Intent; |
| 9 | 9 | import android.content.IntentFilter; |
| 10 | -import android.content.pm.PackageManager; | |
| 11 | 10 | import android.net.Uri; |
| 12 | -import android.os.Bundle; | |
| 13 | 11 | import android.provider.Settings; |
| 14 | 12 | import android.util.Log; |
| 15 | 13 | import android.view.View; |
| 16 | - | |
| 17 | -import androidx.databinding.DataBindingUtil; | |
| 18 | - | |
| 19 | 14 | import com.clj.fastble.BleManager; |
| 20 | 15 | import com.cnlive.core.libs.base.frame.activity.BaseActivity; |
| 21 | 16 | import com.cnlive.core.libs.base.interfaces.OnPermissionResponseListener; |
| ... | ... | @@ -24,10 +19,8 @@ import com.cnlive.core.libs.base.util.StatusBarConfig; |
| 24 | 19 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 25 | 20 | import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityBlueToothStep2Binding; |
| 26 | 21 | import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; |
| 27 | -import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog; | |
| 22 | +import com.cnlive.core.libs.base.ui.widget.SelectDialog; | |
| 28 | 23 | import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; |
| 29 | -import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsListener; | |
| 30 | -import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsUtils; | |
| 31 | 24 | |
| 32 | 25 | import org.greenrobot.eventbus.Subscribe; |
| 33 | 26 | import org.greenrobot.eventbus.ThreadMode; |
| ... | ... | @@ -35,7 +28,6 @@ import org.greenrobot.eventbus.ThreadMode; |
| 35 | 28 | public class BlueToothStep2Activity extends BaseActivity { |
| 36 | 29 | private ActivityBlueToothStep2Binding binding; |
| 37 | 30 | private int permissionRequestCount = 0;//权限请求次数 |
| 38 | - private boolean isClickNextBtn = false; | |
| 39 | 31 | private SelectDialog selectDialog; |
| 40 | 32 | |
| 41 | 33 | @Override |
| ... | ... | @@ -119,7 +111,7 @@ public class BlueToothStep2Activity extends BaseActivity { |
| 119 | 111 | * 一次申请一组权限(使用拒绝弹框)点击事件 |
| 120 | 112 | */ |
| 121 | 113 | public void getPermissionsWithTip() { |
| 122 | - String[] permissions = new String[]{ Manifest.permission.INTERNET | |
| 114 | + String[] permissions = new String[]{Manifest.permission.INTERNET | |
| 123 | 115 | , Manifest.permission.ACCESS_FINE_LOCATION |
| 124 | 116 | , Manifest.permission.ACCESS_COARSE_LOCATION}; |
| 125 | 117 | requestPermission(permissions, "您尚未授予程序运行所需权限\n是否设置?", new OnPermissionResponseListener() { |
| ... | ... | @@ -178,10 +170,8 @@ public class BlueToothStep2Activity extends BaseActivity { |
| 178 | 170 | switch (blueState) { |
| 179 | 171 | case BluetoothAdapter.STATE_TURNING_ON: |
| 180 | 172 | Log.e(TAG, "监听到蓝牙已开启"); |
| 181 | - if (isClickNextBtn) { | |
| 182 | - SearchDeviceActivity.startActivity(BlueToothStep2Activity.this); | |
| 183 | - finish(); | |
| 184 | - } | |
| 173 | + SearchDeviceActivity.startActivity(BlueToothStep2Activity.this); | |
| 174 | + finish(); | |
| 185 | 175 | break; |
| 186 | 176 | case BluetoothAdapter.STATE_ON: |
| 187 | 177 | Log.e(TAG, "监听到蓝牙已启动"); | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/ChangeWifiActivity.java
| ... | ... | @@ -3,7 +3,6 @@ package com.cnlive.strike.xiaojiaspeaker.ui.activity; |
| 3 | 3 | import android.Manifest; |
| 4 | 4 | import android.app.Activity; |
| 5 | 5 | import android.content.Intent; |
| 6 | -import android.content.pm.PackageManager; | |
| 7 | 6 | import android.net.Uri; |
| 8 | 7 | import android.os.Bundle; |
| 9 | 8 | import android.os.Handler; |
| ... | ... | @@ -11,16 +10,13 @@ import android.provider.Settings; |
| 11 | 10 | import android.text.TextUtils; |
| 12 | 11 | import android.util.Log; |
| 13 | 12 | |
| 14 | -import androidx.annotation.NonNull; | |
| 15 | - | |
| 16 | 13 | import com.cnlive.core.libs.base.frame.activity.BaseActivity; |
| 17 | 14 | import com.cnlive.core.libs.base.interfaces.OnPermissionResponseListener; |
| 18 | 15 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 19 | 16 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean; |
| 20 | 17 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.ChangeWifiFragment; |
| 21 | -import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog; | |
| 18 | +import com.cnlive.core.libs.base.ui.widget.SelectDialog; | |
| 22 | 19 | import com.cnlive.strike.xiaojiaspeaker.util.WifiUtils; |
| 23 | -import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsListener; | |
| 24 | 20 | import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsUtils; |
| 25 | 21 | |
| 26 | 22 | public class ChangeWifiActivity extends BaseActivity { | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/RemoteControlActivity.java
| ... | ... | @@ -37,6 +37,11 @@ public class RemoteControlActivity extends BaseActivity { |
| 37 | 37 | return R.layout.activity_remote_control; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | + @Override | |
| 41 | + protected void initBindingData() { | |
| 42 | + super.initBindingData(); | |
| 43 | + binding= (ActivityRemoteControlBinding) baseBinding; | |
| 44 | + } | |
| 40 | 45 | |
| 41 | 46 | @Override |
| 42 | 47 | protected void initView() { | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/SelectWifiActivity.java
| ... | ... | @@ -3,9 +3,7 @@ package com.cnlive.strike.xiaojiaspeaker.ui.activity; |
| 3 | 3 | import android.Manifest; |
| 4 | 4 | import android.app.Activity; |
| 5 | 5 | import android.content.Intent; |
| 6 | -import android.content.pm.PackageManager; | |
| 7 | 6 | import android.net.Uri; |
| 8 | -import android.os.Bundle; | |
| 9 | 7 | import android.os.Handler; |
| 10 | 8 | import android.provider.Settings; |
| 11 | 9 | import android.util.Log; |
| ... | ... | @@ -14,7 +12,7 @@ import com.clj.fastble.data.BleDevice; |
| 14 | 12 | import com.cnlive.core.libs.base.frame.activity.BaseActivity; |
| 15 | 13 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 16 | 14 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectWifiFragment; |
| 17 | -import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog; | |
| 15 | +import com.cnlive.core.libs.base.ui.widget.SelectDialog; | |
| 18 | 16 | import com.cnlive.strike.xiaojiaspeaker.util.WifiUtils; |
| 19 | 17 | import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsListener; |
| 20 | 18 | import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsUtils; | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/AllDeviceFragment.java
| ... | ... | @@ -87,7 +87,7 @@ public class AllDeviceFragment extends BaseFragment<AllDeviceFragmentView, AllDe |
| 87 | 87 | binding.topbar.addLeftImageButton(R.drawable.icon_xiaojia_back, R.id.left_back).setOnClickListener(new View.OnClickListener() { |
| 88 | 88 | @Override |
| 89 | 89 | public void onClick(View view) { |
| 90 | - getActivity().finish(); | |
| 90 | + finish(); | |
| 91 | 91 | } |
| 92 | 92 | }); |
| 93 | 93 | //添加设备按钮 | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SelectWifiFragment.java
| ... | ... | @@ -50,7 +50,7 @@ public class SelectWifiFragment extends BaseFragment<SelectWifiFragmentView, Sel |
| 50 | 50 | @Override |
| 51 | 51 | protected void initFragmentStyle() { |
| 52 | 52 | super.initFragmentStyle(); |
| 53 | - setStatusBarTextColor(StatusBarConfig.WHITE); | |
| 53 | + setStatusBarTextColor(StatusBarConfig.BLACK); | |
| 54 | 54 | setStatusBarColor(R.color.white,0); |
| 55 | 55 | } |
| 56 | 56 | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/widget/WifiPwdDialog.java
| ... | ... | @@ -88,7 +88,7 @@ public class WifiPwdDialog extends Dialog { |
| 88 | 88 | //显示视图 |
| 89 | 89 | this.setContentView(view); |
| 90 | 90 | this.btn_ok.setClickable(false); |
| 91 | - this.btn_ok.setTextColor(ContextCompat.getColor(context, R.color.line)); | |
| 91 | + this.btn_ok.setTextColor(ContextCompat.getColor(context, R.color.my_dialog_line)); | |
| 92 | 92 | this.et_pwd.addTextChangedListener(new TextWatcher() { |
| 93 | 93 | @Override |
| 94 | 94 | public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
| ... | ... | @@ -99,12 +99,12 @@ public class WifiPwdDialog extends Dialog { |
| 99 | 99 | public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
| 100 | 100 | if (charSequence.length() < 8) { |
| 101 | 101 | btn_ok.setClickable(false); |
| 102 | - btn_ok.setTextColor(ContextCompat.getColor(context, R.color.line)); | |
| 102 | + btn_ok.setTextColor(ContextCompat.getColor(context, R.color.my_dialog_line)); | |
| 103 | 103 | |
| 104 | 104 | } else { |
| 105 | 105 | btn_ok.setClickable(true); |
| 106 | 106 | btn_ok.setTextColor(ContextCompat.getColor(context, rightColor)); |
| 107 | - btn_ok.setBackground(context.getResources().getDrawable(R.drawable.selector_xiaojia_dialog_btn_right)); | |
| 107 | + btn_ok.setBackground(context.getResources().getDrawable(R.drawable.selector_my_dialog_btn_right)); | |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | ... | ... |
module/xiaojiasoundbox/src/main/res/drawable-v21/ripple_xiaojia_bg.xml
| 1 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 | -<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/line"> | |
| 2 | +<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/my_dialog_line"> | |
| 3 | 3 | <item android:drawable="@color/transparent"/> |
| 4 | 4 | </ripple> |
| 5 | 5 | ... | ... |
module/xiaojiasoundbox/src/main/res/drawable-v21/selectable_xiaojia_item_white.xml
| 1 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 | -<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/line"> | |
| 2 | +<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/my_dialog_line"> | |
| 3 | 3 | <item android:drawable="@color/white"/> |
| 4 | 4 | </ripple> |
| 5 | 5 | ... | ... |
module/xiaojiasoundbox/src/main/res/drawable/miui_xiaojia_back_drawable.xml
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | </item> |
| 10 | 10 | <item android:state_checked="true"> |
| 11 | 11 | <shape> |
| 12 | - <solid android:color="@color/btn_green" /> | |
| 12 | + <solid android:color="@color/my_dialog_btn_text_color" /> | |
| 13 | 13 | <corners android:radius="99dp" /> |
| 14 | 14 | <stroke android:width="1px" android:color="#DEDEDE" /> |
| 15 | 15 | </shape> | ... | ... |
module/xiaojiasoundbox/src/main/res/drawable/ripple_xiaojia_bg.xml
| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| 3 | 3 | <item android:drawable="@drawable/abc_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/> |
| 4 | 4 | <item android:drawable="@drawable/abc_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true"/> |
| 5 | - <item android:drawable="@color/line" android:state_focused="true" android:state_pressed="true"/> | |
| 6 | - <item android:drawable="@color/line" android:state_focused="false" android:state_pressed="true"/> | |
| 5 | + <item android:drawable="@color/my_dialog_line" android:state_focused="true" android:state_pressed="true"/> | |
| 6 | + <item android:drawable="@color/my_dialog_line" android:state_focused="false" android:state_pressed="true"/> | |
| 7 | 7 | <item android:drawable="@color/white"/> |
| 8 | 8 | </selector> |
| 9 | 9 | ... | ... |
module/xiaojiasoundbox/src/main/res/drawable/selectable_xiaojia_background.xml
| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| 3 | 3 | <item android:drawable="@drawable/abc_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/> |
| 4 | 4 | <item android:drawable="@drawable/abc_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true"/> |
| 5 | - <item android:drawable="@color/line" android:state_focused="true" android:state_pressed="true"/> | |
| 6 | - <item android:drawable="@color/line" android:state_focused="false" android:state_pressed="true"/> | |
| 5 | + <item android:drawable="@color/my_dialog_line" android:state_focused="true" android:state_pressed="true"/> | |
| 6 | + <item android:drawable="@color/my_dialog_line" android:state_focused="false" android:state_pressed="true"/> | |
| 7 | 7 | <item android:drawable="@color/white"/> |
| 8 | 8 | </selector> |
| 9 | 9 | ... | ... |
module/xiaojiasoundbox/src/main/res/drawable/selectable_xiaojia_item_white.xml
| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| 3 | 3 | <item android:drawable="@drawable/abc_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/> |
| 4 | 4 | <item android:drawable="@drawable/abc_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true"/> |
| 5 | - <item android:drawable="@color/line" android:state_focused="true" android:state_pressed="true"/> | |
| 6 | - <item android:drawable="@color/line" android:state_focused="false" android:state_pressed="true"/> | |
| 5 | + <item android:drawable="@color/my_dialog_line" android:state_focused="true" android:state_pressed="true"/> | |
| 6 | + <item android:drawable="@color/my_dialog_line" android:state_focused="false" android:state_pressed="true"/> | |
| 7 | 7 | <item android:drawable="@color/white"/> |
| 8 | 8 | </selector> |
| 9 | 9 | ... | ... |
module/xiaojiasoundbox/src/main/res/drawable/shape_xiaojia_btn_green.xml
| ... | ... | @@ -2,10 +2,10 @@ |
| 2 | 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| 3 | 3 | <corners android:radius="50dp" /> |
| 4 | 4 | <!-- 填充的颜色 --> |
| 5 | - <solid android:color="@color/btn_green" /> | |
| 5 | + <solid android:color="@color/my_dialog_btn_text_color" /> | |
| 6 | 6 | <!--设置渐变--> |
| 7 | 7 | <!--设置渐变--> |
| 8 | 8 | <gradient |
| 9 | - android:endColor="@color/btn_green" | |
| 9 | + android:endColor="@color/my_dialog_btn_text_color" | |
| 10 | 10 | android:startColor="#49EE1D" /> |
| 11 | 11 | </shape> |
| 12 | 12 | \ No newline at end of file | ... | ... |
module/xiaojiasoundbox/src/main/res/drawable/shape_xiaojia_dialog_btn_left_press.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| 3 | 3 | <corners android:bottomLeftRadius="20dp" /> |
| 4 | - <solid android:color="@color/line" /> | |
| 4 | + <solid android:color="@color/my_dialog_line" /> | |
| 5 | 5 | </shape> |
| 6 | 6 | \ No newline at end of file | ... | ... |
module/xiaojiasoundbox/src/main/res/drawable/shape_xiaojia_dialog_btn_right_press.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| 3 | 3 | <corners android:bottomRightRadius="20dp" /> |
| 4 | - <solid android:color="@color/line" /> | |
| 4 | + <solid android:color="@color/my_dialog_line" /> | |
| 5 | 5 | </shape> |
| 6 | 6 | \ No newline at end of file | ... | ... |
module/xiaojiasoundbox/src/main/res/drawable/shape_xiaojia_et_wifi_bg.xml
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| 3 | 3 | <stroke |
| 4 | 4 | android:width="1dp" |
| 5 | - android:color="@color/line" /> | |
| 6 | - <solid android:color="@color/line" /> | |
| 5 | + android:color="@color/my_dialog_line" /> | |
| 6 | + <solid android:color="@color/my_dialog_line" /> | |
| 7 | 7 | <corners android:radius="10dp" /> |
| 8 | 8 | </shape> |
| 9 | 9 | \ No newline at end of file | ... | ... |
module/xiaojiasoundbox/src/main/res/drawable/shape_xiaojia_green_stroke.xml
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| 3 | 3 | <stroke |
| 4 | 4 | android:width="1dp" |
| 5 | - android:color="@color/btn_green" /> | |
| 5 | + android:color="@color/my_dialog_btn_text_color" /> | |
| 6 | 6 | <solid android:color="@color/white" /> |
| 7 | 7 | <corners android:radius="20dp" /> |
| 8 | 8 | </shape> |
| 9 | 9 | \ No newline at end of file | ... | ... |
module/xiaojiasoundbox/src/main/res/layout/activity_conn_bluetooth_success.xml
| ... | ... | @@ -37,7 +37,7 @@ |
| 37 | 37 | android:layout_height="wrap_content" |
| 38 | 38 | android:layout_marginTop="20dp" |
| 39 | 39 | android:text="@string/conn_success" |
| 40 | - android:textColor="@color/btn_green" | |
| 40 | + android:textColor="@color/my_dialog_btn_text_color" | |
| 41 | 41 | android:textSize="20sp" |
| 42 | 42 | android:textStyle="bold" /> |
| 43 | 43 | </LinearLayout> |
| ... | ... | @@ -70,7 +70,7 @@ |
| 70 | 70 | android:layout_marginTop="30dp" |
| 71 | 71 | android:background="@drawable/shape_xiaojia_green_stroke" |
| 72 | 72 | android:text="完成" |
| 73 | - android:textColor="@color/btn_green" | |
| 73 | + android:textColor="@color/my_dialog_btn_text_color" | |
| 74 | 74 | android:textSize="18sp" /> |
| 75 | 75 | |
| 76 | 76 | <TextView |
| ... | ... | @@ -81,7 +81,7 @@ |
| 81 | 81 | android:layout_marginTop="30sp" |
| 82 | 82 | android:gravity="center" |
| 83 | 83 | android:text="给音箱取个名字吧 >>" |
| 84 | - android:textColor="@color/btn_green" | |
| 84 | + android:textColor="@color/my_dialog_btn_text_color" | |
| 85 | 85 | android:textSize="13sp" /> |
| 86 | 86 | |
| 87 | 87 | </LinearLayout> |
| ... | ... | @@ -98,7 +98,7 @@ |
| 98 | 98 | android:layout_height="1dp" |
| 99 | 99 | android:layout_marginLeft="10dp" |
| 100 | 100 | android:layout_marginRight="10dp" |
| 101 | - android:background="@color/line" /> | |
| 101 | + android:background="@color/my_dialog_line" /> | |
| 102 | 102 | |
| 103 | 103 | <TextView |
| 104 | 104 | android:layout_width="wrap_content" |
| ... | ... | @@ -116,7 +116,7 @@ |
| 116 | 116 | android:layout_gravity="center_horizontal" |
| 117 | 117 | android:layout_marginTop="15dp" |
| 118 | 118 | android:text="@string/go_to_liaten_china" |
| 119 | - android:textColor="@color/btn_green" | |
| 119 | + android:textColor="@color/my_dialog_btn_text_color" | |
| 120 | 120 | android:textSize="13sp" /> |
| 121 | 121 | </LinearLayout> |
| 122 | 122 | </LinearLayout> | ... | ... |
module/xiaojiasoundbox/src/main/res/layout/dialog_edit_role.xml
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | android:id="@+id/ll_child" |
| 10 | 10 | android:layout_width="match_parent" |
| 11 | 11 | android:layout_height="wrap_content" |
| 12 | - android:background="@drawable/free_xiaojia_dialog_bg" | |
| 12 | + android:background="@drawable/my_dialog_bg" | |
| 13 | 13 | android:orientation="vertical" |
| 14 | 14 | android:paddingTop="10dp"> |
| 15 | 15 | |
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | android:layout_marginLeft="10dp" |
| 32 | 32 | android:layout_marginTop="15dp" |
| 33 | 33 | android:layout_marginRight="10dp" |
| 34 | - android:background="@color/line" /> | |
| 34 | + android:background="@color/my_dialog_line" /> | |
| 35 | 35 | |
| 36 | 36 | <LinearLayout |
| 37 | 37 | android:layout_width="match_parent" |
| ... | ... | @@ -66,7 +66,7 @@ |
| 66 | 66 | android:layout_height="1dp" |
| 67 | 67 | android:layout_marginLeft="10dp" |
| 68 | 68 | android:layout_marginRight="10dp" |
| 69 | - android:background="@color/line" /> | |
| 69 | + android:background="@color/my_dialog_line" /> | |
| 70 | 70 | |
| 71 | 71 | <LinearLayout |
| 72 | 72 | android:layout_width="match_parent" |
| ... | ... | @@ -86,7 +86,7 @@ |
| 86 | 86 | android:layout_width="match_parent" |
| 87 | 87 | android:layout_height="match_parent" |
| 88 | 88 | android:layout_gravity="center" |
| 89 | - android:background="@drawable/selector_xiaojia_dialog_btn_left" | |
| 89 | + android:background="@drawable/selector_my_dialog_btn_left" | |
| 90 | 90 | android:text="取消" |
| 91 | 91 | android:textColor="@color/color_282828" |
| 92 | 92 | android:textSize="17sp" /> |
| ... | ... | @@ -95,7 +95,7 @@ |
| 95 | 95 | <View |
| 96 | 96 | android:layout_width="1dp" |
| 97 | 97 | android:layout_height="match_parent" |
| 98 | - android:background="@color/line" /> | |
| 98 | + android:background="@color/my_dialog_line" /> | |
| 99 | 99 | |
| 100 | 100 | <LinearLayout |
| 101 | 101 | android:layout_width="0dp" |
| ... | ... | @@ -109,9 +109,9 @@ |
| 109 | 109 | android:layout_width="match_parent" |
| 110 | 110 | android:layout_height="match_parent" |
| 111 | 111 | android:layout_gravity="center" |
| 112 | - android:background="@drawable/selector_xiaojia_dialog_btn_right" | |
| 112 | + android:background="@drawable/selector_my_dialog_btn_right" | |
| 113 | 113 | android:text="保存" |
| 114 | - android:textColor="@color/btn_green" | |
| 114 | + android:textColor="@color/my_dialog_btn_text_color" | |
| 115 | 115 | android:textSize="17sp" /> |
| 116 | 116 | </LinearLayout> |
| 117 | 117 | ... | ... |
module/xiaojiasoundbox/src/main/res/layout/dialog_wifi_pwd.xml
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | android:id="@+id/ll_child" |
| 10 | 10 | android:layout_width="match_parent" |
| 11 | 11 | android:layout_height="wrap_content" |
| 12 | - android:background="@drawable/free_xiaojia_dialog_bg" | |
| 12 | + android:background="@drawable/my_dialog_bg" | |
| 13 | 13 | android:orientation="vertical" |
| 14 | 14 | android:paddingTop="10dp"> |
| 15 | 15 | |
| ... | ... | @@ -71,7 +71,7 @@ |
| 71 | 71 | android:layout_width="match_parent" |
| 72 | 72 | android:layout_height="1dp" |
| 73 | 73 | android:layout_marginTop="3dp" |
| 74 | - android:background="@color/line" /> | |
| 74 | + android:background="@color/my_dialog_line" /> | |
| 75 | 75 | |
| 76 | 76 | <LinearLayout |
| 77 | 77 | android:layout_width="match_parent" |
| ... | ... | @@ -91,7 +91,7 @@ |
| 91 | 91 | android:layout_width="match_parent" |
| 92 | 92 | android:layout_height="match_parent" |
| 93 | 93 | android:layout_gravity="center" |
| 94 | - android:background="@drawable/selector_xiaojia_dialog_btn_left" | |
| 94 | + android:background="@drawable/selector_my_dialog_btn_left" | |
| 95 | 95 | android:text="否" |
| 96 | 96 | android:textColor="@color/black" |
| 97 | 97 | android:textSize="15sp" |
| ... | ... | @@ -101,7 +101,7 @@ |
| 101 | 101 | <View |
| 102 | 102 | android:layout_width="1dp" |
| 103 | 103 | android:layout_height="match_parent" |
| 104 | - android:background="@color/line" /> | |
| 104 | + android:background="@color/my_dialog_line" /> | |
| 105 | 105 | |
| 106 | 106 | <LinearLayout |
| 107 | 107 | android:layout_width="0dp" |
| ... | ... | @@ -115,10 +115,10 @@ |
| 115 | 115 | android:layout_width="match_parent" |
| 116 | 116 | android:layout_height="match_parent" |
| 117 | 117 | android:layout_gravity="center" |
| 118 | - android:background="@drawable/selector_xiaojia_dialog_btn_right" | |
| 118 | + android:background="@drawable/selector_my_dialog_btn_right" | |
| 119 | 119 | android:clickable="false" |
| 120 | 120 | android:text="否" |
| 121 | - android:textColor="@color/line" | |
| 121 | + android:textColor="@color/my_dialog_line" | |
| 122 | 122 | android:textSize="15sp" |
| 123 | 123 | android:textStyle="bold" /> |
| 124 | 124 | </LinearLayout> | ... | ... |
module/xiaojiasoundbox/src/main/res/layout/fragment_change_device_name.xml
| ... | ... | @@ -58,7 +58,7 @@ |
| 58 | 58 | android:layout_height="1dp" |
| 59 | 59 | android:layout_marginLeft="10dp" |
| 60 | 60 | android:layout_marginRight="10dp" |
| 61 | - android:background="@color/line" /> | |
| 61 | + android:background="@color/my_dialog_line" /> | |
| 62 | 62 | |
| 63 | 63 | <TextView |
| 64 | 64 | android:layout_width="wrap_content" | ... | ... |
module/xiaojiasoundbox/src/main/res/layout/fragment_device_detail.xml
| ... | ... | @@ -121,7 +121,7 @@ |
| 121 | 121 | android:layout_height="1dp" |
| 122 | 122 | android:layout_marginLeft="10dp" |
| 123 | 123 | android:layout_marginRight="10dp" |
| 124 | - android:background="@color/line" /> | |
| 124 | + android:background="@color/my_dialog_line" /> | |
| 125 | 125 | </LinearLayout> |
| 126 | 126 | |
| 127 | 127 | |
| ... | ... | @@ -173,7 +173,7 @@ |
| 173 | 173 | android:layout_height="1dp" |
| 174 | 174 | android:layout_marginLeft="10dp" |
| 175 | 175 | android:layout_marginRight="10dp" |
| 176 | - android:background="@color/line" /> | |
| 176 | + android:background="@color/my_dialog_line" /> | |
| 177 | 177 | <!--设备说明--> |
| 178 | 178 | <RelativeLayout |
| 179 | 179 | android:id="@+id/rl_device_declare" | ... | ... |
module/xiaojiasoundbox/src/main/res/layout/fragment_device_manager.xml
module/xiaojiasoundbox/src/main/res/layout/fragment_search_device.xml
| ... | ... | @@ -42,7 +42,7 @@ |
| 42 | 42 | android:layout_height="50dp" |
| 43 | 43 | android:clickable="false" |
| 44 | 44 | android:focusableInTouchMode="false" |
| 45 | - app:indicatorColor="@color/btn_green" | |
| 45 | + app:indicatorColor="@color/my_dialog_btn_text_color" | |
| 46 | 46 | app:indicatorName="BallSpinFadeLoaderIndicator" /> |
| 47 | 47 | </LinearLayout> |
| 48 | 48 | <!-- 未扫描到的视图--> | ... | ... |
module/xiaojiasoundbox/src/main/res/layout/fragment_select_wifi.xml
| ... | ... | @@ -53,7 +53,7 @@ |
| 53 | 53 | android:layout_height="50dp" |
| 54 | 54 | android:clickable="false" |
| 55 | 55 | android:focusableInTouchMode="false" |
| 56 | - app:indicatorColor="@color/btn_green" | |
| 56 | + app:indicatorColor="@color/my_dialog_btn_text_color" | |
| 57 | 57 | app:indicatorName="BallSpinFadeLoaderIndicator" /> |
| 58 | 58 | </LinearLayout> |
| 59 | 59 | </FrameLayout> | ... | ... |
module/xiaojiasoundbox/src/main/res/layout/item_list_user_host.xml
module/xiaojiasoundbox/src/main/res/layout/item_list_user_member.xml
| ... | ... | @@ -54,7 +54,7 @@ |
| 54 | 54 | android:paddingLeft="5dp" |
| 55 | 55 | android:paddingRight="5dp" |
| 56 | 56 | android:text="管理员" |
| 57 | - android:textColor="@color/btn_green" | |
| 57 | + android:textColor="@color/my_dialog_btn_text_color" | |
| 58 | 58 | android:textSize="11sp" /> |
| 59 | 59 | </LinearLayout> |
| 60 | 60 | |
| ... | ... | @@ -143,6 +143,6 @@ |
| 143 | 143 | android:id="@+id/view_line" |
| 144 | 144 | android:layout_width="match_parent" |
| 145 | 145 | android:layout_height="1dp" |
| 146 | - android:background="@color/line" /> | |
| 146 | + android:background="@color/my_dialog_line" /> | |
| 147 | 147 | </LinearLayout> |
| 148 | 148 | </layout> |
| 149 | 149 | \ No newline at end of file | ... | ... |
module/xiaojiasoundbox/src/main/res/layout/list_item_wifi1.xml
module/xiaojiasoundbox/src/main/res/layout/pop_item_menu.xml
| ... | ... | @@ -40,7 +40,7 @@ |
| 40 | 40 | android:id="@+id/view_line" |
| 41 | 41 | android:layout_width="match_parent" |
| 42 | 42 | android:layout_height="0.1dp" |
| 43 | - android:background="@color/line" /> | |
| 43 | + android:background="@color/my_dialog_line" /> | |
| 44 | 44 | |
| 45 | 45 | </LinearLayout> |
| 46 | 46 | </layout> |
| 47 | 47 | \ No newline at end of file | ... | ... |
module/xiaojiasoundbox/src/main/res/values/styles.xml
| 1 | 1 | <resources xmlns:tools="http://schemas.android.com/tools"> |
| 2 | 2 | |
| 3 | - <!--自定义Dialog背景全透明无边框theme--> | |
| 4 | - <style name="MyDialog" parent="android:style/Theme.Dialog"> | |
| 5 | - <item name="android:windowFrame">@null</item> | |
| 6 | - <item name="android:windowBackground">@android:color/transparent</item> | |
| 7 | - <item name="android:windowNoTitle">true</item> | |
| 8 | - <item name="android:windowIsFloating">true</item> | |
| 9 | - <item name="android:windowContentOverlay">@null</item> | |
| 10 | - <item name="android:background">@android:color/transparent</item> | |
| 11 | - </style> | |
| 3 | + | |
| 12 | 4 | <!-- 自定义checkbox--> |
| 13 | 5 | <style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox"> |
| 14 | 6 | <item name="android:button">@null</item> | ... | ... |