Merge branch 'tag-google-analytics' into dev

This commit is contained in:
Tariel Hlontsi 2016-10-19 19:57:58 +03:00
commit 52b0c71eb2
52 changed files with 289 additions and 304 deletions

View File

@ -1,14 +1,10 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android { android {
compileSdkVersion 23 compileSdkVersion 23
buildToolsVersion "23.0.3" buildToolsVersion "23.0.3"
/*
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
*/
defaultConfig { defaultConfig {
applicationId "com.hikapro.backpack" applicationId "com.hikapro.backpack"
minSdkVersion 17 minSdkVersion 17
@ -18,10 +14,16 @@ android {
} }
buildTypes { buildTypes {
release { release {
minifyEnabled true shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' // minifyEnabled true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
minifyEnabled false
} }
} }
lintOptions {
checkReleaseBuilds false
abortOnError false
}
} }
repositories { repositories {
@ -41,6 +43,7 @@ dependencies {
compile 'com.android.support:design:23.3.0' compile 'com.android.support:design:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0' compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.11.0' compile 'com.facebook.android:facebook-android-sdk:4.11.0'
compile 'com.google.android.gms:play-services-analytics:9.0.0'
compile files('libs/socialauth-4.4.jar') compile files('libs/socialauth-4.4.jar')
compile files('libs/socialauth-android-3.2.jar') compile files('libs/socialauth-android-3.2.jar')
} }

38
app/google-services.json Normal file
View File

@ -0,0 +1,38 @@
{
"project_info": {
"project_number": "124365922689",
"project_id": "pack-with-me"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:124365922689:android:90ef7fc7743bcbe5",
"android_client_info": {
"package_name": "com.hikapro.backpack"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyBom_1uKODWi_mTvPAtX8JHGP2-TvNuUpU"
}
],
"services": {
"analytics_service": {
"status": 2,
"analytics_property": {
"tracking_id": "UA-69165220-5"
}
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 1
}
}
}
],
"configuration_version": "1"
}

View File

@ -28,6 +28,18 @@
android:theme="@android:style/Theme.Translucent.NoTitleBar" android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:label="@string/app_name" /> android:label="@string/app_name" />
<!-- Register AnalyticsReceiver and AnalyticsService to support background
dispatching on non-Google Play devices. -->
<receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false"/>
</application> </application>
</manifest> </manifest>

View File

@ -4,6 +4,9 @@ import android.app.Application;
import android.content.Context; import android.content.Context;
import android.graphics.Typeface; import android.graphics.Typeface;
import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Tracker;
/** /**
* Created by tariel on 27/04/16. * Created by tariel on 27/04/16.
*/ */
@ -11,12 +14,15 @@ public class App extends Application {
private static Context context; private static Context context;
private static Typeface mainFace; private static Typeface mainFace;
private static Tracker tracker;
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
App.context = getApplicationContext(); App.context = getApplicationContext();
App.mainFace = Typeface.createFromAsset(App.context.getAssets(), "fonts/Ubuntu-B.ttf"); App.mainFace = Typeface.createFromAsset(App.context.getAssets(), "fonts/Ubuntu-B.ttf");
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
tracker = analytics.newTracker(R.xml.global_tracker);
} }
public static Context getAppContext() { public static Context getAppContext() {
@ -26,4 +32,8 @@ public class App extends Application {
public static Typeface getMainFace() { public static Typeface getMainFace() {
return App.mainFace; return App.mainFace;
} }
synchronized public static Tracker getDefaultTracker() {
return App.tracker;
}
} }

View File

@ -15,7 +15,6 @@ import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.PackedModel; import com.hikapro.backpack.model.PackedModel;
import com.hikapro.backpack.model.SetModel; import com.hikapro.backpack.model.SetModel;
import com.hikapro.backpack.model.ShareModel; import com.hikapro.backpack.model.ShareModel;
import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.model.entities.Set; import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.presenter.AddPresenter; import com.hikapro.backpack.presenter.AddPresenter;
import com.hikapro.backpack.presenter.ItemDetailPresenter; import com.hikapro.backpack.presenter.ItemDetailPresenter;
@ -138,43 +137,36 @@ public class MainActivity extends Activity implements View.ActivityCallback {
model.setPresenter(presenter); model.setPresenter(presenter);
} }
} }
Log.i("On create", "Activity");
} }
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
Log.i("onStart", "Activity");
} }
@Override @Override
protected void onRestart() { protected void onRestart() {
super.onRestart(); super.onRestart();
Log.i("onRestart", "Activity");
} }
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
Log.i("onResume", "Activity");
} }
@Override @Override
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
Log.i("onPause", "Activity");
} }
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
Log.i("onStop", "Activity");
} }
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
Log.i("onDestroy", "Activity");
} }
@Override @Override

View File

@ -3,7 +3,6 @@ package com.hikapro.backpack;
import android.app.Fragment; import android.app.Fragment;
import android.app.FragmentManager; import android.app.FragmentManager;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.HashMap; import java.util.HashMap;

View File

@ -1,15 +1,14 @@
package com.hikapro.backpack.model; package com.hikapro.backpack.model;
import java.util.List;
import com.hikapro.backpack.model.dao.Db;
import com.hikapro.backpack.model.entities.Category; import com.hikapro.backpack.model.entities.Category;
import com.hikapro.backpack.model.entities.Item; import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.model.entities.Set; import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.model.entities.SharingPicture; import com.hikapro.backpack.model.entities.SharingPicture;
import com.hikapro.backpack.model.entities.Timestamp; import com.hikapro.backpack.model.entities.Timestamp;
import com.hikapro.backpack.model.entities.Updates; import com.hikapro.backpack.model.entities.Updates;
import java.util.List;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.Query; import retrofit2.http.Query;

View File

@ -11,8 +11,6 @@ import com.hikapro.backpack.model.dao.Event;
import com.hikapro.backpack.model.entities.Item; import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.presenter.Presenter; import com.hikapro.backpack.presenter.Presenter;
import java.util.Collections;
/** /**
* Created by tariel on 23/04/16. * Created by tariel on 23/04/16.
*/ */

View File

@ -4,11 +4,6 @@ package com.hikapro.backpack.model;
import android.os.Message; import android.os.Message;
import android.widget.Toast; import android.widget.Toast;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Hashtable;
import java.util.List;
import com.hikapro.backpack.App; import com.hikapro.backpack.App;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.model.dao.Command; import com.hikapro.backpack.model.dao.Command;
@ -17,7 +12,11 @@ import com.hikapro.backpack.model.dao.Event;
import com.hikapro.backpack.model.entities.Category; import com.hikapro.backpack.model.entities.Category;
import com.hikapro.backpack.model.entities.Item; import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.presenter.Presenter; import com.hikapro.backpack.presenter.Presenter;
import com.hikapro.backpack.presenter.adapters.helper.AppRater;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Hashtable;
import java.util.List;
/** /**
* Created by tariel on 22/04/16. * Created by tariel on 22/04/16.
@ -121,6 +120,8 @@ public class ItemModel implements Model.Item {
break; break;
case Event.ITEM_PACKED : case Event.ITEM_PACKED :
executeQuery(); executeQuery();
if (getPackedQty() == getActiveItemsCount())
NetworkUtil.sendGoogleAnalyticsEvent("SET PACKED", String.format("Set #%d", currentSet));
break; break;
case Event.ITEM_UNPACKED : case Event.ITEM_UNPACKED :
executeQuery(); executeQuery();

View File

@ -3,12 +3,11 @@ package com.hikapro.backpack.model;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.Message; import android.os.Message;
import java.util.List;
import com.hikapro.backpack.model.entities.Category; import com.hikapro.backpack.model.entities.Category;
import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.presenter.Presenter; import com.hikapro.backpack.presenter.Presenter;
import java.util.List;
/** /**
* Created by tariel on 19/04/16. * Created by tariel on 19/04/16.
*/ */

View File

@ -5,6 +5,11 @@ import android.content.Context;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.util.Log;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;
import com.hikapro.backpack.App;
import java.net.InetAddress; import java.net.InetAddress;
@ -54,4 +59,29 @@ public class NetworkUtil {
NetworkInfo netInfo = connMgr.getActiveNetworkInfo(); NetworkInfo netInfo = connMgr.getActiveNetworkInfo();
return netInfo != null && netInfo.isConnected(); return netInfo != null && netInfo.isConnected();
} }
public static void sendGoogleAnalyticsEvent(String category, String message) {
try {
Tracker tracker = App.getDefaultTracker();
tracker.send(new HitBuilders.EventBuilder()
.setCategory(category)
.setAction(message)
.build());
} catch (Exception e) {
// Log.e("Google Analytics Error", e.getMessage());
}
}
public static void sendGoogleAnalyticsScreen(String screen) {
try {
Tracker tracker = App.getDefaultTracker();
tracker.setScreenName(screen);
tracker.send(new HitBuilders.ScreenViewBuilder().build());
} catch (Exception e) {
// Log.e("Google Analytics Error", e.getMessage());
}
}
} }

