Commit ce795c34 authored by Varun Patil's avatar Varun Patil Committed by GitHub

Merge pull request #269 from wncc/patch17

Minor bug fixes/tweaks
parents 078e5574 e80e0e80
...@@ -8,8 +8,8 @@ android { ...@@ -8,8 +8,8 @@ android {
manifestPlaceholders 'appAuthRedirectScheme': 'https' manifestPlaceholders 'appAuthRedirectScheme': 'https'
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 28
versionCode 26 versionCode 27
versionName "1.3.1" versionName "1.3.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }
......
...@@ -82,7 +82,7 @@ public final class Utils { ...@@ -82,7 +82,7 @@ public final class Utils {
*/ */
public static final void updateFragment(Fragment fragment, FragmentActivity fragmentActivity) { public static final void updateFragment(Fragment fragment, FragmentActivity fragmentActivity) {
FragmentTransaction ft = fragmentActivity.getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = fragmentActivity.getSupportFragmentManager().beginTransaction();
ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right); ft.setCustomAnimations(R.anim.slide_in_up, R.anim.fade_out, R.anim.fade_in, R.anim.slide_out_down);
ft.replace(R.id.framelayout_for_fragment, fragment, fragment.getTag()); ft.replace(R.id.framelayout_for_fragment, fragment, fragment.getTag());
ft.addToBackStack(fragment.getTag()); ft.addToBackStack(fragment.getTag());
ft.commit(); ft.commit();
......
...@@ -645,7 +645,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -645,7 +645,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
/* Animate only for UserFragment */ /* Animate only for UserFragment */
if (fragment instanceof UserFragment) { if (fragment instanceof UserFragment) {
transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right); transaction.setCustomAnimations(R.anim.slide_in_up, R.anim.fade_out, R.anim.fade_in, R.anim.slide_out_down);
} }
transaction.replace(R.id.framelayout_for_fragment, fragment, fragment.getTag()); transaction.replace(R.id.framelayout_for_fragment, fragment, fragment.getTag());
......
...@@ -146,7 +146,7 @@ public class AddEventFragment extends BaseFragment { ...@@ -146,7 +146,7 @@ public class AddEventFragment extends BaseFragment {
eventFragment.setArguments(bundle); eventFragment.setArguments(bundle);
FragmentManager manager = getActivity().getSupportFragmentManager(); FragmentManager manager = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction(); FragmentTransaction transaction = manager.beginTransaction();
transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right); transaction.setCustomAnimations(R.anim.slide_in_up, R.anim.fade_out, R.anim.fade_in, R.anim.slide_out_down);
transaction.replace(R.id.framelayout_for_fragment, eventFragment, eventFragment.getTag()); transaction.replace(R.id.framelayout_for_fragment, eventFragment, eventFragment.getTag());
transaction.addToBackStack(eventFragment.getTag()).commit(); transaction.addToBackStack(eventFragment.getTag()).commit();
} }
...@@ -155,7 +155,7 @@ public class AddEventFragment extends BaseFragment { ...@@ -155,7 +155,7 @@ public class AddEventFragment extends BaseFragment {
BodyFragment bodyFragment = BodyFragment.newInstance(body); BodyFragment bodyFragment = BodyFragment.newInstance(body);
FragmentManager manager = getActivity().getSupportFragmentManager(); FragmentManager manager = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction(); FragmentTransaction transaction = manager.beginTransaction();
transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right); transaction.setCustomAnimations(R.anim.slide_in_up, R.anim.fade_out, R.anim.fade_in, R.anim.slide_out_down);
transaction.replace(R.id.framelayout_for_fragment, bodyFragment, bodyFragment.getTag()); transaction.replace(R.id.framelayout_for_fragment, bodyFragment, bodyFragment.getTag());
transaction.addToBackStack(bodyFragment.getTag()).commit(); transaction.addToBackStack(bodyFragment.getTag()).commit();
} }
......
...@@ -4,6 +4,7 @@ package app.insti.fragment; ...@@ -4,6 +4,7 @@ package app.insti.fragment;
import android.animation.ArgbEvaluator; import android.animation.ArgbEvaluator;
import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.InsetDrawable; import android.graphics.drawable.InsetDrawable;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
...@@ -171,10 +172,19 @@ public class CalendarFragment extends BaseFragment { ...@@ -171,10 +172,19 @@ public class CalendarFragment extends BaseFragment {
@Override @Override
public void decorate(DayViewFacade view) { public void decorate(DayViewFacade view) {
// Color background with alpha
GradientDrawable gD = new GradientDrawable(); GradientDrawable gD = new GradientDrawable();
gD.setColor((int) new ArgbEvaluator().evaluate(((float) alpha / 255.0f), white, color)); gD.setColor((int) new ArgbEvaluator().evaluate(((float) alpha / 255.0f), white, color));
gD.setShape(GradientDrawable.OVAL); gD.setShape(GradientDrawable.OVAL);
InsetDrawable iD = new InsetDrawable(gD, 15);
// Inset to show border on selected
InsetDrawable iD;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iD = new InsetDrawable(gD, 0.1f);
} else {
iD = new InsetDrawable(gD, 10);
}
view.setBackgroundDrawable(iD); view.setBackgroundDrawable(iD);
} }
} }
......
...@@ -12,6 +12,8 @@ import android.graphics.Rect; ...@@ -12,6 +12,8 @@ import android.graphics.Rect;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.widget.NestedScrollView; import android.support.v4.widget.NestedScrollView;
...@@ -73,6 +75,7 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg ...@@ -73,6 +75,7 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg
ImageButton shareEventButton; ImageButton shareEventButton;
RecyclerView bodyRecyclerView; RecyclerView bodyRecyclerView;
String TAG = "EventFragment"; String TAG = "EventFragment";
int appBarOffset = 0;
// Hold a reference to the current animator, // Hold a reference to the current animator,
// so that it can be canceled mid-way. // so that it can be canceled mid-way.
...@@ -144,7 +147,7 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg ...@@ -144,7 +147,7 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg
Bundle bundle = getArguments(); Bundle bundle = getArguments();
String eventJson = bundle.getString(Constants.EVENT_JSON); String eventJson = bundle.getString(Constants.EVENT_JSON);
Log.d(TAG, "onStart: " + eventJson);
event = new Gson().fromJson(eventJson, Event.class); event = new Gson().fromJson(eventJson, Event.class);
inflateViews(event); inflateViews(event);
...@@ -154,6 +157,41 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg ...@@ -154,6 +157,41 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg
if (bundle.getBoolean(Constants.NO_SHARED_ELEM, true)) { if (bundle.getBoolean(Constants.NO_SHARED_ELEM, true)) {
this.transitionEnd(); this.transitionEnd();
} }
setupAppBarLayout();
}
/** Initialize app bar layout */
private void setupAppBarLayout() {
// Set the behavior
AppBarLayout mAppBarLayout = getView().findViewById(R.id.appBar);
((CoordinatorLayout.LayoutParams) mAppBarLayout.getLayoutParams()).setBehavior(new AppBarLayout.Behavior());
// Set offset on init
mAppBarLayout.post(new Runnable() {
@Override
public void run() {
setAppBarOffset(appBarOffset);
}
});
// Store offset for next init
mAppBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
if (i != 0) appBarOffset = -i;
}
});
}
/** Set appbar to have an offset */
private void setAppBarOffset(int offsetPx){
AppBarLayout mAppBarLayout = getView().findViewById(R.id.appBar);
CoordinatorLayout mCoordinatorLayour = getView().findViewById(R.id.coordinator);
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) mAppBarLayout.getLayoutParams();
AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) params.getBehavior();
if (behavior == null) return;
behavior.onNestedPreScroll(mCoordinatorLayour, mAppBarLayout, null, 0, offsetPx, new int[]{0, 0}, 0);
} }
private void inflateViews(final Event event) { private void inflateViews(final Event event) {
......
...@@ -41,6 +41,7 @@ public class SettingsFragment extends PreferenceFragmentCompat { ...@@ -41,6 +41,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
return false; return false;
} }
}); });
showContactPref.setEnabled(false);
// Update Profile // Update Profile
profilePref = findPreference("profile"); profilePref = findPreference("profile");
...@@ -109,8 +110,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { ...@@ -109,8 +110,10 @@ public class SettingsFragment extends PreferenceFragmentCompat {
@Override @Override
public void onResponse(Call<User> call, Response<User> response) { public void onResponse(Call<User> call, Response<User> response) {
if (response.isSuccessful()) { if (response.isSuccessful()) {
if(getActivity() == null || getView() == null) return;
User user = response.body(); User user = response.body();
showContactPref.setChecked(user.getShowContactNumber()); showContactPref.setChecked(user.getShowContactNumber());
showContactPref.setEnabled(true);
} }
} }
}); });
...@@ -124,6 +127,7 @@ public class SettingsFragment extends PreferenceFragmentCompat { ...@@ -124,6 +127,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
retrofitInterface.patchUserMe(Utils.getSessionIDHeader(), new UserShowContactPatchRequest(isChecked)).enqueue(new Callback<User>() { retrofitInterface.patchUserMe(Utils.getSessionIDHeader(), new UserShowContactPatchRequest(isChecked)).enqueue(new Callback<User>() {
@Override @Override
public void onResponse(Call<User> call, Response<User> response) { public void onResponse(Call<User> call, Response<User> response) {
if(getActivity() == null || getView() == null) return;
if (response.isSuccessful()) { if (response.isSuccessful()) {
showContactPref.setChecked(isChecked); showContactPref.setChecked(isChecked);
showContactPref.setEnabled(true); showContactPref.setEnabled(true);
...@@ -135,6 +139,7 @@ public class SettingsFragment extends PreferenceFragmentCompat { ...@@ -135,6 +139,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
@Override @Override
public void onFailure(Call<User> call, Throwable t) { public void onFailure(Call<User> call, Throwable t) {
if(getActivity() == null || getView() == null) return;
showContactPref.setChecked(!isChecked); showContactPref.setChecked(!isChecked);
showContactPref.setEnabled(true); showContactPref.setEnabled(true);
} }
......
...@@ -11,6 +11,7 @@ import android.graphics.Point; ...@@ -11,6 +11,7 @@ import android.graphics.Point;
import android.graphics.Rect; import android.graphics.Rect;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
...@@ -19,7 +20,6 @@ import android.view.LayoutInflater; ...@@ -19,7 +20,6 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
...@@ -150,7 +150,7 @@ public class UserFragment extends BackHandledFragment implements TransitionTarge ...@@ -150,7 +150,7 @@ public class UserFragment extends BackHandledFragment implements TransitionTarge
TextView userRollNumberTextView = getActivity().findViewById(R.id.user_rollno_profile); TextView userRollNumberTextView = getActivity().findViewById(R.id.user_rollno_profile);
final TextView userEmailIDTextView = getActivity().findViewById(R.id.user_email_profile); final TextView userEmailIDTextView = getActivity().findViewById(R.id.user_email_profile);
TextView userContactNumberTextView = getActivity().findViewById(R.id.user_contact_no_profile); TextView userContactNumberTextView = getActivity().findViewById(R.id.user_contact_no_profile);
ImageButton userShareImageButton = getActivity().findViewById(R.id.share_user_button); FloatingActionButton userShareFab = getActivity().findViewById(R.id.share_user_button);
Picasso.get() Picasso.get()
.load(user.getUserProfilePictureUrl()) .load(user.getUserProfilePictureUrl())
...@@ -229,7 +229,7 @@ public class UserFragment extends BackHandledFragment implements TransitionTarge ...@@ -229,7 +229,7 @@ public class UserFragment extends BackHandledFragment implements TransitionTarge
}); });
} }
userShareImageButton.setOnClickListener(new View.OnClickListener() { userShareFab.setOnClickListener(new View.OnClickListener() {
String shareUrl = ShareURLMaker.getUserURL(user); String shareUrl = ShareURLMaker.getUserURL(user);
@Override @Override
...@@ -241,7 +241,7 @@ public class UserFragment extends BackHandledFragment implements TransitionTarge ...@@ -241,7 +241,7 @@ public class UserFragment extends BackHandledFragment implements TransitionTarge
startActivity(Intent.createChooser(i, "Share URL")); startActivity(Intent.createChooser(i, "Share URL"));
} }
}); });
userShareImageButton.setVisibility(VISIBLE); userShareFab.show();
} }
private void call(String contactNumber) { private void call(String contactNumber) {
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<set> <set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="400" android:duration="400"
android:propertyName="x" android:propertyName="alpha"
android:valueFrom="0" android:valueFrom="0"
android:valueTo="-1280" android:valueTo="1"
android:valueType="floatType" /> android:valueType="floatType" />
</set> </set>
\ No newline at end of file
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<set> <set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="400" android:duration="400"
android:propertyName="x" android:propertyName="alpha"
android:valueFrom="-1280" android:valueFrom="1"
android:valueTo="0" android:valueTo="0"
android:valueType="floatType" /> android:valueType="floatType" />
</set> </set>
\ No newline at end of file
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<set> <set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="400" android:duration="400"
android:propertyName="x" android:propertyName="y"
android:valueFrom="1280" android:valueFrom="1920"
android:valueTo="0" android:valueTo="0"
android:valueType="floatType" /> android:valueType="floatType" />
</set> </set>
\ No newline at end of file
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<set> <set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="400" android:duration="400"
android:propertyName="x" android:propertyName="y"
android:valueFrom="0" android:valueFrom="0"
android:valueTo="1280" android:valueTo="1920"
android:valueType="floatType" /> android:valueType="floatType" />
</set> </set>
\ No newline at end of file
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:openDrawer="start"> tools:openDrawer="start"
android:background="?attr/themeColor">
<include <include
layout="@layout/app_bar_main" layout="@layout/app_bar_main"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:context=".fragment.BodyFragment" tools:context=".fragment.BodyFragment"
android:background="?attr/themeColor"> android:background="@android:color/transparent">
<android.support.design.widget.CoordinatorLayout <android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:background="@android:color/transparent">
<android.support.design.widget.CollapsingToolbarLayout <android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -27,8 +28,7 @@ ...@@ -27,8 +28,7 @@
<RelativeLayout <RelativeLayout
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
app:layout_collapseMode="parallax" app:layout_collapseMode="parallax">
android:background="?attr/themeColor">
<ImageView <ImageView
android:id="@+id/body_picture" android:id="@+id/body_picture"
...@@ -36,8 +36,7 @@ ...@@ -36,8 +36,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:transitionName="sharedAvatar" android:transitionName="sharedAvatar" />
android:background="?attr/themeColor" />
</RelativeLayout> </RelativeLayout>
</android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.CollapsingToolbarLayout>
...@@ -47,6 +46,7 @@ ...@@ -47,6 +46,7 @@
android:id="@+id/body_swipe_refresh_layout" android:id="@+id/body_swipe_refresh_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/themeColor"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
......
This diff is collapsed.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container_profile" android:id="@+id/container_profile"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
...@@ -60,21 +60,6 @@ ...@@ -60,21 +60,6 @@
android:textSize="16sp" /> android:textSize="16sp" />
</LinearLayout> </LinearLayout>
<ImageButton
android:id="@+id/share_user_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Share User"
android:padding="16dp"
android:src="@drawable/ic_menu_share"
android:tint="?attr/themeColorInverse"
android:visibility="gone" />
</LinearLayout> </LinearLayout>
<android.support.design.widget.TabLayout <android.support.design.widget.TabLayout
...@@ -104,6 +89,16 @@ ...@@ -104,6 +89,16 @@
</LinearLayout> </LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/share_user_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
android:src="@drawable/ic_menu_share"
android:tint="@android:color/black"
android:visibility="invisible" />
<include layout="@layout/loading_panel" /> <include layout="@layout/loading_panel" />
<app.insti.TouchImageView <app.insti.TouchImageView
...@@ -112,4 +107,4 @@ ...@@ -112,4 +107,4 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:contentDescription="Zoomed Image" android:contentDescription="Zoomed Image"
android:visibility="gone" /> android:visibility="gone" />
</RelativeLayout> </FrameLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment