修复闹钟不自动播放问题
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();
|
||||
|
||||
BIN
app/src/main/res/drawable-hdpi/finished_icon.png
Normal file
BIN
app/src/main/res/drawable-hdpi/finished_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
@@ -55,7 +55,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:id="@+id/iv_cover"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:adjustViewBounds="true"
|
||||
@@ -72,9 +72,9 @@
|
||||
android:text="位置"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_18"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/imageView"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
||||
app:layout_constraintTop_toTopOf="@+id/imageView" />
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_cover"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_cover"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_cover" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -54,7 +54,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:id="@+id/iv_cover"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:adjustViewBounds="true"
|
||||
@@ -71,9 +71,9 @@
|
||||
android:text="位置"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_18"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/imageView"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
||||
app:layout_constraintTop_toTopOf="@+id/imageView" />
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_cover"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_cover"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_cover" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -64,7 +64,7 @@
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:id="@+id/iv_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -30,6 +30,14 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_finish"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:src="@drawable/finished_icon"
|
||||
app:layout_constraintEnd_toEndOf="@+id/cl_vp"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_remind_type"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -128,7 +136,7 @@
|
||||
app:radius="16dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:id="@+id/iv_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
Reference in New Issue
Block a user