Skip to content

Commit

Permalink
v1.2.2
Browse files Browse the repository at this point in the history
Long click player to highlight recording.
  • Loading branch information
DHD2280 committed Mar 15, 2024
1 parent 2054e5a commit da14028
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
applicationId = "it.dhd.bcrmanager"
minSdk = 28
targetSdk = 34
versionCode = 16
versionName = "1.2.0"
versionCode = 20
versionName = "1.2.2"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
setProperty("archivesBaseName", rootProject.name + "-v" + versionName + "-" + versionCode)
resourceConfigurations.addAll(listOf(
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppTheme"
android:localeConfig="@xml/locales_config"
android:grantUriPermissions="true"
android:requestLegacyExternalStorage="true"
tools:targetApi="31">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.provider.ContactsContract;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -64,12 +66,23 @@ public class CallLogAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
private boolean hasExpansion = true;
private boolean hasContactsActionsEnabled = true;

private int highlightPos = RecyclerView.NO_POSITION;

public void filter(List<Object> filteredList) {
callLogItems.clear();
callLogItems.addAll(filteredList);
notifyDataSetChanged();
}

public void highLight(int pos) {
highlightPos = pos;
notifyItemChanged(pos);
new Handler(Looper.getMainLooper()).postDelayed(() -> {
highlightPos = RecyclerView.NO_POSITION;
notifyItemChanged(pos);
}, 350);
}

public interface onActionPlayListener {
void onActionPlay(MaterialButton playButton, CallLogItem item, RecyclerView.Adapter<? extends RecyclerView.ViewHolder> bindingAdapter);
}
Expand Down Expand Up @@ -344,6 +357,14 @@ public void bind(CallLogItem item, int position) {
binding.rootLayout.setCardBackgroundColor(ContextCompat.getColor(mContext, R.color.trans));
}

if (position == highlightPos) {
binding.rootLayout.setCardBackgroundColor(ThemeUtils.getColorSurfaceHighest(mContext));
} else if (position == expandedPosition) {
binding.rootLayout.setCardBackgroundColor(ThemeUtils.getColorSurfaceHigh(mContext));
} else {
binding.rootLayout.setCardBackgroundColor(ContextCompat.getColor(mContext, R.color.trans));
}

binding.expandingLayout.setVisibility(position == expandedPosition ? View.VISIBLE : View.GONE);

// Set Contact Name
Expand Down
15 changes: 14 additions & 1 deletion app/src/main/java/it/dhd/bcrmanager/ui/fragments/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import android.content.res.Configuration;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.SystemClock;
import android.provider.ContactsContract;
import android.text.TextUtils;
Expand Down Expand Up @@ -533,7 +535,7 @@ private void setupBottomPlayer() {
mStarredAdapter.notifyItemChanged(starredListFiltered.indexOf(currentlyPlaying));
});
binding.playerInfoBarContainer.setOnLongClickListener(v -> {
binding.recyclerView.smoothScrollToPosition(sortedListFiltered.indexOf(currentlyPlaying));
highlightRecording();
return true;
});
}
Expand Down Expand Up @@ -1270,4 +1272,15 @@ private void onTrimAudioClip(CallLogItem item) {
fm.beginTransaction().replace(R.id.frame_layout, new TrimAudioFragment(item)).addToBackStack(null).commit();
}

private void highlightRecording() {
if (binding == null) return;
if (!sortedListFiltered.contains(currentlyPlaying)) return;
int pos = sortedListFiltered.indexOf(currentlyPlaying);
binding.recyclerView.scrollToPosition(pos);
binding.recyclerView.postDelayed(() -> {
mRegAdapter.highLight(pos);
//highlightFallback(prefsFragment, prefResult);
}, 200);
}

}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.2.1" apply false
id("com.android.application") version "8.2.2" apply false
id("dev.rikka.tools.materialthemebuilder") version "1.4.1"
}

0 comments on commit da14028

Please sign in to comment.