Skip to content
This repository has been archived by the owner on Dec 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #44 from Longi94/development
Browse files Browse the repository at this point in the history
v2.1.3
  • Loading branch information
Longi94 committed May 4, 2016
2 parents 236c596 + 6e9454a commit 5e0655d
Show file tree
Hide file tree
Showing 23 changed files with 65 additions and 20 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId "com.tlongdev.bktf"
minSdkVersion 14
targetSdkVersion 23
versionCode 44
versionName "2.1.2"
versionCode 45
versionName "2.1.3"

applicationVariants.all { variant ->
variant.outputs.each { output ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public void onClick(View v) {
holder.price.setText(item.getPrice().getFormattedPrice(mContext));
} catch (Throwable t) {
Crashlytics.logException(t);
t.printStackTrace();
}
} else {
holder.price.setText("Price Unknown");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public void onClick(View v) {
holder.price.setText(item.getPrice().getFormattedPrice(mContext));
} catch (Throwable t) {
Crashlytics.logException(t);
t.printStackTrace();
}
}
}
Expand All @@ -154,6 +155,12 @@ public void setListener(OnMoreListener listener) {
mListener = listener;
}

public void closeCursor() {
if (mDataSet != null) {
mDataSet.close();
}
}

/**
* The view holder.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public void onClick(View v) {
holder.price.setText(item.getPrice().getFormattedPrice(mContext));
} catch (Throwable t) {
Crashlytics.logException(t);
t.printStackTrace();
}
}
break;
Expand Down Expand Up @@ -219,6 +220,12 @@ public void setListener(OnSearchClickListener listener) {
mListener = listener;
}

public void closeCursor() {
if (mDataSet != null) {
mDataSet.close();
}
}

class ViewHolder extends RecyclerView.ViewHolder {

final View root;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ public void setListener(OnItemSelectedListener listener) {
this.listener = listener;
}

public void closeCursor() {
if (mDataSet != null) {
mDataSet.close();
}
}

public class ViewHolder extends RecyclerView.ViewHolder {

@BindView(R.id.icon) ImageView icon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ protected void onHandleIntent(Intent intent) {
} catch (IOException e) {
Log.d(LOG_TAG, "Failed to complete token refresh", e);
Crashlytics.logException(e);
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import android.os.AsyncTask;
import android.util.Log;

import com.crashlytics.android.Crashlytics;
import com.tlongdev.bktf.BptfApplication;
import com.tlongdev.bktf.BuildConfig;
import com.tlongdev.bktf.model.Currency;
Expand Down Expand Up @@ -97,7 +96,7 @@ protected Integer doInBackground(Void... params) {
return -1;

} catch (IOException e) {
Crashlytics.logException(e);
e.printStackTrace();
}

return -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import android.content.Context;
import android.os.AsyncTask;

import com.crashlytics.android.Crashlytics;
import com.tlongdev.bktf.BptfApplication;
import com.tlongdev.bktf.BuildConfig;
import com.tlongdev.bktf.R;
Expand Down Expand Up @@ -136,7 +135,7 @@ protected Integer doInBackground(Void... params) {
} catch (IOException e) {
//There was a network error
errorMessage = mContext.getString(R.string.error_network);
Crashlytics.logException(e);
e.printStackTrace();
return -1;
}
}
Expand Down Expand Up @@ -197,7 +196,10 @@ private void saveUserData(BackpackTfPayload payload) {
}

if (player.getSuccess() == 1) {
mUser.setBackpackValue(player.getBackpackValue().get440());
if (player.getBackpackValue() != null) {
mUser.setBackpackValue(player.getBackpackValue().get440());
}

mUser.setName(player.getName());
mUser.setReputation(player.getBackpackTfReputation());
mUser.setInGroup(player.getBackpackTfGroup());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import android.content.SharedPreferences;
import android.os.AsyncTask;

import com.crashlytics.android.Crashlytics;
import com.tlongdev.bktf.BptfApplication;
import com.tlongdev.bktf.BuildConfig;
import com.tlongdev.bktf.R;
Expand Down Expand Up @@ -158,7 +157,7 @@ protected Integer doInBackground(Void... params) {
} catch (IOException e) {
//There was a network error
errorMessage = mContext.getString(R.string.error_network);
Crashlytics.logException(e);
e.printStackTrace();
return -1;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected Integer doInBackground(Void... params) {
}

} catch (IOException e) {
Crashlytics.logException(e);
e.printStackTrace();
}
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ protected Integer doInBackground(Void... params) {

} catch (IOException e) {
errorMessage = mContext.getString(R.string.error_network);
e.printStackTrace();
return -1;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected Integer doInBackground(Void... params) {
} catch (IOException e) {
//There was a network error
errorMessage = mContext.getString(R.string.error_network);
Crashlytics.logException(e);
e.printStackTrace();
}
return -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected Integer doInBackground(Void... params) {
} catch (IOException e) {
//There was a network error
errorMessage = mContext.getString(R.string.error_network);
Crashlytics.logException(e);
e.printStackTrace();
}

return -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public void loadLicenses() {
licenses = ParseLicenseXml.Parse(mContext.getResources().getXml(R.xml.licenses));
} catch (XmlPullParserException | IOException e) {
Crashlytics.logException(e);
e.printStackTrace();
}
mView.showLicenses(licenses);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* Copyright 2016 Long Tran
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -80,7 +80,9 @@ public void onUserBackpackFinished(User user) {

@Override
public void onPrivateBackpack() {
mView.privateBackpack(mUser);
if (mView != null) {
mView.privateBackpack(mUser);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,13 @@ public void loadPrices() {
if (Utility.isNetworkAvailable(mContext)) {
callTlongdevPrices(false, true);
//Show the progress dialog
mView.showLoadingDialog("Downloading prices...");
if (mView != null) {
mView.showLoadingDialog("Downloading prices...");
}
} else {
mView.showErrorDialog();
if (mView != null) {
mView.showErrorDialog();
}
}
} else {
LoadAllPricesInteractor interactor = new LoadAllPricesInteractor(mApplication, this);
Expand All @@ -98,7 +102,9 @@ public void loadPrices() {
if (System.currentTimeMillis() - mPrefs.getLong(mContext.getString(R.string.pref_last_price_list_update), 0) >= 3600000L
&& Utility.isNetworkAvailable(mContext)) {
callTlongdevPrices(true, false);
mView.showRefreshAnimation();
if (mView != null) {
mView.showRefreshAnimation();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ public class NavigationDrawerManager implements SharedPreferences.OnSharedPrefer

@Inject ProfileManager mProfileManager;
@Inject SharedPreferences mPrefs;
@Inject Context mContext;

@BindView(R.id.user_name) TextView mName;
@BindView(R.id.backpack_value) TextView mBackpack;
@BindView(R.id.avatar) ImageView mAvatar;

private MenuItem mUserMenuItem;
private Context mContext;

public NavigationDrawerManager(BptfApplication application) {
application.getDrawerManagerComponent().inject(this);
Expand Down Expand Up @@ -122,7 +122,8 @@ public void setUserMenuItem(MenuItem userMenuItem) {

@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key == null || !key.equals(mContext.getString(R.string.pref_user_data))) {
if (mContext == null || key == null ||
!key.equals(mContext.getString(R.string.pref_user_data))) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ protected void onDestroy() {
super.onDestroy();
mPresenter.detachView();
mAdManager.removeAdView(mAdView);

mAdapter.closeCursor();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ protected void onCreate(Bundle savedInstanceState) {
protected void onDestroy() {
super.onDestroy();
mPresenter.detachView();

mAdapter.closeCursor();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public void updatePrices(Price totalPrice) {
priceUsd.setText(totalPrice.getFormattedPrice(getActivity(), Currency.USD));
} catch (Throwable t) {
Crashlytics.logException(t);
t.printStackTrace();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.EditText;

import com.crashlytics.android.Crashlytics;
Expand Down Expand Up @@ -124,6 +123,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
}
} catch (Throwable t) {
Crashlytics.logException(t);
t.printStackTrace();
}
}

Expand Down Expand Up @@ -155,6 +155,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
}
} catch (Throwable t) {
Crashlytics.logException(t);
t.printStackTrace();
}
}

Expand Down Expand Up @@ -186,6 +187,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
}
} catch (Throwable t) {
Crashlytics.logException(t);
t.printStackTrace();
}
}

Expand Down Expand Up @@ -217,6 +219,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
}
} catch (Throwable t) {
Crashlytics.logException(t);
t.printStackTrace();
}
}

Expand All @@ -237,6 +240,7 @@ public void afterTextChanged(Editable s) {
inputUsd.setText(String.valueOf(Utility.formatDouble(price.getConvertedPrice(getActivity(), Currency.USD, false))));
} catch (Throwable t) {
Crashlytics.logException(t);
t.printStackTrace();
}

mAdManager.addAdView(mAdView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ public void onDestroyView() {
mPresenter.detachView();
mAdManager.removeAdView(mAdView);
mUnbinder.unbind();

mAdapter.closeCursor();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ public RemoteViews getViewAt(int position) {
} catch (InterruptedException | ExecutionException e) {
Crashlytics.logException(e);
rv.setImageViewBitmap(R.id.effect, null);
e.printStackTrace();
}

if (!item.isTradable()) {
Expand Down

0 comments on commit 5e0655d

Please sign in to comment.