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:
parent
9bca299107
commit
7387c29077
@ -29,6 +29,7 @@ import retrofit2.Call;
|
|||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
@ -95,6 +96,7 @@ public class IssueDetailActivity extends BaseActivity {
|
|||||||
private HorizontalScrollView assigneesScrollView;
|
private HorizontalScrollView assigneesScrollView;
|
||||||
private ScrollView scrollViewComments;
|
private ScrollView scrollViewComments;
|
||||||
private TextView issueModified;
|
private TextView issueModified;
|
||||||
|
private ImageView createNewComment;
|
||||||
final Context ctx = this;
|
final Context ctx = this;
|
||||||
private LinearLayout labelsLayout;
|
private LinearLayout labelsLayout;
|
||||||
private LinearLayout assigneesLayout;
|
private LinearLayout assigneesLayout;
|
||||||
@ -132,6 +134,7 @@ public class IssueDetailActivity extends BaseActivity {
|
|||||||
assigneesScrollView = findViewById(R.id.assigneesScrollView);
|
assigneesScrollView = findViewById(R.id.assigneesScrollView);
|
||||||
scrollViewComments = findViewById(R.id.scrollViewComments);
|
scrollViewComments = findViewById(R.id.scrollViewComments);
|
||||||
issueModified = findViewById(R.id.issueModified);
|
issueModified = findViewById(R.id.issueModified);
|
||||||
|
createNewComment = findViewById(R.id.addNewComment);
|
||||||
labelsLayout = findViewById(R.id.frameLabels);
|
labelsLayout = findViewById(R.id.frameLabels);
|
||||||
assigneesLayout = findViewById(R.id.frameAssignees);
|
assigneesLayout = findViewById(R.id.frameAssignees);
|
||||||
|
|
||||||
@ -147,10 +150,38 @@ public class IssueDetailActivity extends BaseActivity {
|
|||||||
mRecyclerView.setNestedScrollingEnabled(false);
|
mRecyclerView.setNestedScrollingEnabled(false);
|
||||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
mRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||||
|
|
||||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
|
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
|
||||||
DividerItemDecoration.VERTICAL);
|
|
||||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
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() {
|
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
@ -165,24 +196,24 @@ public class IssueDetailActivity extends BaseActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Typeface myTypeface;
|
Typeface myTypeface;
|
||||||
if(tinyDb.getInt("customFontId") == 0) {
|
|
||||||
|
|
||||||
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/roboto.ttf");
|
switch(tinyDb.getInt("customFontId")) {
|
||||||
|
|
||||||
}
|
case 0:
|
||||||
else if (tinyDb.getInt("customFontId") == 1) {
|
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;
|
||||||
|
|
||||||
}
|
case 2:
|
||||||
else if (tinyDb.getInt("customFontId") == 2) {
|
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/sourcecodeproregular.ttf");
|
||||||
|
break;
|
||||||
|
|
||||||
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/sourcecodeproregular.ttf");
|
default:
|
||||||
|
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/roboto.ttf");
|
||||||
}
|
break;
|
||||||
else {
|
|
||||||
|
|
||||||
myTypeface = Typeface.createFromAsset(Objects.requireNonNull(getApplicationContext()).getAssets(), "fonts/roboto.ttf");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
|
|||||||
final Context ctx = getContext();
|
final Context ctx = getContext();
|
||||||
final TinyDB tinyDB = new TinyDB(ctx);
|
final TinyDB tinyDB = new TinyDB(ctx);
|
||||||
|
|
||||||
TextView replyToIssue = v.findViewById(R.id.replyToIssue);
|
|
||||||
TextView editIssue = v.findViewById(R.id.editIssue);
|
TextView editIssue = v.findViewById(R.id.editIssue);
|
||||||
TextView editLabels = v.findViewById(R.id.editLabels);
|
TextView editLabels = v.findViewById(R.id.editLabels);
|
||||||
TextView closeIssue = v.findViewById(R.id.closeIssue);
|
TextView closeIssue = v.findViewById(R.id.closeIssue);
|
||||||
@ -56,16 +55,6 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
|
|||||||
TextView subscribeIssue = v.findViewById(R.id.subscribeIssue);
|
TextView subscribeIssue = v.findViewById(R.id.subscribeIssue);
|
||||||
TextView unsubscribeIssue = v.findViewById(R.id.unsubscribeIssue);
|
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")) {
|
if(tinyDB.getString("issueType").equals("pr")) {
|
||||||
|
|
||||||
editIssue.setText(R.string.editPrText);
|
editIssue.setText(R.string.editPrText);
|
||||||
|
@ -100,18 +100,18 @@ public class MyRepositoriesFragment extends Fragment {
|
|||||||
mRecyclerView.setHasFixedSize(true);
|
mRecyclerView.setHasFixedSize(true);
|
||||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
|
||||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
|
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
|
||||||
DividerItemDecoration.VERTICAL);
|
|
||||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||||
|
|
||||||
createNewRepo = v.findViewById(R.id.addNewRepo);
|
createNewRepo = v.findViewById(R.id.addNewRepo);
|
||||||
|
|
||||||
createNewRepo.setOnClickListener(new View.OnClickListener() {
|
createNewRepo.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
|
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -119,12 +119,13 @@ public class MyRepositoriesFragment extends Fragment {
|
|||||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
|
|
||||||
if (dy > 0 && createNewRepo.isShown()) {
|
if (dy > 0 && createNewRepo.isShown()) {
|
||||||
createNewRepo.setVisibility(View.GONE);
|
createNewRepo.setVisibility(View.GONE);
|
||||||
} else if (dy < 0 ) {
|
} else if (dy < 0) {
|
||||||
createNewRepo.setVisibility(View.VISIBLE);
|
createNewRepo.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -212,6 +212,19 @@
|
|||||||
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</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>
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -30,18 +30,6 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:padding="16dp" />
|
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
|
<TextView
|
||||||
android:id="@+id/mergePullRequest"
|
android:id="@+id/mergePullRequest"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:background="@drawable/circle"
|
android:background="@drawable/circle"
|
||||||
android:padding="12dp"
|
android:padding="@dimen/fab_padding"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:contentDescription="@string/addNewContent" />
|
android:contentDescription="@string/addNewContent" />
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:background="@drawable/circle"
|
android:background="@drawable/circle"
|
||||||
android:padding="12dp"
|
android:padding="@dimen/fab_padding"
|
||||||
android:contentDescription="@string/addNewContent" />
|
android:contentDescription="@string/addNewContent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:background="@drawable/circle"
|
android:background="@drawable/circle"
|
||||||
android:padding="12dp"
|
android:padding="@dimen/fab_padding"
|
||||||
android:contentDescription="@string/addNewContent" />
|
android:contentDescription="@string/addNewContent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:background="@drawable/circle"
|
android:background="@drawable/circle"
|
||||||
android:padding="12dp"
|
android:padding="@dimen/fab_padding"
|
||||||
android:contentDescription="@string/addNewContent" />
|
android:contentDescription="@string/addNewContent" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
@ -49,7 +49,7 @@
|
|||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:background="@drawable/circle"
|
android:background="@drawable/circle"
|
||||||
android:padding="12dp"
|
android:padding="@dimen/fab_padding"
|
||||||
android:contentDescription="@string/addNewContent" />
|
android:contentDescription="@string/addNewContent" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
@ -6,5 +6,6 @@
|
|||||||
|
|
||||||
<dimen name="tooltipCornor">5dp</dimen>
|
<dimen name="tooltipCornor">5dp</dimen>
|
||||||
<dimen name="fab_margin">16dp</dimen>
|
<dimen name="fab_margin">16dp</dimen>
|
||||||
|
<dimen name="fab_padding">15dp</dimen>
|
||||||
<dimen name="appbar_padding_top">8dp</dimen>
|
<dimen name="appbar_padding_top">8dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user