View File

@ -3,17 +3,16 @@ package com.hikapro.backpack.model;
import android.os.Message; import android.os.Message;
import android.widget.Toast; import android.widget.Toast;
import java.util.Collections;
import java.util.Hashtable;
import java.util.List;
import com.hikapro.backpack.App; import com.hikapro.backpack.App;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.model.dao.Command; import com.hikapro.backpack.model.dao.Command;
import com.hikapro.backpack.model.dao.Event; import com.hikapro.backpack.model.dao.Event;
import com.hikapro.backpack.model.entities.Category; import com.hikapro.backpack.model.entities.Category;
import com.hikapro.backpack.model.entities.Item; import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.presenter.adapters.helper.AppRater;
import java.util.Collections;
import java.util.Hashtable;
import java.util.List;
/** /**
* Created by tariel on 12/05/16. * Created by tariel on 12/05/16.

View File

@ -3,9 +3,6 @@ package com.hikapro.backpack.model;
import android.os.Message; import android.os.Message;
import android.widget.Toast; import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import com.hikapro.backpack.App; import com.hikapro.backpack.App;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.model.dao.Command; import com.hikapro.backpack.model.dao.Command;
@ -14,6 +11,9 @@ import com.hikapro.backpack.model.dao.Event;
import com.hikapro.backpack.model.entities.Set; import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.presenter.Presenter; import com.hikapro.backpack.presenter.Presenter;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by tariel on 20/04/16. * Created by tariel on 20/04/16.
@ -102,7 +102,7 @@ public class SetModel implements Model.Set {
case Event.SYNC_FAILED : case Event.SYNC_FAILED :
if (presenter != null) if (presenter != null)
presenter.stopProgress(); presenter.stopProgress();
Toast.makeText(App.getAppContext(), "SYNC FAILED", Toast.LENGTH_SHORT).show(); Toast.makeText(App.getAppContext(), R.string.sync_failed, Toast.LENGTH_SHORT).show();
break; break;
case Event.SET_LOAD_ERROR : case Event.SET_LOAD_ERROR :
if (presenter != null) if (presenter != null)

View File

@ -9,14 +9,8 @@ import com.hikapro.backpack.R;
import com.hikapro.backpack.model.dao.Command; import com.hikapro.backpack.model.dao.Command;
import com.hikapro.backpack.model.dao.DAO; import com.hikapro.backpack.model.dao.DAO;
import com.hikapro.backpack.model.dao.Event; import com.hikapro.backpack.model.dao.Event;
import com.hikapro.backpack.model.entities.Category;
import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.presenter.Presenter; import com.hikapro.backpack.presenter.Presenter;
import java.util.Collections;
import java.util.Hashtable;
import java.util.List;
/** /**
* Created by tariel on 16/05/16. * Created by tariel on 16/05/16.
*/ */

View File

