修复闹钟不自动播放问题
This commit is contained in:
@@ -59,7 +59,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
ConstraintLayout cl_vp;
|
||||
@BindView(R.id.jz_video)
|
||||
JzvdStdAssert jz_video;
|
||||
@BindView(R.id.imageView)
|
||||
@BindView(R.id.iv_cover)
|
||||
ImageView imageView;
|
||||
|
||||
private AlarmClockData alarmClockData;
|
||||
@@ -75,6 +75,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_notice);
|
||||
Log.e(TAG, "onCreate: " );
|
||||
ButterKnife.bind(this);
|
||||
Intent intent = getIntent();
|
||||
code = intent.getIntExtra("id", -1);
|
||||
@@ -100,6 +101,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void showData(AlarmClockData alarmClockData) {
|
||||
Log.e(TAG, "showData: " );
|
||||
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||
int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, maxVolume, AudioManager.FLAG_PLAY_SOUND);
|
||||
@@ -202,6 +204,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
jz_video.startPreloading();
|
||||
jz_video.startVideoAfterPreloading();
|
||||
jz_video.startVideo();
|
||||
|
||||
}
|
||||
} else {
|
||||
cl_vp.setVisibility(View.GONE);
|
||||
@@ -211,6 +214,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Log.e(TAG, "onDestroy: " );
|
||||
super.onDestroy();
|
||||
if (mediaPlayer != null) {
|
||||
if (mediaPlayer.isPlaying()) {
|
||||
@@ -223,6 +227,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
Log.e(TAG, "onDestroy: " );
|
||||
if (Jzvd.backPress()) {
|
||||
return;
|
||||
}
|
||||
@@ -230,8 +235,9 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
protected void onStop() {
|
||||
Log.e(TAG, "onDestroy: " );
|
||||
super.onStop();
|
||||
Jzvd.releaseAllVideos();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,10 @@ import com.uiuios.aios.R;
|
||||
import com.uiuios.aios.bean.AlarmClockData;
|
||||
import com.uiuios.aios.utils.FFmpegUtils;
|
||||
import com.uiuios.aios.utils.ScreenUtils;
|
||||
import com.uiuios.aios.utils.Utils;
|
||||
import com.uiuios.aios.view.JzvdStdRound;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -140,19 +142,27 @@ public class AlarmAdapter extends RecyclerView.Adapter<AlarmAdapter.holder> {
|
||||
});
|
||||
}
|
||||
String url = alarmClockData.getFile();
|
||||
String fileName = url.substring(url.lastIndexOf("/") + 1, url.length());
|
||||
String realPath = Utils.getDownLoadPath(mContext) + fileName;
|
||||
File file = new File(realPath);
|
||||
if (file.exists()) {
|
||||
holder.iv_finish.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
holder.iv_finish.setVisibility(View.GONE);
|
||||
}
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
holder.cl_vp.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.cl_vp.setVisibility(View.VISIBLE);
|
||||
if (isImgUrl(url)) {
|
||||
holder.imageView.setVisibility(View.VISIBLE);
|
||||
holder.iv_cover.setVisibility(View.VISIBLE);
|
||||
holder.jz_video.setVisibility(View.GONE);
|
||||
if (!mContext.isDestroyed()) {
|
||||
RequestOptions options = new RequestOptions().transform(new RoundedCorners(ScreenUtils.dip2px(mContext, 16F)));
|
||||
Glide.with(mContext).load(url).apply(options).into(holder.imageView);
|
||||
Glide.with(mContext).load(url).apply(options).into(holder.iv_cover);
|
||||
}
|
||||
} else {
|
||||
holder.imageView.setVisibility(View.GONE);
|
||||
holder.iv_cover.setVisibility(View.GONE);
|
||||
holder.jz_video.setVisibility(View.VISIBLE);
|
||||
holder.jz_video.setUp(url, "");
|
||||
holder.jz_video.startButton.setImageDrawable(mContext.getDrawable(R.drawable.play));
|
||||
@@ -206,7 +216,7 @@ public class AlarmAdapter extends RecyclerView.Adapter<AlarmAdapter.holder> {
|
||||
TextView tv_time, tv_remind_type, tv_title, tv_voice;
|
||||
ConstraintLayout cl_voice, cl_vp;
|
||||
JzvdStdRound jz_video;
|
||||
ImageView imageView;
|
||||
ImageView iv_cover, iv_finish;
|
||||
Switch switch1;
|
||||
|
||||
public holder(@NonNull View itemView) {
|
||||
@@ -219,7 +229,8 @@ public class AlarmAdapter extends RecyclerView.Adapter<AlarmAdapter.holder> {
|
||||
switch1 = itemView.findViewById(R.id.switch1);
|
||||
cl_vp = itemView.findViewById(R.id.cl_vp);
|
||||
jz_video = itemView.findViewById(R.id.jz_video);
|
||||
imageView = itemView.findViewById(R.id.imageView);
|
||||
iv_cover = itemView.findViewById(R.id.iv_cover);
|
||||
iv_finish = itemView.findViewById(R.id.iv_finish);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,13 +134,14 @@ public class MainService extends BaseService implements MainSContact.MainSView,
|
||||
private class AlarmReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.e(TAG, "onReceive: " + System.currentTimeMillis());
|
||||
Log.e(TAG, "onReceive: currentTimeMillis: " + System.currentTimeMillis());
|
||||
String action = intent.getAction();
|
||||
if (TextUtils.isEmpty(action)) return;
|
||||
Log.e(TAG, "onReceive: " + action);
|
||||
String title = intent.getStringExtra("title");
|
||||
int code = intent.getIntExtra("id", -1);
|
||||
Log.e(TAG, "onReceive: title = " + title);
|
||||
int code = intent.getIntExtra("id", -1);
|
||||
Log.e(TAG, "onReceive: code = " + code);
|
||||
setNextAlarm(code);
|
||||
if (ALARMWAKEUP.equals(action)) {
|
||||
Intent noticeIntent = new Intent();
|
||||
|
||||
Reference in New Issue
Block a user