Skip to content

Commit

Permalink
migrate to androidx, migrate to firebase crashlytics
Browse files Browse the repository at this point in the history
  • Loading branch information
naman14 committed Oct 5, 2020
1 parent c85d58a commit dc3b870
Show file tree
Hide file tree
Showing 100 changed files with 350 additions and 423 deletions.
33 changes: 13 additions & 20 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion

defaultConfig {
applicationId "naman14.timber"
Expand All @@ -21,17 +21,12 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
manifestPlaceholders = [ appNameSuffix:""]

}
debug {
ext.enableCrashlytics = false
versionNameSuffix "-debug"
minifyEnabled false
applicationIdSuffix '.dev'
manifestPlaceholders = [ appNameSuffix:" Dev"]

resValue "string", "fabric_api_key", "12345"
resValue "string", "play_billing_license_key", "12345"
resValue "string", "cast_app_id", "12345"

Expand All @@ -48,21 +43,20 @@ android {

repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
implementation "com.android.support:design:$rootProject.supportLibraryVersion"
implementation "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"
implementation "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
implementation "com.android.support:palette-v7:$rootProject.supportLibraryVersion"
implementation "com.android.support:percent:$rootProject.supportLibraryVersion"
implementation 'com.android.support:multidex:1.0.1'
implementation "androidx.appcompat:appcompat:1.0.2"
implementation "com.google.android.material:material:1.2.1"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation "androidx.palette:palette:1.0.0"
implementation "androidx.percentlayout:percentlayout:1.0.0"
implementation 'androidx.multidex:multidex:2.0.1'

implementation "com.android.support:mediarouter-v7:$rootProject.supportLibraryVersion"
implementation 'com.google.android.gms:play-services-cast-framework:11.6.0'
implementation "androidx.mediarouter:mediarouter:1.1.0"
implementation 'com.google.android.gms:play-services-cast-framework:16.1.2'

implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
implementation 'net.steamcrafted:materialiconlib:1.1.4'
Expand All @@ -78,9 +72,8 @@ dependencies {
implementation('com.github.naman14:app-theme-engine:0.5.2@aar') {
transitive = true
}
implementation('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
transitive = true;
}
implementation 'com.google.firebase:firebase-crashlytics:17.2.2'

implementation 'com.anjlab.android.iab.v3:library:1.0.+'
implementation 'org.nanohttpd:nanohttpd:2.3.1'

Expand Down
8 changes: 2 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
android:name=".TimberApp"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="Timber${appNameSuffix}"
android:label="Timber"
android:theme="@style/AppTheme.FullScreen.Light"
tools:replace="android:allowBackup, android:label">

<activity
android:name=".activities.MainActivity"
android:label="Timber${appNameSuffix}"
android:label="Timber"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down Expand Up @@ -114,10 +114,6 @@
</intent-filter>
</service>

<!--use your own api key for fabric-->
<meta-data
android:name="io.fabric.ApiKey"
android:value="@string/fabric_api_key" />

<meta-data
android:name=
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/com/naman14/timber/MusicPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

package com.naman14.timber;

import android.Manifest;
import android.app.Activity;
import android.content.ComponentName;
import android.content.ContentResolver;
Expand All @@ -25,7 +24,6 @@
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.IBinder;
Expand All @@ -41,8 +39,6 @@
import java.util.Arrays;
import java.util.WeakHashMap;

import static android.support.v4.content.PermissionChecker.checkSelfPermission;

public class MusicPlayer {

private static final WeakHashMap<Context, ServiceBinder> mConnectionMap;
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/java/com/naman14/timber/MusicService.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@
import android.provider.MediaStore;
import android.provider.MediaStore.Audio.AlbumColumns;
import android.provider.MediaStore.Audio.AudioColumns;
import android.support.v4.app.NotificationManagerCompat;
import androidx.core.app.NotificationManagerCompat;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.media.session.PlaybackStateCompat;
import android.support.v7.graphics.Palette;

import androidx.media.app.NotificationCompat;
import androidx.palette.graphics.Palette;
import android.text.TextUtils;
import android.util.Log;

Expand Down Expand Up @@ -1270,7 +1272,7 @@ private Notification buildNotification() {
mNotificationPostTime = System.currentTimeMillis();
}

android.support.v4.app.NotificationCompat.Builder builder = new android.support.v4.app.NotificationCompat.Builder(this, CHANNEL_ID)
androidx.core.app.NotificationCompat.Builder builder = new androidx.core.app.NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_notification)
.setLargeIcon(artwork)
.setContentIntent(clickIntent)
Expand All @@ -1292,7 +1294,7 @@ private Notification buildNotification() {

if (TimberUtils.isLollipop()) {
builder.setVisibility(Notification.VISIBILITY_PUBLIC);
android.support.v4.media.app.NotificationCompat.MediaStyle style = new android.support.v4.media.app.NotificationCompat.MediaStyle()
NotificationCompat.MediaStyle style = new NotificationCompat.MediaStyle()
.setMediaSession(mSession.getSessionToken())
.setShowActionsInCompactView(0, 1, 2, 3);
builder.setStyle(style);
Expand Down
15 changes: 1 addition & 14 deletions app/src/main/java/com/naman14/timber/TimberApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@

package com.naman14.timber;

import android.content.Context;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;
import androidx.multidex.MultiDexApplication;

import com.afollestad.appthemeengine.ATE;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.core.CrashlyticsCore;
import com.naman14.timber.permissions.Nammu;
import com.naman14.timber.utils.PreferencesUtility;
import com.nostra13.universalimageloader.core.ImageLoader;
Expand All @@ -31,11 +27,8 @@
import java.io.IOException;
import java.io.InputStream;

import io.fabric.sdk.android.Fabric;

public class TimberApp extends MultiDexApplication {


private static TimberApp mInstance;

public static synchronized TimberApp getInstance() {
Expand All @@ -47,12 +40,6 @@ public void onCreate() {
super.onCreate();
mInstance = this;

//disable crashlytics for debug builds
Crashlytics crashlyticsKit = new Crashlytics.Builder()
.core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
.build();
Fabric.with(this, crashlyticsKit);

ImageLoaderConfiguration localImageLoaderConfiguration = new ImageLoaderConfiguration.Builder(this).imageDownloader(new BaseImageDownloader(this) {
PreferencesUtility prefs = PreferencesUtility.getInstance(TimberApp.this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.service.media.MediaBrowserService;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;

import com.naman14.timber.dataloaders.AlbumLoader;
import com.naman14.timber.dataloaders.AlbumSongLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.media.AudioManager;
import android.media.session.MediaSessionManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand All @@ -42,7 +41,6 @@
import com.google.android.gms.cast.framework.Session;
import com.google.android.gms.cast.framework.SessionManager;
import com.google.android.gms.cast.framework.SessionManagerListener;
import com.google.android.gms.cast.framework.media.widget.ExpandedControllerActivity;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.naman14.timber.ITimberService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.media.AudioManager;
import android.os.Bundle;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;

import com.afollestad.appthemeengine.ATEActivity;
import com.naman14.timber.utils.Helpers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
Expand Down
25 changes: 7 additions & 18 deletions app/src/main/java/com/naman14/timber/activities/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,28 @@
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import com.google.android.material.navigation.NavigationView;
import com.google.android.material.snackbar.Snackbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.afollestad.appthemeengine.customizers.ATEActivityThemeCustomizer;
import com.anjlab.android.iab.v3.BillingProcessor;
import com.google.android.gms.cast.framework.CastButtonFactory;
import com.google.android.gms.cast.framework.CastContext;
import com.google.android.gms.cast.framework.CastSession;
import com.google.android.gms.cast.framework.Session;
import com.google.android.gms.cast.framework.SessionManager;
import com.google.android.gms.cast.framework.SessionManagerListener;
import com.google.android.gms.cast.framework.media.widget.ExpandedControllerActivity;
import com.google.android.gms.cast.framework.media.widget.MiniControllerFragment;
import com.naman14.timber.MusicPlayer;
import com.naman14.timber.R;
import com.naman14.timber.cast.ExpandedControlsActivity;
import com.naman14.timber.cast.SimpleSessionManagerListener;
import com.naman14.timber.cast.WebServer;
import com.naman14.timber.fragments.AlbumDetailFragment;
import com.naman14.timber.fragments.ArtistDetailFragment;
import com.naman14.timber.fragments.FoldersFragment;
Expand All @@ -68,7 +58,6 @@
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import android.graphics.Color;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.StyleRes;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import androidx.annotation.StyleRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import com.afollestad.appthemeengine.Config;
import com.afollestad.appthemeengine.customizers.ATEActivityThemeCustomizer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.PersistableBundle;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar;
import android.transition.Transition;
import android.util.Log;
import android.view.Menu;
Expand All @@ -53,7 +52,6 @@
import com.naman14.timber.listeners.SimplelTransitionListener;
import com.naman14.timber.models.Song;
import com.naman14.timber.utils.Constants;
import com.naman14.timber.utils.PreferencesUtility;
import com.naman14.timber.utils.TimberUtils;
import com.naman14.timber.widgets.DividerItemDecoration;
import com.naman14.timber.widgets.DragSortRecycler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import androidx.annotation.Nullable;
import androidx.core.view.MenuItemCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.Toolbar;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;

import com.afollestad.appthemeengine.ATE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import android.app.Activity;
import android.graphics.Bitmap;
import android.support.v7.graphics.Palette;
import android.support.v7.widget.RecyclerView;
import androidx.palette.graphics.Palette;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
Expand Down
Loading

0 comments on commit dc3b870

Please sign in to comment.