@ -4,7 +4,6 @@ import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.os.Handler; import android.os.Handler;
@ -12,7 +11,22 @@ import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.os.Process; import android.os.Process;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.hikapro.backpack.App;
import com.hikapro.backpack.R;
import com.hikapro.backpack.model.Api;
import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.NetworkUtil;
import com.hikapro.backpack.model.RestClient;
import com.hikapro.backpack.model.entities.Category;
import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.model.entities.SharingPicture;
import com.hikapro.backpack.model.entities.Timestamp;
import com.hikapro.backpack.model.entities.UpdateLog;
import com.hikapro.backpack.presenter.adapters.helper.AppRater;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -29,23 +43,6 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.hikapro.backpack.App;
import com.hikapro.backpack.R;
import com.hikapro.backpack.model.Api;
import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.NetworkUtil;
import com.hikapro.backpack.model.RestClient;
import com.hikapro.backpack.model.SetModel;
import com.hikapro.backpack.model.entities.Category;
import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.model.entities.SharingPicture;
import com.hikapro.backpack.model.entities.Timestamp;
import com.hikapro.backpack.model.entities.UpdateLog;
import com.hikapro.backpack.presenter.adapters.helper.AppRater;
import retrofit2.Response; import retrofit2.Response;
/** /**
@ -324,7 +321,7 @@ public class DAO {
db.insert(Db.LogTable.TABLE_NAME, null, values); db.insert(Db.LogTable.TABLE_NAME, null, values);
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception ex) { } catch (Exception ex) {
Log.e("Insert Timestamp", ex.getMessage()); // Log.e("Insert Timestamp", ex.getMessage());
} finally { } finally {
db.endTransaction(); db.endTransaction();
db.close(); db.close();
@ -342,7 +339,7 @@ public class DAO {
db.insert(Db.SharingPicsTable.TABLE_NAME, null, values); db.insert(Db.SharingPicsTable.TABLE_NAME, null, values);
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception ex) { } catch (Exception ex) {
Log.e("Inserting sharing photo", ex.getMessage()); // Log.e("Inserting sharing photo", ex.getMessage());
} finally { } finally {
db.endTransaction(); db.endTransaction();
db.close(); db.close();
@ -362,7 +359,7 @@ public class DAO {
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception ex) { } catch (Exception ex) {
Log.e("Insert Items", ex.getMessage()); // Log.e("Insert Items", ex.getMessage());
} finally { } finally {
db.endTransaction(); db.endTransaction();
db.close(); db.close();
@ -407,7 +404,7 @@ public class DAO {
ret = item.getId(); ret = item.getId();
} }
} catch (Exception ex) { } catch (Exception ex) {
Log.e("Insert Item", ex.getMessage()); // Log.e("Insert Item", ex.getMessage());
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();
@ -433,7 +430,7 @@ public class DAO {
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception ex) { } catch (Exception ex) {
Log.e("Insert Categories", ex.getMessage()); // Log.e("Insert Categories", ex.getMessage());
} finally { } finally {
db.endTransaction(); db.endTransaction();
db.close(); db.close();
@ -457,7 +454,7 @@ public class DAO {
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception ex) { } catch (Exception ex) {
Log.e("Insert Sets", ex.getMessage()); // Log.e("Insert Sets", ex.getMessage());
} finally { } finally {
db.endTransaction(); db.endTransaction();
db.close(); db.close();
@ -478,7 +475,7 @@ public class DAO {
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception ex) { } catch (Exception ex) {
Log.e("Insert Set Items", ex.getMessage()); // Log.e("Insert Set Items", ex.getMessage());
} finally { } finally {
db.endTransaction(); db.endTransaction();
} }
@ -496,7 +493,7 @@ public class DAO {
ret = db.insert(Db.SetItemsTable.TABLE_NAME, null, values); ret = db.insert(Db.SetItemsTable.TABLE_NAME, null, values);
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception ex) { } catch (Exception ex) {
Log.e("Insert Set Item", ex.getMessage()); // Log.e("Insert Set Item", ex.getMessage());
} finally { } finally {
db.endTransaction(); db.endTransaction();
db.close(); db.close();
@ -528,7 +525,7 @@ public class DAO {
if (cursor.moveToNext()) if (cursor.moveToNext())
ret = Db.LogTable.parseCursor(cursor); ret = Db.LogTable.parseCursor(cursor);
} catch (Exception ex) { } catch (Exception ex) {
Log.e("Update Log", ex.getMessage()); // Log.e("Update Log", ex.getMessage());
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();
@ -550,7 +547,7 @@ public class DAO {
if (cursor.moveToNext()) if (cursor.moveToNext())
ret = Db.SharingPicsTable.parseCursor(cursor); ret = Db.SharingPicsTable.parseCursor(cursor);
} catch (Exception e) { } catch (Exception e) {
Log.e("Reading sharing pic", e.getMessage()); // Log.e("Reading sharing pic", e.getMessage());
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();
@ -573,7 +570,7 @@ public class DAO {
ret = Db.ItemsTable.parseCursor(cursor); ret = Db.ItemsTable.parseCursor(cursor);
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("Find item", e.getMessage()); // Log.e("Find item", e.getMessage());
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();
@ -615,7 +612,7 @@ public class DAO {
ret = Db.ItemsTable.parseCursor(cursor); ret = Db.ItemsTable.parseCursor(cursor);
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("Read item", e.getMessage()); // Log.e("Read item", e.getMessage());
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();
@ -657,7 +654,7 @@ public class DAO {
ret = Db.ItemsTable.parseCursor(cursor); ret = Db.ItemsTable.parseCursor(cursor);
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("Read item", e.getMessage()); // Log.e("Read item", e.getMessage());
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();
@ -704,7 +701,7 @@ public class DAO {
ret.add(item); ret.add(item);
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("Read items", e.getMessage()); // Log.e("Read items", e.getMessage());
ret = null; ret = null;
} finally { } finally {
if (cursor != null) if (cursor != null)
@ -754,7 +751,7 @@ public class DAO {
ret.add(item); ret.add(item);
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("Read items like", e.getMessage()); // Log.e("Read items like", e.getMessage());
ret = null; ret = null;
} finally { } finally {
if (cursor != null) if (cursor != null)
@ -793,7 +790,7 @@ public class DAO {
ret.add(item); ret.add(item);
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("Read items like", e.getMessage()); // Log.e("Read items like", e.getMessage());
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();
@ -821,7 +818,7 @@ public class DAO {
ret.put(category.getId(), category); ret.put(category.getId(), category);
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("Read categories", e.getMessage()); // Log.e("Read categories", e.getMessage());
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();
@ -856,7 +853,7 @@ public class DAO {
if (cursor.moveToNext()) if (cursor.moveToNext())
ret = Db.SetsTable.parseCursor(cursor); ret = Db.SetsTable.parseCursor(cursor);
} catch (Exception e) { } catch (Exception e) {
Log.e("Read set", e.getMessage()); // Log.e("Read set", e.getMessage());
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();
@ -881,7 +878,7 @@ public class DAO {
} }
Collections.sort(ret); Collections.sort(ret);
} catch (Exception e) { } catch (Exception e) {
Log.e("Read sets", e.getMessage()); // Log.e("Read sets", e.getMessage());
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();
@ -905,7 +902,7 @@ public class DAO {
new String[]{String.valueOf(id)}); new String[]{String.valueOf(id)});
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Update local pic", e.getMessage()); // Log.e("Update local pic", e.getMessage());
} finally { } finally {
if (db != null) { if (db != null) {
db.endTransaction(); db.endTransaction();
@ -933,7 +930,7 @@ public class DAO {
new String[]{String.valueOf(id)}); new String[]{String.valueOf(id)});
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Update sharing pic path", e.getMessage()); // Log.e("Update sharing pic path", e.getMessage());
ret = -1; ret = -1;
} finally { } finally {
if (db != null) { if (db != null) {
@ -960,7 +957,7 @@ public class DAO {
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Update sets order", e.getMessage()); // Log.e("Update sets order", e.getMessage());
} finally { } finally {
if (db != null) { if (db != null) {
db.endTransaction(); db.endTransaction();
@ -1003,7 +1000,7 @@ public class DAO {
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Update pending removal", e.getMessage()); // Log.e("Update pending removal", e.getMessage());
} finally { } finally {
if (db != null) { if (db != null) {
db.endTransaction(); db.endTransaction();
@ -1047,7 +1044,7 @@ public class DAO {
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Update item deleted", e.getMessage()); // Log.e("Update item deleted", e.getMessage());
} finally { } finally {
if (db != null) { if (db != null) {
db.endTransaction(); db.endTransaction();
@ -1077,7 +1074,7 @@ public class DAO {
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Update set active", e.getMessage()); // Log.e("Update set active", e.getMessage());
ret = -1; ret = -1;
} finally { } finally {
if (db != null) { if (db != null) {
@ -1104,7 +1101,7 @@ public class DAO {
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
ret = -1; ret = -1;
Log.e("Clean packed", e.getMessage()); // Log.e("Clean packed", e.getMessage());
} finally { } finally {
if (db != null) { if (db != null) {
db.endTransaction(); db.endTransaction();
@ -1138,7 +1135,7 @@ public class DAO {
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Update item packed", e.getMessage()); // Log.e("Update item packed", e.getMessage());
ret = -1; ret = -1;
} finally { } finally {
if (db != null) { if (db != null) {
@ -1187,7 +1184,7 @@ public class DAO {
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Update item packed", e.getMessage()); // Log.e("Update item packed", e.getMessage());
} finally { } finally {
if (db != null) { if (db != null) {
db.endTransaction(); db.endTransaction();
@ -1229,7 +1226,7 @@ public class DAO {
new String[]{String.valueOf(setId), String.valueOf(1)}); new String[]{String.valueOf(setId), String.valueOf(1)});
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Restore defaults", e.getMessage()); // Log.e("Restore defaults", e.getMessage());
ret = -1; ret = -1;
} finally { } finally {
if (db != null) { if (db != null) {
@ -1257,7 +1254,7 @@ public class DAO {
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Update set names", e.getMessage()); // Log.e("Update set names", e.getMessage());
} finally { } finally {
if (db != null) { if (db != null) {
db.endTransaction(); db.endTransaction();
@ -1284,7 +1281,7 @@ public class DAO {
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Update category names", e.getMessage()); // Log.e("Update category names", e.getMessage());
} finally { } finally {
if (db != null) { if (db != null) {
db.endTransaction(); db.endTransaction();
@ -1312,7 +1309,7 @@ public class DAO {
} }
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Update item names", e.getMessage()); // Log.e("Update item names", e.getMessage());
} finally { } finally {
if (db != null) { if (db != null) {
db.endTransaction(); db.endTransaction();
@ -1340,7 +1337,7 @@ public class DAO {
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (Exception e) { } catch (Exception e) {
Log.e("Update log locale", e.getMessage()); // Log.e("Update log locale", e.getMessage());
} finally { } finally {
if (db != null) { if (db != null) {
db.endTransaction(); db.endTransaction();
@ -1385,6 +1382,7 @@ public class DAO {
message.what = Event.ITEM_READ_ERROR; message.what = Event.ITEM_READ_ERROR;
message.arg1 = setId; message.arg1 = setId;
message.arg2 = itemId; message.arg2 = itemId;
NetworkUtil.sendGoogleAnalyticsEvent("ITEM DETAILS CLICK", String.format("Set #%d Item #%d", setId, itemId));
break; break;
case Command.ITEM_DELETE_FROM_SET : case Command.ITEM_DELETE_FROM_SET :
@ -1393,6 +1391,7 @@ public class DAO {
message.what = Event.ITEM_FROM_SET_DELETED; message.what = Event.ITEM_FROM_SET_DELETED;
else else
message.what = Event.ITEM_FROM_SET_ERROR; message.what = Event.ITEM_FROM_SET_ERROR;
NetworkUtil.sendGoogleAnalyticsEvent("ITEM DELETED", String.format("Set #%d Item #%d", setId, itemId));
break; break;
case Command.ITEM_PENDING_REMOVAL: case Command.ITEM_PENDING_REMOVAL:
@ -1432,6 +1431,7 @@ public class DAO {
} else { } else {
message.what = Event.ITEM_INSERT_ERROR; message.what = Event.ITEM_INSERT_ERROR;
} }
NetworkUtil.sendGoogleAnalyticsEvent("ITEM ADDED", String.format("Set #%d Item #%d", setId, item.getId()));
break; break;
case Command.ITEM_PACK : case Command.ITEM_PACK :
@ -1572,6 +1572,7 @@ public class DAO {
message.what = Event.SET_UNPACK_COMPLETED; message.what = Event.SET_UNPACK_COMPLETED;
else else
message.what = Event.SET_UNPACK_ERROR; message.what = Event.SET_UNPACK_ERROR;
NetworkUtil.sendGoogleAnalyticsEvent("SET UNPACK", String.format("Set #%d", setId));
break; break;
case Command.SET_RESTORE_DEFAULT : case Command.SET_RESTORE_DEFAULT :
@ -1627,7 +1628,7 @@ public class DAO {
message.what = Event.SYNC_COMPLETED; message.what = Event.SYNC_COMPLETED;
else { else {
if (!NetworkUtil.isInternetAvailable()) { if (!NetworkUtil.isInternetAvailable()) {
message.what = Event.SYNC_FAILED; message.what = Event.SYNC_NO_CONNECTION;
} else { } else {
Response<List<Set>> response0 = api.getSets(locale).execute(); Response<List<Set>> response0 = api.getSets(locale).execute();
updateSetNames(response0.body()); updateSetNames(response0.body());
@ -1711,7 +1712,7 @@ public class DAO {
message.what = Event.SYNC_FAILED; message.what = Event.SYNC_FAILED;
} }
} catch (Exception ex) { } catch (Exception ex) {
Log.e("Read from file", ex.getMessage()); // Log.e("Read from file", ex.getMessage());
message.what = Event.SYNC_FAILED; message.what = Event.SYNC_FAILED;
} finally { } finally {
message.arg1 = 200; message.arg1 = 200;
@ -1906,7 +1907,7 @@ public class DAO {
is.close(); is.close();
sets = new String(buffer, "UTF-8"); sets = new String(buffer, "UTF-8");
} catch (IOException ex) { } catch (IOException ex) {
Log.e("Reading json", ex.getMessage()); // Log.e("Reading json", ex.getMessage());
} }
return sets; return sets;
} }
@ -1921,7 +1922,7 @@ public class DAO {
is.close(); is.close();
categories = new String(buffer, "UTF-8"); categories = new String(buffer, "UTF-8");
} catch (IOException ex) { } catch (IOException ex) {
Log.e("Reading json", ex.getMessage()); // Log.e("Reading json", ex.getMessage());
} }
return categories; return categories;
} }
@ -1936,7 +1937,7 @@ public class DAO {
is.close(); is.close();
items = new String(buffer, "UTF-8"); items = new String(buffer, "UTF-8");
} catch (IOException ex) { } catch (IOException ex) {
Log.e("Reading json", ex.getMessage()); // Log.e("Reading json", ex.getMessage());
} }
return items; return items;
} }
@ -1951,8 +1952,9 @@ public class DAO {
is.close(); is.close();
sharingPic = new String(buffer, "UTF-8"); sharingPic = new String(buffer, "UTF-8");
} catch (IOException ex) { } catch (IOException ex) {
Log.e("Reading json", ex.getMessage()); // Log.e("Reading json", ex.getMessage());
} }
return sharingPic; return sharingPic;
} }
} }

View File

@ -5,11 +5,6 @@ import android.database.Cursor;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Locale;
import com.hikapro.backpack.model.entities.Category; import com.hikapro.backpack.model.entities.Category;
import com.hikapro.backpack.model.entities.Item; import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.model.entities.Set; import com.hikapro.backpack.model.entities.Set;
@ -17,6 +12,10 @@ import com.hikapro.backpack.model.entities.SharingPicture;
import com.hikapro.backpack.model.entities.Timestamp; import com.hikapro.backpack.model.entities.Timestamp;
import com.hikapro.backpack.model.entities.UpdateLog; import com.hikapro.backpack.model.entities.UpdateLog;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Locale;
/** /**
* Created by tariel on 20/04/16. * Created by tariel on 20/04/16.
*/ */

