Settings - Changes users password + Photo

This commit is contained in:
Sagi Dayan 2016-07-09 04:19:00 +03:00
commit c1e05033d5
46 changed files with 835 additions and 533 deletions

View file

@ -2,6 +2,7 @@
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintButtonStyle" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintUseCompoundDrawables" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />

View file

@ -1,11 +1,12 @@
<component name="libraryTable">
<library name="animated-vector-drawable-23.4.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.4.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.4.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.4.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/animated-vector-drawable/23.4.0/animated-vector-drawable-23.4.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/animated-vector-drawable/23.4.0/animated-vector-drawable-23.4.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/animated-vector-drawable/23.4.0/animated-vector-drawable-23.4.0-sources.jar!/" />
</SOURCES>

View file

@ -4,11 +4,12 @@
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.4.0/appcompat-v7-23.4.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.4.0/appcompat-v7-23.4.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.4.0/appcompat-v7-23.4.0-sources.jar!/" />
</SOURCES>

View file

@ -4,11 +4,12 @@
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/design/23.4.0/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/design/23.4.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/design/23.4.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/design/23.4.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/design/23.4.0/design-23.4.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/design/23.4.0/design-23.4.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/design/23.4.0/design-23.4.0-sources.jar!/" />
</SOURCES>

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="firebase-analytics-impl-9.2.0">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-analytics-impl/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-analytics-impl/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-analytics-impl/9.2.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="firebase-auth-9.2.0">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-auth/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-auth/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-auth/9.2.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="firebase-auth-common-9.2.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-auth-common/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-auth-common/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-auth-common/9.2.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="firebase-auth-module-9.2.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-auth-module/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-auth-module/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-auth-module/9.2.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="firebase-config-9.2.0">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-config/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-config/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-config/9.2.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="firebase-crash-9.2.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-crash/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-crash/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-crash/9.2.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="firebase-database-9.2.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-database/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-database/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-database/9.2.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="firebase-messaging-9.2.0">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-messaging/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-messaging/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-messaging/9.2.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="firebase-storage-9.2.0">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-storage/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-storage/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-storage/9.2.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="firebase-storage-common-9.2.0">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-storage-common/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-storage-common/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.firebase/firebase-storage-common/9.2.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -5,11 +5,12 @@
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/mediarouter-v7/23.0.0/jars/libs/internal_impl-23.0.0.jar!/" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/mediarouter-v7/23.0.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/mediarouter-v7/23.0.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/mediarouter-v7/23.0.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/mediarouter-v7/23.0.0/mediarouter-v7-23.0.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/mediarouter-v7/23.0.0/mediarouter-v7-23.0.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/mediarouter-v7/23.0.0/mediarouter-v7-23.0.0-sources.jar!/" />
</SOURCES>

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="play-services-9.2.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services/9.2.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="play-services-appindexing-9.2.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-appindexing/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-appindexing/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-appindexing/9.2.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="play-services-auth-base-9.2.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-auth-base/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-auth-base/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-auth-base/9.2.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="play-services-basement-9.2.0">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/9.2.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="play-services-cast-9.2.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-cast/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-cast/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-cast/9.2.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="play-services-contextmanager-9.2.0">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-contextmanager/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-contextmanager/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-contextmanager/9.2.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="play-services-location-9.2.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-location/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-location/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-location/9.2.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="play-services-plus-9.2.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-plus/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-plus/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-plus/9.2.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="play-services-tagmanager-api-9.2.0">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-tagmanager-api/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-tagmanager-api/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-tagmanager-api/9.2.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="play-services-tasks-9.2.0">
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-tasks/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-tasks/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-tasks/9.2.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="play-services-vision-9.2.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-vision/9.2.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-vision/9.2.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-vision/9.2.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -4,11 +4,12 @@
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.4.0/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.4.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.4.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.4.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/recyclerview-v7/23.4.0/recyclerview-v7-23.4.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/recyclerview-v7/23.4.0/recyclerview-v7-23.4.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/recyclerview-v7/23.4.0/recyclerview-v7-23.4.0-sources.jar!/" />
</SOURCES>

View file

@ -1,10 +1,11 @@
<component name="libraryTable">
<library name="support-annotations-23.4.0">
<CLASSES>
<root url="jar://$USER_HOME$/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/23.4.0/support-annotations-23.4.0.jar!/" />
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/23.4.0/support-annotations-23.4.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/23.4.0/support-annotations-23.4.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/23.4.0/support-annotations-23.4.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/support-annotations/23.4.0/support-annotations-23.4.0-sources.jar!/" />
</SOURCES>

View file

@ -5,11 +5,12 @@
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.4.0/jars/libs/internal_impl-23.4.0.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.4.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.4.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.4.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0-sources.jar!/" />
</SOURCES>

View file

@ -6,6 +6,7 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-vector-drawable/23.4.0/support-vector-drawable-23.4.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-vector-drawable/23.4.0/support-vector-drawable-23.4.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/support-vector-drawable/23.4.0/support-vector-drawable-23.4.0-sources.jar!/" />
</SOURCES>

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="volley-1.0.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.volley/volley/1.0.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.volley/volley/1.0.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.volley/volley/1.0.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>

View file

