Replacing bottom sheet item by floating action button. (#360)

Merge branch 'fab-button-issues' of https://gitea.com/opyale/GitNex into fab-button-issues

Merge remote-tracking branch 'remotes/main/master' into fab-button-issues

Merge branch 'master' into fab-button-issues

Adding onScrollListener.

Reply icon

Generalizing padding of floating action button.

Merge branch 'master' into fab-button-issues

Improving proportions.

Replacing bottom sheet item by floating action button and cleaning up code.

Co-authored-by: opyale <example@example.com>
Co-authored-by: anonTree1417 <example@example.com>
Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/360
Reviewed-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
opyale 2020-04-07 20:06:39 +00:00 committed by M M Arif
parent 9bca299107
commit 7387c29077
11 changed files with 71 additions and 48 deletions

View File

@ -29,6 +29,7 @@ import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
@ -95,6 +96,7 @@ public class IssueDetailActivity extends BaseActivity {
private HorizontalScrollView assigneesScrollView;
private ScrollView scrollViewComments;
private TextView issueModified;
private ImageView createNewComment;
final Context ctx = this;
private LinearLayout labelsLayout;
private LinearLayout assigneesLayout;
@ -132,6 +134,7 @@ public class IssueDetailActivity extends BaseActivity {
assigneesScrollView = findViewById(R.id.assigneesScrollView);
scrollViewComments = findViewById(R.id.scrollViewComments);
issueModified = findViewById(R.id.issueModified);
createNewComment = findViewById(R.id.addNewComment);
labelsLayout = findViewById(R.id.frameLabels);
assigneesLayout = findViewById(R.id.frameAssignees);
@ -147,10 +150,38 @@ public class IssueDetailActivity extends BaseActivity {
mRecyclerView.setNestedScrollingEnabled(false);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
DividerItemDecoration.VERTICAL);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
createNewComment = findViewById(R.id.addNewComment);
createNewComment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(ctx, ReplyToIssueActivity.class));
}
});
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
if (dy > 0 && createNewComment.isShown()) {
createNewComment.setVisibility(View.GONE);
} else if (dy < 0) {
createNewComment.setVisibility(View.VISIBLE);
}
}
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
}
});
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
@ -165,24 +196,24 @@ public class IssueDetailActivity extends BaseActivity {
});
Typeface myTypeface;
if(tinyDb.getInt("customFontId") == 0) {
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/roboto.ttf");
switch(tinyDb.getInt("customFontId")) {
}
else if (tinyDb.getInt("customFontId") == 1) {
case 0:
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/roboto.ttf");
break;
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/manroperegular.ttf");
case 1:
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/manroperegular.ttf");
break;
}
else if (tinyDb.getInt("customFontId") == 2) {
case 2:
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/sourcecodeproregular.ttf");
break;
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/sourcecodeproregular.ttf");
}
else {
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/roboto.ttf");
default:
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/roboto.ttf");
break;
}

View File

@ -43,7 +43,6 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
final Context ctx = getContext();
final TinyDB tinyDB = new TinyDB(ctx);
TextView replyToIssue = v.findViewById(R.id.replyToIssue);
TextView editIssue = v.findViewById(R.id.editIssue);
TextView editLabels = v.findViewById(R.id.editLabels);
TextView closeIssue = v.findViewById(R.id.closeIssue);
@ -56,16 +55,6 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
TextView subscribeIssue = v.findViewById(R.id.subscribeIssue);
TextView unsubscribeIssue = v.findViewById(R.id.unsubscribeIssue);
replyToIssue.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(ctx, ReplyToIssueActivity.class));
dismiss();
}
});
if(tinyDB.getString("issueType").equals("pr")) {
editIssue.setText(R.string.editPrText);

View File

@ -100,18 +100,18 @@ public class MyRepositoriesFragment extends Fragment {
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
DividerItemDecoration.VERTICAL);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(dividerItemDecoration);
createNewRepo = v.findViewById(R.id.addNewRepo);
createNewRepo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
startActivity(intent);
}
});
@ -119,12 +119,13 @@ public class MyRepositoriesFragment extends Fragment {
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
if (dy > 0 && createNewRepo.isShown()) {
createNewRepo.setVisibility(View.GONE);
} else if (dy < 0 ) {
} else if (dy < 0) {
createNewRepo.setVisibility(View.VISIBLE);
}
}
@Override

View File

@ -212,6 +212,19 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<ImageView
android:id="@+id/addNewComment"
android:src="@drawable/ic_reply"
android:tint="@color/white"
android:layout_width="54dp"
android:layout_height="54dp"
android:layout_margin="15dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:background="@drawable/circle"
android:padding="@dimen/fab_padding"
android:contentDescription="@string/addNewContent" />
</RelativeLayout>
</LinearLayout>

View File

@ -30,18 +30,6 @@
android:visibility="gone"
android:padding="16dp" />
<TextView
android:id="@+id/replyToIssue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/replyToIssue"
android:drawableStart="@drawable/ic_reply"
android:drawablePadding="24dp"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp"
android:padding="16dp" />
<TextView
android:id="@+id/mergePullRequest"
android:layout_width="match_parent"

View File

@ -50,7 +50,7 @@
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:background="@drawable/circle"
android:padding="12dp"
android:padding="@dimen/fab_padding"
android:visibility="gone"
android:contentDescription="@string/addNewContent" />

View File

@ -38,7 +38,7 @@
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:background="@drawable/circle"
android:padding="12dp"
android:padding="@dimen/fab_padding"
android:contentDescription="@string/addNewContent" />
<TextView

View File

@ -36,7 +36,7 @@
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:background="@drawable/circle"
android:padding="12dp"
android:padding="@dimen/fab_padding"
android:contentDescription="@string/addNewContent" />
<TextView

View File

@ -49,7 +49,7 @@
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:background="@drawable/circle"
android:padding="12dp"
android:padding="@dimen/fab_padding"
android:contentDescription="@string/addNewContent" />
</RelativeLayout>

View File

@ -49,7 +49,7 @@
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:background="@drawable/circle"
android:padding="12dp"
android:padding="@dimen/fab_padding"
android:contentDescription="@string/addNewContent" />
</RelativeLayout>

View File

@ -6,5 +6,6 @@
<dimen name="tooltipCornor">5dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="fab_padding">15dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
</resources>