added google analytics
This commit is contained in:
parent
5d24380d59
commit
cf61c00474
|
@ -1,14 +1,10 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.3"
|
||||
/*
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
*/
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.hikapro.backpack"
|
||||
minSdkVersion 17
|
||||
|
@ -18,10 +14,16 @@ android {
|
|||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
shrinkResources true
|
||||
// minifyEnabled true
|
||||
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
minifyEnabled false
|
||||
}
|
||||
}
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
@ -41,6 +43,7 @@ dependencies {
|
|||
compile 'com.android.support:design:23.3.0'
|
||||
compile 'com.android.support:cardview-v7:23.3.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-android-3.2.jar')
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
|
@ -28,6 +28,18 @@
|
|||
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||
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>
|
||||
|
||||
</manifest>
|
|
@ -4,6 +4,9 @@ import android.app.Application;
|
|||
import android.content.Context;
|
||||
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.
|
||||
*/
|
||||
|
@ -11,12 +14,15 @@ public class App extends Application {
|
|||
|
||||
private static Context context;
|
||||
private static Typeface mainFace;
|
||||
private static Tracker tracker;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
App.context = getApplicationContext();
|
||||
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() {
|
||||
|
@ -26,4 +32,8 @@ public class App extends Application {
|
|||
public static Typeface getMainFace() {
|
||||
return App.mainFace;
|
||||
}
|
||||
|
||||
synchronized public static Tracker getDefaultTracker() {
|
||||
return App.tracker;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import com.hikapro.backpack.model.Model;
|
|||
import com.hikapro.backpack.model.PackedModel;
|
||||
import com.hikapro.backpack.model.SetModel;
|
||||
import com.hikapro.backpack.model.ShareModel;
|
||||
import com.hikapro.backpack.model.entities.Item;
|
||||
import com.hikapro.backpack.model.entities.Set;
|
||||
import com.hikapro.backpack.presenter.AddPresenter;
|
||||
import com.hikapro.backpack.presenter.ItemDetailPresenter;
|
||||
|
@ -138,43 +137,36 @@ public class MainActivity extends Activity implements View.ActivityCallback {
|
|||
model.setPresenter(presenter);
|
||||
}
|
||||
}
|
||||
Log.i("On create", "Activity");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
Log.i("onStart", "Activity");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
Log.i("onRestart", "Activity");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Log.i("onResume", "Activity");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
Log.i("onPause", "Activity");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
Log.i("onStop", "Activity");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Log.i("onDestroy", "Activity");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.hikapro.backpack;
|
|||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashMap;
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
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.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.Updates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
|
|
@ -11,8 +11,6 @@ import com.hikapro.backpack.model.dao.Event;
|
|||
import com.hikapro.backpack.model.entities.Item;
|
||||
import com.hikapro.backpack.presenter.Presenter;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Created by tariel on 23/04/16.
|
||||
*/
|
||||
|
|
|
@ -4,11 +4,6 @@ package com.hikapro.backpack.model;
|
|||
import android.os.Message;
|
||||
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.R;
|
||||
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.Item;
|
||||
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.
|
||||
|
@ -121,6 +120,8 @@ public class ItemModel implements Model.Item {
|
|||
break;
|
||||
case Event.ITEM_PACKED :
|
||||
executeQuery();
|
||||
if (getPackedQty() == getActiveItemsCount())
|
||||
NetworkUtil.sendGoogleAnalyticsEvent("SET PACKED", String.format("Set #%d", currentSet));
|
||||
break;
|
||||
case Event.ITEM_UNPACKED :
|
||||
executeQuery();
|
||||
|
|
|
@ -3,12 +3,11 @@ package com.hikapro.backpack.model;
|
|||
import android.graphics.Bitmap;
|
||||
import android.os.Message;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hikapro.backpack.model.entities.Category;
|
||||
import com.hikapro.backpack.model.entities.Item;
|
||||
import com.hikapro.backpack.presenter.Presenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by tariel on 19/04/16.
|
||||
*/
|
||||
|
|
|
@ -5,6 +5,11 @@ import android.content.Context;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.net.ConnectivityManager;
|
||||
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;
|
||||
|
||||
|
@ -54,4 +59,29 @@ public class NetworkUtil {
|
|||
NetworkInfo netInfo = connMgr.getActiveNetworkInfo();
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,17 +3,16 @@ package com.hikapro.backpack.model;
|
|||
import android.os.Message;
|
||||
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.R;
|
||||
import com.hikapro.backpack.model.dao.Command;
|
||||
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.adapters.helper.AppRater;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by tariel on 12/05/16.
|
||||
|
|
|
@ -3,9 +3,6 @@ package com.hikapro.backpack.model;
|
|||
import android.os.Message;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hikapro.backpack.App;
|
||||
import com.hikapro.backpack.R;
|
||||
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.presenter.Presenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Created by tariel on 20/04/16.
|
||||
|
@ -102,7 +102,7 @@ public class SetModel implements Model.Set {
|
|||
case Event.SYNC_FAILED :
|
||||
if (presenter != null)
|
||||
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;
|
||||
case Event.SET_LOAD_ERROR :
|
||||
if (presenter != null)
|
||||
|
|
|
@ -9,14 +9,8 @@ import com.hikapro.backpack.R;
|
|||
import com.hikapro.backpack.model.dao.Command;
|
||||
import com.hikapro.backpack.model.dao.DAO;
|
||||
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 java.util.Collections;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by tariel on 16/05/16.
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.content.ContentValues;
|
|||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Handler;
|
||||
|
@ -12,7 +11,22 @@ import android.os.Looper;
|
|||
import android.os.Message;
|
||||
import android.os.Process;
|
||||
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.InputStream;
|
||||
|
@ -29,23 +43,6 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -324,7 +321,7 @@ public class DAO {
|
|||
db.insert(Db.LogTable.TABLE_NAME, null, values);
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception ex) {
|
||||
Log.e("Insert Timestamp", ex.getMessage());
|
||||
// Log.e("Insert Timestamp", ex.getMessage());
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
db.close();
|
||||
|
@ -342,7 +339,7 @@ public class DAO {
|
|||
db.insert(Db.SharingPicsTable.TABLE_NAME, null, values);
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception ex) {
|
||||
Log.e("Inserting sharing photo", ex.getMessage());
|
||||
// Log.e("Inserting sharing photo", ex.getMessage());
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
db.close();
|
||||
|
@ -362,7 +359,7 @@ public class DAO {
|
|||
}
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception ex) {
|
||||
Log.e("Insert Items", ex.getMessage());
|
||||
// Log.e("Insert Items", ex.getMessage());
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
db.close();
|
||||
|
@ -407,7 +404,7 @@ public class DAO {
|
|||
ret = item.getId();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Log.e("Insert Item", ex.getMessage());
|
||||
// Log.e("Insert Item", ex.getMessage());
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
@ -433,7 +430,7 @@ public class DAO {
|
|||
}
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception ex) {
|
||||
Log.e("Insert Categories", ex.getMessage());
|
||||
// Log.e("Insert Categories", ex.getMessage());
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
db.close();
|
||||
|
@ -457,7 +454,7 @@ public class DAO {
|
|||
}
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception ex) {
|
||||
Log.e("Insert Sets", ex.getMessage());
|
||||
// Log.e("Insert Sets", ex.getMessage());
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
db.close();
|
||||
|
@ -478,7 +475,7 @@ public class DAO {
|
|||
}
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception ex) {
|
||||
Log.e("Insert Set Items", ex.getMessage());
|
||||
// Log.e("Insert Set Items", ex.getMessage());
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
@ -496,7 +493,7 @@ public class DAO {
|
|||
ret = db.insert(Db.SetItemsTable.TABLE_NAME, null, values);
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception ex) {
|
||||
Log.e("Insert Set Item", ex.getMessage());
|
||||
// Log.e("Insert Set Item", ex.getMessage());
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
db.close();
|
||||
|
@ -528,7 +525,7 @@ public class DAO {
|
|||
if (cursor.moveToNext())
|
||||
ret = Db.LogTable.parseCursor(cursor);
|
||||
} catch (Exception ex) {
|
||||
Log.e("Update Log", ex.getMessage());
|
||||
// Log.e("Update Log", ex.getMessage());
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
@ -550,7 +547,7 @@ public class DAO {
|
|||
if (cursor.moveToNext())
|
||||
ret = Db.SharingPicsTable.parseCursor(cursor);
|
||||
} catch (Exception e) {
|
||||
Log.e("Reading sharing pic", e.getMessage());
|
||||
// Log.e("Reading sharing pic", e.getMessage());
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
@ -573,7 +570,7 @@ public class DAO {
|
|||
ret = Db.ItemsTable.parseCursor(cursor);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("Find item", e.getMessage());
|
||||
// Log.e("Find item", e.getMessage());
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
@ -615,7 +612,7 @@ public class DAO {
|
|||
ret = Db.ItemsTable.parseCursor(cursor);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("Read item", e.getMessage());
|
||||
// Log.e("Read item", e.getMessage());
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
@ -657,7 +654,7 @@ public class DAO {
|
|||
ret = Db.ItemsTable.parseCursor(cursor);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("Read item", e.getMessage());
|
||||
// Log.e("Read item", e.getMessage());
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
@ -704,7 +701,7 @@ public class DAO {
|
|||
ret.add(item);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("Read items", e.getMessage());
|
||||
// Log.e("Read items", e.getMessage());
|
||||
ret = null;
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
|
@ -754,7 +751,7 @@ public class DAO {
|
|||
ret.add(item);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("Read items like", e.getMessage());
|
||||
// Log.e("Read items like", e.getMessage());
|
||||
ret = null;
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
|
@ -793,7 +790,7 @@ public class DAO {
|
|||
ret.add(item);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("Read items like", e.getMessage());
|
||||
// Log.e("Read items like", e.getMessage());
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
@ -821,7 +818,7 @@ public class DAO {
|
|||
ret.put(category.getId(), category);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("Read categories", e.getMessage());
|
||||
// Log.e("Read categories", e.getMessage());
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
@ -856,7 +853,7 @@ public class DAO {
|
|||
if (cursor.moveToNext())
|
||||
ret = Db.SetsTable.parseCursor(cursor);
|
||||
} catch (Exception e) {
|
||||
Log.e("Read set", e.getMessage());
|
||||
// Log.e("Read set", e.getMessage());
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
@ -881,7 +878,7 @@ public class DAO {
|
|||
}
|
||||
Collections.sort(ret);
|
||||
} catch (Exception e) {
|
||||
Log.e("Read sets", e.getMessage());
|
||||
// Log.e("Read sets", e.getMessage());
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
@ -905,7 +902,7 @@ public class DAO {
|
|||
new String[]{String.valueOf(id)});
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("Update local pic", e.getMessage());
|
||||
// Log.e("Update local pic", e.getMessage());
|
||||
} finally {
|
||||
if (db != null) {
|
||||
db.endTransaction();
|
||||
|
@ -933,7 +930,7 @@ public class DAO {
|
|||
new String[]{String.valueOf(id)});
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("Update sharing pic path", e.getMessage());
|
||||
// Log.e("Update sharing pic path", e.getMessage());
|
||||
ret = -1;
|
||||
} finally {
|
||||
if (db != null) {
|
||||
|
@ -960,7 +957,7 @@ public class DAO {
|
|||
}
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("Update sets order", e.getMessage());
|
||||
// Log.e("Update sets order", e.getMessage());
|
||||
} finally {
|
||||
if (db != null) {
|
||||
db.endTransaction();
|
||||
|
@ -1003,7 +1000,7 @@ public class DAO {
|
|||
db.setTransactionSuccessful();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e("Update pending removal", e.getMessage());
|
||||
// Log.e("Update pending removal", e.getMessage());
|
||||
} finally {
|
||||
if (db != null) {
|
||||
db.endTransaction();
|
||||
|
@ -1047,7 +1044,7 @@ public class DAO {
|
|||
}
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("Update item deleted", e.getMessage());
|
||||
// Log.e("Update item deleted", e.getMessage());
|
||||
} finally {
|
||||
if (db != null) {
|
||||
db.endTransaction();
|
||||
|
@ -1077,7 +1074,7 @@ public class DAO {
|
|||
}
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("Update set active", e.getMessage());
|
||||
// Log.e("Update set active", e.getMessage());
|
||||
ret = -1;
|
||||
} finally {
|
||||
if (db != null) {
|
||||
|
@ -1104,7 +1101,7 @@ public class DAO {
|
|||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
ret = -1;
|
||||
Log.e("Clean packed", e.getMessage());
|
||||
// Log.e("Clean packed", e.getMessage());
|
||||
} finally {
|
||||
if (db != null) {
|
||||
db.endTransaction();
|
||||
|
@ -1138,7 +1135,7 @@ public class DAO {
|
|||
}
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("Update item packed", e.getMessage());
|
||||
// Log.e("Update item packed", e.getMessage());
|
||||
ret = -1;
|
||||
} finally {
|
||||
if (db != null) {
|
||||
|
@ -1187,7 +1184,7 @@ public class DAO {
|
|||
}
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("Update item packed", e.getMessage());
|
||||
// Log.e("Update item packed", e.getMessage());
|
||||
} finally {
|
||||
if (db != null) {
|
||||
db.endTransaction();
|
||||
|
@ -1229,7 +1226,7 @@ public class DAO {
|
|||
new String[]{String.valueOf(setId), String.valueOf(1)});
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("Restore defaults", e.getMessage());
|
||||
// Log.e("Restore defaults", e.getMessage());
|
||||
ret = -1;
|
||||
} finally {
|
||||
if (db != null) {
|
||||
|
@ -1257,7 +1254,7 @@ public class DAO {
|
|||
}
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("Update set names", e.getMessage());
|
||||
// Log.e("Update set names", e.getMessage());
|
||||
} finally {
|
||||
if (db != null) {
|
||||
db.endTransaction();
|
||||
|
@ -1284,7 +1281,7 @@ public class DAO {
|
|||
}
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("Update category names", e.getMessage());
|
||||
// Log.e("Update category names", e.getMessage());
|
||||
} finally {
|
||||
if (db != null) {
|
||||
db.endTransaction();
|
||||
|
@ -1312,7 +1309,7 @@ public class DAO {
|
|||
}
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("Update item names", e.getMessage());
|
||||
// Log.e("Update item names", e.getMessage());
|
||||
} finally {
|
||||
if (db != null) {
|
||||
db.endTransaction();
|
||||
|
@ -1340,7 +1337,7 @@ public class DAO {
|
|||
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("Update log locale", e.getMessage());
|
||||
// Log.e("Update log locale", e.getMessage());
|
||||
} finally {
|
||||
if (db != null) {
|
||||
db.endTransaction();
|
||||
|
@ -1385,6 +1382,7 @@ public class DAO {
|
|||
message.what = Event.ITEM_READ_ERROR;
|
||||
message.arg1 = setId;
|
||||
message.arg2 = itemId;
|
||||
NetworkUtil.sendGoogleAnalyticsEvent("ITEM DETAILS CLICK", String.format("Set #%d Item #%d", setId, itemId));
|
||||
break;
|
||||
|
||||
case Command.ITEM_DELETE_FROM_SET :
|
||||
|
@ -1393,6 +1391,7 @@ public class DAO {
|
|||
message.what = Event.ITEM_FROM_SET_DELETED;
|
||||
else
|
||||
message.what = Event.ITEM_FROM_SET_ERROR;
|
||||
NetworkUtil.sendGoogleAnalyticsEvent("ITEM DELETED", String.format("Set #%d Item #%d", setId, itemId));
|
||||
break;
|
||||
|
||||
case Command.ITEM_PENDING_REMOVAL:
|
||||
|
@ -1432,6 +1431,7 @@ public class DAO {
|
|||
} else {
|
||||
message.what = Event.ITEM_INSERT_ERROR;
|
||||
}
|
||||
NetworkUtil.sendGoogleAnalyticsEvent("ITEM ADDED", String.format("Set #%d Item #%d", setId, item.getId()));
|
||||
break;
|
||||
|
||||
case Command.ITEM_PACK :
|
||||
|
@ -1572,6 +1572,7 @@ public class DAO {
|
|||
message.what = Event.SET_UNPACK_COMPLETED;
|
||||
else
|
||||
message.what = Event.SET_UNPACK_ERROR;
|
||||
NetworkUtil.sendGoogleAnalyticsEvent("SET UNPACK", String.format("Set #%d", setId));
|
||||
break;
|
||||
|
||||
case Command.SET_RESTORE_DEFAULT :
|
||||
|
@ -1627,7 +1628,7 @@ public class DAO {
|
|||
message.what = Event.SYNC_COMPLETED;
|
||||
else {
|
||||
if (!NetworkUtil.isInternetAvailable()) {
|
||||
message.what = Event.SYNC_FAILED;
|
||||
message.what = Event.SYNC_NO_CONNECTION;
|
||||
} else {
|
||||
Response<List<Set>> response0 = api.getSets(locale).execute();
|
||||
updateSetNames(response0.body());
|
||||
|
@ -1711,7 +1712,7 @@ public class DAO {
|
|||
message.what = Event.SYNC_FAILED;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Log.e("Read from file", ex.getMessage());
|
||||
// Log.e("Read from file", ex.getMessage());
|
||||
message.what = Event.SYNC_FAILED;
|
||||
} finally {
|
||||
message.arg1 = 200;
|
||||
|
@ -1906,7 +1907,7 @@ public class DAO {
|
|||
is.close();
|
||||
sets = new String(buffer, "UTF-8");
|
||||
} catch (IOException ex) {
|
||||
Log.e("Reading json", ex.getMessage());
|
||||
// Log.e("Reading json", ex.getMessage());
|
||||
}
|
||||
return sets;
|
||||
}
|
||||
|
@ -1921,7 +1922,7 @@ public class DAO {
|
|||
is.close();
|
||||
categories = new String(buffer, "UTF-8");
|
||||
} catch (IOException ex) {
|
||||
Log.e("Reading json", ex.getMessage());
|
||||
// Log.e("Reading json", ex.getMessage());
|
||||
}
|
||||
return categories;
|
||||
}
|
||||
|
@ -1936,7 +1937,7 @@ public class DAO {
|
|||
is.close();
|
||||
items = new String(buffer, "UTF-8");
|
||||
} catch (IOException ex) {
|
||||
Log.e("Reading json", ex.getMessage());
|
||||
// Log.e("Reading json", ex.getMessage());
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
@ -1951,8 +1952,9 @@ public class DAO {
|
|||
is.close();
|
||||
sharingPic = new String(buffer, "UTF-8");
|
||||
} catch (IOException ex) {
|
||||
Log.e("Reading json", ex.getMessage());
|
||||
// Log.e("Reading json", ex.getMessage());
|
||||
}
|
||||
return sharingPic;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,11 +5,6 @@ import android.database.Cursor;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
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.Item;
|
||||
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.UpdateLog;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Created by tariel on 20/04/16.
|
||||
*/
|
||||
|
|
|
@ -6,8 +6,9 @@ import android.graphics.BitmapFactory;
|
|||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
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.FileOutputStream;
|
||||
|
@ -16,10 +17,6 @@ import java.net.SocketTimeoutException;
|
|||
import java.net.URL;
|
||||
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.
|
||||
*/
|
||||
|
@ -43,9 +40,9 @@ public class ImageDownloadHelper {
|
|||
bitmap = BitmapFactory.decodeStream(conn.getInputStream());
|
||||
} catch (SocketTimeoutException ex) {
|
||||
bitmap = null;
|
||||
Log.e(IMAGE_DOWNLOAD_TAG, " Timeout elapsed.");
|
||||
// Log.e(IMAGE_DOWNLOAD_TAG, " Timeout elapsed.");
|
||||
} 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 {
|
||||
file = File.createTempFile(fileName, null, context.getCacheDir());
|
||||
} catch (IOException e) {
|
||||
Log.e(IMAGE_DOWNLOAD_TAG, " Cannot obtain temp file");
|
||||
// Log.e(IMAGE_DOWNLOAD_TAG, " Cannot obtain temp file");
|
||||
}
|
||||
|
||||
return file;
|
||||
|
@ -99,7 +96,7 @@ public class ImageDownloadHelper {
|
|||
outputStream = new FileOutputStream(file);
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
|
||||
} 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 {
|
||||
|
||||
if (outputStream != null) {
|
||||
|
@ -128,10 +125,10 @@ public class ImageDownloadHelper {
|
|||
outputStream = new FileOutputStream(file);
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
|
||||
} else {
|
||||
Log.e(IMAGE_DOWNLOAD_TAG, "Saving failed (External): directory unavailable.");
|
||||
// Log.e(IMAGE_DOWNLOAD_TAG, "Saving failed (External): directory unavailable.");
|
||||
}
|
||||
} 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 {
|
||||
|
||||
|
@ -154,10 +151,7 @@ public class ImageDownloadHelper {
|
|||
public boolean isExternalStorageWritable() {
|
||||
boolean ret;
|
||||
String state = Environment.getExternalStorageState();
|
||||
if (Environment.MEDIA_MOUNTED.equals(state)) {
|
||||
ret = true;
|
||||
} else
|
||||
ret = false;
|
||||
ret = Environment.MEDIA_MOUNTED.equals(state);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -166,17 +160,15 @@ public class ImageDownloadHelper {
|
|||
public boolean isExternalStorageReadable() {
|
||||
boolean ret;
|
||||
String state = Environment.getExternalStorageState();
|
||||
if (Environment.MEDIA_MOUNTED.equals(state) ||
|
||||
Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
|
||||
ret = true;
|
||||
} else
|
||||
ret = false;
|
||||
ret = Environment.MEDIA_MOUNTED.equals(state) ||
|
||||
Environment.MEDIA_MOUNTED_READ_ONLY.equals(state);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private File getDir() {
|
||||
File ret = null;
|
||||
try {
|
||||
// Get available SD cards
|
||||
File[] dirs = ContextCompat.getExternalFilesDirs(context, Environment.DIRECTORY_PICTURES);
|
||||
if (dirs != null) {
|
||||
|
@ -191,7 +183,10 @@ public class ImageDownloadHelper {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -53,9 +53,7 @@ public class Category implements Serializable {
|
|||
|
||||
Category that = (Category) o;
|
||||
|
||||
if (id != that.id)
|
||||
return false;
|
||||
return true;
|
||||
return id == that.id;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,19 +166,17 @@ public class Item implements Comparable<Item>, Serializable {
|
|||
|
||||
Item that = (Item) o;
|
||||
|
||||
if (id != that.id)
|
||||
return false;
|
||||
return true;
|
||||
return id == that.id;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
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)
|
||||
return cmp;
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,14 +133,12 @@ public class Set implements Comparable<Set>, Serializable {
|
|||
|
||||
Set that = (Set) o;
|
||||
|
||||
if (id != that.id)
|
||||
return false;
|
||||
return true;
|
||||
return id == that.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,9 +75,7 @@ public class SharingPicture {
|
|||
|
||||
SharingPicture that = (SharingPicture) o;
|
||||
|
||||
if (id != that.id)
|
||||
return false;
|
||||
return true;
|
||||
return id == that.id;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,12 +12,9 @@ import android.os.Bundle;
|
|||
import android.support.v7.widget.DefaultItemAnimator;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SearchView;
|
||||
|
@ -25,12 +22,12 @@ import android.widget.Toast;
|
|||
|
||||
import com.hikapro.backpack.R;
|
||||
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.Item;
|
||||
import com.hikapro.backpack.presenter.adapters.AddListAdapter;
|
||||
import com.hikapro.backpack.presenter.adapters.helper.FlowLayout;
|
||||
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.view.View;
|
||||
|
||||
|
@ -41,6 +38,8 @@ import java.lang.ref.WeakReference;
|
|||
*/
|
||||
public class AddPresenter implements Presenter.Add {
|
||||
|
||||
private static final String TAG = "Add New Item";
|
||||
|
||||
private WeakReference<View.Add> view;
|
||||
private Model.Add model;
|
||||
|
||||
|
@ -49,15 +48,12 @@ public class AddPresenter implements Presenter.Add {
|
|||
private FlowLayout categoryContainer;
|
||||
private ViewGroup categoryContainerMain;
|
||||
private boolean isContainerAlreadyInitialised;
|
||||
private Item newItem;
|
||||
private Item selectedItem;
|
||||
private Button currentCategoryButton;
|
||||
private Button cancelButton;
|
||||
private Button saveButton;
|
||||
private SearchView searchView;
|
||||
private boolean canSave;
|
||||
|
||||
|
||||
public AddPresenter() {
|
||||
this.adapter = new AddListAdapter(this);
|
||||
}
|
||||
|
@ -116,7 +112,7 @@ public class AddPresenter implements Presenter.Add {
|
|||
actionBar.setDisplayHomeAsUpEnabled(false);
|
||||
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);
|
||||
android.view.View.OnClickListener listener = new ActionBarButtonClickListener();
|
||||
cancelButton.setOnClickListener(listener);
|
||||
|
@ -136,6 +132,7 @@ public class AddPresenter implements Presenter.Add {
|
|||
magImage.setLayoutParams(new LinearLayout.LayoutParams(0, 0));
|
||||
searchView.setMinimumHeight(40);
|
||||
searchView.setOnQueryTextListener(new SearchTextListener());
|
||||
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -182,11 +179,8 @@ public class AddPresenter implements Presenter.Add {
|
|||
|
||||
private void setSaveButtonAccess() {
|
||||
|
||||
if (searchView.getQuery().length() > 0 && currentCategoryButton != null
|
||||
|| selectedItem != null)
|
||||
canSave = true;
|
||||
else
|
||||
canSave = false;
|
||||
canSave = searchView.getQuery().length() > 0 && currentCategoryButton != null
|
||||
|| selectedItem != null;
|
||||
|
||||
if (canSave)
|
||||
saveButton.setTextColor(saveButton.getResources().getColor(R.color.save_green));
|
||||
|
@ -280,7 +274,7 @@ public class AddPresenter implements Presenter.Add {
|
|||
if (selectedItem != null) {
|
||||
model.add(selectedItem, getView().getSet().getId());
|
||||
} else {
|
||||
newItem = new Item(searchView.getQuery().toString(), currentCategoryButton.getId());
|
||||
Item newItem = new Item(searchView.getQuery().toString(), currentCategoryButton.getId());
|
||||
newItem.setUserDefined(true);
|
||||
model.add(newItem, getView().getSet().getId());
|
||||
}
|
||||
|
|
|
@ -16,23 +16,25 @@ import android.webkit.URLUtil;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import com.hikapro.backpack.R;
|
||||
import com.hikapro.backpack.model.Model;
|
||||
import com.hikapro.backpack.model.NetworkUtil;
|
||||
import com.hikapro.backpack.model.entities.Item;
|
||||
import com.hikapro.backpack.presenter.adapters.ItemDetailAdapter;
|
||||
import com.hikapro.backpack.presenter.adapters.helper.OnSwipeTouchListener;
|
||||
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.view.View;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
* Created by tariel on 23/04/16.
|
||||
*/
|
||||
public class ItemDetailPresenter implements Presenter.ItemDetail {
|
||||
|
||||
private static final String TAG = "Item Details";
|
||||
|
||||
private WeakReference<View.ItemDetail> view;
|
||||
private Model.Detail model;
|
||||
private Model.Item exModel;
|
||||
|
@ -110,6 +112,7 @@ public class ItemDetailPresenter implements Presenter.ItemDetail {
|
|||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
}
|
||||
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,24 +19,26 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import com.hikapro.backpack.R;
|
||||
import com.hikapro.backpack.model.Model;
|
||||
import com.hikapro.backpack.model.NetworkUtil;
|
||||
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.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.StickyHeaderDecoration;
|
||||
import com.hikapro.backpack.view.View;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
* Created by tariel on 20/04/16.
|
||||
*/
|
||||
public class ItemListPresenter implements Presenter.ItemList {
|
||||
|
||||
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 Model.Item model;
|
||||
|
@ -103,6 +105,7 @@ public class ItemListPresenter implements Presenter.ItemList {
|
|||
android.view.View con = view.findViewById(R.id.item_list_container);
|
||||
applyBackground(con, set.getId());
|
||||
}
|
||||
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -168,7 +171,7 @@ public class ItemListPresenter implements Presenter.ItemList {
|
|||
LinearLayoutManager llm = (LinearLayoutManager)recycler.getLayoutManager();
|
||||
int pos = llm.findFirstVisibleItemPosition();
|
||||
model.setLastVisiblePosition(pos);
|
||||
Log.i("Last position remember", String.valueOf(pos));
|
||||
// Log.i("Last position remember", String.valueOf(pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.app.Fragment;
|
|||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -14,12 +13,11 @@ import android.widget.Button;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.hikapro.backpack.R;
|
||||
import com.hikapro.backpack.model.NetworkUtil;
|
||||
import com.hikapro.backpack.model.entities.Set;
|
||||
import com.hikapro.backpack.presenter.adapters.PackedListAdapter;
|
||||
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.ItemSwipeCallback;
|
||||
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 {
|
||||
|
||||
private static final String TAG = "Packed items";
|
||||
|
||||
private TextView backToList;
|
||||
private Button unpackButton;
|
||||
|
||||
|
@ -97,6 +97,7 @@ public class PackedListPresenter extends ItemListPresenter {
|
|||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
}
|
||||
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.hikapro.backpack.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
|
|
|
@ -12,11 +12,9 @@ import android.view.ViewGroup;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.hikapro.backpack.R;
|
||||
import com.hikapro.backpack.model.Model;
|
||||
import com.hikapro.backpack.model.NetworkUtil;
|
||||
import com.hikapro.backpack.model.entities.Set;
|
||||
import com.hikapro.backpack.presenter.adapters.SetListAdapter;
|
||||
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.recycler.SetViewHolder;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Created by tariel on 20/04/16.
|
||||
*/
|
||||
public class SetListPresenter implements Presenter.SetList {
|
||||
|
||||
private static final String TAG = "Set List";
|
||||
|
||||
private WeakReference<View.SetList> view;
|
||||
private Model.Set model;
|
||||
private SetListAdapter adapter;
|
||||
|
@ -94,6 +97,7 @@ public class SetListPresenter implements Presenter.SetList {
|
|||
if (activity != null)
|
||||
activity.getActionBar().hide();
|
||||
|
||||
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.app.ActionBar;
|
|||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.app.Fragment;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
|
@ -33,6 +32,7 @@ import com.facebook.share.model.ShareLinkContent;
|
|||
import com.facebook.share.widget.ShareDialog;
|
||||
import com.hikapro.backpack.R;
|
||||
import com.hikapro.backpack.model.Model;
|
||||
import com.hikapro.backpack.model.NetworkUtil;
|
||||
import com.hikapro.backpack.view.View;
|
||||
|
||||
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.SocialAuthListener;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
|
@ -49,6 +48,8 @@ import java.lang.ref.WeakReference;
|
|||
*/
|
||||
public class SharePresenter implements Presenter.Share {
|
||||
|
||||
private static final String TAG = "Share";
|
||||
|
||||
private ShareDialog shareDialog;
|
||||
private CallbackManager callbackManager;
|
||||
|
||||
|
@ -155,7 +156,7 @@ public class SharePresenter implements Presenter.Share {
|
|||
public void onError(FacebookException error) {
|
||||
Toast.makeText(getActivityContext(), R.string.fb_error,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
Log.e("Share", "Facebook error", error);
|
||||
// Log.e("Share", "Facebook error", error);
|
||||
}
|
||||
});
|
||||
facebookButton.setOnClickListener(new android.view.View.OnClickListener() {
|
||||
|
@ -181,7 +182,7 @@ public class SharePresenter implements Presenter.Share {
|
|||
} catch (Exception e) {
|
||||
Toast.makeText(getActivityContext(), R.string.fb_error,
|
||||
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);
|
||||
setVisibility();
|
||||
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -251,22 +253,22 @@ public class SharePresenter implements Presenter.Share {
|
|||
socialAuthAdapter.uploadImageAsync(message, "PackWithMe.png",
|
||||
bitmap, 0, new UploadImageListener());
|
||||
} catch (Exception e) {
|
||||
Log.e("ShareTwitter", e.getMessage());
|
||||
// Log.e("ShareTwitter", e.getMessage());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onError(SocialAuthError error) {
|
||||
Log.d("ShareTwitter", "Authentication Error: " + error.getMessage());
|
||||
// Log.d("ShareTwitter", "Authentication Error: " + error.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
Log.d("ShareTwitter", "Authentication Cancelled");
|
||||
// Log.d("ShareTwitter", "Authentication Cancelled");
|
||||
}
|
||||
|
||||
@Override
|
||||
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) {
|
||||
Toast.makeText(getActivityContext(), R.string.twitter_posted,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
Log.d("ShareTwitter", "Posting completed");
|
||||
// Log.d("ShareTwitter", "Posting completed");
|
||||
} else {
|
||||
Toast.makeText(getActivityContext(), R.string.twitter_error2,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
Log.d("ShareTwitter", "Posting failed");
|
||||
// Log.d("ShareTwitter", "Posting failed");
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
Toast.makeText(getActivityContext(), R.string.twitter_error2,
|
||||
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) {
|
||||
Toast.makeText(getActivityContext(), "Posting to twitter failed!",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
Log.e("ShareTwitter", e.getMessage());
|
||||
// Log.e("ShareTwitter", e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,13 +4,11 @@ import android.support.v7.widget.RecyclerView;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.hikapro.backpack.R;
|
||||
import com.hikapro.backpack.model.entities.Item;
|
||||
import com.hikapro.backpack.presenter.Presenter;
|
||||
import com.hikapro.backpack.view.recycler.AddItemViewHolder;
|
||||
import com.hikapro.backpack.view.recycler.ItemViewHolder;
|
||||
|
||||
/**
|
||||
* Created by tariel on 18/05/16.
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package com.hikapro.backpack.presenter.adapters;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.hikapro.backpack.R;
|
||||
|
|
|
@ -2,13 +2,11 @@ package com.hikapro.backpack.presenter.adapters;
|
|||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hikapro.backpack.App;
|
||||
import com.hikapro.backpack.R;
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.hikapro.backpack.presenter.adapters;
|
|||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hikapro.backpack.R;
|
||||
import com.hikapro.backpack.model.entities.Item;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
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.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.net.Uri;
|
|||
import android.util.Log;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hikapro.backpack.App;
|
||||
import com.hikapro.backpack.R;
|
||||
|
@ -80,7 +79,7 @@ public class AppRater {
|
|||
later();
|
||||
dialog.dismiss();
|
||||
} 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();
|
||||
dialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
Log.e("Rate dialog", "Error while rating", e);
|
||||
// Log.e("Rate dialog", "Error while rating", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class AutoResizeTextView extends TextView {
|
|||
* text, it takes less space than {@code availableSpace}, > 0
|
||||
* otherwise
|
||||
*/
|
||||
public int onTestSize(int suggestedSize, RectF availableSpace);
|
||||
int onTestSize(int suggestedSize, RectF availableSpace);
|
||||
}
|
||||
|
||||
private RectF mTextRect = new RectF();
|
||||
|
|
|
@ -9,8 +9,6 @@ import android.support.v7.widget.LinearLayoutManager;
|
|||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
|
||||
import com.hikapro.backpack.presenter.adapters.helper.Util;
|
||||
|
||||
|
||||
public class DividerDecoration extends RecyclerView.ItemDecoration {
|
||||
|
||||
|
|
|
@ -318,10 +318,6 @@ public class SwipableElement extends LinearLayout {
|
|||
public boolean isMenuVisible() {
|
||||
Rect bounds = new Rect();
|
||||
this.getHitRect(bounds);
|
||||
if (mMenuView.getLocalVisibleRect(bounds)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return mMenuView.getLocalVisibleRect(bounds);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,10 +177,7 @@ public class SwipableRecycler extends RecyclerView {
|
|||
view.getLocationOnScreen(location);
|
||||
int x = location[0];
|
||||
int y = location[1];
|
||||
if (ev.getRawX() < x || ev.getRawX() > (x + view.getWidth()) || ev.getRawY() < y || ev.getRawY() > (y + view.getHeight())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !(ev.getRawX() < x || ev.getRawX() > (x + view.getWidth()) || ev.getRawY() < y || ev.getRawY() > (y + view.getHeight()));
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
|
|
@ -21,7 +21,6 @@ public interface View {
|
|||
void showItemList(Set set);
|
||||
void setPresenter(Presenter.SetList presenter);
|
||||
|
||||
//GLM_add_resources_SetList
|
||||
OnStartDragListener getOnStartDragListener();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,19 +2,14 @@ package com.hikapro.backpack.view.fragments;
|
|||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
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.Set;
|
||||
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()
|
||||
+ " must implement activityCallback");
|
||||
}
|
||||
Log.i(this.toString(), " onAttach");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// setHasOptionsMenu(true);
|
||||
Log.i(this.toString(), " onCreate");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,50 +71,42 @@ public class AddFragment extends Fragment implements com.hikapro.backpack.view.V
|
|||
Bundle savedInstanceState) {
|
||||
presenter.setView(this);
|
||||
View view = presenter.onCreateView(inflater, container, savedInstanceState);
|
||||
Log.i(this.toString(), " onCreateView");
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
Log.i(this.toString(), " onActivityCreated");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Log.i(this.toString(), " onStart");
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Log.i(this.toString(), " onResume");
|
||||
}
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
Log.i(this.toString(), " onStop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
presenter.onDestroy(true); // TODO isChangingConfigurations
|
||||
Log.i(this.toString(), " onDestroyView");
|
||||
presenter.onDestroy(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
presenter.onDestroy(false); // TODO isChangingConfigurations
|
||||
Log.i(this.toString(), " onDestroy");
|
||||
presenter.onDestroy(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
Log.i(this.toString(), " onDetach");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,19 +2,14 @@ package com.hikapro.backpack.view.fragments;
|
|||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.hikapro.backpack.R;
|
||||
import com.hikapro.backpack.model.entities.Item;
|
||||
import com.hikapro.backpack.presenter.Presenter;
|
||||
|
||||
/**
|
||||
|
@ -64,62 +59,51 @@ public class ItemDetailFragment extends Fragment implements com.hikapro.backpack
|
|||
throw new ClassCastException(activity.toString()
|
||||
+ " must implement activityCallback");
|
||||
}
|
||||
Log.i(this.toString(), "onAttach");
|
||||
}
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Log.i(this.toString(), "onCreate");
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
presenter.setView(this);
|
||||
View view = presenter.onCreateView(inflater, container, savedInstanceState);
|
||||
Log.i(this.toString(), " onCreateView");
|
||||
return view;
|
||||
}
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
Log.i(this.toString(), " onActivityCreated");
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Log.i(this.toString(), " onStart");
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Log.i(this.toString(), " onResume");
|
||||
}
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
Log.i(this.toString(), " onStop");
|
||||
}
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
presenter.onDestroy(true);
|
||||
Log.i(this.toString(), " onDestroyView");
|
||||
}
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
presenter.onDestroy(false);
|
||||
Log.i(this.toString(), " onDestroy");
|
||||
}
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
Log.i(this.toString(), " onDetach");
|
||||
}
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
Log.i(this.toString(), " onSaveInstanceState");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.app.Activity;
|
|||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -14,11 +13,9 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.SearchView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hikapro.backpack.R;
|
||||
import com.hikapro.backpack.model.Model;
|
||||
import com.hikapro.backpack.model.entities.Item;
|
||||
import com.hikapro.backpack.model.entities.Set;
|
||||
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);
|
||||
SearchView searchView = (SearchView) item.getActionView();
|
||||
searchView.setOnQueryTextListener(this);
|
||||
Log.i(this.getClass().getName(), " onCreateOptionsMenu");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,66 +115,55 @@ public class ItemListFragment extends Fragment implements com.hikapro.backpack.v
|
|||
throw new ClassCastException(activity.toString()
|
||||
+ " must implement activityCallback");
|
||||
}
|
||||
Log.i(this.getClass().getName(), " onAttach");
|
||||
}
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
Log.i(this.getClass().getName(), " onCreate");
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
presenter.setView(this);
|
||||
View view = presenter.onCreateView(inflater, container, savedInstanceState);
|
||||
Log.i(this.getClass().getName(), " onCreateView");
|
||||
return view;
|
||||
}
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
Log.i(this.getClass().getName(), " onActivityCreated");
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Log.i(this.getClass().getName(), " onStart");
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
presenter.onResume();
|
||||
Log.i(this.getClass().getName(), " onResume");
|
||||
}
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
Log.i(this.getClass().getName(), " onStop");
|
||||
}
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
presenter.onDestroy(true); // TODO isChangingConfigurations
|
||||
presenter.onDestroy(true);
|
||||
hz = false;
|
||||
Log.i(this.getClass().getName(), " onDestroyView");
|
||||
}
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
presenter.onDestroy(false); // TODO isChangingConfigurations
|
||||
Log.i(this.getClass().getName(), " onDestroy");
|
||||
presenter.onDestroy(false);
|
||||
}
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
Log.i(this.getClass().getName(), " onDetach");
|
||||
}
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
presenter.onSaveInstanceState(outState);
|
||||
Log.i(this.getClass().getName(), " onSaveInstanceState");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -48,17 +48,14 @@ public class SetListFragment extends Fragment implements com.hikapro.backpack.vi
|
|||
throw new ClassCastException(activity.toString()
|
||||
+ " must implement activityCallback");
|
||||
}
|
||||
Log.i(this.toString(), "onAttach");
|
||||
}
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Log.i(this.toString(), "onCreate");
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Log.i(this.toString(), "onCreateView");
|
||||
presenter.setView(this);
|
||||
View view = presenter.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
|
@ -68,44 +65,36 @@ public class SetListFragment extends Fragment implements com.hikapro.backpack.vi
|
|||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
Log.i(this.toString(), "onActivityCreated");
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Log.i(this.toString(), "onStart");
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Log.i(this.toString(), "onResume");
|
||||
}
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
Log.i(this.toString(), "onPause");
|
||||
}
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
Log.i(this.toString(), "onStop");
|
||||
}
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
presenter.onDestroy(true); // TODO isChangingConfigurations
|
||||
Log.i(this.toString(), "onDestroyView");
|
||||
presenter.onDestroy(true);
|
||||
}
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
presenter.onDestroy(false); // TODO isChangingConfigurations
|
||||
Log.i(this.toString(), "onDestroy");
|
||||
presenter.onDestroy(false);
|
||||
}
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
Log.i(this.toString(), "onDetach");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -133,13 +122,11 @@ public class SetListFragment extends Fragment implements com.hikapro.backpack.vi
|
|||
}
|
||||
|
||||
|
||||
//GLM_add_resources_SetList
|
||||
@Override
|
||||
public void onStartDrag(RecyclerView.ViewHolder viewHolder) {
|
||||
presenter.onStartDrag(viewHolder);
|
||||
}
|
||||
|
||||
//GLM_add_resources_SetList
|
||||
@Override
|
||||
public OnStartDragListener getOnStartDragListener() {
|
||||
return this;
|
||||
|
|
|
@ -2,15 +2,14 @@ package com.hikapro.backpack.view.fragments;
|
|||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.hikapro.backpack.R;
|
||||
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()
|
||||
+ " must implement activityCallback");
|
||||
}
|
||||
Log.i(this.toString(), "onAttach");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.hikapro.backpack.view.recycler;
|
|||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
|
|
@ -3,13 +3,11 @@ package com.hikapro.backpack.view.recycler;
|
|||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.hikapro.backpack.R;
|
||||
import com.hikapro.backpack.presenter.adapters.helper.items.swipe2.SwipableElement;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,6 @@ public class SetViewHolder extends RecyclerView.ViewHolder implements ItemTouchH
|
|||
cardContent = (ViewGroup) view.findViewById(R.id.card_content);
|
||||
}
|
||||
|
||||
//GLM_add_resources_SetList
|
||||
@Override
|
||||
public void onItemClear() {
|
||||
cardContent.setBackgroundColor(cardView.getResources().getColor(R.color.colorListBackground));
|
||||
|
@ -48,7 +47,6 @@ public class SetViewHolder extends RecyclerView.ViewHolder implements ItemTouchH
|
|||
drawable = null;
|
||||
}
|
||||
|
||||
//GLM_add_resources_SetList
|
||||
@Override
|
||||
public void onItemSelected() {
|
||||
this.drawable = cardContent.getBackground();
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
android:actionViewClass="android.widget.SearchView"
|
||||
android:visible="true"
|
||||
android:title="@string/menu_search"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_add"
|
||||
android:icon="@drawable/ic_add_white_36dp"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="packed">Собрано</string>
|
||||
<string name="what_in_bag">Показать вещи в рюкзаке ↓</string>
|
||||
|
||||
|
@ -41,6 +42,7 @@
|
|||
<string name="please_wait">Пожалуйста, подождите</string>
|
||||
<string name="cannot_post">Постинг недоступен. Пожалуйста, проверьте Ваше соединение с Интернетом.</string>
|
||||
<string name="loading">Загрузка...</string>
|
||||
<string name="sync_failed">Ошибка синхронизации</string>
|
||||
|
||||
<string name="dlg_restore_header">Восстановить список</string>
|
||||
<string name="dlg_restore_txt">Уверены, что хотите восстановить список? Удалённые Вами предметы будут восстановлены, а добавленные удалены.</string>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<string name="leave_at_home_button">LEAVE AT HOME</string>
|
||||
<string name="add_to_bag_button">ADD TO BAG</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_error2">Posting to twitter failed!</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="cannot_post">Posting is not available. Please, check your internet connection.</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_txt">Do you want to restore this list? Items you have added will be removed, while deleted items will be added back.</string>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<integer name="duration">200</integer>
|
||||
<integer name="valueTransitionXplus">768</integer>
|
||||
<integer name="valueTransitionXminus">-768</integer>
|
||||
<integer name="valueTransitionXplus">720</integer>
|
||||
<integer name="valueTransitionXminus">-720</integer>
|
||||
|
||||
<integer name="valueTransitionYplus">1024</integer>
|
||||
<integer name="valueTransitionYminus">-1024</integer>
|
||||
|
|
|
@ -6,6 +6,7 @@ buildscript {
|
|||
}
|
||||
dependencies {
|
||||
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
|
||||
// in the individual module build.gradle files
|
||||
|
|
Loading…
Reference in New Issue