version:2.6
fix: update:优化爱心提醒
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user