View File

@ -6,8 +6,9 @@ import android.graphics.BitmapFactory;
import android.net.Uri; import android.net.Uri;
import android.os.Environment; import android.os.Environment;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.widget.Toast; import com.hikapro.backpack.App;
import com.hikapro.backpack.model.NetworkUtil;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -16,10 +17,6 @@ import java.net.SocketTimeoutException;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import com.hikapro.backpack.App;
import com.hikapro.backpack.R;
import com.hikapro.backpack.model.NetworkUtil;
/** /**
* Created by tariel on 04/05/16. * Created by tariel on 04/05/16.
*/ */
@ -43,9 +40,9 @@ public class ImageDownloadHelper {
bitmap = BitmapFactory.decodeStream(conn.getInputStream()); bitmap = BitmapFactory.decodeStream(conn.getInputStream());
} catch (SocketTimeoutException ex) { } catch (SocketTimeoutException ex) {
bitmap = null; bitmap = null;
Log.e(IMAGE_DOWNLOAD_TAG, " Timeout elapsed."); // Log.e(IMAGE_DOWNLOAD_TAG, " Timeout elapsed.");
} catch (Exception ex) { } catch (Exception ex) {
Log.e(IMAGE_DOWNLOAD_TAG, " File cannot be downloaded due to exception."); // Log.e(IMAGE_DOWNLOAD_TAG, " File cannot be downloaded due to exception.");
} }
} }
@ -75,7 +72,7 @@ public class ImageDownloadHelper {
try { try {
file = File.createTempFile(fileName, null, context.getCacheDir()); file = File.createTempFile(fileName, null, context.getCacheDir());
} catch (IOException e) { } catch (IOException e) {
Log.e(IMAGE_DOWNLOAD_TAG, " Cannot obtain temp file"); // Log.e(IMAGE_DOWNLOAD_TAG, " Cannot obtain temp file");
} }
return file; return file;
@ -99,7 +96,7 @@ public class ImageDownloadHelper {
outputStream = new FileOutputStream(file); outputStream = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream); bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
} catch (Exception e) { } catch (Exception e) {
Log.e(IMAGE_DOWNLOAD_TAG, "File cannot be saved (Internal): " + e); // Log.e(IMAGE_DOWNLOAD_TAG, "File cannot be saved (Internal): " + e);
} finally { } finally {
if (outputStream != null) { if (outputStream != null) {
@ -128,10 +125,10 @@ public class ImageDownloadHelper {
outputStream = new FileOutputStream(file); outputStream = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream); bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
} else { } else {
Log.e(IMAGE_DOWNLOAD_TAG, "Saving failed (External): directory unavailable."); // Log.e(IMAGE_DOWNLOAD_TAG, "Saving failed (External): directory unavailable.");
} }
} catch (Exception e) { } catch (Exception e) {
Log.e(IMAGE_DOWNLOAD_TAG, "File cannot be saved (External): " + e); // Log.e(IMAGE_DOWNLOAD_TAG, "File cannot be saved (External): " + e);
} finally { } finally {
@ -154,10 +151,7 @@ public class ImageDownloadHelper {
public boolean isExternalStorageWritable() { public boolean isExternalStorageWritable() {
boolean ret; boolean ret;
String state = Environment.getExternalStorageState(); String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) { ret = Environment.MEDIA_MOUNTED.equals(state);
ret = true;
} else
ret = false;
return ret; return ret;
} }
@ -166,17 +160,15 @@ public class ImageDownloadHelper {
public boolean isExternalStorageReadable() { public boolean isExternalStorageReadable() {
boolean ret; boolean ret;
String state = Environment.getExternalStorageState(); String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state) || ret = Environment.MEDIA_MOUNTED.equals(state) ||
Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { Environment.MEDIA_MOUNTED_READ_ONLY.equals(state);
ret = true;
} else
ret = false;
return ret; return ret;
} }
private File getDir() { private File getDir() {
File ret = null; File ret = null;
try {
// Get available SD cards // Get available SD cards
File[] dirs = ContextCompat.getExternalFilesDirs(context, Environment.DIRECTORY_PICTURES); File[] dirs = ContextCompat.getExternalFilesDirs(context, Environment.DIRECTORY_PICTURES);
if (dirs != null) { if (dirs != null) {
@ -191,7 +183,10 @@ public class ImageDownloadHelper {
} }
if (!ret.mkdirs()) { if (!ret.mkdirs()) {
Log.e(IMAGE_DOWNLOAD_TAG, "Directory was not created or already exists."); // Log.e(IMAGE_DOWNLOAD_TAG, "Directory was not created or already exists.");
}
} catch (Exception ex) {
} }
return ret; return ret;
} }

View File

@ -53,9 +53,7 @@ public class Category implements Serializable {
Category that = (Category) o; Category that = (Category) o;
if (id != that.id) return id == that.id;
return false;
return true;
} }
} }

View File

@ -166,19 +166,17 @@ public class Item implements Comparable<Item>, Serializable {
Item that = (Item) o; Item that = (Item) o;
if (id != that.id) return id == that.id;
return false;
return true;
} }
@Override @Override
public int compareTo(Item another) { public int compareTo(Item another) {
int cmp = Integer.valueOf(category).compareTo(Integer.valueOf(another.category)); int cmp = Integer.valueOf(category).compareTo(another.category);
if (cmp != 0) if (cmp != 0)
return cmp; return cmp;
else { else {
cmp = Boolean.valueOf(pendingRemoval).compareTo(Boolean.valueOf(another.pendingRemoval)); cmp = Boolean.valueOf(pendingRemoval).compareTo(another.pendingRemoval);
return (cmp != 0 ? cmp : name.compareTo(another.name)); return (cmp != 0 ? cmp : name.compareTo(another.name));
} }
} }

View File

@ -133,14 +133,12 @@ public class Set implements Comparable<Set>, Serializable {
Set that = (Set) o; Set that = (Set) o;
if (id != that.id) return id == that.id;
return false;
return true;
} }
@Override @Override
public int compareTo(Set another) { public int compareTo(Set another) {
int cmp = Integer.valueOf(lineNumber).compareTo(Integer.valueOf(another.lineNumber)); int cmp = Integer.valueOf(lineNumber).compareTo(another.lineNumber);
return (cmp != 0 ? cmp : name.compareTo(another.name)); return (cmp != 0 ? cmp : name.compareTo(another.name));
} }
} }

View File

