Skip to content

Commit

Permalink
fix : Disable log calls on Release build variants.
Browse files Browse the repository at this point in the history
Change Activity animations.
  • Loading branch information
thesabareesh committed Feb 1, 2017
1 parent 0cc5fd2 commit 4e535cd
Show file tree
Hide file tree
Showing 24 changed files with 125 additions and 72 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ android {
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

}
debug {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import me.sabareesh.trippie.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -24,7 +25,7 @@
import me.sabareesh.trippie.util.Utils;

/**
* Created by ve288800 on 03-Jan-17.
* Created by Sabareesh on 03-Jan-17.
*/

public class PlaceListAdapter extends RecyclerView.Adapter<PlaceListAdapter.ViewHolder> {
Expand Down Expand Up @@ -61,11 +62,18 @@ public void onClick(View v) {
Intent intent = new Intent(mContext, PlaceDetailActivity.class);
ImageView thumbnail = (ImageView) v.findViewById(R.id.place_pic);
//ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(CityActivity.this, thumbnail, getString(R.string.transition_image));
ActivityOptions options = ActivityOptions.makeScaleUpAnimation(thumbnail, 0, 0, thumbnail.getWidth(), thumbnail.getHeight());
//ActivityOptions options = ActivityOptions.makeScaleUpAnimation(thumbnail, 0, 0, thumbnail.getWidth(), thumbnail.getHeight());
intent.putExtra("place_id", place_id);
intent.putExtra("place_name", place_name);
intent.putExtra("image_URL", place_imageURL);
mContext.startActivity(intent, options.toBundle());
if (Build.VERSION.SDK_INT >= 23) {
ActivityOptions options=ActivityOptions.makeClipRevealAnimation(thumbnail, 0, 0, thumbnail.getWidth(), thumbnail.getHeight());
mContext.startActivity(intent, options.toBundle());
}else{
ActivityOptions options = ActivityOptions.makeScaleUpAnimation(thumbnail, 0, 0, thumbnail.getWidth(), thumbnail.getHeight());
mContext.startActivity(intent, options.toBundle());
}
//mContext.startActivity(intent, options.toBundle());
}
});

