修复闹钟不自动播放问题
This commit is contained in:
@@ -16,8 +16,8 @@ android {
|
|||||||
applicationId "com.uiuios.aios"
|
applicationId "com.uiuios.aios"
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 2
|
versionCode 3
|
||||||
versionName "1.1"
|
versionName "1.2"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ dependencies {
|
|||||||
implementation 'com.arialyy.aria:core:3.8.15'
|
implementation 'com.arialyy.aria:core:3.8.15'
|
||||||
annotationProcessor 'com.arialyy.aria:compiler:3.8.15'
|
annotationProcessor 'com.arialyy.aria:compiler:3.8.15'
|
||||||
//videoplayer
|
//videoplayer
|
||||||
implementation 'cn.jzvd:jiaozivideoplayer:7.7.0'
|
implementation 'cn.jzvd:jiaozivideoplayer:7.7.2.3300'
|
||||||
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-core:1.0.16'
|
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-core:1.0.16'
|
||||||
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-native:1.0.16'
|
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-native:1.0.16'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class NoticeActivity extends AppCompatActivity {
|
|||||||
ConstraintLayout cl_vp;
|
ConstraintLayout cl_vp;
|
||||||
@BindView(R.id.jz_video)
|
@BindView(R.id.jz_video)
|
||||||
JzvdStdAssert jz_video;
|
JzvdStdAssert jz_video;
|
||||||
@BindView(R.id.imageView)
|
@BindView(R.id.iv_cover)
|
||||||
ImageView imageView;
|
ImageView imageView;
|
||||||
|
|
||||||
private AlarmClockData alarmClockData;
|
private AlarmClockData alarmClockData;
|
||||||
@@ -75,6 +75,7 @@ public class NoticeActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_notice);
|
setContentView(R.layout.activity_notice);
|
||||||
|
Log.e(TAG, "onCreate: " );
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
code = intent.getIntExtra("id", -1);
|
code = intent.getIntExtra("id", -1);
|
||||||
@@ -100,6 +101,7 @@ public class NoticeActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showData(AlarmClockData alarmClockData) {
|
private void showData(AlarmClockData alarmClockData) {
|
||||||
|
Log.e(TAG, "showData: " );
|
||||||
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||||
int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
||||||
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, maxVolume, AudioManager.FLAG_PLAY_SOUND);
|
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, maxVolume, AudioManager.FLAG_PLAY_SOUND);
|
||||||
@@ -202,6 +204,7 @@ public class NoticeActivity extends AppCompatActivity {
|
|||||||
jz_video.startPreloading();
|
jz_video.startPreloading();
|
||||||
jz_video.startVideoAfterPreloading();
|
jz_video.startVideoAfterPreloading();
|
||||||
jz_video.startVideo();
|
jz_video.startVideo();
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cl_vp.setVisibility(View.GONE);
|
cl_vp.setVisibility(View.GONE);
|
||||||
@@ -211,6 +214,7 @@ public class NoticeActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
Log.e(TAG, "onDestroy: " );
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
if (mediaPlayer != null) {
|
if (mediaPlayer != null) {
|
||||||
if (mediaPlayer.isPlaying()) {
|
if (mediaPlayer.isPlaying()) {
|
||||||
@@ -223,6 +227,7 @@ public class NoticeActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
|
Log.e(TAG, "onDestroy: " );
|
||||||
if (Jzvd.backPress()) {
|
if (Jzvd.backPress()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -230,8 +235,9 @@ public class NoticeActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onStop() {
|
||||||
super.onPause();
|
Log.e(TAG, "onDestroy: " );
|
||||||
|
super.onStop();
|
||||||
Jzvd.releaseAllVideos();
|
Jzvd.releaseAllVideos();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,10 @@ import com.uiuios.aios.R;
|
|||||||
import com.uiuios.aios.bean.AlarmClockData;
|
import com.uiuios.aios.bean.AlarmClockData;
|
||||||
import com.uiuios.aios.utils.FFmpegUtils;
|
import com.uiuios.aios.utils.FFmpegUtils;
|
||||||
import com.uiuios.aios.utils.ScreenUtils;
|
import com.uiuios.aios.utils.ScreenUtils;
|
||||||
|
import com.uiuios.aios.utils.Utils;
|
||||||
import com.uiuios.aios.view.JzvdStdRound;
|
import com.uiuios.aios.view.JzvdStdRound;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -140,19 +142,27 @@ public class AlarmAdapter extends RecyclerView.Adapter<AlarmAdapter.holder> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
String url = alarmClockData.getFile();
|
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)) {
|
if (TextUtils.isEmpty(url)) {
|
||||||
holder.cl_vp.setVisibility(View.GONE);
|
holder.cl_vp.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
holder.cl_vp.setVisibility(View.VISIBLE);
|
holder.cl_vp.setVisibility(View.VISIBLE);
|
||||||
if (isImgUrl(url)) {
|
if (isImgUrl(url)) {
|
||||||
holder.imageView.setVisibility(View.VISIBLE);
|
holder.iv_cover.setVisibility(View.VISIBLE);
|
||||||
holder.jz_video.setVisibility(View.GONE);
|
holder.jz_video.setVisibility(View.GONE);
|
||||||
if (!mContext.isDestroyed()) {
|
if (!mContext.isDestroyed()) {
|
||||||
RequestOptions options = new RequestOptions().transform(new RoundedCorners(ScreenUtils.dip2px(mContext, 16F)));
|
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 {
|
} else {
|
||||||
holder.imageView.setVisibility(View.GONE);
|
holder.iv_cover.setVisibility(View.GONE);
|
||||||
holder.jz_video.setVisibility(View.VISIBLE);
|
holder.jz_video.setVisibility(View.VISIBLE);
|
||||||
holder.jz_video.setUp(url, "");
|
holder.jz_video.setUp(url, "");
|
||||||
holder.jz_video.startButton.setImageDrawable(mContext.getDrawable(R.drawable.play));
|
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;
|
TextView tv_time, tv_remind_type, tv_title, tv_voice;
|
||||||
ConstraintLayout cl_voice, cl_vp;
|
ConstraintLayout cl_voice, cl_vp;
|
||||||
JzvdStdRound jz_video;
|
JzvdStdRound jz_video;
|
||||||
ImageView imageView;
|
ImageView iv_cover, iv_finish;
|
||||||
Switch switch1;
|
Switch switch1;
|
||||||
|
|
||||||
public holder(@NonNull View itemView) {
|
public holder(@NonNull View itemView) {
|
||||||
@@ -219,7 +229,8 @@ public class AlarmAdapter extends RecyclerView.Adapter<AlarmAdapter.holder> {
|
|||||||
switch1 = itemView.findViewById(R.id.switch1);
|
switch1 = itemView.findViewById(R.id.switch1);
|
||||||
cl_vp = itemView.findViewById(R.id.cl_vp);
|
cl_vp = itemView.findViewById(R.id.cl_vp);
|
||||||
jz_video = itemView.findViewById(R.id.jz_video);
|
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 {
|
private class AlarmReceiver extends BroadcastReceiver {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Log.e(TAG, "onReceive: " + System.currentTimeMillis());
|
Log.e(TAG, "onReceive: currentTimeMillis: " + System.currentTimeMillis());
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
if (TextUtils.isEmpty(action)) return;
|
if (TextUtils.isEmpty(action)) return;
|
||||||
Log.e(TAG, "onReceive: " + action);
|
Log.e(TAG, "onReceive: " + action);
|
||||||
String title = intent.getStringExtra("title");
|
String title = intent.getStringExtra("title");
|
||||||
int code = intent.getIntExtra("id", -1);
|
|
||||||
Log.e(TAG, "onReceive: title = " + title);
|
Log.e(TAG, "onReceive: title = " + title);
|
||||||
|
int code = intent.getIntExtra("id", -1);
|
||||||
|
Log.e(TAG, "onReceive: code = " + code);
|
||||||
setNextAlarm(code);
|
setNextAlarm(code);
|
||||||
if (ALARMWAKEUP.equals(action)) {
|
if (ALARMWAKEUP.equals(action)) {
|
||||||
Intent noticeIntent = new Intent();
|
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">
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/iv_cover"
|
||||||
android:layout_width="32dp"
|
android:layout_width="32dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="32dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
@@ -72,9 +72,9 @@
|
|||||||
android:text="位置"
|
android:text="位置"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/sp_18"
|
android:textSize="@dimen/sp_18"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/imageView"
|
app:layout_constraintBottom_toBottomOf="@+id/iv_cover"
|
||||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
app:layout_constraintStart_toEndOf="@+id/iv_cover"
|
||||||
app:layout_constraintTop_toTopOf="@+id/imageView" />
|
app:layout_constraintTop_toTopOf="@+id/iv_cover" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent">
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/iv_cover"
|
||||||
android:layout_width="32dp"
|
android:layout_width="32dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="32dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
@@ -71,9 +71,9 @@
|
|||||||
android:text="位置"
|
android:text="位置"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/sp_18"
|
android:textSize="@dimen/sp_18"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/imageView"
|
app:layout_constraintBottom_toBottomOf="@+id/iv_cover"
|
||||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
app:layout_constraintStart_toEndOf="@+id/iv_cover"
|
||||||
app:layout_constraintTop_toTopOf="@+id/imageView" />
|
app:layout_constraintTop_toTopOf="@+id/iv_cover" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/iv_cover"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
@@ -30,6 +30,14 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="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
|
<TextView
|
||||||
android:id="@+id/tv_remind_type"
|
android:id="@+id/tv_remind_type"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -128,7 +136,7 @@
|
|||||||
app:radius="16dp" />
|
app:radius="16dp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/iv_cover"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
|||||||
Reference in New Issue
Block a user