@ -75,9 +75,7 @@ public class SharingPicture {
SharingPicture that = (SharingPicture) o; SharingPicture that = (SharingPicture) o;
if (id != that.id) return id == that.id;
return false;
return true;
} }
} }

View File

@ -12,12 +12,9 @@ import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.SearchView; import android.widget.SearchView;
@ -25,12 +22,12 @@ import android.widget.Toast;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.model.Model; import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.NetworkUtil;
import com.hikapro.backpack.model.entities.Category; import com.hikapro.backpack.model.entities.Category;
import com.hikapro.backpack.model.entities.Item; import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.presenter.adapters.AddListAdapter; import com.hikapro.backpack.presenter.adapters.AddListAdapter;
import com.hikapro.backpack.presenter.adapters.helper.FlowLayout; import com.hikapro.backpack.presenter.adapters.helper.FlowLayout;
import com.hikapro.backpack.presenter.adapters.helper.Util; import com.hikapro.backpack.presenter.adapters.helper.Util;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2; import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2;
import com.hikapro.backpack.view.View; import com.hikapro.backpack.view.View;
@ -41,6 +38,8 @@ import java.lang.ref.WeakReference;
*/ */
public class AddPresenter implements Presenter.Add { public class AddPresenter implements Presenter.Add {
private static final String TAG = "Add New Item";
private WeakReference<View.Add> view; private WeakReference<View.Add> view;
private Model.Add model; private Model.Add model;
@ -49,15 +48,12 @@ public class AddPresenter implements Presenter.Add {
private FlowLayout categoryContainer; private FlowLayout categoryContainer;
private ViewGroup categoryContainerMain; private ViewGroup categoryContainerMain;
private boolean isContainerAlreadyInitialised; private boolean isContainerAlreadyInitialised;
private Item newItem;
private Item selectedItem; private Item selectedItem;
private Button currentCategoryButton; private Button currentCategoryButton;
private Button cancelButton;
private Button saveButton; private Button saveButton;
private SearchView searchView; private SearchView searchView;
private boolean canSave; private boolean canSave;
public AddPresenter() { public AddPresenter() {
this.adapter = new AddListAdapter(this); this.adapter = new AddListAdapter(this);
} }
@ -116,7 +112,7 @@ public class AddPresenter implements Presenter.Add {
actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setCustomView(custActionBarView); actionBar.setCustomView(custActionBarView);
cancelButton = (Button) custActionBarView.findViewById(R.id.action_add_cancel); Button cancelButton = (Button) custActionBarView.findViewById(R.id.action_add_cancel);
saveButton = (Button) custActionBarView.findViewById(R.id.action_add_save); saveButton = (Button) custActionBarView.findViewById(R.id.action_add_save);
android.view.View.OnClickListener listener = new ActionBarButtonClickListener(); android.view.View.OnClickListener listener = new ActionBarButtonClickListener();
cancelButton.setOnClickListener(listener); cancelButton.setOnClickListener(listener);
@ -136,6 +132,7 @@ public class AddPresenter implements Presenter.Add {
magImage.setLayoutParams(new LinearLayout.LayoutParams(0, 0)); magImage.setLayoutParams(new LinearLayout.LayoutParams(0, 0));
searchView.setMinimumHeight(40); searchView.setMinimumHeight(40);
searchView.setOnQueryTextListener(new SearchTextListener()); searchView.setOnQueryTextListener(new SearchTextListener());
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
return view; return view;
} }
@ -182,11 +179,8 @@ public class AddPresenter implements Presenter.Add {
private void setSaveButtonAccess() { private void setSaveButtonAccess() {
if (searchView.getQuery().length() > 0 && currentCategoryButton != null canSave = searchView.getQuery().length() > 0 && currentCategoryButton != null
|| selectedItem != null) || selectedItem != null;
canSave = true;
else
canSave = false;
if (canSave) if (canSave)
saveButton.setTextColor(saveButton.getResources().getColor(R.color.save_green)); saveButton.setTextColor(saveButton.getResources().getColor(R.color.save_green));
@ -280,7 +274,7 @@ public class AddPresenter implements Presenter.Add {
if (selectedItem != null) { if (selectedItem != null) {
model.add(selectedItem, getView().getSet().getId()); model.add(selectedItem, getView().getSet().getId());
} else { } else {
newItem = new Item(searchView.getQuery().toString(), currentCategoryButton.getId()); Item newItem = new Item(searchView.getQuery().toString(), currentCategoryButton.getId());
newItem.setUserDefined(true); newItem.setUserDefined(true);
model.add(newItem, getView().getSet().getId()); model.add(newItem, getView().getSet().getId());
} }

View File

@ -16,23 +16,25 @@ import android.webkit.URLUtil;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import java.lang.ref.WeakReference;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.model.Model; import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.NetworkUtil;
import com.hikapro.backpack.model.entities.Item; import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.presenter.adapters.ItemDetailAdapter; import com.hikapro.backpack.presenter.adapters.ItemDetailAdapter;
import com.hikapro.backpack.presenter.adapters.helper.OnSwipeTouchListener; import com.hikapro.backpack.presenter.adapters.helper.OnSwipeTouchListener;
import com.hikapro.backpack.presenter.adapters.helper.Util; import com.hikapro.backpack.presenter.adapters.helper.Util;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2; import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2;
import com.hikapro.backpack.view.View; import com.hikapro.backpack.view.View;
import java.lang.ref.WeakReference;
/** /**
* Created by tariel on 23/04/16. * Created by tariel on 23/04/16.
*/ */
public class ItemDetailPresenter implements Presenter.ItemDetail { public class ItemDetailPresenter implements Presenter.ItemDetail {
private static final String TAG = "Item Details";
private WeakReference<View.ItemDetail> view; private WeakReference<View.ItemDetail> view;
private Model.Detail model; private Model.Detail model;
private Model.Item exModel; private Model.Item exModel;
@ -110,6 +112,7 @@ public class ItemDetailPresenter implements Presenter.ItemDetail {
actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true);
} }
} }
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
return view; return view;
} }

View File

@ -19,24 +19,26 @@ import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import java.lang.ref.WeakReference;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.model.Model; import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.NetworkUtil;
import com.hikapro.backpack.model.entities.Set; import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.presenter.adapters.ItemListAdapter;
import com.hikapro.backpack.presenter.adapters.helper.AppRater; import com.hikapro.backpack.presenter.adapters.helper.AppRater;
import com.hikapro.backpack.presenter.adapters.helper.Util; import com.hikapro.backpack.presenter.adapters.helper.Util;
import com.hikapro.backpack.presenter.adapters.ItemListAdapter;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2; import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2;
import com.hikapro.backpack.presenter.adapters.helper.items.StickyHeaderDecoration; import com.hikapro.backpack.presenter.adapters.helper.items.StickyHeaderDecoration;
import com.hikapro.backpack.view.View; import com.hikapro.backpack.view.View;
import java.lang.ref.WeakReference;
/** /**
* Created by tariel on 20/04/16. * Created by tariel on 20/04/16.
*/ */
public class ItemListPresenter implements Presenter.ItemList { public class ItemListPresenter implements Presenter.ItemList {
protected static final String BUNDLE_SET_LIST_KEY = "BUNDLE_SET_LIST_KEY"; protected static final String BUNDLE_SET_LIST_KEY = "BUNDLE_SET_LIST_KEY";
private static final String TAG = "Item List";
protected WeakReference<View.ItemList> view; protected WeakReference<View.ItemList> view;
protected Model.Item model; protected Model.Item model;
@ -103,6 +105,7 @@ public class ItemListPresenter implements Presenter.ItemList {
android.view.View con = view.findViewById(R.id.item_list_container); android.view.View con = view.findViewById(R.id.item_list_container);
applyBackground(con, set.getId()); applyBackground(con, set.getId());
} }
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
return view; return view;
} }
@ -168,7 +171,7 @@ public class ItemListPresenter implements Presenter.ItemList {
LinearLayoutManager llm = (LinearLayoutManager)recycler.getLayoutManager(); LinearLayoutManager llm = (LinearLayoutManager)recycler.getLayoutManager();
int pos = llm.findFirstVisibleItemPosition(); int pos = llm.findFirstVisibleItemPosition();
model.setLastVisiblePosition(pos); model.setLastVisiblePosition(pos);
Log.i("Last position remember", String.valueOf(pos)); // Log.i("Last position remember", String.valueOf(pos));
} }
@Override @Override

View File

@ -6,7 +6,6 @@ import android.app.Fragment;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -14,12 +13,11 @@ import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.model.NetworkUtil;
import com.hikapro.backpack.model.entities.Set; import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.presenter.adapters.PackedListAdapter; import com.hikapro.backpack.presenter.adapters.PackedListAdapter;
import com.hikapro.backpack.presenter.adapters.helper.Util; import com.hikapro.backpack.presenter.adapters.helper.Util;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2; import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2;
import com.hikapro.backpack.presenter.adapters.helper.items.ItemSwipeCallback;
import com.hikapro.backpack.presenter.adapters.helper.items.StickyHeaderDecoration; import com.hikapro.backpack.presenter.adapters.helper.items.StickyHeaderDecoration;
/** /**
@ -27,6 +25,8 @@ import com.hikapro.backpack.presenter.adapters.helper.items.StickyHeaderDecorati
*/ */
public class PackedListPresenter extends ItemListPresenter { public class PackedListPresenter extends ItemListPresenter {
private static final String TAG = "Packed items";
private TextView backToList; private TextView backToList;
private Button unpackButton; private Button unpackButton;
@ -97,6 +97,7 @@ public class PackedListPresenter extends ItemListPresenter {
actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true);
} }
} }
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
return view; return view;
} }