@ -27,7 +27,7 @@ import java.util.List;
*/
public class GPSUtils extends Service implements LocationListener {
private static final String TAG ="GPSUtils" ;
private static final String TAG = "GPSUtils";
private final Context mContext;
// flag for GPS status
@ -53,7 +53,7 @@ public class GPSUtils extends Service implements LocationListener {
getLocation();
}
// public Location getLocation() {
// public Location getLocation() {
// LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
// if (locationManager != null) {
// Location lastKnownLocationGPS = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
@ -69,14 +69,14 @@ public class GPSUtils extends Service implements LocationListener {
// return null;
// }
public Location getLocation() {
try {
Log.d("TAG","in get location");
locationManager =
(LocationManager) mContext
.getSystemService(LOCATION_SERVICE);
try {
Log.d("TAG", "in get location");
locationManager =
(LocationManager) mContext
.getSystemService(LOCATION_SERVICE);
// getting GPS status
isGPSEnabled = locationManager
// getting GPS status
isGPSEnabled = locationManager
.isProviderEnabled(LocationManager.GPS_PROVIDER);
// getting network status
@ -91,10 +91,10 @@ public class GPSUtils extends Service implements LocationListener {
if (isNetworkEnabled) {
if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
Log.e("TAG", "No Permissions");
((MainActivity)mContext).setLocationPermission(false);
Utils.setLocationPermission(false);
return null;
}else{
((MainActivity)mContext).setLocationPermission(true);
} else {
Utils.setLocationPermission(true);
}
Log.d(TAG, "Network");
if (locationManager != null) {
@ -120,9 +120,8 @@ public class GPSUtils extends Service implements LocationListener {
}
}
}
}
else{
location = locationManager.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER);
} else {
location = locationManager.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER);
}
}
@ -133,7 +132,7 @@ public class GPSUtils extends Service implements LocationListener {
return location;
}
public void showSettingsAlert(){
public void showSettingsAlert() {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
// Setting Dialog Title
@ -144,7 +143,7 @@ public class GPSUtils extends Service implements LocationListener {
// On pressing Settings button
alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which) {
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
mContext.startActivity(intent);
}
@ -188,13 +187,13 @@ public class GPSUtils extends Service implements LocationListener {
return null;
}
public List<Address> getFromLocation(double latitude, double longitude, int maxResults){
public List<Address> getFromLocation(double latitude, double longitude, int maxResults) {
try {
List<Address> addresses;
geocoder = new Geocoder(mContext);
if (latitude != 0 || longitude != 0) {
addresses = geocoder.getFromLocation(latitude ,
addresses = geocoder.getFromLocation(latitude,
longitude, maxResults);
return addresses;
@ -212,11 +211,11 @@ public class GPSUtils extends Service implements LocationListener {
/**
* Function to get latitude
* */
public double getLatitude(){
if(location != null){
*/
public double getLatitude() {
if (location != null) {
latitude = location.getLatitude();
}else{
} else {
Log.d("Tag", "Got NULL");
}
@ -226,9 +225,9 @@ public class GPSUtils extends Service implements LocationListener {
/**
* Function to get longitude
* */
public double getLongitude(){
if(location != null){
*/
public double getLongitude() {
if (location != null) {
longitude = location.getLongitude();
}
@ -236,21 +235,20 @@ public class GPSUtils extends Service implements LocationListener {
return longitude;
}
public Location getLastKnownLocation(){
public Location getLastKnownLocation() {
if (location == null)
return getLocation();
return location;
}
public String getAddress() {
String address="";
String address = "";
List<Address> listAddress = getFromLocation(getLatitude(),getLongitude(),1);
List<Address> listAddress = getFromLocation(getLatitude(), getLongitude(), 1);
for (int i = 0; i <= listAddress.get(0).getMaxAddressLineIndex(); i++) {
listAddress.get(0).getAddressLine(i);
address += listAddress.get(0).getAddressLine(i)+" ";
address += listAddress.get(0).getAddressLine(i) + " ";
}
return address;
}

View file

@ -19,6 +19,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.ImageView;
@ -176,14 +177,15 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
final Note note = eventMarkerMap.get(marker);
final Dialog noteViewDialog = new Dialog(getActivity());
noteViewDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
noteViewDialog.setContentView(R.layout.note_display_full);
boolean isOwner = note.getOwnerId().equals(mainActivity.getUserId());
if (isOwner)
noteViewDialog.setTitle("You wrote...");
else
noteViewDialog.setTitle("Someone wrote...");
// if (isOwner)
// noteViewDialog.setTitle("You wrote...");
// else
// noteViewDialog.setTitle("Someone wrote...");
noteViewDialog.show();
@ -191,24 +193,29 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
final TextView title = (TextView) noteViewDialog.findViewById(R.id.ndf_title_textview);
final TextView body = (TextView) noteViewDialog.findViewById(R.id.ndf_body_textview);
final TextView time = (TextView) noteViewDialog.findViewById(R.id.ndf_time_textview);
final TextView date = (TextView) noteViewDialog.findViewById(R.id.ndf_date_textview);
final TextView location = (TextView) noteViewDialog.findViewById(R.id.ndf_address_textview);
final TextView likes = (TextView) noteViewDialog.findViewById(R.id.ndf_likes_textview);
final TextView tags = (TextView) noteViewDialog.findViewById(R.id.ndf_tags_textview);
// final TextView tags = (TextView) noteViewDialog.findViewById(R.id.ndf_tags_textview);
final TextView permission = (TextView) noteViewDialog.findViewById(R.id.ndf_permission_textview);
final ImageView avatar = (ImageView) noteViewDialog.findViewById(R.id.note_user_avatar);
final ImageView permissionImg = (ImageView) noteViewDialog.findViewById(R.id.permission_image);
final ImageButton deleteBtn = (ImageButton) noteViewDialog.findViewById(R.id.ndf_delete_imagebutton);
title.setText(note.getTitle());
body.setText(note.getBody());
time.setText(note.getTimestamp());
location.setText("Address: " + note.getAddress());
likes.setText("Likes: " + note.getLikes());
tags.setText("Tags: " + note.getTags().toString());
time.setText(note.getTime());
date.setText(note.getDate());
location.setText("" + note.getAddress());
likes.setText("" + note.getLikes());
// tags.setText("Tags: " + note.getTags().toString());
Utils.URLtoImageView(avatar, note.getAvatar());
if (isOwner) {
permission.setText("Permission: " + (note.isPublic() ? "Public" : "Private"));
permission.setText("" + (note.isPublic() ? "Public" : "Private"));
} else {
permissionImg.setVisibility(View.INVISIBLE);
permission.setText("");
deleteBtn.setBackgroundResource(R.drawable.like_icon);
}
@ -315,7 +322,7 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
}
}
};
private class getMarkersFromNotes extends AsyncTask<List<Note>, MarkerNoteStruct, Void> {

View file

@ -3,6 +3,8 @@ package com.android_app.matan.ara.sagi.thesocialnotework;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
@ -40,6 +42,8 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList
private final String LOGIN_PATH = "/login";
private LoginActivity self; //this
protected LinearLayout layout;
private boolean permissionsReturend = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -59,6 +63,9 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList
this.mLoginButton.setOnClickListener(this);
this.mLoginButton.setEnabled(false);
//check for permission
// while(!permissionsReturend);
}
private void removeFocuse() {
@ -220,5 +227,42 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList
public void afterTextChanged(Editable editable) {
}
// @Override
// public void onRequestPermissionsResult(int requestCode,
// String permissions[], int[] grantResults) {
// permissionsReturend = true;
// Log.d(TAG, "onRequestPermissionsResult: in func");
// switch (requestCode) {
// case FINE_PERM: {
// // If request is cancelled, the result arrays are empty.
// if (grantResults.length > 0
// && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// Log.d(TAG, "onRequestPermissionsResult: got permission for location");
// Utils.setLocationPermission(true);
// ActivityCompat.requestPermissions(LoginActivity.this, new String[]{android.Manifest.permission.CAMERA}, CAMERA_PERM);
// } else {
// Log.d(TAG, "onRequestPermissionsResult:DIDNT get permission for location");
//
// Toast.makeText(LoginActivity.this,"No Location Permissions granted.\n\"An App is nothing without its permissions\"",Toast.LENGTH_LONG);
//// System.exit(0);
// }
// return;
// }
// case CAMERA_PERM: {
// if (grantResults.length > 0
// && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// Log.d(TAG, "onRequestPermissionsResult: got permission for camera");
// Utils.setCameraPermission(true);
//
//
// } else {
// Log.d(TAG, "onRequestPermissionsResult: DIDNT get permission for camera");
// Toast.makeText(LoginActivity.this,"No Camera Permissions granted.\n\"An App is nothing without its permissions\"",Toast.LENGTH_LONG);
// }
// return;
// }
// }
// }
}

View file

@ -1,9 +1,11 @@
package com.android_app.matan.ara.sagi.thesocialnotework;
import android.*;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
@ -11,6 +13,7 @@ import android.os.Bundle;
import android.os.StrictMode;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.LayoutInflater;
@ -40,177 +43,207 @@ import java.util.Date;
import java.util.List;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
public static final String LOCAL_DATA_TSN = "TSN_DATA_STORE";
protected final String TAG = "[TSN / MainActivity]";
protected User user;
private GPSUtils gpsUtils;
private boolean locationPermission;
private GmapFragment gmapFragment;
private PersonalFragment personalFragment;
private SettingsFragment settingsFragment;
private Toolbar toolbar;
public static final String BASE_URL = "http://thesocialnotework-api.appspot.com/api";
private ImageView menu_avatar;
implements NavigationView.OnNavigationItemSelectedListener {
public static final String LOCAL_DATA_TSN = "TSN_DATA_STORE";
protected final String TAG = "[TSN / MainActivity]";
protected User user;
private GPSUtils gpsUtils;
private boolean locationPermission;
private GmapFragment gmapFragment;
private PersonalFragment personalFragment;
private SettingsFragment settingsFragment;
private Toolbar toolbar;
public static final String BASE_URL = "http://thesocialnotework-api.appspot.com/api";
private ImageView menu_avatar;
private MainActivity self;
private NavigationView nav_view;
private final int FINE_PERM = 0, CAMERA_PERM = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.self = this;
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("Personal Notes");
setSupportActionBar(toolbar);
gmapFragment = new GmapFragment();
personalFragment = new PersonalFragment();
settingsFragment = new SettingsFragment();
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.self = this;
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("Personal Notes");
setSupportActionBar(toolbar);
gmapFragment = new GmapFragment();
personalFragment = new PersonalFragment();
settingsFragment = new SettingsFragment();
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
//get Bundle data (UserString)
Bundle b = getIntent().getExtras();
this.user = new User(b.getString("UserData"));
//Get The Nav_View Avatar View
nav_view = (NavigationView) findViewById(R.id.nav_view);
View header_v = nav_view.getHeaderView(0);
menu_avatar = (ImageView) header_v.findViewById(R.id.nav_user_avatar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
//get Bundle data (UserString)
Bundle b = getIntent().getExtras();
this.user = new User(b.getString("UserData"));
//Get The Nav_View Avatar View
nav_view = (NavigationView) findViewById(R.id.nav_view);
View header_v = nav_view.getHeaderView(0);
menu_avatar = (ImageView)header_v.findViewById(R.id.nav_user_avatar);
//Change Layout
Log.d(TAG, "Changing Fragment to Personal Activity");
//Change Layout
Log.d(TAG, "Changing Fragment to Personal Activity");
// PersonalFragment personalFragment = new PersonalFragment();
personalFragment.setArguments(b);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.fragment_container, personalFragment);
ft.commit();
Log.d(TAG, "Changed");
gpsUtils = new GPSUtils(this);
gpsUtils.getLocation();
personalFragment.setArguments(b);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.fragment_container, personalFragment);
ft.commit();
Log.d(TAG, "Changed");
gpsUtils = new GPSUtils(this);
gpsUtils.getLocation();
//Change The Avatar
Utils.URLtoImageView(menu_avatar, user.getAvatar());
//Change The Avatar
Utils.URLtoImageView(menu_avatar, user.getAvatar());
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Bundle b = new Bundle();
int id = item.getItemId();
if (id == R.id.nav_explore) {
toolbar.setTitle("Explore");
setSupportActionBar(toolbar);
} else if (id == R.id.nav_map) {
Log.d(TAG, "Before going to map");
toolbar.setTitle("Map");
setSupportActionBar(toolbar);
ft.replace(R.id.fragment_container, gmapFragment);
ft.commit();
} else if (id == R.id.nav_personal) {
Log.d(TAG, "Before going to personal");
ft.replace(R.id.fragment_container, personalFragment);
ft.commit();
} else if (id == R.id.nav_settings) {
toolbar.setTitle("Settings");
setSupportActionBar(toolbar);
ft.replace(R.id.fragment_container, settingsFragment);
ft.commit();
} else if (id == R.id.nav_logout) {
SharedPreferences sharedPref = this.getSharedPreferences(MainActivity.LOCAL_DATA_TSN, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.remove("UserData");
editor.commit();
Intent loginActivity = new Intent(MainActivity.this, LoginActivity.class);
startActivity(loginActivity);
finish();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Bundle b = new Bundle();
int id = item.getItemId();
if (id == R.id.nav_explore) {
toolbar.setTitle("Explore");
setSupportActionBar(toolbar);
} else if (id == R.id.nav_map) {
Log.d(TAG,"Before going to map");
toolbar.setTitle("Map");
setSupportActionBar(toolbar);
ft.replace(R.id.fragment_container, gmapFragment);
ft.commit();
} else if (id == R.id.nav_personal) {
Log.d(TAG,"Before going to personal");
ft.replace(R.id.fragment_container, personalFragment);
ft.commit();
} else if (id == R.id.nav_settings) {
toolbar.setTitle("Settings");
setSupportActionBar(toolbar);
ft.replace(R.id.fragment_container, settingsFragment);
ft.commit();
} else if (id == R.id.nav_logout) {
SharedPreferences sharedPref = this.getSharedPreferences(MainActivity.LOCAL_DATA_TSN, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.remove("UserData");
editor.commit();
Intent loginActivity = new Intent(MainActivity.this, LoginActivity.class);
startActivity(loginActivity);
finish();
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
public GPSUtils getGPSUtils() {
return this.gpsUtils;
}
public void setLocationPermission(boolean locationPermission) {
this.locationPermission = locationPermission;
}
public GPSUtils getGPSUtils() {
return this.gpsUtils;
}
public User getUser(){
public User getUser() {
return user;
}
public String getUserId(){return user.getId();}
public String getUserId() {
return user.getId();
}
public void updateNavAvatar(){
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
Log.d(TAG, "onRequestPermissionsResult: in func");
switch (requestCode) {
case FINE_PERM: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 2) {
if (!(grantResults[0] == PackageManager.PERMISSION_GRANTED)) {
Log.d(TAG, "onRequestPermissionsResult: Did Not get permission for location");
Toast.makeText(MainActivity.this, "No Location Permissions granted.\n\"An App is nothing without its permissions\"", Toast.LENGTH_LONG).show();
System.exit(0);
}
if (!(grantResults[1] == PackageManager.PERMISSION_GRANTED)) {
Log.d(TAG, "onRequestPermissionsResult:DIDNT get permission for camera");
Toast.makeText(MainActivity.this, "No Camera Permissions granted.\nyou will not be able to change avatar", Toast.LENGTH_LONG).show();
Utils.setCameraPermission(false);
} else {
Utils.setCameraPermission(true);
}
if (grantResults[2] != PackageManager.PERMISSION_GRANTED) {
Log.d(TAG, "onRequestPermissionsResult:DIDNT get READ\\WRITE External storage permission");
Toast.makeText(MainActivity.this, "No READ\\WRITE External storage Permissions granted.\nyou will not be able to change avatar", Toast.LENGTH_LONG).show();
Utils.setCameraPermission(false);
} else {
Utils.setCameraPermission(true);
}
return;
}
}
}
}
public void updateNavAvatar() {
//Change The Avatar
Log.d(TAG, "updateNavAvatar: PINPINPINPIN");
Utils.URLtoImageView(menu_avatar, user.getAvatar());
Toast.makeText(this, "Profile Updated!", Toast.LENGTH_LONG).show();
}
}

View file

@ -212,7 +212,7 @@ public class Note implements Parcelable {
}
public String getDate() {
Date d = new Date();
Date d = new Date(timestamp);
DateFormat format = new SimpleDateFormat("dd MMM yyy");
return format.format(d);
}

View file

@ -19,6 +19,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.Button;
@ -50,173 +51,187 @@ import java.util.List;
*/
public class PersonalFragment extends Fragment {
protected ListView noteList;
private final int FINE_PERM = 0;
private final String BASE_URL = "http://thesocialnotework-api.appspot.com/api";
private GPSUtils gpsUtils;
private List<Note> listOfNotes;
private ListAdapter noteListAdapter;
private String userId;
private final String TAG = "[TSN/PersonalFragment]";
private MainActivity activity;
public PersonalFragment() {
// Required empty public constructor
}
protected ListView noteList;
private final String BASE_URL = "http://thesocialnotework-api.appspot.com/api";
private GPSUtils gpsUtils;
private List<Note> listOfNotes;
private ListAdapter noteListAdapter;
private String userId;
private final String TAG = "[TSN/PersonalFragment]";
private MainActivity activity;
private final int FINE_PERM = 0, CAMERA_PERM = 1;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_personal, container, false);
// Inflate the layout for this fragment
activity = (MainActivity) getActivity();
Bundle bundle = getArguments();
this.userId = activity.getUserId();
Log.d(TAG, "onCreateView: userID: " + userId);
//check for permission
ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, FINE_PERM);
public PersonalFragment() {
// Required empty public constructor
}
this.noteList = (ListView) view.findViewById(R.id.ps_list_listview);
gpsUtils = activity.getGPSUtils();
gpsUtils.getLocation();
listOfNotes = new ArrayList<>();
noteListAdapter = new ListAdapter(getContext(), listOfNotes);
noteList.setAdapter(noteListAdapter);
noteList.setOnItemClickListener(new ItemClickedListener());
Utils.showLoadingDialog(getActivity(), "Fetching..", "getting your notes");
getAllNotes();
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_personal, container, false);
// Inflate the layout for this fragment
activity = (MainActivity) getActivity();
Bundle bundle = getArguments();
this.userId = activity.getUserId();
Log.d(TAG, "onCreateView: userID: " + userId);
ActivityCompat.requestPermissions(activity, new String[]{
android.Manifest.permission.ACCESS_FINE_LOCATION,
android.Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE
},
FINE_PERM
);
// ActivityCompat.requestPermissions(activity, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, FINE_PERM);
// if (!Utils.arePermissionsGranted()) {
// Toast.makeText(getContext(), "Missing some Permissions...\nPlease go to app info and enable them", Toast.LENGTH_LONG).show();
// }
this.noteList = (ListView) view.findViewById(R.id.ps_list_listview);
gpsUtils = activity.getGPSUtils();
gpsUtils.getLocation();
listOfNotes = new ArrayList<>();
noteListAdapter = new ListAdapter(getContext(), listOfNotes);
noteList.setAdapter(noteListAdapter);
noteList.setOnItemClickListener(new ItemClickedListener());
Utils.showLoadingDialog(getActivity(), "Fetching..", "getting your notes");
getAllNotes();
//https://thesocialnotework-api.appspot.com/api/note/all?uid=<USER_ID>
// The New "Add Button"
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);
fab.setOnClickListener(addNewNoteDialog);
// The New "Add Button"
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);
fab.setOnClickListener(addNewNoteDialog);
return view;
}
return view;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
Utils.dismissLoadingDialog();
Log.d(TAG, "onAttach");
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
Utils.dismissLoadingDialog();
Log.d(TAG, "onAttach");
}
@Override
public void onDetach() {
super.onDetach();
Utils.dismissLoadingDialog();
}
@Override
public void onDetach() {
super.onDetach();
Utils.dismissLoadingDialog();
}
public void getAllNotes() {
Log.d(TAG, "url: " + BASE_URL + "/note/all?uid=" + userId);
VolleyUtilSingleton.getInstance(getActivity()).get(BASE_URL + "/note/all?uid=" + userId, getNotesSuccessListener, Utils.genericErrorListener);
}
public void getAllNotes() {
Log.d(TAG, "url: " + BASE_URL + "/note/all?uid=" + userId);
VolleyUtilSingleton.getInstance(getActivity()).get(BASE_URL + "/note/all?uid=" + userId, getNotesSuccessListener, Utils.genericErrorListener);
}
private View.OnClickListener addNewNoteDialog = new View.OnClickListener() {
private View.OnClickListener addNewNoteDialog = new View.OnClickListener() {
public void onClick(View v) {
//create and configure dialog
final Dialog dialog = new Dialog(getActivity());
dialog.setContentView(R.layout.note_view_full);
dialog.setTitle("New Note");
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(dialog.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
dialog.setCancelable(false);
dialog.show();
dialog.getWindow().setAttributes(lp);
//get note_view_full layout elements
final Switch permissionSwitch = (Switch) dialog.findViewById(R.id.nvf_note_permission);
final EditText newTitle = (EditText) dialog.findViewById(R.id.nvf_note_title);
final EditText newBody = (EditText) dialog.findViewById(R.id.nvf_note_content);
Button saveBtn = (Button) dialog.findViewById(R.id.nvf_note_submit_btn);
Button cancelBtn = (Button) dialog.findViewById(R.id.nvf_note_cancel_btn);
cancelBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
dialog.dismiss();
}
});
saveBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//create and configure dialog
final Dialog dialog = new Dialog(getActivity());
dialog.setContentView(R.layout.note_view_full);
dialog.setTitle("New Note");
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(dialog.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
dialog.setCancelable(false);
dialog.show();
dialog.getWindow().setAttributes(lp);
//title too short
if (newTitle.getText().length() == 0) {
Toast toast = Toast.makeText(getActivity(), "Title too short.", Toast.LENGTH_LONG);
toast.show();
return;
}
//title too long
if (newTitle.getText().length() > 20) {
Toast toast = Toast.makeText(getActivity(), "Title too long.\n Use up to 20 notes.", Toast.LENGTH_LONG);
toast.show();
return;
}
//volley post
final JSONObject noteJson = new JSONObject();
try {
//get note_view_full layout elements
final Switch permissionSwitch = (Switch) dialog.findViewById(R.id.nvf_note_permission);
final EditText newTitle = (EditText) dialog.findViewById(R.id.nvf_note_title);
final EditText newBody = (EditText) dialog.findViewById(R.id.nvf_note_content);
Button saveBtn = (Button) dialog.findViewById(R.id.nvf_note_submit_btn);
Button cancelBtn = (Button) dialog.findViewById(R.id.nvf_note_cancel_btn);
cancelBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
dialog.dismiss();
}
});
saveBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//title too short
if (newTitle.getText().length() == 0) {
Toast toast = Toast.makeText(getActivity(), "Title too short.", Toast.LENGTH_LONG);
toast.show();
return;
}
//title too long
if (newTitle.getText().length() > 20) {
Toast toast = Toast.makeText(getActivity(), "Title too long.\n Use up to 20 notes.", Toast.LENGTH_LONG);
toast.show();
return;
}
//volley post
final JSONObject noteJson = new JSONObject();
try {
//TODO need to get owner id from login screen
noteJson.put("owner_id", userId);
noteJson.put("title", newTitle.getText());
noteJson.put("lat", gpsUtils.getLatitude());
noteJson.put("lng", gpsUtils.getLongitude());
noteJson.put("address", gpsUtils.getAddress());
noteJson.put("body", newBody.getText());
noteJson.put("is_public", permissionSwitch.isChecked());
//TODO need to get owner id from login screen
noteJson.put("owner_id", userId);
noteJson.put("title", newTitle.getText());
noteJson.put("lat", gpsUtils.getLatitude());
noteJson.put("lng", gpsUtils.getLongitude());
noteJson.put("address", gpsUtils.getAddress());
noteJson.put("body", newBody.getText());
noteJson.put("is_public", permissionSwitch.isChecked());
// noteJson.put("tags",);
Log.d(TAG, "Json: " + noteJson.toString());
Log.d(TAG, "Json: " + noteJson.toString());
} catch (Exception e) {
Log.d(TAG, "saveBtn: " + e.toString());
}
//send request and close dialog
VolleyUtilSingleton.getInstance(getActivity()).post(BASE_URL + "/note/upsert", noteJson, newNoteSuccessListener, Utils.genericErrorListener);
dialog.dismiss();
}
});
//change text of switch according to state.
permissionSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked)
permissionSwitch.setText(R.string.nvf_public_label);
else
permissionSwitch.setText(R.string.nvf_private_label);
}
});
} catch (Exception e) {
Log.d(TAG, "saveBtn: " + e.toString());
}
//send request and close dialog
VolleyUtilSingleton.getInstance(getActivity()).post(BASE_URL + "/note/upsert", noteJson, newNoteSuccessListener, Utils.genericErrorListener);
dialog.dismiss();
}
};
//response listener for adding new note
Response.Listener<JSONObject> newNoteSuccessListener = new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.d(TAG, "newNoteSuccess: response - " + response.toString());
try {
Date time = new Date();
JSONObject noteObject = response.getJSONObject("note");
time.setTime(noteObject.getLong("created_at"));
addNoteFromJsonObj(noteObject, time);
noteList.setAdapter(noteListAdapter);
} catch (Exception e) {
Log.e(TAG, "newNoteSuccess:" + e.getMessage());
}
});
//change text of switch according to state.
permissionSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked)
permissionSwitch.setText(R.string.nvf_public_label);
else
permissionSwitch.setText(R.string.nvf_private_label);
}
};
});
}
};
//response listener for adding new note
Response.Listener<JSONObject> newNoteSuccessListener = new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.d(TAG, "newNoteSuccess: response - " + response.toString());
try {
Date time = new Date();
JSONObject noteObject = response.getJSONObject("note");
time.setTime(noteObject.getLong("created_at"));
addNoteFromJsonObj(noteObject, time);
noteList.setAdapter(noteListAdapter);
} catch (Exception e) {
Log.e(TAG, "newNoteSuccess:" + e.getMessage());
}
}
};
// //response Error listener for adding new note
@ -228,29 +243,30 @@ public class PersonalFragment extends Fragment {
// };
//response listener for getting all user notes
Response.Listener<JSONObject> getNotesSuccessListener = new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.d(TAG, "getNotesSuccessListener: " + response.toString());
Utils.dismissLoadingDialog();
try {
//need to get all notes and add to listOfNotes
JSONArray noteObjectsArray = response.getJSONArray("notes");
Date time = new Date();
for (int i = 0; i < noteObjectsArray.length(); i++) {
JSONObject noteObject = noteObjectsArray.getJSONObject(i);
time.setTime(noteObject.getLong("created_at"));
addNoteFromJsonObj(noteObject, time);
}
noteList.setAdapter(noteListAdapter);
} catch (Exception e) {
Log.e(TAG, "newNoteSuccess:" + e.getMessage());
}
//response listener for getting all user notes
Response.Listener<JSONObject> getNotesSuccessListener = new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.d(TAG, "getNotesSuccessListener: " + response.toString());
Utils.dismissLoadingDialog();
try {
//need to get all notes and add to listOfNotes
JSONArray noteObjectsArray = response.getJSONArray("notes");
activity.getUser().setNumber_of_notes(noteObjectsArray.length());
Date time = new Date();
for (int i = 0; i < noteObjectsArray.length(); i++) {
JSONObject noteObject = noteObjectsArray.getJSONObject(i);
time.setTime(noteObject.getLong("created_at"));
addNoteFromJsonObj(noteObject, time);
}
};
noteList.setAdapter(noteListAdapter);
} catch (Exception e) {
Log.e(TAG, "newNoteSuccess:" + e.getMessage());
}
}
};
// //response ErrorListener for getting all user notes
@ -273,125 +289,126 @@ public class PersonalFragment extends Fragment {
// };
private ArrayList<String> jsonArrayToStringArray(JSONArray jArray) {
ArrayList<String> stringArray = new ArrayList<String>();
for (int i = 0, count = jArray.length(); i < count; i++) {
try {
JSONObject jsonObject = jArray.getJSONObject(i);
stringArray.add(jsonObject.toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
return stringArray;
private ArrayList<String> jsonArrayToStringArray(JSONArray jArray) {
ArrayList<String> stringArray = new ArrayList<String>();
for (int i = 0, count = jArray.length(); i < count; i++) {
try {
JSONObject jsonObject = jArray.getJSONObject(i);
stringArray.add(jsonObject.toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
return stringArray;
}
private void addNoteFromJsonObj(JSONObject noteObject, Date time) throws JSONException {
Note addNote = new Note(
noteObject.getString("id"),
Float.parseFloat(noteObject.getJSONObject("location").getString("lat")),
Float.parseFloat(noteObject.getJSONObject("location").getString("lng")),
noteObject.getJSONObject("location").getString("address"),
noteObject.getString("title"),
noteObject.getString("body"),
time.toString(),
noteObject.getBoolean("is_public"),
noteObject.getInt("likes"),
noteObject.getString("avatar"),
noteObject.getString("owner_id"),
jsonArrayToStringArray(noteObject.getJSONArray("tags"))
);
listOfNotes.add(addNote);
}
// click on listView item
class ItemClickedListener implements AdapterView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
//create and configure dialog
final Note note = listOfNotes.get(position);
final Dialog noteViewDialog = new Dialog(getActivity());
noteViewDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
noteViewDialog.setContentView(R.layout.note_display_full);
// noteViewDialog.setTitle("You wrote...");
private void addNoteFromJsonObj(JSONObject noteObject, Date time) throws JSONException {
Note addNote = new Note(
noteObject.getString("id"),
Float.parseFloat(noteObject.getJSONObject("location").getString("lat")),
Float.parseFloat(noteObject.getJSONObject("location").getString("lng")),
noteObject.getJSONObject("location").getString("address"),
noteObject.getString("title"),
noteObject.getString("body"),
time.toString(),
noteObject.getBoolean("is_public"),
noteObject.getInt("likes"),
noteObject.getString("avatar"),
noteObject.getString("owner_id"),
jsonArrayToStringArray(noteObject.getJSONArray("tags"))
);
listOfNotes.add(addNote);
}
// click on listView item
class ItemClickedListener implements AdapterView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
//create and configure dialog
final Note note = listOfNotes.get(position);
final Dialog noteViewDialog = new Dialog(getActivity());
noteViewDialog.setContentView(R.layout.note_display_full);
noteViewDialog.setTitle("You wrote...");
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(noteViewDialog.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
noteViewDialog.show();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(noteViewDialog.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
noteViewDialog.show();
// dialog.getWindow().setAttributes(lp);
//get note_view_full layout elements
final TextView title = (TextView) noteViewDialog.findViewById(R.id.ndf_title_textview);
final TextView body = (TextView) noteViewDialog.findViewById(R.id.ndf_body_textview);
final TextView time = (TextView) noteViewDialog.findViewById(R.id.ndf_time_textview);
final TextView location = (TextView) noteViewDialog.findViewById(R.id.ndf_address_textview);
final TextView likes = (TextView) noteViewDialog.findViewById(R.id.ndf_likes_textview);
final TextView tags = (TextView) noteViewDialog.findViewById(R.id.ndf_tags_textview);
final TextView permission = (TextView) noteViewDialog.findViewById(R.id.ndf_permission_textview);
final ImageButton deleteBtn = (ImageButton) noteViewDialog.findViewById(R.id.ndf_delete_imagebutton);
final ImageView avatar = (ImageView) noteViewDialog.findViewById(R.id.note_user_avatar);
//get note_view_full layout elements
final TextView title = (TextView) noteViewDialog.findViewById(R.id.ndf_title_textview);
final TextView body = (TextView) noteViewDialog.findViewById(R.id.ndf_body_textview);
final TextView time = (TextView) noteViewDialog.findViewById(R.id.ndf_time_textview);
final TextView date = (TextView) noteViewDialog.findViewById(R.id.ndf_date_textview);
final TextView location = (TextView) noteViewDialog.findViewById(R.id.ndf_address_textview);
final TextView likes = (TextView) noteViewDialog.findViewById(R.id.ndf_likes_textview);
// final TextView tags = (TextView) noteViewDialog.findViewById(R.id.ndf_tags_textview);
final TextView permission = (TextView) noteViewDialog.findViewById(R.id.ndf_permission_textview);
final ImageButton deleteBtn = (ImageButton) noteViewDialog.findViewById(R.id.ndf_delete_imagebutton);
final ImageView avatar = (RoundAvatarImageView) noteViewDialog.findViewById(R.id.note_user_avatar);
title.setText(note.getTitle());
body.setText(note.getBody());
time.setText(note.getTimestamp());
location.setText("Address: " + note.getAddress());
likes.setText("Likes: " + note.getLikes());
tags.setText("Tags: "+ note.getTags().toString());
permission.setText("Permission: " + (note.isPublic() ? "Public" : "Private"));
Utils.URLtoImageView(avatar, note.getAvatar());
title.setText(note.getTitle());
body.setText(note.getBody());
date.setText(note.getDate());
time.setText(note.getTime());
location.setText(note.getAddress());
if (likes != null) likes.setText("" + note.getLikes());
// tags.setText("Tags: "+ note.getTags().toString());
permission.setText("" + (note.isPublic() ? "Public" : "Private"));
Utils.URLtoImageView(avatar, note.getAvatar());
deleteBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//Put up the Yes/No message box
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder
.setTitle("Delete Note")
.setMessage("Are you sure you want to delete the note?")
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//Yes button clicked, do something
Toast.makeText(getActivity(), "Item Deleted!",
Toast.LENGTH_SHORT).show();
//TODO send delete
JSONObject delNote = new JSONObject();
try {
delNote.put("uid", userId);
delNote.put("nid", note.getId());
VolleyUtilSingleton.getInstance(getActivity()).post(BASE_URL + "/note/delete", delNote, Utils.deleteNoteSuccessListener, Utils.genericErrorListener);
listOfNotes.remove(position);
deleteBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//Put up the Yes/No message box
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder
.setTitle("Delete Note")
.setMessage("Are you sure you want to delete the note?")
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//Yes button clicked, do something
Toast.makeText(getActivity(), "Item Deleted!",
Toast.LENGTH_SHORT).show();
//TODO send delete
JSONObject delNote = new JSONObject();
try {
delNote.put("uid", userId);
delNote.put("nid", note.getId());
VolleyUtilSingleton.getInstance(getActivity()).post(BASE_URL + "/note/delete", delNote, Utils.deleteNoteSuccessListener, Utils.genericErrorListener);
activity.getUser().setNumber_of_notes(activity.getUser().getNumber_of_notes()-1);
listOfNotes.remove(position);
} catch (JSONException e) {
Toast.makeText(getActivity(), "Something went wrong.\n Failed to delete note...", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
noteList.setAdapter(noteListAdapter);
noteViewDialog.dismiss();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//Yes button clicked, do something
Toast.makeText(getActivity(), "Canceled",
Toast.LENGTH_SHORT).show();
noteViewDialog.dismiss();
}
}) //Do nothing on no
.show();
} catch (JSONException e) {
Toast.makeText(getActivity(), "Something went wrong.\n Failed to delete note...", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
});
noteList.setAdapter(noteListAdapter);
noteViewDialog.dismiss();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//Yes button clicked, do something
Toast.makeText(getActivity(), "Canceled",
Toast.LENGTH_SHORT).show();
noteViewDialog.dismiss();
}
}) //Do nothing on no
.show();
}
});
}
}
}

