Skip to content

Commit

Permalink
Replace kapt with ksp and update dependencies (#1560)
Browse files Browse the repository at this point in the history
  • Loading branch information
simophin authored Jul 24, 2024
1 parent fc5c7a7 commit 631d93c
Show file tree
Hide file tree
Showing 65 changed files with 193 additions and 195 deletions.
22 changes: 6 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion"
classpath "com.google.gms:google-services:$googleServicesVersion"
classpath "com.google.dagger:hilt-android-gradle-plugin:$daggerVersion"
}
}

plugins {
id 'kotlin-kapt'
id 'com.google.devtools.ksp'
id 'com.google.dagger.hilt.android'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'witness'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlinx-serialization'
apply plugin: 'dagger.hilt.android.plugin'

configurations.all {
exclude module: "commons-logging"
Expand Down Expand Up @@ -89,7 +86,7 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.4.7'
kotlinCompilerExtensionVersion '1.5.14'
}

defaultConfig {
Expand Down Expand Up @@ -239,8 +236,9 @@ android {

dependencies {

implementation("com.google.dagger:hilt-android:2.46.1")
kapt("com.google.dagger:hilt-android-compiler:2.44")
implementation("com.google.dagger:hilt-android:$daggerHiltVersion")
ksp("com.google.dagger:hilt-compiler:$daggerHiltVersion")
ksp("androidx.hilt:hilt-compiler:$jetpackHiltVersion")

implementation "androidx.appcompat:appcompat:$appcompatVersion"
implementation 'androidx.recyclerview:recyclerview:1.2.1'
Expand Down Expand Up @@ -281,17 +279,14 @@ dependencies {
implementation 'commons-net:commons-net:3.7.2'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation "com.github.bumptech.glide:glide:$glideVersion"
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
kapt "com.github.bumptech.glide:compiler:$glideVersion"
ksp "com.github.bumptech.glide:ksp:$glideVersion"
implementation 'com.makeramen:roundedimageview:2.1.0'
implementation 'com.pnikosis:materialish-progress:1.5'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'pl.tajchert:waitingdots:0.1.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'com.melnykov:floatingactionbutton:1.3.0'
implementation 'com.google.zxing:android-integration:3.1.0'
implementation "com.google.dagger:hilt-android:$daggerVersion"
kapt "com.google.dagger:hilt-compiler:$daggerVersion"
implementation 'mobi.upod:time-duration-picker:1.1.3'
implementation 'com.google.zxing:core:3.2.1'
implementation ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') {
Expand Down Expand Up @@ -415,8 +410,3 @@ def autoResConfig() {
.collect { matcher -> matcher.group(1) }
.sort()
}

// Allow references to generated code
kapt {
correctErrorTypes = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import org.session.libsignal.utilities.guava.Optional
import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2
import org.thoughtcrime.securesms.conversation.v2.input_bar.InputBar
import org.thoughtcrime.securesms.home.HomeActivity
import org.thoughtcrime.securesms.mms.GlideApp
import com.bumptech.glide.Glide

@RunWith(AndroidJUnit4::class)
@LargeTest
Expand Down Expand Up @@ -71,7 +71,7 @@ class HomeActivityTests {
onView(allOf(isDescendantOfA(withId(R.id.inputBar)),withId(R.id.inputBarEditText))).perform(ViewActions.replaceText(messageToSend))
if (linkPreview != null) {
val activity = activityMonitor.waitForActivity() as ConversationActivityV2
val glide = GlideApp.with(activity)
val glide = Glide.with(activity)
activity.findViewById<InputBar>(R.id.inputBar).updateLinkPreviewDraft(glide, linkPreview)
}
onView(allOf(isDescendantOfA(withId(R.id.inputBar)),inputButtonWithDrawable(R.drawable.ic_arrow_up))).perform(ViewActions.click())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.thoughtcrime.securesms.conversation.v2.utilities.ThumbnailView;
import org.thoughtcrime.securesms.database.MediaDatabase.MediaRecord;
import org.thoughtcrime.securesms.database.loaders.BucketedThreadMediaLoader.BucketedThreadMedia;
import org.thoughtcrime.securesms.mms.GlideRequests;
import com.bumptech.glide.RequestManager;
import org.thoughtcrime.securesms.mms.Slide;
import org.thoughtcrime.securesms.util.MediaUtil;

Expand All @@ -46,7 +46,7 @@ class MediaGalleryAdapter extends StickyHeaderGridAdapter {
private static final String TAG = MediaGalleryAdapter.class.getSimpleName();

private final Context context;
private final GlideRequests glideRequests;
private final RequestManager glideRequests;
private final Locale locale;
private final ItemClickListener itemClickListener;
private final Set<MediaRecord> selected;
Expand Down Expand Up @@ -74,7 +74,7 @@ private static class HeaderHolder extends StickyHeaderGridAdapter.HeaderViewHold
}

MediaGalleryAdapter(@NonNull Context context,
@NonNull GlideRequests glideRequests,
@NonNull RequestManager glideRequests,
BucketedThreadMedia media,
Locale locale,
ItemClickListener clickListener)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
import org.thoughtcrime.securesms.database.loaders.BucketedThreadMediaLoader;
import org.thoughtcrime.securesms.database.loaders.BucketedThreadMediaLoader.BucketedThreadMedia;
import org.thoughtcrime.securesms.database.loaders.ThreadMediaLoader;
import org.thoughtcrime.securesms.mms.GlideApp;
import com.bumptech.glide.Glide;
import org.thoughtcrime.securesms.permissions.Permissions;
import org.session.libsession.utilities.recipients.Recipient;
import org.thoughtcrime.securesms.util.AttachmentUtil;
Expand Down Expand Up @@ -227,7 +227,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
this.gridManager = new StickyHeaderGridLayoutManager(getResources().getInteger(R.integer.media_overview_cols));

this.recyclerView.setAdapter(new MediaGalleryAdapter(getContext(),
GlideApp.with(this),
Glide.with(this),
new BucketedThreadMedia(getContext()),
locale,
this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
import org.thoughtcrime.securesms.database.model.MmsMessageRecord;
import org.thoughtcrime.securesms.mediapreview.MediaPreviewViewModel;
import org.thoughtcrime.securesms.mediapreview.MediaRailAdapter;
import org.thoughtcrime.securesms.mms.GlideApp;
import org.thoughtcrime.securesms.mms.GlideRequests;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import org.thoughtcrime.securesms.mms.Slide;
import org.thoughtcrime.securesms.permissions.Permissions;
import org.thoughtcrime.securesms.util.AttachmentUtil;
Expand Down Expand Up @@ -281,7 +281,7 @@ private void initializeViews() {
mediaPager.setOffscreenPageLimit(1);

albumRail = findViewById(R.id.media_preview_album_rail);
albumRailAdapter = new MediaRailAdapter(GlideApp.with(this), this, false);
albumRailAdapter = new MediaRailAdapter(Glide.with(this), this, false);

albumRail.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
albumRail.setAdapter(albumRailAdapter);
Expand Down Expand Up @@ -370,7 +370,7 @@ private void initializeMedia() {
if (conversationRecipient != null) {
getSupportLoaderManager().restartLoader(0, null, this);
} else {
adapter = new SingleItemPagerAdapter(this, GlideApp.with(this), getWindow(), initialMediaUri, initialMediaType, initialMediaSize);
adapter = new SingleItemPagerAdapter(this, Glide.with(this), getWindow(), initialMediaUri, initialMediaType, initialMediaSize);
mediaPager.setAdapter(adapter);

if (initialCaption != null) {
Expand Down Expand Up @@ -518,7 +518,7 @@ public void onLoadFinished(@NonNull Loader<Pair<Cursor, Integer>> loader, @Nulla

mediaPager.removeOnPageChangeListener(viewPagerListener);

adapter = new CursorPagerAdapter(this, GlideApp.with(this), getWindow(), data.first, data.second, leftIsRecent);
adapter = new CursorPagerAdapter(this, Glide.with(this), getWindow(), data.first, data.second, leftIsRecent);
mediaPager.setAdapter(adapter);

viewModel.setCursor(this, data.first, leftIsRecent);
Expand Down Expand Up @@ -588,15 +588,15 @@ public void onPageScrollStateChanged(int state) {

private static class SingleItemPagerAdapter extends MediaItemAdapter {

private final GlideRequests glideRequests;
private final RequestManager glideRequests;
private final Window window;
private final Uri uri;
private final String mediaType;
private final long size;

private final LayoutInflater inflater;

SingleItemPagerAdapter(@NonNull Context context, @NonNull GlideRequests glideRequests,
SingleItemPagerAdapter(@NonNull Context context, @NonNull RequestManager glideRequests,
@NonNull Window window, @NonNull Uri uri, @NonNull String mediaType,
long size)
{
Expand Down Expand Up @@ -663,14 +663,14 @@ private static class CursorPagerAdapter extends MediaItemAdapter {
private final WeakHashMap<Integer, MediaView> mediaViews = new WeakHashMap<>();

private final Context context;
private final GlideRequests glideRequests;
private final RequestManager glideRequests;
private final Window window;
private final Cursor cursor;
private final boolean leftIsRecent;

private int autoPlayPosition;

CursorPagerAdapter(@NonNull Context context, @NonNull GlideRequests glideRequests,
CursorPagerAdapter(@NonNull Context context, @NonNull RequestManager glideRequests,
@NonNull Window window, @NonNull Cursor cursor, int autoPlayPosition,
boolean leftIsRecent)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
private BroadcastReceiver clearKeyReceiver;

@Override
protected final void onCreate(Bundle savedInstanceState) {
protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate(" + savedInstanceState + ")");
onPreCreate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.Job
Expand All @@ -38,7 +39,6 @@ import org.session.libsession.utilities.truncateIdForDisplay
import org.session.libsignal.utilities.Log
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
import org.thoughtcrime.securesms.dependencies.DatabaseComponent
import org.thoughtcrime.securesms.mms.GlideApp
import org.thoughtcrime.securesms.permissions.Permissions
import org.thoughtcrime.securesms.service.WebRtcCallService
import org.thoughtcrime.securesms.util.AvatarPlaceholderGenerator
Expand Down Expand Up @@ -70,7 +70,7 @@ class WebRtcCallActivity : PassphraseRequiredActionBarActivity() {
}

private val viewModel by viewModels<CallViewModel>()
private val glide by lazy { GlideApp.with(this) }
private val glide by lazy { Glide.with(this) }
private lateinit var binding: ActivityWebrtcBinding
private var uiJob: Job? = null
private var wantsToAnswer = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import org.session.libsession.utilities.ThemeUtil;
import org.session.libsession.utilities.recipients.Recipient;
import org.session.libsession.utilities.recipients.RecipientExporter;
import org.thoughtcrime.securesms.mms.GlideApp;
import org.thoughtcrime.securesms.mms.GlideRequests;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import org.thoughtcrime.securesms.util.AvatarPlaceholderGenerator;

import java.util.Objects;
Expand Down Expand Up @@ -117,10 +117,10 @@ public void update(String hexEncodedPublicKey) {
}

private void updateAvatar(Recipient recipient) {
setAvatar(GlideApp.with(getContext()), recipient, false);
setAvatar(Glide.with(getContext()), recipient, false);
}

public void setAvatar(@NonNull GlideRequests requestManager, @Nullable Recipient recipient, boolean quickContactEnabled) {
public void setAvatar(@NonNull RequestManager requestManager, @Nullable Recipient recipient, boolean quickContactEnabled) {
if (recipient != null) {
if (recipient.isLocalNumber()) {
setImageDrawable(new ResourceContactPhoto(R.drawable.ic_note_to_self).asDrawable(getContext(), recipient.getColor().toAvatarColor(getContext()), inverted));
Expand Down Expand Up @@ -156,7 +156,7 @@ public void setAvatar(@NonNull GlideRequests requestManager, @Nullable Recipient
}
}

public void clear(@NonNull GlideRequests glideRequests) {
public void clear(@NonNull RequestManager glideRequests) {
glideRequests.clear(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import android.widget.FrameLayout;

import network.loki.messenger.R;
import org.thoughtcrime.securesms.mms.GlideRequests;
import com.bumptech.glide.RequestManager;
import org.thoughtcrime.securesms.mms.VideoSlide;
import org.thoughtcrime.securesms.video.VideoPlayer;

Expand Down Expand Up @@ -54,7 +54,7 @@ private void initialize() {
this.videoView = new Stub<>(findViewById(R.id.video_player_stub));
}

public void set(@NonNull GlideRequests glideRequests,
public void set(@NonNull RequestManager glideRequests,
@NonNull Window window,
@NonNull Uri source,
@NonNull String mediaType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ import org.session.libsession.utilities.GroupUtil
import org.session.libsession.utilities.recipients.Recipient
import org.session.libsignal.utilities.Log
import org.thoughtcrime.securesms.dependencies.DatabaseComponent
import org.thoughtcrime.securesms.mms.GlideApp
import org.thoughtcrime.securesms.mms.GlideRequests
import com.bumptech.glide.Glide
import com.bumptech.glide.RequestManager

class ProfilePictureView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : RelativeLayout(context, attrs) {
private val TAG = "ProfilePictureView"

private val binding = ViewProfilePictureBinding.inflate(LayoutInflater.from(context), this)
private val glide: GlideRequests = GlideApp.with(this)
private val glide: RequestManager = Glide.with(this)
private val prefs = AppTextSecurePreferences(context)
private val userPublicKey = prefs.getLocalNumber()
var publicKey: String? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import network.loki.messenger.R;
import org.thoughtcrime.securesms.database.CursorRecyclerViewAdapter;
import org.thoughtcrime.securesms.database.loaders.RecentPhotosLoader;
import org.thoughtcrime.securesms.mms.GlideApp;
import com.bumptech.glide.Glide;

import org.session.libsession.utilities.ViewUtil;

Expand Down Expand Up @@ -118,7 +118,7 @@ public void onBindItemViewHolder(RecentPhotoViewHolder viewHolder, @NonNull Curs

Key signature = new MediaStoreSignature(mimeType, dateModified, orientation);

GlideApp.with(getContext().getApplicationContext())
Glide.with(getContext().getApplicationContext())
.load(uri)
.signature(signature)
.diskCacheStrategy(DiskCacheStrategy.NONE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import android.widget.FrameLayout;

import org.thoughtcrime.securesms.conversation.v2.utilities.ThumbnailView;
import org.thoughtcrime.securesms.mms.GlideRequests;
import com.bumptech.glide.RequestManager;

import org.thoughtcrime.securesms.mms.Slide;
import org.thoughtcrime.securesms.mms.SlideClickListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.thoughtcrime.securesms.components.subsampling.AttachmentBitmapDecoder;
import org.thoughtcrime.securesms.components.subsampling.AttachmentRegionDecoder;
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri;
import org.thoughtcrime.securesms.mms.GlideRequests;
import com.bumptech.glide.RequestManager;
import org.thoughtcrime.securesms.mms.PartAuthority;
import org.thoughtcrime.securesms.util.BitmapDecodingException;
import org.thoughtcrime.securesms.util.BitmapUtil;
Expand Down Expand Up @@ -62,7 +62,7 @@ public ZoomingImageView(Context context, AttributeSet attrs, int defStyleAttr) {
}

@SuppressLint("StaticFieldLeak")
public void setImageUri(@NonNull GlideRequests glideRequests, @NonNull Uri uri, @NonNull String contentType)
public void setImageUri(@NonNull RequestManager glideRequests, @NonNull Uri uri, @NonNull String contentType)
{
final Context context = getContext();
final int maxTextureSize = BitmapUtil.getMaxTextureSize();
Expand Down Expand Up @@ -97,7 +97,7 @@ protected void onPostExecute(@Nullable Pair<Integer, Integer> dimensions) {
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

private void setImageViewUri(@NonNull GlideRequests glideRequests, @NonNull Uri uri) {
private void setImageViewUri(@NonNull RequestManager glideRequests, @NonNull Uri uri) {
photoView.setVisibility(View.VISIBLE);
subsamplingImageView.setVisibility(View.GONE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


import org.thoughtcrime.securesms.components.emoji.EmojiPageViewGridAdapter.VariationSelectorListener;
import org.thoughtcrime.securesms.mms.GlideRequests;
import com.bumptech.glide.RequestManager;
import org.thoughtcrime.securesms.util.ResUtil;

import org.session.libsession.utilities.ThemeUtil;
Expand Down Expand Up @@ -87,7 +87,7 @@ public int getProviderIconView(boolean selected) {
}

@Override
public void loadCategoryTabIcon(@NonNull GlideRequests glideRequests, @NonNull ImageView imageView, int index) {
public void loadCategoryTabIcon(@NonNull RequestManager glideRequests, @NonNull ImageView imageView, int index) {
Drawable drawable = ResUtil.getDrawable(context, models.get(index).getIconAttr());
imageView.setImageDrawable(drawable);
}
Expand Down
Loading

0 comments on commit 631d93c

Please sign in to comment.