View File

@ -1,7 +1,6 @@
package com.hikapro.backpack.presenter; package com.hikapro.backpack.presenter;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;

View File

@ -12,11 +12,9 @@ import android.view.ViewGroup;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.Toast; import android.widget.Toast;
import java.lang.ref.WeakReference;
import java.util.Collections;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.model.Model; import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.NetworkUtil;
import com.hikapro.backpack.model.entities.Set; import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.presenter.adapters.SetListAdapter; import com.hikapro.backpack.presenter.adapters.SetListAdapter;
import com.hikapro.backpack.presenter.adapters.helper.sets.OnStartDragListener; import com.hikapro.backpack.presenter.adapters.helper.sets.OnStartDragListener;
@ -24,11 +22,16 @@ import com.hikapro.backpack.presenter.adapters.helper.sets.SimpleItemTouchHelper
import com.hikapro.backpack.view.View; import com.hikapro.backpack.view.View;
import com.hikapro.backpack.view.recycler.SetViewHolder; import com.hikapro.backpack.view.recycler.SetViewHolder;
import java.lang.ref.WeakReference;
import java.util.Collections;
/** /**
* Created by tariel on 20/04/16. * Created by tariel on 20/04/16.
*/ */
public class SetListPresenter implements Presenter.SetList { public class SetListPresenter implements Presenter.SetList {
private static final String TAG = "Set List";
private WeakReference<View.SetList> view; private WeakReference<View.SetList> view;
private Model.Set model; private Model.Set model;
private SetListAdapter adapter; private SetListAdapter adapter;
@ -94,6 +97,7 @@ public class SetListPresenter implements Presenter.SetList {
if (activity != null) if (activity != null)
activity.getActionBar().hide(); activity.getActionBar().hide();
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
return view; return view;
} }

View File

@ -4,7 +4,6 @@ import android.app.ActionBar;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.app.Fragment; import android.app.Fragment;
import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
@ -33,6 +32,7 @@ import com.facebook.share.model.ShareLinkContent;
import com.facebook.share.widget.ShareDialog; import com.facebook.share.widget.ShareDialog;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.model.Model; import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.NetworkUtil;
import com.hikapro.backpack.view.View; import com.hikapro.backpack.view.View;
import org.brickred.socialauth.Profile; import org.brickred.socialauth.Profile;
@ -41,7 +41,6 @@ import org.brickred.socialauth.android.SocialAuthAdapter;
import org.brickred.socialauth.android.SocialAuthError; import org.brickred.socialauth.android.SocialAuthError;
import org.brickred.socialauth.android.SocialAuthListener; import org.brickred.socialauth.android.SocialAuthListener;
import java.io.File;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
/** /**
@ -49,6 +48,8 @@ import java.lang.ref.WeakReference;
*/ */
public class SharePresenter implements Presenter.Share { public class SharePresenter implements Presenter.Share {
private static final String TAG = "Share";
private ShareDialog shareDialog; private ShareDialog shareDialog;
private CallbackManager callbackManager; private CallbackManager callbackManager;
@ -155,7 +156,7 @@ public class SharePresenter implements Presenter.Share {
public void onError(FacebookException error) { public void onError(FacebookException error) {
Toast.makeText(getActivityContext(), R.string.fb_error, Toast.makeText(getActivityContext(), R.string.fb_error,
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
Log.e("Share", "Facebook error", error); // Log.e("Share", "Facebook error", error);
} }
}); });
facebookButton.setOnClickListener(new android.view.View.OnClickListener() { facebookButton.setOnClickListener(new android.view.View.OnClickListener() {
@ -181,7 +182,7 @@ public class SharePresenter implements Presenter.Share {
} catch (Exception e) { } catch (Exception e) {
Toast.makeText(getActivityContext(), R.string.fb_error, Toast.makeText(getActivityContext(), R.string.fb_error,
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
Log.e("Sharing", "Facebook error", e); // Log.e("Sharing", "Facebook error", e);
} }
} }
} }
@ -224,6 +225,7 @@ public class SharePresenter implements Presenter.Share {
} }
twitterLogin = (TextView) v.findViewById(R.id.twitter_login); twitterLogin = (TextView) v.findViewById(R.id.twitter_login);
setVisibility(); setVisibility();
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
return v; return v;
} }
@ -251,22 +253,22 @@ public class SharePresenter implements Presenter.Share {
socialAuthAdapter.uploadImageAsync(message, "PackWithMe.png", socialAuthAdapter.uploadImageAsync(message, "PackWithMe.png",
bitmap, 0, new UploadImageListener()); bitmap, 0, new UploadImageListener());
} catch (Exception e) { } catch (Exception e) {
Log.e("ShareTwitter", e.getMessage()); // Log.e("ShareTwitter", e.getMessage());
} }
} }
@Override @Override
public void onError(SocialAuthError error) { public void onError(SocialAuthError error) {
Log.d("ShareTwitter", "Authentication Error: " + error.getMessage()); // Log.d("ShareTwitter", "Authentication Error: " + error.getMessage());
} }
@Override @Override
public void onCancel() { public void onCancel() {
Log.d("ShareTwitter", "Authentication Cancelled"); // Log.d("ShareTwitter", "Authentication Cancelled");
} }
@Override @Override
public void onBack() { public void onBack() {
Log.d("ShareTwitter", "Dialog Closed by pressing Back Key"); // Log.d("ShareTwitter", "Dialog Closed by pressing Back Key");
} }
} }
@ -279,16 +281,16 @@ public class SharePresenter implements Presenter.Share {
|| status.intValue() == 204) { || status.intValue() == 204) {
Toast.makeText(getActivityContext(), R.string.twitter_posted, Toast.makeText(getActivityContext(), R.string.twitter_posted,
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
Log.d("ShareTwitter", "Posting completed"); // Log.d("ShareTwitter", "Posting completed");
} else { } else {
Toast.makeText(getActivityContext(), R.string.twitter_error2, Toast.makeText(getActivityContext(), R.string.twitter_error2,
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
Log.d("ShareTwitter", "Posting failed"); // Log.d("ShareTwitter", "Posting failed");
} }
} catch (NullPointerException e) { } catch (NullPointerException e) {
Toast.makeText(getActivityContext(), R.string.twitter_error2, Toast.makeText(getActivityContext(), R.string.twitter_error2,
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
Log.e("ShareTwitter", e.getMessage()); // Log.e("ShareTwitter", e.getMessage());
} }
} }
@ -296,7 +298,7 @@ public class SharePresenter implements Presenter.Share {
public void onError(SocialAuthError e) { public void onError(SocialAuthError e) {
Toast.makeText(getActivityContext(), "Posting to twitter failed!", Toast.makeText(getActivityContext(), "Posting to twitter failed!",
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
Log.e("ShareTwitter", e.getMessage()); // Log.e("ShareTwitter", e.getMessage());
} }
} }

View File

@ -4,13 +4,11 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.model.entities.Item; import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.presenter.Presenter; import com.hikapro.backpack.presenter.Presenter;
import com.hikapro.backpack.view.recycler.AddItemViewHolder; import com.hikapro.backpack.view.recycler.AddItemViewHolder;
import com.hikapro.backpack.view.recycler.ItemViewHolder;
/** /**
* Created by tariel on 18/05/16. * Created by tariel on 18/05/16.

View File

@ -1,13 +1,11 @@
package com.hikapro.backpack.presenter.adapters; package com.hikapro.backpack.presenter.adapters;
import android.content.res.Resources;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;

View File

@ -2,13 +2,11 @@ package com.hikapro.backpack.presenter.adapters;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Typeface;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Toast;
import com.hikapro.backpack.App; import com.hikapro.backpack.App;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;

View File

@ -3,7 +3,6 @@ package com.hikapro.backpack.presenter.adapters;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.view.View; import android.view.View;
import android.widget.Toast;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.model.entities.Item; import com.hikapro.backpack.model.entities.Item;

View File

@ -1,8 +1,5 @@
package com.hikapro.backpack.presenter.adapters; package com.hikapro.backpack.presenter.adapters;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;

View File

@ -9,7 +9,6 @@ import android.net.Uri;
import android.util.Log; import android.util.Log;
import android.view.Window; import android.view.Window;
import android.widget.Button; import android.widget.Button;
import android.widget.Toast;
import com.hikapro.backpack.App; import com.hikapro.backpack.App;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
@ -80,7 +79,7 @@ public class AppRater {
later(); later();
dialog.dismiss(); dialog.dismiss();
} catch (Exception e) { } catch (Exception e) {
Log.e("Rate dialog", "Error while closing", e); // Log.e("Rate dialog", "Error while closing", e);
} }
} }
}); });
@ -92,7 +91,7 @@ public class AppRater {
sure(); sure();
dialog.dismiss(); dialog.dismiss();
} catch (Exception e) { } catch (Exception e) {
Log.e("Rate dialog", "Error while rating", e); // Log.e("Rate dialog", "Error while rating", e);
} }
} }

View File

@ -25,7 +25,7 @@ public class AutoResizeTextView extends TextView {
* text, it takes less space than {@code availableSpace}, > 0 * text, it takes less space than {@code availableSpace}, > 0
* otherwise * otherwise
*/ */
public int onTestSize(int suggestedSize, RectF availableSpace); int onTestSize(int suggestedSize, RectF availableSpace);
} }
private RectF mTextRect = new RectF(); private RectF mTextRect = new RectF();