View file

@ -0,0 +1,38 @@
package com.android_app.matan.ara.sagi.thesocialnotework;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by matanbaryosef on 08/07/2016.
*/
public class RoundAvatarImageView extends ImageView {
public static float radius = 110.0f;
public RoundAvatarImageView(Context context) {
super(context);
}
public RoundAvatarImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public RoundAvatarImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onDraw(Canvas canvas) {
//float radius = 36.0f;
Path clipPath = new Path();
RectF rect = new RectF(0, 0, this.getWidth(), this.getHeight());
clipPath.addRoundRect(rect, radius, radius, Path.Direction.CW);
canvas.clipPath(clipPath);
super.onDraw(canvas);
}
}

View file

@ -4,6 +4,7 @@ import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
@ -18,6 +19,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
@ -41,6 +43,7 @@ public class SettingsFragment extends Fragment implements View.OnClickListener,
private Uri currentImgUri;
private TextView lbl_num_of_notes, lbl_num_of_liked;
private User user;
private Button btn_save;
public SettingsFragment() {
@ -62,6 +65,7 @@ public class SettingsFragment extends Fragment implements View.OnClickListener,
this.parent = (MainActivity)getActivity();
Utils.showLoadingDialog(parent, "Just a sec...", "");
this.user = parent.getUser();
Log.d(TAG, "onCreateView: "+user.toString());
this.cameraBtn = (ImageButton) view.findViewById(R.id.btn_camera);
this.cameraBtn.setOnClickListener(this);
this.avatarImage = (ImageView) view.findViewById(R.id.settings_userAvater_iamgeView);
@ -72,6 +76,8 @@ public class SettingsFragment extends Fragment implements View.OnClickListener,
this.txt_username = (EditText)view.findViewById(R.id.txt_username);
this.lbl_num_of_notes = (TextView)view.findViewById(R.id.lbl_num_of_notes);
this.lbl_num_of_liked = (TextView)view.findViewById(R.id.lbl_num_of_liked);
this.btn_save = (Button)view.findViewById(R.id.btn_save);
this.btn_save.setOnClickListener(this);
this.txt_username.setEnabled(false);
@ -81,8 +87,8 @@ public class SettingsFragment extends Fragment implements View.OnClickListener,
this.txt_password.setText(user.getPassword());
this.txt_email.setText(user.getEmail());
// this.lbl_num_of_notes.setText(user.getNumber_of_notes()); //TODO
// this.lbl_num_of_notes.setText(user.getLiked_notes().size());
this.lbl_num_of_notes.setText(""+user.getNumber_of_notes()); //TODO
this.lbl_num_of_notes.setText(""+user.getLiked_notes().size());
Utils.dismissLoadingDialog();
@ -106,8 +112,18 @@ public class SettingsFragment extends Fragment implements View.OnClickListener,
switch(view.getId()){
case R.id.btn_camera:
//check for permission
ActivityCompat.requestPermissions(parent, new String[]{Manifest.permission.CAMERA}, 1);
openCamera(view);
// ActivityCompat.requestPermissions(parent, new String[]{Manifest.permission.CAMERA}, 1);
if ((ActivityCompat.checkSelfPermission((MainActivity) getActivity(), android.Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED)
&&(ActivityCompat.checkSelfPermission((MainActivity) getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)) {
openCamera(view);
}else{
Toast.makeText(getActivity(), "No Camera or Storage Permissions granted.\n\"An App is nothing without its permissions\"", Toast.LENGTH_LONG).show();
}
break;
case R.id.btn_save:
user.updateUser(parent);
break;
}
}

View file

@ -151,11 +151,13 @@ public class User {
}
public void updateUser(final MainActivity activity){
Log.d(TAG, "updateUser: ================================");
VolleyUtilSingleton.getInstance(activity).post(Utils.BASE_URL + "/user/upsert", this.toJSON(), new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
if(response.get("status") == "OK"){
if(response.get("status").equals("OK")){
Log.d(TAG, "onResponse: In OKOKOKOK");
activity.updateNavAvatar();
SharedPreferences sharedPref = activity.getSharedPreferences(MainActivity.LOCAL_DATA_TSN, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();

View file

@ -4,6 +4,12 @@ import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.AsyncTask;
import android.os.Environment;
import android.util.Log;
@ -37,6 +43,8 @@ public class Utils {
private static HashMap<String, Bitmap> bitmapHash = new HashMap<>();
public static final String PHOTOS_DIR_PATH = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/TheSocialNotework/";
private static boolean mLocationPermission = false;
private static boolean mCameraPermission = false;
public static Bitmap getBitmapFromURL(String url) {
@ -69,6 +77,7 @@ public class Utils {
public void onErrorResponse(VolleyError error) {
Log.d(TAG, "genericErrorListener");
error.printStackTrace();
Utils.dismissLoadingDialog();
}
};
@ -137,7 +146,8 @@ public class Utils {
private static class setUserAvatar extends AsyncTask<Void, Void, Bitmap> {
private ImageView iv;
private String url;
public setUserAvatar(ImageView imageView, String url){
public setUserAvatar(ImageView imageView, String url) {
this.iv = imageView;
this.url = url;
}
@ -146,16 +156,58 @@ public class Utils {
protected Bitmap doInBackground(Void... v) {
// Bitmap b;
return Utils.getBitmapFromURL(url);
return Utils.getBitmapFromURL(url);
}
@Override
protected void onPostExecute(Bitmap b){
protected void onPostExecute(Bitmap b) {
iv.setImageBitmap(b);
}
}
public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, int pixels) {
Log.d(TAG, "rounded bitmap");
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap
.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
final float roundPx = pixels;
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
}
public static void setLocationPermission(boolean locationPermission) {
mLocationPermission = locationPermission;
}
public static void setCameraPermission(boolean cameraPermission) {
mCameraPermission = cameraPermission;
}
public static boolean arePermissionsGranted() {
return (mLocationPermission && mCameraPermission);
}
public static boolean isCameraPermissionGranted(){
return mCameraPermission;
}
public static boolean isLocationPermissionGranted(){
return mLocationPermission;
}
}

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<padding
android:top="6dp"
android:bottom="6dp"/>
<corners android:radius="35dp" />
<stroke android:width="1dp" android:color="@android:color/transparent" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

View file

@ -44,10 +44,10 @@
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/txt_email"
android:hint="Email" />
android:hint="Email"
android:inputType="none|text" />
</LinearLayout>
<RelativeLayout

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@drawable/cast_ic_notification_1">
<LinearLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
@ -15,10 +15,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:id="@+id/note_user_avatar" />
<com.android_app.matan.ara.sagi.thesocialnotework.RoundAvatarImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:id="@+id/note_user_avatar"
android:layout_centerInParent="true"
android:scaleType="centerCrop" />
<LinearLayout
android:orientation="vertical"
@ -30,49 +33,120 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:textAppearance="?android:attr/textAppearanceLarge" />
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_gravity="center" />
<TextView
android:id="@+id/ndf_body_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Body"
android:textAppearance="?android:attr/textAppearanceMedium" />
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_gravity="center" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/ndf_time_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="@+id/ndf_address_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text" />
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="@+id/imageView6"
android:src="@drawable/date_icon"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/ndf_tags_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:textAppearance="?android:attr/textAppearanceListItem" />
<TextView
android:id="@+id/ndf_date_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:layout_marginLeft="10dp" />
<TextView
android:id="@+id/ndf_permission_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text" />
<ImageView
android:layout_width="13dp"
android:layout_height="13dp"
android:id="@+id/imageView7"
android:scaleType="fitCenter"
android:src="@drawable/time_icon"
android:layout_marginLeft="10dp"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/ndf_likes_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text" />
<TextView
android:id="@+id/ndf_time_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:layout_marginLeft="10dp" />
</LinearLayout>
<ImageButton
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="@+id/imageView8"
android:src="@drawable/location_icon"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/ndf_address_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="@+id/permission_image"
android:src="@drawable/permission_icon"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/ndf_permission_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="@+id/imageView9"
android:src="@drawable/like_icon"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/ndf_likes_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:layout_marginLeft="10dp" />
</LinearLayout>
<ImageButton
android:id="@+id/ndf_delete_imagebutton"
android:layout_width="40dp"
android:layout_height="40dp"

View file

@ -3,4 +3,5 @@
<color name="colorPrimary">#246068</color>
<color name="colorPrimaryDark">#012e34</color>
<color name="colorAccent">#ffb073</color>
<color name="darkGrayNote">#d1d4d7</color>
</resources>