mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2023-12-13 20:50:18 +01:00
FAB for new email in profile view
This commit is contained in:
parent
199f5ff152
commit
6037c1dde0
|
@ -1,36 +0,0 @@
|
|||
package org.mian.gitnex.fragments;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.activities.MyProfileEmailActivity;
|
||||
import org.mian.gitnex.databinding.BottomSheetProfileBinding;
|
||||
|
||||
/**
|
||||
* @author M M Arif
|
||||
*/
|
||||
public class BottomSheetMyProfileFragment extends BottomSheetDialogFragment {
|
||||
|
||||
@Nullable @Override
|
||||
public View onCreateView(
|
||||
@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
|
||||
BottomSheetProfileBinding bottomSheetProfileBinding =
|
||||
BottomSheetProfileBinding.inflate(inflater, container, false);
|
||||
|
||||
bottomSheetProfileBinding.addNewEmailAddress.setOnClickListener(
|
||||
v1 -> {
|
||||
startActivity(new Intent(getContext(), MyProfileEmailActivity.class));
|
||||
dismiss();
|
||||
});
|
||||
|
||||
return bottomSheetProfileBinding.getRoot();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package org.mian.gitnex.fragments;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
@ -14,6 +15,7 @@ import androidx.lifecycle.ViewModelProvider;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import org.mian.gitnex.activities.MyProfileEmailActivity;
|
||||
import org.mian.gitnex.adapters.MyProfileEmailsAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentProfileEmailsBinding;
|
||||
import org.mian.gitnex.viewmodels.ProfileEmailsViewModel;
|
||||
|
@ -62,6 +64,9 @@ public class MyProfileEmailsFragment extends Fragment {
|
|||
|
||||
fetchDataAsync();
|
||||
|
||||
fragmentProfileEmailsBinding.addNewEmailAddress.setOnClickListener(
|
||||
v1 -> startActivity(new Intent(getContext(), MyProfileEmailActivity.class)));
|
||||
|
||||
return fragmentProfileEmailsBinding.getRoot();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,6 @@ import android.graphics.Typeface;
|
|||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
@ -45,7 +42,7 @@ public class MyProfileFragment extends Fragment {
|
|||
ctx = getContext();
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_profile, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
setHasOptionsMenu(false);
|
||||
|
||||
((MainActivity) requireActivity())
|
||||
.setActionBarTitle(getResources().getString(R.string.navProfile));
|
||||
|
@ -68,31 +65,6 @@ public class MyProfileFragment extends Fragment {
|
|||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
|
||||
menu.clear();
|
||||
requireActivity().getMenuInflater().inflate(R.menu.profile_dotted_menu, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == android.R.id.home) {
|
||||
((MainActivity) ctx).finish();
|
||||
return true;
|
||||
} else if (id == R.id.profileMenu) {
|
||||
BottomSheetMyProfileFragment bottomSheet = new BottomSheetMyProfileFragment();
|
||||
bottomSheet.show(getChildFragmentManager(), "profileBottomSheet");
|
||||
return true;
|
||||
} else {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void viewData(View v, AccountContext account) {
|
||||
|
||||
TextView userFullName = v.findViewById(R.id.userFullName);
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/myProfileHeadFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bottomSheetHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/navProfile"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.flexbox.FlexboxLayout
|
||||
android:id="@+id/myProfileSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="4dp"
|
||||
app:alignContent="center"
|
||||
app:alignItems="flex_start"
|
||||
app:flexWrap="wrap"
|
||||
app:justifyContent="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/addNewEmailAddress"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
android:padding="4dp"
|
||||
android:text="@string/addButton"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"
|
||||
app:drawableTopCompat="@drawable/ic_email"
|
||||
app:layout_alignSelf="flex_start"/>
|
||||
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</LinearLayout>
|
|
@ -13,6 +13,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/primaryTextColor" />
|
||||
android:textColor="@color/colorWhite" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/shape_full_circle"
|
||||
android:backgroundTint="?attr/inputTextColor"
|
||||
android:backgroundTint="@color/retroThemeDiffAddedColor"
|
||||
android:orientation="horizontal"
|
||||
android:padding="15dp">
|
||||
android:padding="@dimen/dimen16dp" >
|
||||
|
||||
<TextView android:id="@+id/toastText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/primaryBackgroundColor" />
|
||||
android:textColor="@color/black" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/shape_full_circle"
|
||||
android:backgroundTint="?attr/inputTextColor"
|
||||
android:backgroundTint="@color/retroThemeDiffAddedColor"
|
||||
android:orientation="horizontal"
|
||||
android:padding="15dp">
|
||||
android:padding="@dimen/dimen16dp" >
|
||||
|
||||
<TextView android:id="@+id/toastText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/primaryBackgroundColor" />
|
||||
android:textColor="@color/black" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/shape_full_circle"
|
||||
android:backgroundTint="?attr/inputTextColor"
|
||||
android:backgroundTint="@color/retroThemeDiffAddedColor"
|
||||
android:orientation="horizontal"
|
||||
android:padding="15dp">
|
||||
android:padding="@dimen/dimen16dp" >
|
||||
|
||||
<TextView android:id="@+id/toastText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/primaryBackgroundColor" />
|
||||
android:textColor="@color/black" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
@ -17,7 +17,9 @@
|
|||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="@dimen/dimen72dp" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
|
@ -42,4 +44,17 @@
|
|||
android:textSize="@dimen/dimen20sp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</RelativeLayout>
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/addNewEmailAddress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_margin="@dimen/dimen16dp"
|
||||
android:text="@string/pageTitleAddEmail"
|
||||
android:contentDescription="@string/pageTitleAddEmail"
|
||||
android:textColor="?attr/primaryBackgroundColor"
|
||||
android:backgroundTint="?attr/fabColor"
|
||||
app:iconTint="?attr/primaryBackgroundColor"
|
||||
app:icon="@drawable/ic_add" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
Loading…
Reference in a new issue