Skip to content

Commit

Permalink
migrated to androidx
Browse files Browse the repository at this point in the history
  • Loading branch information
shreknitin89 committed Jul 28, 2021
1 parent 69d0ee2 commit ebbd5b3
Show file tree
Hide file tree
Showing 31 changed files with 326 additions and 260 deletions.
8 changes: 8 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 19 additions & 21 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
compileSdkVersion 30
defaultConfig {
applicationId "app.mannit.nitin.com.bakingapp"
minSdkVersion 19
targetSdkVersion 27
targetSdkVersion 30
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
Expand All @@ -20,13 +21,15 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:$rootProject.support_library"
implementation "com.android.support:support-v4:$rootProject.support_library"
implementation "com.android.support:recyclerview-v7:$rootProject.support_library"
implementation "com.android.support:cardview-v7:$rootProject.support_library"
implementation "com.android.support:design:$rootProject.support_library"
implementation "com.android.support.constraint:constraint-layout:1.0.2"
testImplementation 'junit:junit:4.12'

implementation "androidx.multidex:multidex:$rootProject.multidex_version"
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.cardview:cardview:1.0.0"
testImplementation 'junit:junit:4.13.2'

// Butterknife for easy bindings
implementation "com.jakewharton:butterknife:$rootProject.butterknife"
Expand All @@ -51,15 +54,10 @@ dependencies {
implementation "com.google.android.exoplayer:exoplayer:$rootProject.exoplayer"

// Testing-only dependencies
implementation "com.android.support.test.espresso:espresso-idling-resource:$rootProject.espresso"
androidTestImplementation "com.android.support.test:rules:1.0.1"
androidTestImplementation "com.android.support.test:runner:1.0.1"
androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.espresso"
androidTestCompile "com.android.support.test.espresso:espresso-intents:$rootProject.espresso"
androidTestCompile "com.android.support.test.espresso:espresso-contrib:$rootProject.espresso", {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
implementation "androidx.test.espresso:espresso-idling-resource:$rootProject.espresso"
androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espresso"
androidTestImplementation "androidx.test.espresso:espresso-intents:$rootProject.espresso"
androidTestImplementation "androidx.test.espresso:espresso-contrib:$rootProject.espresso"
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test:rules:1.4.0"
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name="androidx.multidex.MultiDexApplication"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
Expand All @@ -17,6 +12,12 @@
import android.widget.ListView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.DialogFragment;

import org.parceler.Parcels;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package app.mannit.nitin.com.bakingapp.IdlingResource;

import android.support.annotation.Nullable;
import android.support.test.espresso.IdlingResource;
import androidx.annotation.Nullable;
import androidx.test.espresso.IdlingResource;

import java.util.concurrent.atomic.AtomicBoolean;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBar;
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 android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MenuItem;
Expand All @@ -20,6 +12,15 @@
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.google.gson.Gson;
import com.squareup.picasso.Picasso;

Expand Down Expand Up @@ -85,18 +86,18 @@ protected void onCreate(Bundle savedInstanceState) {
}
//
final int position = getIntent().getIntExtra(Constants.RECIPE_ID, 0);
mItem = mRecipes.get(position - 1);
if (mItem != null) {
this.setTitle(mItem.getName());
final List<Ingredient> ingredients = mItem.getIngredients();
ArrayList<String> ingredientsList = new ArrayList<>();
for (Ingredient ingredient : ingredients) {
ingredientsList.add(String.format("%s %s %s", ingredient.getQuantity(), ingredient.getMeasure(), ingredient.getIngredient()));
}
UpdateBakingService.startBakingService(this, ingredientsList);
mSteps = mItem.getSteps();
mLinearLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLinearLayoutManager);
mItem = mRecipes.get(position - 1);
if (mItem != null) {
this.setTitle(mItem.getName());
final List<Ingredient> ingredients = mItem.getIngredients();
ArrayList<String> ingredientsList = new ArrayList<>();
for (Ingredient ingredient : ingredients) {
ingredientsList.add(String.format("%s %s %s", ingredient.getQuantity(), ingredient.getMeasure(), ingredient.getIngredient()));
}
UpdateBakingService.startBakingService(this, ingredientsList);
mSteps = mItem.getSteps();
mLinearLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLinearLayoutManager);
}
}

Expand Down Expand Up @@ -159,7 +160,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
protected void onResume() {
super.onResume();
if(mListState != null) {
if (mListState != null) {
mLinearLayoutManager.onRestoreInstanceState(mListState);
mRecyclerView.setAdapter(new SimpleItemRecyclerViewAdapter(this, mSteps, mTwoPane));
} else {
Expand Down Expand Up @@ -211,7 +212,10 @@ public void onBindViewHolder(final RecipeDetailActivity.SimpleItemRecyclerViewAd
holder.mIdView.setText(mSteps.get(position).getShortDescription());
String thumbnail = mSteps.get(position).getThumbnailURL();
if (!TextUtils.isEmpty(thumbnail)) {
Picasso.with(mParentActivity).load(thumbnail).error(R.drawable.place_holder).into(holder.mImageView);
Picasso.get()
.load(thumbnail)
.error(R.drawable.place_holder)
.into(holder.mImageView);
}
holder.itemView.setTag(mSteps.get(position));
holder.itemView.setOnClickListener(mOnClickListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.support.test.espresso.IdlingResource;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.test.espresso.IdlingResource;

import com.google.gson.Gson;
import com.squareup.picasso.Picasso;

Expand Down Expand Up @@ -148,7 +149,7 @@ public void onBindViewHolder(final ViewHolder holder, int position) {
if (imagePath == null || imagePath.isEmpty()) {
holder.mImageView.setImageResource(R.drawable.place_holder);
} else {
Picasso.with(mParentActivity)
Picasso.get()
.load(imagePath)
.error(R.drawable.place_holder)
.into(holder.mImageView);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package app.mannit.nitin.com.bakingapp;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import androidx.appcompat.app.AppCompatActivity;

import butterknife.ButterKnife;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
Expand All @@ -15,18 +12,20 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import com.google.android.exoplayer2.C;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;

import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.LoadControl;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
Expand All @@ -40,6 +39,8 @@
import butterknife.BindView;
import butterknife.ButterKnife;

import static com.google.android.exoplayer2.C.INDEX_UNSET;

/**
* Created by nitingeetasagardasari on 11/5/17 for the project BakingApp.
*/
Expand Down Expand Up @@ -119,7 +120,10 @@ private void initializePlayer(Uri mediaUri) {
TrackSelector trackSelector = new DefaultTrackSelector();
LoadControl loadControl = new DefaultLoadControl();

mExoPlayer = ExoPlayerFactory.newSimpleInstance(this.getContext(), trackSelector, loadControl);
mExoPlayer = new SimpleExoPlayer.Builder(this.getContext())
.setTrackSelector(trackSelector)
.setLoadControl(loadControl)
.build();
mExoPlayerView.setPlayer(mExoPlayer);

// Set the ExoPlayer.EventListener to this activity.
Expand All @@ -128,10 +132,11 @@ private void initializePlayer(Uri mediaUri) {
// Prepare the MediaSource.
String userAgent = com.google.android.exoplayer2.util.Util.getUserAgent(this.getContext(), "Baking App");

MediaSource mediaSource = new ExtractorMediaSource(mediaUri, new DefaultDataSourceFactory(
this.getContext(), userAgent), new DefaultExtractorsFactory(), null, null);
DefaultDataSourceFactory dataSourceFactory = new DefaultDataSourceFactory(
this.getContext(), userAgent);
MediaSource mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaUri);

boolean haveResumePosition = mResumeWindow != C.INDEX_UNSET;
boolean haveResumePosition = mResumeWindow != INDEX_UNSET;

if (haveResumePosition) {
mExoPlayerView.getPlayer().seekTo(mResumeWindow, mResumePosition);
Expand Down
Loading

0 comments on commit ebbd5b3

Please sign in to comment.