View File

@ -9,8 +9,6 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.View; import android.view.View;
import com.hikapro.backpack.presenter.adapters.helper.Util;
public class DividerDecoration extends RecyclerView.ItemDecoration { public class DividerDecoration extends RecyclerView.ItemDecoration {

View File

@ -318,10 +318,6 @@ public class SwipableElement extends LinearLayout {
public boolean isMenuVisible() { public boolean isMenuVisible() {
Rect bounds = new Rect(); Rect bounds = new Rect();
this.getHitRect(bounds); this.getHitRect(bounds);
if (mMenuView.getLocalVisibleRect(bounds)) { return mMenuView.getLocalVisibleRect(bounds);
return true;
} else {
return false;
}
} }
} }

View File

@ -177,10 +177,7 @@ public class SwipableRecycler extends RecyclerView {
view.getLocationOnScreen(location); view.getLocationOnScreen(location);
int x = location[0]; int x = location[0];
int y = location[1]; int y = location[1];
if (ev.getRawX() < x || ev.getRawX() > (x + view.getWidth()) || ev.getRawY() < y || ev.getRawY() > (y + view.getHeight())) { return !(ev.getRawX() < x || ev.getRawX() > (x + view.getWidth()) || ev.getRawY() < y || ev.getRawY() > (y + view.getHeight()));
return false;
}
return true;
} }
private void init() { private void init() {

View File

@ -21,7 +21,6 @@ public interface View {
void showItemList(Set set); void showItemList(Set set);
void setPresenter(Presenter.SetList presenter); void setPresenter(Presenter.SetList presenter);
//GLM_add_resources_SetList
OnStartDragListener getOnStartDragListener(); OnStartDragListener getOnStartDragListener();
} }

View File

@ -2,19 +2,14 @@ package com.hikapro.backpack.view.fragments;
import android.app.Activity; import android.app.Activity;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.app.Fragment;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.SearchView;
import com.hikapro.backpack.R;
import com.hikapro.backpack.model.entities.Item; import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.model.entities.Set; import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.presenter.Presenter; import com.hikapro.backpack.presenter.Presenter;
@ -64,14 +59,11 @@ public class AddFragment extends Fragment implements com.hikapro.backpack.view.V
throw new ClassCastException(activity.toString() throw new ClassCastException(activity.toString()
+ " must implement activityCallback"); + " must implement activityCallback");
} }
Log.i(this.toString(), " onAttach");
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// setHasOptionsMenu(true);
Log.i(this.toString(), " onCreate");
} }
@Override @Override
@ -79,50 +71,42 @@ public class AddFragment extends Fragment implements com.hikapro.backpack.view.V
Bundle savedInstanceState) { Bundle savedInstanceState) {
presenter.setView(this); presenter.setView(this);
View view = presenter.onCreateView(inflater, container, savedInstanceState); View view = presenter.onCreateView(inflater, container, savedInstanceState);
Log.i(this.toString(), " onCreateView");
return view; return view;
} }
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
Log.i(this.toString(), " onActivityCreated");
} }
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
Log.i(this.toString(), " onStart");
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
Log.i(this.toString(), " onResume");
} }
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();
Log.i(this.toString(), " onStop");
} }
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
presenter.onDestroy(true); // TODO isChangingConfigurations presenter.onDestroy(true);
Log.i(this.toString(), " onDestroyView");
} }
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
presenter.onDestroy(false); // TODO isChangingConfigurations presenter.onDestroy(false);
Log.i(this.toString(), " onDestroy");
} }
@Override @Override
public void onDetach() { public void onDetach() {
super.onDetach(); super.onDetach();
Log.i(this.toString(), " onDetach");
} }
@Override @Override

View File