Expand All @@ -81,7 +89,7 @@ public void onBindViewHolder(ViewHolder viewHolder, int i) {
url = Constants.PLACE_THUMBNAIL +
placeList.getPhoto_reference().get(0) +
"&" + Constants.API_KEY_PARAM + "=" + Constants.API_VALUE;
//Log.d(TAG, "Image url " + url);
Log.d(TAG, "Image url " + url);
} else {
url = placeList.getIcon_url();
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/me/sabareesh/trippie/model/Extras.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import android.os.Parcelable;

/**
* Created by VE288800 on 08-Jan-17.
* Created by Sabareesh on 08-Jan-17.
*/

public class Extras implements Parcelable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


/**
* Created by VE288800 on 05-Jan-17.
* Created by Sabareesh on 05-Jan-17.
*/

public class PlaceDetail {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.ArrayList;

/**
* Created by ve288800 on 03-Jan-17.
* Created by Sabareesh on 03-Jan-17.
*/

public class PlaceList {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/me/sabareesh/trippie/model/Review.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import android.os.Parcelable;

/**
* Created by VE288800 on 08-Jan-17.
* Created by Sabareesh on 08-Jan-17.
*/

public class Review implements Parcelable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import me.sabareesh.trippie.util.Log;

import java.util.HashMap;

/**
* Created by VE288800 on 09-Jan-17.
* Created by Sabareesh on 09-Jan-17.
*/

public class PlacesProvider extends ContentProvider {
Expand Down Expand Up @@ -82,7 +82,7 @@ public int delete(Uri uri, String selection, String[] selectionArgs) {
count = database.delete(sqLiteOpenHelper.TABLE_NAME,selection,selectionArgs);
break;
case PLACES_ID:
//Log.d("Selection deletion", "selection" + selection);
Log.d("Selection deletion", "selection" + selection);
count = database.delete( sqLiteOpenHelper.TABLE_NAME, sqLiteOpenHelper.ID + " = '" + selection +"'"
+(!TextUtils.isEmpty(null) ? " AND (" +
selection + ')' : ""), selectionArgs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import me.sabareesh.trippie.util.Log;

/**
* Created by VE288800 on 09-Jan-17.
* Created by Sabareesh on 09-Jan-17.
*/

public class PlacesSQLiteHelper extends SQLiteOpenHelper {
Expand Down Expand Up @@ -52,7 +52,7 @@ public PlacesSQLiteHelper(Context context) {

@Override
public void onCreate(SQLiteDatabase db) {
//Log.d(" Creating a table", "" + CREATE_TABLE);
Log.d(" Creating a table", "" + CREATE_TABLE);
db.execSQL(CREATE_TABLE );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.google.android.gms.location.places.Places;

/**
* Created by VE288800 on 09-Jan-17.
* Created by Sabareesh on 09-Jan-17.
*/

public abstract class PhotoTask extends AsyncTask<String, Void, PhotoTask.AttributedPhoto> {
Expand Down
24 changes: 17 additions & 7 deletions app/src/main/java/me/sabareesh/trippie/ui/CityActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import me.sabareesh.trippie.util.Log;
import android.util.TypedValue;
import android.view.MenuItem;
import android.view.View;
Expand Down Expand Up @@ -110,13 +112,21 @@ protected void onCreate(Bundle savedInstanceState) {
public void onItemClick(View view, int position) {
int itemPosition = recyclerView.getChildLayoutPosition(view);
ImageView thumbnail = (ImageView) view.findViewById(R.id.thumbnail);
//Log.d(TAG, "City Item clicked: " + String.valueOf(itemPosition));
Log.d(TAG, "City Item clicked: " + String.valueOf(itemPosition));
Intent intent = new Intent(view.getContext(), PlaceListActivity.class);
intent.putExtra("cityLatLng", mCityLat + "," + mCityLng);
intent.putExtra("itemPosition", itemPosition);
//ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(CityActivity.this, thumbnail, getString(R.string.transition_image));
ActivityOptions options = ActivityOptions.makeScaleUpAnimation(thumbnail, 0, 0, thumbnail.getWidth(), thumbnail.getHeight());
startActivity(intent, options.toBundle());
if (Build.VERSION.SDK_INT >= 23) {
ActivityOptions options=ActivityOptions.makeClipRevealAnimation(thumbnail, 0, 0, thumbnail.getWidth(), thumbnail.getHeight());
startActivity(intent, options.toBundle());
}else{
ActivityOptions options = ActivityOptions.makeScaleUpAnimation(thumbnail, 0, 0, thumbnail.getWidth(), thumbnail.getHeight());
startActivity(intent, options.toBundle());
}



}

@Override
Expand Down Expand Up @@ -229,17 +239,17 @@ public void onStop() {

@Override
public void onConnected(@Nullable Bundle bundle) {
//Log.i(TAG, "API services connected.");
Log.i(TAG, "API services connected.");
}

@Override
public void onConnectionSuspended(int i) {
//Log.i(TAG, "Location services suspended. Please reconnect.");
Log.i(TAG, "Location services suspended. Please reconnect.");
}

@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
//Log.i(TAG, "API services connection failed. Please reconnect.");
Log.i(TAG, "API services connection failed. Please reconnect.");
}

public class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
Expand Down
16 changes: 8 additions & 8 deletions app/src/main/java/me/sabareesh/trippie/ui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import me.sabareesh.trippie.util.Log;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
Expand Down Expand Up @@ -60,7 +60,7 @@
import me.sabareesh.trippie.util.Constants;
import me.sabareesh.trippie.util.Utils;

;


public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener,
Expand Down Expand Up @@ -226,7 +226,7 @@ public void onClick(View v) {

@Override
public void onError(Status status) {
//Log.e(TAG, "onError: Status = " + status.toString());
Log.e(TAG, "onError: Status = " + status.toString());

Toast.makeText(this, getString(R.string.error_api) + status.getStatusMessage(),
Toast.LENGTH_SHORT).show();
Expand All @@ -237,7 +237,7 @@ public void onError(Status status) {

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
//Log.v(TAG, "onCreateLoader");
Log.v(TAG, "onCreateLoader");
if (id == PLACES_LOADER_ID) {
Uri uri = PlacesProvider.CONTENT_URI;
return new CursorLoader(this, uri, null, null, null, null);
Expand All @@ -247,7 +247,7 @@ public Loader<Cursor> onCreateLoader(int id, Bundle args) {

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
//Log.v(TAG, "onLoadFinished");
Log.v(TAG, "onLoadFinished");
if (loader.getId() == PLACES_LOADER_ID && cursor != null) {
while (cursor != null && cursor.moveToNext()) {
PlaceList placeList = new PlaceList();
Expand Down Expand Up @@ -384,7 +384,7 @@ else if(id==R.id.nav_info){

@Override
public void onPlaceSelected(Place place) {
//Log.i(TAG, "Place Selected: " + place.getName());
Log.i(TAG, "Place Selected: " + place.getName());
final String cityId = String.valueOf(place.getId());
final String cityName = String.valueOf(place.getName());
final String cityLat = String.valueOf(place.getLatLng().latitude);
Expand All @@ -405,7 +405,7 @@ public void onPlaceSelected(Place place) {
@Override
public void onResume() {
super.onResume();
//Log.v(TAG, " activity onResume");
Log.v(TAG, " activity onResume");

((EditText) mAutocompleteFragment.getView().
findViewById(R.id.place_autocomplete_search_input)).setText("");
Expand All @@ -422,7 +422,7 @@ public void onResume() {
@Override
protected void onDestroy() {
super.onDestroy();
//Log.v(TAG, "Loader destroyed");
Log.v(TAG, "Loader destroyed");
getSupportLoaderManager().destroyLoader(PLACES_LOADER_ID);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import me.sabareesh.trippie.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
Expand Down Expand Up @@ -91,7 +91,7 @@ protected void onCreate(Bundle savedInstanceState) {
place_id = getIntent().getStringExtra("place_id");
place_name = getIntent().getStringExtra("place_name");
image_URL = getIntent().getStringExtra("image_URL");
//Log.d(TAG, "Image url " + image_URL);
Log.d(TAG, "Image url " + image_URL);
//Toast.makeText(this, place_id, Toast.LENGTH_SHORT).show();

}
Expand Down Expand Up @@ -137,12 +137,12 @@ protected void onCreate(Bundle savedInstanceState) {
.append(PLACE_ID_PARAM + "=" + place_id)
.append("&" + APPKEY_PARAM + "=" + Constants.API_VALUE);

//Log.d(TAG, "Place URL built " + sb.toString());
Log.d(TAG, "Place URL built " + sb.toString());

fetchPlaceDetails(sb.toString());

} catch (Exception e) {
//Log.e(TAG, "Error building url", e);
Log.e(TAG, "Error building url");
}
}

Expand Down Expand Up @@ -221,7 +221,7 @@ public void onResponse(JSONObject response) {

@Override
public void onErrorResponse(VolleyError error) {
//VolleyLog.d(TAG, "Error: " + error.getMessage());
VolleyLog.d(TAG, "Error: " + error.getMessage());

}
});
Expand Down Expand Up @@ -303,7 +303,7 @@ public void addReviews(final Extras extras) {

reviewAuthor.setText(extras.getReviewAtIndex(i).getAuthor());
reviewContent.setText(extras.getReviewAtIndex(i).getBody().replace("\n\n", " ").replace("\n", " "));
//Log.d(TAG, "picasso url http:" + extras.getReviewAtIndex(i).getAvatar_url());
Log.d(TAG, "picasso url http:" + extras.getReviewAtIndex(i).getAvatar_url());
Picasso.with(this).load("http:" + extras.getReviewAtIndex(i).getAvatar_url())
.placeholder(R.drawable.ic_account_circle_black_24dp)
.transform(new CircleTransform())
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/me/sabareesh/trippie/ui/PlaceListActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import me.sabareesh.trippie.util.Log;
import android.util.TypedValue;
import android.view.MenuItem;
import android.view.View;
Expand Down Expand Up @@ -147,12 +147,12 @@ protected void onCreate(Bundle savedInstanceState) {
.append("&" + RADIUS_PARAM + "=" + Constants.RADIUS_VALUE)
.append("&" + APPKEY_PARAM + "=" + Constants.API_VALUE);

//Log.d(LOG_TAG, "Places URL built " + sb.toString());
Log.d(LOG_TAG, "Places URL built " + sb.toString());

fetchPlaces(sb.toString());

} catch (Exception e) {
//Log.e(LOG_TAG, "Error building url", e);
Log.e(LOG_TAG, "Error building url");
}

//Admob
Expand All @@ -175,7 +175,7 @@ public void run() {
@Override
public void onAdLoaded() {
mAdView.setVisibility(View.VISIBLE);
//Log.d(LOG_TAG, getString(R.string.admob_loaded));
Log.d(LOG_TAG, getString(R.string.admob_loaded));
}

});
Expand Down Expand Up @@ -285,7 +285,7 @@ public void onResponse(JSONObject response) {

@Override
public void onErrorResponse(VolleyError error) {
//VolleyLog.d(LOG_TAG, "Error: " + error.getMessage());
VolleyLog.d(LOG_TAG, "Error: " + error.getMessage());

}
});
Expand Down
Loading

0 comments on commit 4e535cd

Please sign in to comment.