version:2.6
fix: update:优化爱心提醒
This commit is contained in:
@@ -16,8 +16,8 @@ android {
|
||||
applicationId "com.uiui.aios"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 29
|
||||
versionCode 14
|
||||
versionName "2.3"
|
||||
versionCode 17
|
||||
versionName "2.6"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -29,7 +29,7 @@ android {
|
||||
|
||||
manifestPlaceholders = [
|
||||
XG_ACCESS_ID : "1500030457",
|
||||
XG_ACCESS_KEY : "AZZXANJF4HBD",
|
||||
XG_ACCESS_KEY: "AZZXANJF4HBD",
|
||||
]
|
||||
|
||||
manifestPlaceholders = [
|
||||
@@ -141,6 +141,8 @@ dependencies {
|
||||
// implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compileOnly files('libs/framework.jar')
|
||||
implementation files('libs/QWeather_Public_Android_V4.9.jar')
|
||||
implementation project(path: ':niceimageview')
|
||||
|
||||
//保持1.3.1 更新会报错
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
//2.0.4以上无法预览
|
||||
@@ -186,7 +188,7 @@ dependencies {
|
||||
implementation 'com.amap.api:location:5.1.0'
|
||||
//MMKV
|
||||
implementation 'com.tencent:mmkv-static:1.2.12'
|
||||
implementation 'com.tencent.tpns:tpns:1.3.4.4-release'
|
||||
implementation 'com.tencent.tpns:tpns:1.3.6.0-release'
|
||||
//状态栏透明
|
||||
implementation 'com.gitee.zackratos:UltimateBarX:0.8.0'
|
||||
//指示器
|
||||
@@ -199,6 +201,8 @@ dependencies {
|
||||
annotationProcessor 'com.arialyy.aria:compiler:3.8.15'
|
||||
//videoplayer
|
||||
implementation 'cn.jzvd:jiaozivideoplayer:7.7.0'
|
||||
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-core:1.0.16'
|
||||
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-native:1.0.16'
|
||||
}
|
||||
|
||||
preBuild {
|
||||
|
||||
@@ -3,53 +3,35 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.uiui.aios"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
<!-- 清单文件中, 申明监听通话精确状态权限,该权限需要android:sharedUserId="android.uid.system" -->
|
||||
<uses-permission android:name="android.permission.READ_PRECISE_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
|
||||
<!-- 允许访问网络,必选权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<!-- 允许获取精确位置,精准定位必选 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<!-- 允许获取粗略位置,粗略定位必选 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<!-- 允许获取设备和运营商信息,用于问题排查和网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<!-- 允许获取网络状态,用于网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<!-- 允许获取wifi网络信息,用于网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<!-- 允许获取wifi状态改变,用于网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<!-- 后台获取位置信息,若需后台定位则必选 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
<!-- 用于申请调用A-GPS模块,卫星定位加速 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
<!-- 允许写设备缓存,用于问题排查 -->
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<!-- 允许写入扩展存储,用于写入缓存定位数据 -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<!-- 允许读设备等信息,用于问题排查 -->
|
||||
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" /> <!-- 允许访问网络,必选权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" /> <!-- 允许获取精确位置,精准定位必选 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- 允许获取粗略位置,粗略定位必选 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 允许获取设备和运营商信息,用于问题排查和网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- 允许获取网络状态,用于网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 允许获取wifi网络信息,用于网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许获取wifi状态改变,用于网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 后台获取位置信息,若需后台定位则必选 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> <!-- 用于申请调用A-GPS模块,卫星定位加速 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <!-- 允许写设备缓存,用于问题排查 -->
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" /> <!-- 允许写入扩展存储,用于写入缓存定位数据 -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 允许读设备等信息,用于问题排查 -->
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
|
||||
<!-- 【必须】 移动推送 TPNS SDK VIP版本所需权限 -->
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" /> <!-- 【必须】 移动推送 TPNS SDK VIP版本所需权限 -->
|
||||
<permission
|
||||
android:name="${applicationId}.permission.XGPUSH_RECEIVE"
|
||||
android:protectionLevel="signature" />
|
||||
<uses-permission android:name="${applicationId}.permission.XGPUSH_RECEIVE" />
|
||||
|
||||
<!-- 【必须】 移动推送 TPNS SDK 所需权限 -->
|
||||
<uses-permission android:name="${applicationId}.permission.XGPUSH_RECEIVE" /> <!-- 【必须】 移动推送 TPNS SDK 所需权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<!-- 【常用】 移动推送 TPNS SDK所需权限 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 【常用】 移动推送 TPNS SDK所需权限 -->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
@@ -57,7 +39,7 @@
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
|
||||
<application
|
||||
android:name="com.uiui.aios.base.BaseApplication"
|
||||
android:name=".base.BaseApplication"
|
||||
android:allowBackup="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
@@ -68,7 +50,7 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name="com.uiui.aios.activity.main.MainActivity"
|
||||
android:name=".activity.main.MainActivity"
|
||||
android:clearTaskOnLaunch="true"
|
||||
android:enabled="true"
|
||||
android:excludeFromRecents="true"
|
||||
@@ -87,28 +69,32 @@
|
||||
<category android:name="android.intent.category.MONKEY" />
|
||||
<category android:name="android.intent.category.LAUNCHER_APP" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.uiui.aios.activity.CodeActivity"
|
||||
android:name=".activity.CodeActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="sensorPortrait" />
|
||||
<activity
|
||||
android:name="com.uiui.aios.activity.weather.WeatherActivity"
|
||||
android:name=".activity.weather.WeatherActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="sensorLandscape" />
|
||||
<activity
|
||||
android:name="com.uiui.aios.activity.EmergencyActivity"
|
||||
android:name=".activity.EmergencyActivity"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name="com.uiui.aios.activity.NoticeActivity"
|
||||
android:name=".activity.NoticeActivity"
|
||||
android:excludeFromRecents="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/activity_styles" />
|
||||
<activity android:name="com.uiui.aios.activity.APPListActivity" />
|
||||
<activity android:name=".activity.APPListActivity" />
|
||||
<activity
|
||||
android:name=".activity.alarm.AlarmClockActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppWhiteTheme" />
|
||||
|
||||
<receiver
|
||||
android:name="com.uiui.aios.receiver.BootReceiver"
|
||||
android:name=".receiver.BootReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
@@ -126,16 +112,16 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="com.uiui.aios.receiver.InstallResultReceiver"
|
||||
android:name=".receiver.InstallResultReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<service
|
||||
android:name="com.uiui.aios.service.AlarmService"
|
||||
android:name=".service.AlarmService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
<service
|
||||
android:name="com.uiui.aios.service.main.MainService"
|
||||
android:name=".service.main.MainService"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
@@ -146,27 +132,21 @@
|
||||
<data android:scheme="package" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name=".service.NotificationService"
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
|
||||
<intent-filter>
|
||||
<action android:name="android.service.notification.NotificationListenerService" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
|
||||
<!-- 高德地图 -->
|
||||
</service> <!-- 高德地图 -->
|
||||
<!-- 设置key -->
|
||||
<meta-data
|
||||
android:name="com.amap.api.v2.apikey"
|
||||
android:value="${AMAP_KEY}" />
|
||||
<!-- 定位需要的服务 适配Android Q需要加上android:foregroundServiceType="location" -->
|
||||
android:value="${AMAP_KEY}" /> <!-- 定位需要的服务 适配Android Q需要加上android:foregroundServiceType="location" -->
|
||||
<service
|
||||
android:name="com.amap.api.location.APSService"
|
||||
android:foregroundServiceType="location" />
|
||||
|
||||
|
||||
<activity
|
||||
android:name="com.tencent.android.tpush.TpnsActivity"
|
||||
android:exported="true"
|
||||
@@ -174,12 +154,14 @@
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="${applicationId}.OPEN_TPNS_ACTIVITY" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="com.uiui.aios"
|
||||
android:scheme="tpns" />
|
||||
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
@@ -189,7 +171,6 @@
|
||||
<action android:name="android.intent.action" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.tencent.android.tpush.InnerTpnsActivity"
|
||||
android:exported="false"
|
||||
@@ -213,89 +194,69 @@
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- 【必须】 信鸽receiver广播接收 -->
|
||||
</activity> <!-- 【必须】 信鸽receiver广播接收 -->
|
||||
<receiver
|
||||
android:name="com.tencent.android.tpush.XGPushReceiver"
|
||||
android:exported="false"
|
||||
android:process=":xg_vip_service">
|
||||
|
||||
<intent-filter android:priority="0x7fffffff">
|
||||
|
||||
|
||||
<!-- 【必须】 信鸽SDK的内部广播 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.SDK" />
|
||||
<action android:name="com.tencent.android.xg.vip.action.INTERNAL_PUSH_MESSAGE" />
|
||||
<action android:name="com.tencent.android.xg.vip.action.ACTION_SDK_KEEPALIVE" />
|
||||
</intent-filter>
|
||||
|
||||
</receiver>
|
||||
|
||||
<!-- 【必须】移动推送 TPNS service -->
|
||||
</receiver> <!-- 【必须】移动推送 TPNS service -->
|
||||
<service
|
||||
android:name="com.tencent.android.tpush.service.XGVipPushService"
|
||||
android:persistent="true"
|
||||
android:process=":xg_vip_service"></service>
|
||||
|
||||
<!-- 【必须】通知 service ,android:name 部分改为包名.XGVIP_PUSH_ACTION -->
|
||||
android:process=":xg_vip_service" /> <!-- 【必须】通知 service ,android:name 部分改为包名.XGVIP_PUSH_ACTION -->
|
||||
<service
|
||||
android:name="com.tencent.android.tpush.rpc.XGRemoteService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
|
||||
<!-- 【必须】请修改为当前APP名包.XGVIP_PUSH_ACTION -->
|
||||
<action android:name="${applicationId}.XGVIP_PUSH_ACTION" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<!-- 【必须】【注意】authorities 修改为包名.XGVIP_PUSH_AUTH -->
|
||||
</service> <!-- 【必须】【注意】authorities 修改为包名.XGVIP_PUSH_AUTH -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.XGPushProvider"
|
||||
android:authorities="${applicationId}.XGVIP_PUSH_AUTH" />
|
||||
|
||||
<!-- 【必须】【注意】authorities 修改为包名.TPUSH_PROVIDER -->
|
||||
android:authorities="${applicationId}.XGVIP_PUSH_AUTH" /> <!-- 【必须】【注意】authorities 修改为包名.TPUSH_PROVIDER -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.SettingsContentProvider"
|
||||
android:authorities="${applicationId}.TPUSH_PROVIDER" />
|
||||
|
||||
<!-- 【可选】用于增强保活能力 -->
|
||||
android:authorities="${applicationId}.TPUSH_PROVIDER" /> <!-- 【可选】用于增强保活能力 -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.XGVipPushKAProvider"
|
||||
android:authorities="${applicationId}.AUTH_XGPUSH_KEEPALIVE"
|
||||
android:exported="true"
|
||||
tools:replace="android:exported" />
|
||||
|
||||
<!-- 【可选】APP实现的Receiver,用于接收消息透传和操作结果的回调,请根据需要添加 -->
|
||||
tools:replace="android:exported" /> <!-- 【可选】APP实现的Receiver,用于接收消息透传和操作结果的回调,请根据需要添加 -->
|
||||
<!-- YOUR_PACKAGE_PATH.CustomPushReceiver需要改为自己的Receiver: -->
|
||||
<receiver android:name=".tpush.MessageReceiver">
|
||||
<intent-filter>
|
||||
|
||||
<!-- 接收消息透传 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.PUSH_MESSAGE" />
|
||||
<!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.FEEDBACK" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- MQTT START -->
|
||||
</receiver> <!-- MQTT START -->
|
||||
<service
|
||||
android:name="com.tencent.tpns.mqttchannel.services.MqttService"
|
||||
android:exported="false"
|
||||
android:process=":xg_vip_service" />
|
||||
|
||||
<provider
|
||||
android:name="com.tencent.tpns.baseapi.base.SettingsContentProvider"
|
||||
android:authorities="${applicationId}.XG_SETTINGS_PROVIDER"
|
||||
android:exported="false" />
|
||||
|
||||
<!-- MQTT END-->
|
||||
|
||||
android:exported="false" /> <!-- MQTT END -->
|
||||
<!-- 【必须】 请修改为 APP 的 AccessId,“15”开头的10位数字,中间没空格 -->
|
||||
<meta-data
|
||||
android:name="XG_V2_ACCESS_ID"
|
||||
android:value="1500030457" />
|
||||
<!-- 【必须】 请修改为APP的AccessKey,“A”开头的12位字符串,中间没空格 -->
|
||||
android:value="1500030457" /> <!-- 【必须】 请修改为APP的AccessKey,“A”开头的12位字符串,中间没空格 -->
|
||||
<meta-data
|
||||
android:name="XG_V2_ACCESS_KEY"
|
||||
android:value="AZZXANJF4HBD" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.uiui.aios.activity.alarm;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.uiui.aios.R;
|
||||
import com.uiui.aios.adapter.AlarmAdapter;
|
||||
import com.uiui.aios.base.BaseActivity;
|
||||
import com.uiui.aios.bean.AlarmClockData;
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.network.NetInterfaceManager;
|
||||
import com.uiui.aios.utils.AlarmUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class AlarmClockActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.recyclerView)
|
||||
RecyclerView recyclerView;
|
||||
|
||||
private AlarmAdapter mAlarmAdapter;
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_alarm_clock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
ButterKnife.bind(this);
|
||||
mAlarmAdapter = new AlarmAdapter();
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(AlarmClockActivity.this));
|
||||
recyclerView.setAdapter(mAlarmAdapter);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
NetInterfaceManager.getInstance().getAlarmClockApiObservable()
|
||||
.subscribe(new Observer<BaseResponse<List<AlarmClockData>>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getAlarmClock", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<AlarmClockData>> listBaseResponse) {
|
||||
Log.e("getAlarmClock", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AlarmClockData> data = listBaseResponse.data;
|
||||
AlarmUtils.getInstance().setAlarmClockData(data);
|
||||
mAlarmAdapter.setAlarmClockData(data);
|
||||
} else {
|
||||
mAlarmAdapter.setAlarmClockData(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getAlarmClock", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAlarmClock", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
160
app/src/main/java/com/uiui/aios/adapter/AlarmAdapter.java
Normal file
160
app/src/main/java/com/uiui/aios/adapter/AlarmAdapter.java
Normal file
@@ -0,0 +1,160 @@
|
||||
package com.uiui.aios.adapter;
|
||||
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.MediaPlayer;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.uiui.aios.R;
|
||||
import com.uiui.aios.bean.AlarmClockData;
|
||||
import com.uiui.aios.utils.AudioUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class AlarmAdapter extends RecyclerView.Adapter<AlarmAdapter.holder> {
|
||||
|
||||
private List<AlarmClockData> mAlarmClockData;
|
||||
|
||||
public void setAlarmClockData(List<AlarmClockData> alarmClockData) {
|
||||
this.mAlarmClockData = alarmClockData;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new AlarmAdapter.holder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_alarm_clock, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull holder holder, int position) {
|
||||
AlarmClockData alarmClockData = mAlarmClockData.get(position);
|
||||
switch (alarmClockData.getType()) {
|
||||
case 1:
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = sdf.parse(alarmClockData.getTime());
|
||||
SimpleDateFormat hours = new SimpleDateFormat("HH:mm");
|
||||
String time = hours.format(date);
|
||||
holder.tv_time.setText(time);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
holder.tv_remind_type.setText("单次");
|
||||
break;
|
||||
case 2:
|
||||
holder.tv_time.setText(alarmClockData.getTime());
|
||||
holder.tv_remind_type.setText("循环");
|
||||
break;
|
||||
case 3:
|
||||
holder.tv_time.setText(alarmClockData.getTime());
|
||||
holder.tv_remind_type.setText("周一至周五");
|
||||
break;
|
||||
case 4:
|
||||
holder.tv_time.setText(alarmClockData.getTime());
|
||||
holder.tv_remind_type.setText("周六至周日");
|
||||
break;
|
||||
default:
|
||||
}
|
||||
String title = alarmClockData.getTitle();
|
||||
if (TextUtils.isEmpty(title)) {
|
||||
holder.tv_title.setText("无标题");
|
||||
} else {
|
||||
holder.tv_title.setText(title);
|
||||
}
|
||||
String voice = alarmClockData.getVoice();
|
||||
if (TextUtils.isEmpty(voice)) {
|
||||
holder.cl_voice.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.cl_voice.setVisibility(View.VISIBLE);
|
||||
MediaPlayer mMediaPlayer = new MediaPlayer();
|
||||
mMediaPlayer.setAudioAttributes(
|
||||
new AudioAttributes.Builder()
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
||||
.build()
|
||||
);
|
||||
mMediaPlayer.setOnCompletionListener(mp -> Log.e("setOnCompletionListener", "onCompletion: "));
|
||||
mMediaPlayer.setOnPreparedListener(mp -> Log.e("setOnPreparedListener", "onPrepared: "));
|
||||
mMediaPlayer.setOnErrorListener((mp, what, extra) -> false);
|
||||
//设置音频文件到MediaPlayer对象中
|
||||
try {
|
||||
mMediaPlayer.setDataSource(voice);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//让MediaPlayer对象准备,用这个方法防止加载时耗时导致anr
|
||||
mMediaPlayer.prepareAsync();
|
||||
AudioUtils.getDurationInMilliseconds(voice, new Observer<Integer>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull Integer integer) {
|
||||
holder.tv_voice.setText(integer + "秒");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
holder.cl_voice.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mMediaPlayer.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mAlarmClockData == null ? 0 : mAlarmClockData.size();
|
||||
}
|
||||
|
||||
class holder extends RecyclerView.ViewHolder {
|
||||
TextView tv_time;
|
||||
TextView tv_remind_type;
|
||||
TextView tv_title;
|
||||
TextView tv_voice;
|
||||
ConstraintLayout cl_voice;
|
||||
Switch switch1;
|
||||
ImageView iv_delete;
|
||||
|
||||
public holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tv_time = itemView.findViewById(R.id.tv_time);
|
||||
tv_remind_type = itemView.findViewById(R.id.tv_remind_type);
|
||||
tv_title = itemView.findViewById(R.id.tv_title);
|
||||
tv_voice = itemView.findViewById(R.id.tv_voice);
|
||||
cl_voice = itemView.findViewById(R.id.cl_voice);
|
||||
switch1 = itemView.findViewById(R.id.switch1);
|
||||
iv_delete = itemView.findViewById(R.id.iv_delete);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,28 @@
|
||||
package com.uiui.aios.adapter;
|
||||
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.MediaPlayer;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.uiui.aios.R;
|
||||
import com.uiui.aios.bean.AlarmClockData;
|
||||
import com.uiui.aios.utils.AudioUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class NotificationAdapter extends RecyclerView.Adapter<NotificationAdapter.Holder> {
|
||||
private List<AlarmClockData> dataList;
|
||||
|
||||
@@ -27,6 +37,56 @@ public class NotificationAdapter extends RecyclerView.Adapter<NotificationAdapte
|
||||
AlarmClockData alarmClockData = dataList.get(position);
|
||||
holder.tv_title.setText("提醒事件:" + alarmClockData.getTitle());
|
||||
holder.tv_time.setText("提醒时间:" + alarmClockData.getTime());
|
||||
String voice = alarmClockData.getVoice();
|
||||
if (TextUtils.isEmpty(voice)) {
|
||||
holder.cl_voice.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.cl_voice.setVisibility(View.VISIBLE);
|
||||
MediaPlayer mMediaPlayer = new MediaPlayer();
|
||||
mMediaPlayer.setAudioAttributes(
|
||||
new AudioAttributes.Builder()
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
||||
.build()
|
||||
);
|
||||
mMediaPlayer.setOnCompletionListener(mp -> Log.e("setOnCompletionListener", "onCompletion: "));
|
||||
mMediaPlayer.setOnPreparedListener(mp -> Log.e("setOnPreparedListener", "onPrepared: "));
|
||||
mMediaPlayer.setOnErrorListener((mp, what, extra) -> false);
|
||||
//设置音频文件到MediaPlayer对象中
|
||||
try {
|
||||
mMediaPlayer.setDataSource(voice);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//让MediaPlayer对象准备,用这个方法防止加载时耗时导致anr
|
||||
mMediaPlayer.prepareAsync();
|
||||
AudioUtils.getDurationInMilliseconds(voice, new Observer<Integer>() {
|
||||
@Override
|
||||
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@io.reactivex.rxjava3.annotations.NonNull Integer integer) {
|
||||
holder.tv_voice.setText(integer + "秒");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
holder.cl_voice.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mMediaPlayer.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,11 +103,15 @@ public class NotificationAdapter extends RecyclerView.Adapter<NotificationAdapte
|
||||
class Holder extends RecyclerView.ViewHolder {
|
||||
TextView tv_title;
|
||||
TextView tv_time;
|
||||
TextView tv_voice;
|
||||
ConstraintLayout cl_voice;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tv_title = itemView.findViewById(R.id.tv_title);
|
||||
tv_time = itemView.findViewById(R.id.tv_time);
|
||||
tv_voice = itemView.findViewById(R.id.tv_voice);
|
||||
cl_voice = itemView.findViewById(R.id.cl_voice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,16 +10,23 @@ public class ActivityBean implements Serializable {
|
||||
String type_name;
|
||||
//标题
|
||||
String title;
|
||||
String location;
|
||||
//活动时间戳 单位秒
|
||||
long activity_time;
|
||||
//人数
|
||||
int people_num;
|
||||
//语音地址
|
||||
String voice;
|
||||
//设备名
|
||||
String sn_name;
|
||||
/*用户名*/
|
||||
String name;
|
||||
//设备头像
|
||||
String avatar;
|
||||
String address;
|
||||
long add_time;
|
||||
String file;
|
||||
int comment_count;
|
||||
int like_count;
|
||||
int join_num;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
@@ -45,6 +52,14 @@ public class ActivityBean implements Serializable {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public long getActivity_time() {
|
||||
return activity_time;
|
||||
}
|
||||
@@ -69,12 +84,12 @@ public class ActivityBean implements Serializable {
|
||||
this.voice = voice;
|
||||
}
|
||||
|
||||
public String getSn_name() {
|
||||
return sn_name;
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setSn_name(String sn_name) {
|
||||
this.sn_name = sn_name;
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
@@ -84,4 +99,52 @@ public class ActivityBean implements Serializable {
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public long getAdd_time() {
|
||||
return add_time;
|
||||
}
|
||||
|
||||
public void setAdd_time(long add_time) {
|
||||
this.add_time = add_time;
|
||||
}
|
||||
|
||||
public String getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(String file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public int getComment_count() {
|
||||
return comment_count;
|
||||
}
|
||||
|
||||
public void setComment_count(int comment_count) {
|
||||
this.comment_count = comment_count;
|
||||
}
|
||||
|
||||
public int getLike_count() {
|
||||
return like_count;
|
||||
}
|
||||
|
||||
public void setLike_count(int like_count) {
|
||||
this.like_count = like_count;
|
||||
}
|
||||
|
||||
public int getJoin_num() {
|
||||
return join_num;
|
||||
}
|
||||
|
||||
public void setJoin_num(int join_num) {
|
||||
this.join_num = join_num;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,12 +12,12 @@ public class AlarmClockData implements Serializable {
|
||||
private static final long serialVersionUID = -5856502480745183157L;
|
||||
|
||||
int id;
|
||||
int type;
|
||||
String time;
|
||||
String title;
|
||||
String voice;
|
||||
int type;//类型 1一次 2循环 3周一到周五 4 周六周日
|
||||
String time;//"2021-11-15 18:33:23",//时间格式化字符串,循环类型是18:33:23
|
||||
String title;//标题
|
||||
String voice;//语音文件地址
|
||||
String voice_md5;
|
||||
String file;
|
||||
String file;//图片或视频文件地址
|
||||
|
||||
boolean finished = false;
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ public class DemandBean implements Serializable {
|
||||
String type_name;
|
||||
//标题
|
||||
String title;
|
||||
String address;
|
||||
String location;
|
||||
//活动时间戳 单位秒
|
||||
long demand_time;
|
||||
//价格
|
||||
@@ -17,9 +19,14 @@ public class DemandBean implements Serializable {
|
||||
//语音地址
|
||||
String voice;
|
||||
//设备名
|
||||
String sn_name;
|
||||
String name;
|
||||
//设备头像
|
||||
String avatar;
|
||||
long add_time;
|
||||
String file;
|
||||
int comment_count;
|
||||
int like_count;
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
@@ -45,6 +52,22 @@ public class DemandBean implements Serializable {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public long getDemand_time() {
|
||||
return demand_time;
|
||||
}
|
||||
@@ -69,12 +92,12 @@ public class DemandBean implements Serializable {
|
||||
this.voice = voice;
|
||||
}
|
||||
|
||||
public String getSn_name() {
|
||||
return sn_name;
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setSn_name(String sn_name) {
|
||||
this.sn_name = sn_name;
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
@@ -84,4 +107,36 @@ public class DemandBean implements Serializable {
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public long getAdd_time() {
|
||||
return add_time;
|
||||
}
|
||||
|
||||
public void setAdd_time(long add_time) {
|
||||
this.add_time = add_time;
|
||||
}
|
||||
|
||||
public String getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(String file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public int getComment_count() {
|
||||
return comment_count;
|
||||
}
|
||||
|
||||
public void setComment_count(int comment_count) {
|
||||
this.comment_count = comment_count;
|
||||
}
|
||||
|
||||
public int getLike_count() {
|
||||
return like_count;
|
||||
}
|
||||
|
||||
public void setLike_count(int like_count) {
|
||||
this.like_count = like_count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.uiui.aios.BuildConfig;
|
||||
import com.uiui.aios.R;
|
||||
import com.uiui.aios.activity.CodeActivity;
|
||||
import com.uiui.aios.activity.EmergencyActivity;
|
||||
import com.uiui.aios.activity.alarm.AlarmClockActivity;
|
||||
import com.uiui.aios.activity.weather.WeatherActivity;
|
||||
import com.uiui.aios.adapter.NotificationAdapter;
|
||||
import com.uiui.aios.adapter.SOSNnmberAdapter;
|
||||
@@ -73,8 +74,8 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
// @BindView(R.id.cl_alarm)
|
||||
// ConstraintLayout cl_alarm;
|
||||
|
||||
// @BindView(R.id.cl_wifi)
|
||||
// ConstraintLayout cl_wifi;
|
||||
@BindView(R.id.cl_note)
|
||||
ConstraintLayout cl_note;
|
||||
@BindView(R.id.cl_sos)
|
||||
ConstraintLayout cl_soso;
|
||||
@BindView(R.id.cl_weather)
|
||||
@@ -299,7 +300,19 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
// ApkUtils.openPackage(getActivity(), "com.alarmclock.uiui");
|
||||
// }
|
||||
// });
|
||||
cl_note.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startActivity(new Intent(mContext, AlarmClockActivity.class));
|
||||
}
|
||||
});
|
||||
notificationAdapter = new NotificationAdapter();
|
||||
rv_noti.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startActivity(new Intent(mContext, AlarmClockActivity.class));
|
||||
}
|
||||
});
|
||||
rv_noti.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
rv_noti.setAdapter(notificationAdapter);
|
||||
if (isWifiConnect()) {
|
||||
|
||||
@@ -29,6 +29,8 @@ import com.uiui.aios.bean.DemandBean;
|
||||
import com.uiui.aios.bean.GoodsInfo;
|
||||
import com.uiui.aios.network.NetInterfaceManager;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
@@ -69,13 +71,23 @@ public class SecondFragment extends BaseFragment {
|
||||
ImageView iv_avatar_a;
|
||||
@BindView(R.id.tv_title_a)
|
||||
TextView tv_title_a;
|
||||
@BindView(R.id.tc_joined_num_a)
|
||||
TextView tc_joined_num_a;
|
||||
@BindView(R.id.tv_time_a)
|
||||
TextView tv_time_a;
|
||||
@BindView(R.id.tv_address_a)
|
||||
TextView tv_address_a;
|
||||
|
||||
@BindView(R.id.iv_avatar_d)
|
||||
ImageView iv_avatar_d;
|
||||
@BindView(R.id.tv_title_d)
|
||||
TextView tv_title_d;
|
||||
@BindView(R.id.tv_price)
|
||||
TextView tv_price;
|
||||
@BindView(R.id.tc_joined_num_d)
|
||||
TextView tc_joined_num_d;
|
||||
@BindView(R.id.tv_time_d)
|
||||
TextView tv_time_d;
|
||||
@BindView(R.id.tv_address_d)
|
||||
TextView tv_address_d;
|
||||
|
||||
@BindView(R.id.iv1)
|
||||
ImageView iv1;
|
||||
@@ -205,9 +217,12 @@ public class SecondFragment extends BaseFragment {
|
||||
}
|
||||
|
||||
private void setDemand(DemandBean demandBean) {
|
||||
Glide.with(iv_avatar_d).load(demandBean.getAvatar()).into(iv_avatar_d);
|
||||
Glide.with(iv_avatar_d).load(demandBean.getAvatar()).error(getResources().getDrawable(R.drawable.default_head)).into(iv_avatar_d);
|
||||
tv_title_d.setText(demandBean.getTitle());
|
||||
tv_price.setText(String.valueOf(demandBean.getPrice()));
|
||||
// tv_price.setText(String.valueOf(demandBean.getPrice()));
|
||||
tc_joined_num_d.setText(demandBean.getLike_count() + "人参加");
|
||||
tv_time_d.setText(getTime(demandBean.getDemand_time()));
|
||||
tv_address_d.setText(demandBean.getAddress());
|
||||
}
|
||||
|
||||
private void getActivityList() {
|
||||
@@ -249,8 +264,17 @@ public class SecondFragment extends BaseFragment {
|
||||
}
|
||||
|
||||
private void setActivity(ActivityBean activity) {
|
||||
Glide.with(iv_avatar_a).load(activity.getAvatar()).into(iv_avatar_a);
|
||||
Glide.with(iv_avatar_a).load(activity.getAvatar()).error(getResources().getDrawable(R.drawable.default_head)).into(iv_avatar_a);
|
||||
tv_title_a.setText(activity.getTitle());
|
||||
tc_joined_num_a.setText(activity.getJoin_num() + "人参加");
|
||||
tv_time_a.setText(getTime(activity.getActivity_time()));
|
||||
tv_address_a.setText(activity.getAddress());
|
||||
}
|
||||
|
||||
private String getTime(long second) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM月dd日 HH:mm");
|
||||
Date date = new Date(second * 1000);
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.uiui.aios.network;
|
||||
|
||||
public class URLAddress {
|
||||
public static final String ROOT_URL = "https://led.aolelearn.cn/android/";
|
||||
public static final String ROOT_URL = "https://led.zuoyepad.com/android/";
|
||||
/*获取闹钟*/
|
||||
public static final String GET_ALARM_CLOCK = "getAlarmClock";
|
||||
/*应用使用记录*/
|
||||
|
||||
@@ -27,6 +27,7 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
private static final int OK = 200;
|
||||
private MainSContact.MainSView mView;
|
||||
private Context mContext;
|
||||
MMKV mMMKV = MMKV.defaultMMKV();
|
||||
|
||||
private BehaviorSubject<ActivityEvent> lifecycle;
|
||||
|
||||
@@ -56,7 +57,6 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getAlarmClock() {
|
||||
MMKV mmkv = MMKV.defaultMMKV();
|
||||
NetInterfaceManager.getInstance().getAlarmClockApiObservable()
|
||||
.subscribe(new Observer<BaseResponse<List<AlarmClockData>>>() {
|
||||
@Override
|
||||
|
||||
@@ -77,7 +77,7 @@ public class MainService extends BaseService implements MainSContact.MainSView,
|
||||
super.onCreate();
|
||||
Log.e(TAG, "onCreate: ");
|
||||
ApkUtils.UninstallAPP(this, "com.joytv.live");
|
||||
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
||||
// ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
||||
|
||||
Aria.init(this);
|
||||
Aria.download(this).register();
|
||||
|
||||
@@ -49,6 +49,8 @@ public class ApkUtils {
|
||||
this.add("com.alldocube.store");
|
||||
this.add("com.android.email");
|
||||
this.add("com.android.calendar");
|
||||
this.add("com.android.uiuios");
|
||||
this.add("com.uiui.os");
|
||||
}};
|
||||
private static HashSet<String> showPackageName = new HashSet<String>() {{
|
||||
this.add("com.android.dialer");
|
||||
@@ -58,6 +60,7 @@ public class ApkUtils {
|
||||
this.add("com.android.camera2");
|
||||
this.add("com.mediatek.camera");
|
||||
this.add("com.android.mms");
|
||||
this.add("com.uiui.city");
|
||||
}};
|
||||
private static HashSet<String> allHintPackage = new HashSet<String>() {{
|
||||
this.add("com.android.uiuios");
|
||||
|
||||
37
app/src/main/java/com/uiui/aios/utils/AudioUtils.java
Normal file
37
app/src/main/java/com/uiui/aios/utils/AudioUtils.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.uiui.aios.utils;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.ObservableEmitter;
|
||||
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import wseemann.media.FFmpegMediaMetadataRetriever;
|
||||
|
||||
public class AudioUtils {
|
||||
/**
|
||||
* 获取在线音频时间长度
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
public static void getDurationInMilliseconds(String url, Observer<Integer> observer) {
|
||||
Observable.create(new ObservableOnSubscribe<Integer>() {
|
||||
@Override
|
||||
public void subscribe(@NonNull ObservableEmitter<Integer> emitter) throws Throwable {
|
||||
long time = System.currentTimeMillis();
|
||||
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
|
||||
mmr.setDataSource(url);
|
||||
int duration = Integer.parseInt(mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION));
|
||||
Log.e("AudioUtils", "getDurationInMilliseconds: " + (System.currentTimeMillis() - time));
|
||||
mmr.release();//释放资源
|
||||
emitter.onNext(duration / 1000);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(observer);
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,9 @@ public class JzvdStdAssert extends JzvdStd {
|
||||
@Override
|
||||
public void onCompletion() {
|
||||
super.onCompletion();
|
||||
onVideoCompletionListener.onVideoComplet();
|
||||
if (onVideoCompletionListener != null) {
|
||||
onVideoCompletionListener.onVideoComplet();
|
||||
}
|
||||
Log.e("onStateChanged", "onCompletion");
|
||||
}
|
||||
|
||||
|
||||
BIN
app/src/main/res/drawable-hdpi/default_head.png
Normal file
BIN
app/src/main/res/drawable-hdpi/default_head.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/drawable-hdpi/delete.png
Normal file
BIN
app/src/main/res/drawable-hdpi/delete.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
13
app/src/main/res/drawable/alarm_background.xml
Normal file
13
app/src/main/res/drawable/alarm_background.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid android:color="@color/white" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners android:radius="16dp" />
|
||||
|
||||
<!-- <padding-->
|
||||
<!-- android:bottom="0dp"-->
|
||||
<!-- android:left="8dp"-->
|
||||
<!-- android:right="8dp"-->
|
||||
<!-- android:top="0dp" />-->
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/alarm_notifi_background.xml
Normal file
13
app/src/main/res/drawable/alarm_notifi_background.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid android:color="@color/gray" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners android:radius="16dp" />
|
||||
|
||||
<padding
|
||||
android:bottom="8dp"
|
||||
android:left="8dp"
|
||||
android:right="8dp"
|
||||
android:top="8dp" />
|
||||
</shape>
|
||||
19
app/src/main/res/drawable/gray_thumb.xml
Normal file
19
app/src/main/res/drawable/gray_thumb.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<!-- 高度40 -->
|
||||
<size android:height="32dp" android:width="32dp"/>
|
||||
<!-- 圆角弧度 20 -->
|
||||
<corners android:radius="16dp"/>
|
||||
|
||||
|
||||
<!-- 变化率 -->
|
||||
<gradient
|
||||
android:endColor="#ffffff"
|
||||
android:startColor="#ffffff" />
|
||||
|
||||
<stroke android:width="1dp"
|
||||
android:color="@color/gray"/>
|
||||
|
||||
</shape>
|
||||
12
app/src/main/res/drawable/gray_track.xml
Normal file
12
app/src/main/res/drawable/gray_track.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
<!-- 高度30 此处设置宽度无效-->
|
||||
<size android:height="16dp"/>
|
||||
<!-- 圆角弧度 15 -->
|
||||
<corners android:radius="16dp"/>
|
||||
<!-- 变化率 定义从左到右的颜色不变 -->
|
||||
<gradient
|
||||
android:endColor="@color/gray"
|
||||
android:startColor="@color/gray" />
|
||||
</shape>
|
||||
19
app/src/main/res/drawable/green_thumb.xml
Normal file
19
app/src/main/res/drawable/green_thumb.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<!-- 高度40 -->
|
||||
<size android:height="32dp" android:width="32dp"/>
|
||||
<!-- 圆角弧度 20 -->
|
||||
<corners android:radius="16dp"/>
|
||||
|
||||
|
||||
<!-- 变化率 -->
|
||||
<gradient
|
||||
android:endColor="#31B97D"
|
||||
android:startColor="#31B97D" />
|
||||
|
||||
<stroke android:width="1dp"
|
||||
android:color="#9FDDC3"/>
|
||||
|
||||
</shape>
|
||||
12
app/src/main/res/drawable/green_track.xml
Normal file
12
app/src/main/res/drawable/green_track.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<!-- 高度30 -->
|
||||
<size android:height="16dp"/>
|
||||
<!-- 圆角弧度 15 -->
|
||||
<corners android:radius="16dp"/>
|
||||
<!-- 变化率 -->
|
||||
<gradient
|
||||
android:endColor="#9FDDC3"
|
||||
android:startColor="#9FDDC3" />
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/join_background.xml
Normal file
13
app/src/main/res/drawable/join_background.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid android:color="@color/default_background_color" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners android:radius="16dp" />
|
||||
|
||||
<padding
|
||||
android:bottom="0dp"
|
||||
android:left="8dp"
|
||||
android:right="8dp"
|
||||
android:top="0dp" />
|
||||
</shape>
|
||||
6
app/src/main/res/drawable/thumb.xml
Normal file
6
app/src/main/res/drawable/thumb.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 按钮的选择器,可以设置按钮在不同状态下的时候,按钮不同的颜色 -->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:state_checked="true" android:drawable="@drawable/green_thumb" />
|
||||
<item android:drawable="@drawable/gray_thumb" />
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/track.xml
Normal file
6
app/src/main/res/drawable/track.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 底层下滑条的样式选择器,可控制Switch在不同状态下,底下下滑条的颜色 -->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:state_checked="true" android:drawable="@drawable/green_track" />
|
||||
<item android:drawable="@drawable/gray_track" />
|
||||
</selector>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid android:color="@color/notice_blue" />
|
||||
<solid android:color="@color/voice_color" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners
|
||||
android:bottomLeftRadius="30dp"
|
||||
|
||||
@@ -98,6 +98,15 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="更多"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/textView4"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView4" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_note_nodata"
|
||||
android:layout_width="150dp"
|
||||
|
||||
@@ -54,9 +54,9 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl1"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView9">
|
||||
|
||||
@@ -209,9 +209,9 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl2"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView13">
|
||||
|
||||
@@ -276,6 +276,14 @@
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/custom_background">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:maxLines="1"
|
||||
android:text="查看更多"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView18" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv3"
|
||||
@@ -284,12 +292,14 @@
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/nodata"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView18"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
@@ -304,18 +314,20 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl3"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
<com.shehuan.niv.NiceImageView
|
||||
android:id="@+id/iv_avatar_a"
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_width="92dp"
|
||||
android:layout_height="92dp"
|
||||
android:src="@drawable/default_head"
|
||||
app:is_circle="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -325,15 +337,52 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text=""
|
||||
android:maxLines="1"
|
||||
android:text="活动名称"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_avatar_a"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tc_joined_num_a"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:background="@drawable/join_background"
|
||||
android:text="0人参加"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_title_a"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_title_a"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_title_a" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time_a"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:maxLines="1"
|
||||
android:text="时间"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_title_a"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title_a" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_address_a"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:gravity="start"
|
||||
android:maxEms="12"
|
||||
android:maxLines="1"
|
||||
android:text="地点"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_time_a"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_time_a" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -355,12 +404,23 @@
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/nodata"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:maxLines="1"
|
||||
android:text="查看更多"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView19" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView19"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
@@ -375,18 +435,20 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl4"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
<com.shehuan.niv.NiceImageView
|
||||
android:id="@+id/iv_avatar_d"
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_width="92dp"
|
||||
android:layout_height="92dp"
|
||||
android:src="@drawable/default_head"
|
||||
app:is_circle="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -396,36 +458,52 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text=""
|
||||
android:maxLines="1"
|
||||
android:text="活动名称"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_avatar_d"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView17"
|
||||
android:id="@+id/tc_joined_num_d"
|
||||
app:layout_goneMarginStart="4dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text=""
|
||||
android:layout_marginStart="6dp"
|
||||
android:background="@drawable/join_background"
|
||||
android:text="0人参加"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_title_d"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_title_d"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_title_d" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time_d"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:maxLines="1"
|
||||
android:text="时间"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_title_d"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title_d" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_price"
|
||||
android:id="@+id/tv_address_d"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text=""
|
||||
android:layout_marginTop="2dp"
|
||||
android:gravity="start"
|
||||
android:maxEms="12"
|
||||
android:maxLines="1"
|
||||
android:text="地点"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/textView17"
|
||||
app:layout_constraintStart_toEndOf="@+id/textView17"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView17"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_time_d"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_time_d" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -21,23 +20,22 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_weather"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_weight="3"
|
||||
android:background="@drawable/custom_background">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pic"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="180dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/he100"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView3" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
@@ -56,32 +54,35 @@
|
||||
android:id="@+id/tv_temp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="10℃"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="25sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:textSize="40sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_pic"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_pic"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_pic"
|
||||
app:layout_constraintVertical_bias="0.296" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_location"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="位置"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_temp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_temp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_note"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_weight="3"
|
||||
android:background="@drawable/custom_background">
|
||||
|
||||
<TextView
|
||||
@@ -97,6 +98,15 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="更多"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/textView4"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView4" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_note_nodata"
|
||||
android:layout_width="150dp"
|
||||
@@ -118,24 +128,17 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_sos"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_weight="2"
|
||||
android:background="@drawable/custom_background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView11"
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
@@ -167,16 +170,24 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView11" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView7" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||
<!-- android:id="@+id/cl_alarm"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:layout_margin="8dp"-->
|
||||
<!-- android:layout_weight="1"-->
|
||||
<!-- android:background="@drawable/custom_background">-->
|
||||
<!-- android:background="@drawable/custom_background"-->
|
||||
<!-- tools:ignore="NestedWeights">-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/textView5"-->
|
||||
@@ -216,9 +227,10 @@
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/textView5" />-->
|
||||
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_health"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
@@ -231,7 +243,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="健康码"
|
||||
android:text="健康档案"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
@@ -243,22 +255,16 @@
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/health_code"
|
||||
android:src="@drawable/home_clinical_detection"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_tongue"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp"
|
||||
@@ -266,133 +272,63 @@
|
||||
android:background="@drawable/custom_background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="设备状态"
|
||||
android:text="AI舌诊"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/home_clinical_tongue"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_battery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_charging"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="23dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/charging_icon"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_battery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_charging"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_wifi"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_wifi"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/wifi_icon"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wifi_ssid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_wifi"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_wifi" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_face"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/custom_background">
|
||||
|
||||
<com.king.view.circleprogressview.CircleProgressView
|
||||
android:id="@+id/cpv"
|
||||
android:layout_width="144dp"
|
||||
android:layout_height="144dp"
|
||||
app:cpvDuration="1000"
|
||||
app:cpvLabelTextSize="26sp"
|
||||
app:cpvNormalColor="#D8D6D7"
|
||||
app:cpvShowTick="false"
|
||||
app:cpvStrokeWidth="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="一键加速"
|
||||
android:text="AI面诊"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/home_clinical_face"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_hand"
|
||||
@@ -407,7 +343,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="系统应用"
|
||||
android:text="AI手诊"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
@@ -415,19 +351,17 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_allapp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/systemapp_icon"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/home_clinical_hand"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</com.uiui.aios.view.CustomContent>
|
||||
@@ -54,9 +54,9 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl1"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView9">
|
||||
|
||||
@@ -209,9 +209,9 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl2"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView13">
|
||||
|
||||
@@ -276,6 +276,14 @@
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/custom_background">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:maxLines="1"
|
||||
android:text="查看更多"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView18" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv3"
|
||||
@@ -284,12 +292,14 @@
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/nodata"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView18"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
@@ -304,18 +314,20 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl3"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
<com.shehuan.niv.NiceImageView
|
||||
android:id="@+id/iv_avatar_a"
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_width="92dp"
|
||||
android:layout_height="92dp"
|
||||
android:src="@drawable/default_head"
|
||||
app:is_circle="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -325,15 +337,52 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text=""
|
||||
android:maxLines="1"
|
||||
android:text="活动名称"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_avatar_a"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tc_joined_num_a"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:background="@drawable/join_background"
|
||||
android:text="0人参加"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_title_a"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_title_a"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_title_a" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time_a"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:maxLines="1"
|
||||
android:text="时间"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_title_a"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title_a" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_address_a"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:gravity="start"
|
||||
android:maxEms="12"
|
||||
android:maxLines="1"
|
||||
android:text="地点"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_time_a"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_time_a" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -355,12 +404,23 @@
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/nodata"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:maxLines="1"
|
||||
android:text="查看更多"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView19" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView19"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
@@ -375,18 +435,20 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl4"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
<com.shehuan.niv.NiceImageView
|
||||
android:id="@+id/iv_avatar_d"
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_width="92dp"
|
||||
android:layout_height="92dp"
|
||||
android:src="@drawable/default_head"
|
||||
app:is_circle="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -396,36 +458,52 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text=""
|
||||
android:maxLines="1"
|
||||
android:text="活动名称"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_avatar_d"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView17"
|
||||
android:id="@+id/tc_joined_num_d"
|
||||
app:layout_goneMarginStart="4dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text=""
|
||||
android:layout_marginStart="6dp"
|
||||
android:background="@drawable/join_background"
|
||||
android:text="0人参加"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_title_d"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_title_d"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_title_d" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time_d"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:maxLines="1"
|
||||
android:text="时间"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_title_d"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title_d" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_price"
|
||||
android:id="@+id/tv_address_d"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text=""
|
||||
android:layout_marginTop="2dp"
|
||||
android:gravity="start"
|
||||
android:maxEms="12"
|
||||
android:maxLines="1"
|
||||
android:text="地点"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/textView17"
|
||||
app:layout_constraintStart_toEndOf="@+id/textView17"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView17"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_time_d"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_time_d" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
20
app/src/main/res/layout/activity_alarm_clock.xml
Normal file
20
app/src/main/res/layout/activity_alarm_clock.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.alarm.AlarmClockActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -30,7 +30,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:id="@+id/tv_voice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="30秒"
|
||||
|
||||
112
app/src/main/res/layout/item_alarm_clock.xml
Normal file
112
app/src/main/res/layout/item_alarm_clock.xml
Normal file
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@drawable/alarm_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="00:00"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="50sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_remind_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="循环"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_time"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="标题"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_remind_type"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_remind_type" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_voice"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/voice_background"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_title"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_voice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/voice_background"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="0秒"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/voice"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<Switch
|
||||
android:id="@+id/switch1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:checked="true"
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_time" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_delete"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/delete"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/cl_voice"
|
||||
app:layout_constraintEnd_toEndOf="@+id/switch1" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -3,12 +3,17 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="16dp">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:background="@drawable/alarm_notifi_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
@@ -31,6 +36,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_voice"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
@@ -39,10 +45,10 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_time">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:id="@+id/tv_voice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="30秒"
|
||||
android:text="0秒"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -8,12 +8,15 @@
|
||||
<color name="transparent_white">#FFFFFF</color>
|
||||
<color name="transparent">#00FFFFFF</color>
|
||||
<color name="black">#000000</color>
|
||||
|
||||
<color name="gray">#f0f0f0</color>
|
||||
<color name="lightGray">#FFD3D3D3</color>
|
||||
<color name="tv_add_color">#4880ff</color>
|
||||
<color name="yellow">#F8B551</color>
|
||||
<color name="notice_blue">#0480FF</color>
|
||||
<color name="ok_button">#4D4B50</color>
|
||||
<color name="red">#FF0000</color>
|
||||
<color name="actions_item_pressed">#424144</color>
|
||||
<color name="default_background_color">#8e6afb</color>
|
||||
|
||||
<color name="voice_color">#00D56B</color>
|
||||
</resources>
|
||||
|
||||
@@ -10,6 +10,15 @@
|
||||
<item name="android:fitsSystemWindows">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppWhiteTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/gray</item>
|
||||
<item name="colorPrimaryDark">@color/gray</item>
|
||||
<item name="colorAccent">@color/gray</item>
|
||||
<item name="android:windowBackground">@color/gray</item>
|
||||
<item name="android:fitsSystemWindows">true</item>
|
||||
</style>
|
||||
|
||||
<style name="activity_styles" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- <item name="android:windowFullscreen">true</item>-->
|
||||
<!--设置dialog的背景-->
|
||||
|
||||
1
niceimageview/.gitignore
vendored
Normal file
1
niceimageview/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
35
niceimageview/build.gradle
Normal file
35
niceimageview/build.gradle
Normal file
@@ -0,0 +1,35 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
zhanRuiRelease{
|
||||
|
||||
}
|
||||
zhanRuiDebug{
|
||||
|
||||
}
|
||||
debug{
|
||||
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||
}
|
||||
21
niceimageview/proguard-rules.pro
vendored
Normal file
21
niceimageview/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For menu details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
2
niceimageview/src/main/AndroidManifest.xml
Normal file
2
niceimageview/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.shehuan.niv" />
|
||||
338
niceimageview/src/main/java/com/shehuan/niv/NiceImageView.java
Normal file
338
niceimageview/src/main/java/com/shehuan/niv/NiceImageView.java
Normal file
@@ -0,0 +1,338 @@
|
||||
package com.shehuan.niv;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Xfermode;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
public class NiceImageView extends AppCompatImageView {
|
||||
private Context context;
|
||||
|
||||
private boolean isCircle; // 是否显示为圆形,如果为圆形则设置的corner无效
|
||||
private boolean isCoverSrc; // border、inner_border是否覆盖图片
|
||||
private int borderWidth; // 边框宽度
|
||||
private int borderColor = Color.WHITE; // 边框颜色
|
||||
private int innerBorderWidth; // 内层边框宽度
|
||||
private int innerBorderColor = Color.WHITE; // 内层边框充色
|
||||
|
||||
private int cornerRadius; // 统一设置圆角半径,优先级高于单独设置每个角的半径
|
||||
private int cornerTopLeftRadius; // 左上角圆角半径
|
||||
private int cornerTopRightRadius; // 右上角圆角半径
|
||||
private int cornerBottomLeftRadius; // 左下角圆角半径
|
||||
private int cornerBottomRightRadius; // 右下角圆角半径
|
||||
|
||||
private int maskColor; // 遮罩颜色
|
||||
|
||||
private Xfermode xfermode;
|
||||
|
||||
private int width;
|
||||
private int height;
|
||||
private float radius;
|
||||
|
||||
private float[] borderRadii;
|
||||
private float[] srcRadii;
|
||||
|
||||
private RectF srcRectF; // 图片占的矩形区域
|
||||
private RectF borderRectF; // 边框的矩形区域
|
||||
|
||||
private Paint paint;
|
||||
private Path path; // 用来裁剪图片的ptah
|
||||
private Path srcPath; // 图片区域大小的path
|
||||
|
||||
public NiceImageView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public NiceImageView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public NiceImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
this.context = context;
|
||||
|
||||
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.NiceImageView, 0, 0);
|
||||
for (int i = 0; i < ta.getIndexCount(); i++) {
|
||||
int attr = ta.getIndex(i);
|
||||
if (attr == R.styleable.NiceImageView_is_cover_src) {
|
||||
isCoverSrc = ta.getBoolean(attr, isCoverSrc);
|
||||
} else if (attr == R.styleable.NiceImageView_is_circle) {
|
||||
isCircle = ta.getBoolean(attr, isCircle);
|
||||
} else if (attr == R.styleable.NiceImageView_border_width) {
|
||||
borderWidth = ta.getDimensionPixelSize(attr, borderWidth);
|
||||
} else if (attr == R.styleable.NiceImageView_border_color) {
|
||||
borderColor = ta.getColor(attr, borderColor);
|
||||
} else if (attr == R.styleable.NiceImageView_inner_border_width) {
|
||||
innerBorderWidth = ta.getDimensionPixelSize(attr, innerBorderWidth);
|
||||
} else if (attr == R.styleable.NiceImageView_inner_border_color) {
|
||||
innerBorderColor = ta.getColor(attr, innerBorderColor);
|
||||
} else if (attr == R.styleable.NiceImageView_corner_radius) {
|
||||
cornerRadius = ta.getDimensionPixelSize(attr, cornerRadius);
|
||||
} else if (attr == R.styleable.NiceImageView_corner_top_left_radius) {
|
||||
cornerTopLeftRadius = ta.getDimensionPixelSize(attr, cornerTopLeftRadius);
|
||||
} else if (attr == R.styleable.NiceImageView_corner_top_right_radius) {
|
||||
cornerTopRightRadius = ta.getDimensionPixelSize(attr, cornerTopRightRadius);
|
||||
} else if (attr == R.styleable.NiceImageView_corner_bottom_left_radius) {
|
||||
cornerBottomLeftRadius = ta.getDimensionPixelSize(attr, cornerBottomLeftRadius);
|
||||
} else if (attr == R.styleable.NiceImageView_corner_bottom_right_radius) {
|
||||
cornerBottomRightRadius = ta.getDimensionPixelSize(attr, cornerBottomRightRadius);
|
||||
} else if (attr == R.styleable.NiceImageView_mask_color) {
|
||||
maskColor = ta.getColor(attr, maskColor);
|
||||
}
|
||||
}
|
||||
ta.recycle();
|
||||
|
||||
borderRadii = new float[8];
|
||||
srcRadii = new float[8];
|
||||
|
||||
borderRectF = new RectF();
|
||||
srcRectF = new RectF();
|
||||
|
||||
paint = new Paint();
|
||||
path = new Path();
|
||||
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1) {
|
||||
xfermode = new PorterDuffXfermode(PorterDuff.Mode.DST_IN);
|
||||
} else {
|
||||
xfermode = new PorterDuffXfermode(PorterDuff.Mode.DST_OUT);
|
||||
srcPath = new Path();
|
||||
}
|
||||
|
||||
calculateRadii();
|
||||
clearInnerBorderWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
width = w;
|
||||
height = h;
|
||||
|
||||
initBorderRectF();
|
||||
initSrcRectF();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
// 使用图形混合模式来显示指定区域的图片
|
||||
canvas.saveLayer(srcRectF, null, Canvas.ALL_SAVE_FLAG);
|
||||
if (!isCoverSrc) {
|
||||
float sx = 1.0f * (width - 2 * borderWidth - 2 * innerBorderWidth) / width;
|
||||
float sy = 1.0f * (height - 2 * borderWidth - 2 * innerBorderWidth) / height;
|
||||
// 缩小画布,使图片内容不被borders覆盖
|
||||
canvas.scale(sx, sy, width / 2.0f, height / 2.0f);
|
||||
}
|
||||
super.onDraw(canvas);
|
||||
paint.reset();
|
||||
path.reset();
|
||||
if (isCircle) {
|
||||
path.addCircle(width / 2.0f, height / 2.0f, radius, Path.Direction.CCW);
|
||||
} else {
|
||||
path.addRoundRect(srcRectF, srcRadii, Path.Direction.CCW);
|
||||
}
|
||||
|
||||
paint.setAntiAlias(true);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setXfermode(xfermode);
|
||||
//9.0及以上系统图片一次圆一次方的解决办法
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1) {
|
||||
canvas.drawPath(path, paint);
|
||||
} else {
|
||||
srcPath.addRect(srcRectF, Path.Direction.CCW);
|
||||
// 计算tempPath和path的差集
|
||||
srcPath.op(path, Path.Op.DIFFERENCE);
|
||||
canvas.drawPath(srcPath, paint);
|
||||
srcPath.reset();//1
|
||||
}
|
||||
paint.setXfermode(null);
|
||||
|
||||
// 绘制遮罩
|
||||
if (maskColor != 0) {
|
||||
paint.setColor(maskColor);
|
||||
canvas.drawPath(path, paint);
|
||||
}
|
||||
// 恢复画布
|
||||
canvas.restore();
|
||||
// 绘制边框
|
||||
drawBorders(canvas);
|
||||
}
|
||||
|
||||
private void drawBorders(Canvas canvas) {
|
||||
if (isCircle) {
|
||||
if (borderWidth > 0) {
|
||||
drawCircleBorder(canvas, borderWidth, borderColor, radius - borderWidth / 2.0f);
|
||||
}
|
||||
if (innerBorderWidth > 0) {
|
||||
drawCircleBorder(canvas, innerBorderWidth, innerBorderColor, radius - borderWidth - innerBorderWidth / 2.0f);
|
||||
}
|
||||
} else {
|
||||
if (borderWidth > 0) {
|
||||
drawRectFBorder(canvas, borderWidth, borderColor, borderRectF, borderRadii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawCircleBorder(Canvas canvas, int borderWidth, int borderColor, float radius) {
|
||||
initBorderPaint(borderWidth, borderColor);
|
||||
path.addCircle(width / 2.0f, height / 2.0f, radius, Path.Direction.CCW);
|
||||
canvas.drawPath(path, paint);
|
||||
}
|
||||
|
||||
private void drawRectFBorder(Canvas canvas, int borderWidth, int borderColor, RectF rectF, float[] radii) {
|
||||
initBorderPaint(borderWidth, borderColor);
|
||||
path.addRoundRect(rectF, radii, Path.Direction.CCW);
|
||||
canvas.drawPath(path, paint);
|
||||
}
|
||||
|
||||
private void initBorderPaint(int borderWidth, int borderColor) {
|
||||
path.reset();
|
||||
paint.setStrokeWidth(borderWidth);
|
||||
paint.setColor(borderColor);
|
||||
paint.setStyle(Paint.Style.STROKE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算外边框的RectF
|
||||
*/
|
||||
private void initBorderRectF() {
|
||||
if (!isCircle) {
|
||||
borderRectF.set(borderWidth / 2.0f, borderWidth / 2.0f, width - borderWidth / 2.0f, height - borderWidth / 2.0f);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算图片原始区域的RectF
|
||||
*/
|
||||
private void initSrcRectF() {
|
||||
if (isCircle) {
|
||||
radius = Math.min(width, height) / 2.0f;
|
||||
srcRectF.set(width / 2.0f - radius, height / 2.0f - radius, width / 2.0f + radius, height / 2.0f + radius);
|
||||
} else {
|
||||
srcRectF.set(0, 0, width, height);
|
||||
if (isCoverSrc) {
|
||||
srcRectF = borderRectF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算RectF的圆角半径
|
||||
*/
|
||||
private void calculateRadii() {
|
||||
if (isCircle) {
|
||||
return;
|
||||
}
|
||||
if (cornerRadius > 0) {
|
||||
for (int i = 0; i < borderRadii.length; i++) {
|
||||
borderRadii[i] = cornerRadius;
|
||||
srcRadii[i] = cornerRadius - borderWidth / 2.0f;
|
||||
}
|
||||
} else {
|
||||
borderRadii[0] = borderRadii[1] = cornerTopLeftRadius;
|
||||
borderRadii[2] = borderRadii[3] = cornerTopRightRadius;
|
||||
borderRadii[4] = borderRadii[5] = cornerBottomRightRadius;
|
||||
borderRadii[6] = borderRadii[7] = cornerBottomLeftRadius;
|
||||
|
||||
srcRadii[0] = srcRadii[1] = cornerTopLeftRadius - borderWidth / 2.0f;
|
||||
srcRadii[2] = srcRadii[3] = cornerTopRightRadius - borderWidth / 2.0f;
|
||||
srcRadii[4] = srcRadii[5] = cornerBottomRightRadius - borderWidth / 2.0f;
|
||||
srcRadii[6] = srcRadii[7] = cornerBottomLeftRadius - borderWidth / 2.0f;
|
||||
}
|
||||
}
|
||||
|
||||
private void calculateRadiiAndRectF(boolean reset) {
|
||||
if (reset) {
|
||||
cornerRadius = 0;
|
||||
}
|
||||
calculateRadii();
|
||||
initBorderRectF();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 目前圆角矩形情况下不支持inner_border,需要将其置0
|
||||
*/
|
||||
private void clearInnerBorderWidth() {
|
||||
if (!isCircle) {
|
||||
this.innerBorderWidth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void isCoverSrc(boolean isCoverSrc) {
|
||||
this.isCoverSrc = isCoverSrc;
|
||||
initSrcRectF();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void isCircle(boolean isCircle) {
|
||||
this.isCircle = isCircle;
|
||||
clearInnerBorderWidth();
|
||||
initSrcRectF();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setBorderWidth(int borderWidth) {
|
||||
this.borderWidth = Utils.dp2px(context, borderWidth);
|
||||
calculateRadiiAndRectF(false);
|
||||
}
|
||||
|
||||
public void setBorderColor(@ColorInt int borderColor) {
|
||||
this.borderColor = borderColor;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setInnerBorderWidth(int innerBorderWidth) {
|
||||
this.innerBorderWidth = Utils.dp2px(context, innerBorderWidth);
|
||||
clearInnerBorderWidth();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setInnerBorderColor(@ColorInt int innerBorderColor) {
|
||||
this.innerBorderColor = innerBorderColor;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setCornerRadius(int cornerRadius) {
|
||||
this.cornerRadius = Utils.dp2px(context, cornerRadius);
|
||||
calculateRadiiAndRectF(false);
|
||||
}
|
||||
|
||||
public void setCornerTopLeftRadius(int cornerTopLeftRadius) {
|
||||
this.cornerTopLeftRadius = Utils.dp2px(context, cornerTopLeftRadius);
|
||||
calculateRadiiAndRectF(true);
|
||||
}
|
||||
|
||||
public void setCornerTopRightRadius(int cornerTopRightRadius) {
|
||||
this.cornerTopRightRadius = Utils.dp2px(context, cornerTopRightRadius);
|
||||
calculateRadiiAndRectF(true);
|
||||
}
|
||||
|
||||
public void setCornerBottomLeftRadius(int cornerBottomLeftRadius) {
|
||||
this.cornerBottomLeftRadius = Utils.dp2px(context, cornerBottomLeftRadius);
|
||||
calculateRadiiAndRectF(true);
|
||||
}
|
||||
|
||||
public void setCornerBottomRightRadius(int cornerBottomRightRadius) {
|
||||
this.cornerBottomRightRadius = Utils.dp2px(context, cornerBottomRightRadius);
|
||||
calculateRadiiAndRectF(true);
|
||||
}
|
||||
|
||||
public void setMaskColor(@ColorInt int maskColor) {
|
||||
this.maskColor = maskColor;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
11
niceimageview/src/main/java/com/shehuan/niv/Utils.java
Normal file
11
niceimageview/src/main/java/com/shehuan/niv/Utils.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.shehuan.niv;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class Utils {
|
||||
public static int dp2px(Context context, float dipValue) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (dipValue * scale + 0.5f);
|
||||
}
|
||||
}
|
||||
17
niceimageview/src/main/res/values/attrs.xml
Normal file
17
niceimageview/src/main/res/values/attrs.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="NiceImageView">
|
||||
<attr name="is_circle" format="boolean" />
|
||||
<attr name="is_cover_src" format="boolean" />
|
||||
<attr name="corner_radius" format="dimension" />
|
||||
<attr name="corner_top_left_radius" format="dimension" />
|
||||
<attr name="corner_top_right_radius" format="dimension" />
|
||||
<attr name="corner_bottom_left_radius" format="dimension" />
|
||||
<attr name="corner_bottom_right_radius" format="dimension" />
|
||||
<attr name="border_width" format="dimension" />
|
||||
<attr name="border_color" format="color" />
|
||||
<attr name="inner_border_width" format="dimension" />
|
||||
<attr name="inner_border_color" format="color" />
|
||||
<attr name="mask_color" format="color" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
3
niceimageview/src/main/res/values/strings.xml
Normal file
3
niceimageview/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">niceimageview</string>
|
||||
</resources>
|
||||
@@ -1,2 +1,2 @@
|
||||
include ':app'
|
||||
rootProject.name='老人平板桌面'
|
||||
include ':app', ':niceimageview'
|
||||
rootProject.name='UIUI老人平板桌面'
|
||||
Reference in New Issue
Block a user