@ -2,19 +2,14 @@ package com.hikapro.backpack.view.fragments;
import android.app.Activity; import android.app.Activity;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.app.Fragment;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.hikapro.backpack.R;
import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.presenter.Presenter; import com.hikapro.backpack.presenter.Presenter;
/** /**
@ -64,62 +59,51 @@ public class ItemDetailFragment extends Fragment implements com.hikapro.backpack
throw new ClassCastException(activity.toString() throw new ClassCastException(activity.toString()
+ " must implement activityCallback"); + " must implement activityCallback");
} }
Log.i(this.toString(), "onAttach");
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Log.i(this.toString(), "onCreate");
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
presenter.setView(this); presenter.setView(this);
View view = presenter.onCreateView(inflater, container, savedInstanceState); View view = presenter.onCreateView(inflater, container, savedInstanceState);
Log.i(this.toString(), " onCreateView");
return view; return view;
} }
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
Log.i(this.toString(), " onActivityCreated");
} }
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
Log.i(this.toString(), " onStart");
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
Log.i(this.toString(), " onResume");
} }
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();
Log.i(this.toString(), " onStop");
} }
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
presenter.onDestroy(true); presenter.onDestroy(true);
Log.i(this.toString(), " onDestroyView");
} }
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
presenter.onDestroy(false); presenter.onDestroy(false);
Log.i(this.toString(), " onDestroy");
} }
@Override @Override
public void onDetach() { public void onDetach() {
super.onDetach(); super.onDetach();
Log.i(this.toString(), " onDetach");
} }
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
Log.i(this.toString(), " onSaveInstanceState");
} }
@Override @Override

View File

@ -5,7 +5,6 @@ import android.app.Activity;
import android.app.Fragment; import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@ -14,11 +13,9 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.SearchView; import android.widget.SearchView;
import android.widget.Toast;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.model.Model; import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.model.entities.Set; import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.presenter.Presenter; import com.hikapro.backpack.presenter.Presenter;
@ -55,7 +52,6 @@ public class ItemListFragment extends Fragment implements com.hikapro.backpack.v
final MenuItem item = menu.findItem(R.id.action_search); final MenuItem item = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) item.getActionView(); SearchView searchView = (SearchView) item.getActionView();
searchView.setOnQueryTextListener(this); searchView.setOnQueryTextListener(this);
Log.i(this.getClass().getName(), " onCreateOptionsMenu");
} }
@Override @Override
@ -119,66 +115,55 @@ public class ItemListFragment extends Fragment implements com.hikapro.backpack.v
throw new ClassCastException(activity.toString() throw new ClassCastException(activity.toString()
+ " must implement activityCallback"); + " must implement activityCallback");
} }
Log.i(this.getClass().getName(), " onAttach");
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setHasOptionsMenu(true); setHasOptionsMenu(true);
Log.i(this.getClass().getName(), " onCreate");
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
presenter.setView(this); presenter.setView(this);
View view = presenter.onCreateView(inflater, container, savedInstanceState); View view = presenter.onCreateView(inflater, container, savedInstanceState);
Log.i(this.getClass().getName(), " onCreateView");
return view; return view;
} }
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
Log.i(this.getClass().getName(), " onActivityCreated");
} }
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
Log.i(this.getClass().getName(), " onStart");
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
presenter.onResume(); presenter.onResume();
Log.i(this.getClass().getName(), " onResume");
} }
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();
Log.i(this.getClass().getName(), " onStop");
} }
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
presenter.onDestroy(true); // TODO isChangingConfigurations presenter.onDestroy(true);
hz = false; hz = false;
Log.i(this.getClass().getName(), " onDestroyView");
} }
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
presenter.onDestroy(false); // TODO isChangingConfigurations presenter.onDestroy(false);
Log.i(this.getClass().getName(), " onDestroy");
} }
@Override @Override
public void onDetach() { public void onDetach() {
super.onDetach(); super.onDetach();
Log.i(this.getClass().getName(), " onDetach");
} }
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
presenter.onSaveInstanceState(outState); presenter.onSaveInstanceState(outState);
Log.i(this.getClass().getName(), " onSaveInstanceState");
} }
@Override @Override

View File

@ -48,17 +48,14 @@ public class SetListFragment extends Fragment implements com.hikapro.backpack.vi
throw new ClassCastException(activity.toString() throw new ClassCastException(activity.toString()
+ " must implement activityCallback"); + " must implement activityCallback");
} }
Log.i(this.toString(), "onAttach");
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Log.i(this.toString(), "onCreate");
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
Log.i(this.toString(), "onCreateView");
presenter.setView(this); presenter.setView(this);
View view = presenter.onCreateView(inflater, container, savedInstanceState); View view = presenter.onCreateView(inflater, container, savedInstanceState);
@ -68,44 +65,36 @@ public class SetListFragment extends Fragment implements com.hikapro.backpack.vi
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
Log.i(this.toString(), "onActivityCreated");
} }
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
Log.i(this.toString(), "onStart");
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
Log.i(this.toString(), "onResume");
} }
@Override @Override
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
Log.i(this.toString(), "onPause");
} }
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();
Log.i(this.toString(), "onStop");
} }
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
presenter.onDestroy(true); // TODO isChangingConfigurations presenter.onDestroy(true);
Log.i(this.toString(), "onDestroyView");
} }
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
presenter.onDestroy(false); // TODO isChangingConfigurations presenter.onDestroy(false);
Log.i(this.toString(), "onDestroy");
} }
@Override @Override
public void onDetach() { public void onDetach() {
super.onDetach(); super.onDetach();
Log.i(this.toString(), "onDetach");
} }
@Override @Override
@ -133,13 +122,11 @@ public class SetListFragment extends Fragment implements com.hikapro.backpack.vi
} }
//GLM_add_resources_SetList
@Override @Override
public void onStartDrag(RecyclerView.ViewHolder viewHolder) { public void onStartDrag(RecyclerView.ViewHolder viewHolder) {
presenter.onStartDrag(viewHolder); presenter.onStartDrag(viewHolder);
} }
//GLM_add_resources_SetList
@Override @Override
public OnStartDragListener getOnStartDragListener() { public OnStartDragListener getOnStartDragListener() {
return this; return this;

View File

@ -2,15 +2,14 @@ package com.hikapro.backpack.view.fragments;
import android.app.Activity; import android.app.Activity;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.app.Fragment;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.hikapro.backpack.R;
import com.hikapro.backpack.presenter.Presenter; import com.hikapro.backpack.presenter.Presenter;
/** /**
@ -50,7 +49,6 @@ public class ShareFragment extends Fragment implements com.hikapro.backpack.view
throw new ClassCastException(activity.toString() throw new ClassCastException(activity.toString()
+ " must implement activityCallback"); + " must implement activityCallback");
} }
Log.i(this.toString(), "onAttach");
} }

View File

@ -2,7 +2,6 @@ package com.hikapro.backpack.view.recycler;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.View; import android.view.View;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;

View File

@ -3,13 +3,11 @@ package com.hikapro.backpack.view.recycler;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.TextView; import android.widget.TextView;
import com.hikapro.backpack.R; import com.hikapro.backpack.R;
import com.hikapro.backpack.presenter.adapters.helper.items.swipe2.SwipableElement;
/** /**

View File

@ -38,7 +38,6 @@ public class SetViewHolder extends RecyclerView.ViewHolder implements ItemTouchH
cardContent = (ViewGroup) view.findViewById(R.id.card_content); cardContent = (ViewGroup) view.findViewById(R.id.card_content);
} }
//GLM_add_resources_SetList
@Override @Override
public void onItemClear() { public void onItemClear() {
cardContent.setBackgroundColor(cardView.getResources().getColor(R.color.colorListBackground)); cardContent.setBackgroundColor(cardView.getResources().getColor(R.color.colorListBackground));
@ -48,7 +47,6 @@ public class SetViewHolder extends RecyclerView.ViewHolder implements ItemTouchH
drawable = null; drawable = null;
} }
//GLM_add_resources_SetList
@Override @Override
public void onItemSelected() { public void onItemSelected() {
this.drawable = cardContent.getBackground(); this.drawable = cardContent.getBackground();

View File

@ -31,6 +31,7 @@
android:actionViewClass="android.widget.SearchView" android:actionViewClass="android.widget.SearchView"
android:visible="true" android:visible="true"
android:title="@string/menu_search"/> android:title="@string/menu_search"/>
<item <item
android:id="@+id/action_add" android:id="@+id/action_add"
android:icon="@drawable/ic_add_white_36dp" android:icon="@drawable/ic_add_white_36dp"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="packed">Собрано</string> <string name="packed">Собрано</string>
<string name="what_in_bag">Показать вещи в рюкзаке &#x2193;</string> <string name="what_in_bag">Показать вещи в рюкзаке &#x2193;</string>
@ -41,6 +42,7 @@
<string name="please_wait">Пожалуйста, подождите</string> <string name="please_wait">Пожалуйста, подождите</string>
<string name="cannot_post">Постинг недоступен. Пожалуйста, проверьте Ваше соединение с Интернетом.</string> <string name="cannot_post">Постинг недоступен. Пожалуйста, проверьте Ваше соединение с Интернетом.</string>
<string name="loading">Загрузка...</string> <string name="loading">Загрузка...</string>
<string name="sync_failed">Ошибка синхронизации</string>
<string name="dlg_restore_header">Восстановить список</string> <string name="dlg_restore_header">Восстановить список</string>
<string name="dlg_restore_txt">Уверены, что хотите восстановить список? Удалённые Вами предметы будут восстановлены, а добавленные удалены.</string> <string name="dlg_restore_txt">Уверены, что хотите восстановить список? Удалённые Вами предметы будут восстановлены, а добавленные удалены.</string>

View File

@ -15,7 +15,7 @@
<string name="leave_at_home_button">LEAVE AT HOME</string> <string name="leave_at_home_button">LEAVE AT HOME</string>
<string name="add_to_bag_button">ADD TO BAG</string> <string name="add_to_bag_button">ADD TO BAG</string>
<string name="return_to_list_button">RETURN TO LIST</string> <string name="return_to_list_button">RETURN TO LIST</string>
<string name="restore_completed">Restore completed</string> <string name="restore_completed">Restoring completed</string>
<string name="twitter_error">Cannot post to twitter!</string> <string name="twitter_error">Cannot post to twitter!</string>
<string name="twitter_error2">Posting to twitter failed!</string> <string name="twitter_error2">Posting to twitter failed!</string>
<string name="twitter_posted">Posted to twitter!</string> <string name="twitter_posted">Posted to twitter!</string>
@ -41,6 +41,7 @@
<string name="please_wait">Please, wait for a while</string> <string name="please_wait">Please, wait for a while</string>
<string name="cannot_post">Posting is not available. Please, check your internet connection.</string> <string name="cannot_post">Posting is not available. Please, check your internet connection.</string>
<string name="loading">Loading...</string> <string name="loading">Loading...</string>
<string name="sync_failed">Sync failed</string>
<string name="dlg_restore_header">Restore To Default</string> <string name="dlg_restore_header">Restore To Default</string>
<string name="dlg_restore_txt">Do you want to restore this list? Items you have added will be removed, while deleted items will be added back.</string> <string name="dlg_restore_txt">Do you want to restore this list? Items you have added will be removed, while deleted items will be added back.</string>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<integer name="duration">200</integer> <integer name="duration">200</integer>
<integer name="valueTransitionXplus">768</integer> <integer name="valueTransitionXplus">720</integer>
<integer name="valueTransitionXminus">-768</integer> <integer name="valueTransitionXminus">-720</integer>
<integer name="valueTransitionYplus">1024</integer> <integer name="valueTransitionYplus">1024</integer>
<integer name="valueTransitionYminus">-1024</integer> <integer name="valueTransitionYminus">-1024</integer>

View File

@ -6,6 +6,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files