mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2025-12-08 19:05:54 +00:00
this commit fixes #1451 and removes some unused stuff
This commit is contained in:
parent
52016e71b6
commit
4d33d3bb41
@ -2,9 +2,6 @@ package com.fastaccess.ui.modules.profile.overview;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
@ -14,15 +11,11 @@ import android.support.transition.Transition;
|
||||
import android.support.transition.TransitionManager;
|
||||
import android.support.v4.widget.NestedScrollView;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.evernote.android.state.State;
|
||||
import com.fastaccess.R;
|
||||
@ -54,7 +47,6 @@ import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
import github.GetPinnedReposQuery;
|
||||
|
||||
import static android.view.Gravity.TOP;
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
@ -66,10 +58,7 @@ public class ProfileOverviewFragment extends BaseFragment<ProfileOverviewMvp.Vie
|
||||
|
||||
@BindView(R.id.contributionsCaption) FontTextView contributionsCaption;
|
||||
@BindView(R.id.organizationsCaption) FontTextView organizationsCaption;
|
||||
@BindView(R.id.headerImage) RelativeLayout headerImage;
|
||||
@BindView(R.id.userInformation) LinearLayout userInformation;
|
||||
@BindView(R.id.chooseBanner) Button chooseBanner;
|
||||
@BindView(R.id.banner_edit) ImageButton chooseBanner_pencil;
|
||||
@BindView(R.id.username) FontTextView username;
|
||||
@BindView(R.id.fullname) FontTextView fullname;
|
||||
@BindView(R.id.description) FontTextView description;
|
||||
@ -276,10 +265,6 @@ public class ProfileOverviewFragment extends BaseFragment<ProfileOverviewMvp.Vie
|
||||
showMessage(R.string.error, R.string.no_user_found);
|
||||
}
|
||||
|
||||
@Override public void onImagePosted(@Nullable String link) {
|
||||
hideProgress();
|
||||
}
|
||||
|
||||
@Override public void onInitPinnedRepos(@NonNull List<GetPinnedReposQuery.Node> nodes) {
|
||||
if (pinnedReposTextView == null) return;
|
||||
if (!nodes.isEmpty()) {
|
||||
@ -323,38 +308,6 @@ public class ProfileOverviewFragment extends BaseFragment<ProfileOverviewMvp.Vie
|
||||
super.onScrollTop(index);
|
||||
}
|
||||
|
||||
@Override public void onHeaderLoaded(@Nullable Bitmap bitmap) {
|
||||
if (bitmap != null) {
|
||||
headerImage.setBackground(new BitmapDrawable(getResources(), bitmap));
|
||||
headerImage.setVisibility(VISIBLE);
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
headerImage.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, Math.round(metrics.widthPixels / 3.33333f)));
|
||||
((ViewGroup) userInformation.getParent()).removeView(userInformation);
|
||||
headerImage.addView(userInformation);
|
||||
userInformation.setPaddingRelative(getResources().getDimensionPixelSize(R.dimen.spacing_xs_large), 0, 0, getResources()
|
||||
.getDimensionPixelSize(R.dimen.spacing_xs_large));
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
username.setTextColor(getResources().getColor(android.R.color.primary_text_dark, getActivity().getTheme()));
|
||||
userInformation.setBackground(getResources().getDrawable(R.drawable.scrim, getActivity().getTheme()));
|
||||
} else {
|
||||
username.setTextColor(getResources().getColor(android.R.color.primary_text_dark));
|
||||
userInformation.setBackground(getResources().getDrawable(R.drawable.scrim));
|
||||
}
|
||||
chooseBanner.setVisibility(GONE);
|
||||
if (getPresenter().getLogin().equals(Login.getUser().getLogin())) {
|
||||
chooseBanner_pencil.setVisibility(VISIBLE);
|
||||
chooseBanner_pencil.bringToFront();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
chooseBanner_pencil.setColorFilter(getResources().getColor(R.color.material_light_white, getActivity().getTheme()));
|
||||
chooseBanner_pencil.setForegroundGravity(TOP);
|
||||
} else {
|
||||
chooseBanner_pencil.setColorFilter(getResources().getColor(R.color.material_light_white));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onHideProgress() {
|
||||
hideProgress();
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.fastaccess.ui.modules.profile.overview;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
@ -30,12 +29,8 @@ public interface ProfileOverviewMvp {
|
||||
|
||||
void onInitOrgs(@Nullable List<User> orgs);
|
||||
|
||||
void onHeaderLoaded(@Nullable Bitmap bitmap);
|
||||
|
||||
void onUserNotFound();
|
||||
|
||||
void onImagePosted(@Nullable String link);
|
||||
|
||||
void onInitPinnedRepos(@NonNull List<GetPinnedReposQuery.Node> nodes);
|
||||
}
|
||||
|
||||
|
||||
@ -289,15 +289,14 @@ public class IssueTimelineFragment extends BaseFragment<IssueTimelineMvp.View, I
|
||||
}
|
||||
|
||||
@Override public void addComment(@Nullable TimelineModel timelineModel, int index) {
|
||||
Logger.e(index);
|
||||
Logger.e();
|
||||
if (timelineModel != null) {
|
||||
adapter.addItem(timelineModel, 1);
|
||||
recycler.smoothScrollToPosition(1);
|
||||
} else if (index != -1) {
|
||||
recycler.smoothScrollToPosition(index + 1);
|
||||
} else {
|
||||
showMessage(R.string.error, R.string.comment_is_too_far_to_paginate);
|
||||
if ((index + 1) > adapter.getItemCount()) {
|
||||
showMessage(R.string.error, R.string.comment_is_too_far_to_paginate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ class ProjectCurdDialogFragment : BaseDialogFragment<BaseMvp.FAView, BasePresent
|
||||
val position: Int = arguments!!.getInt(BundleConstant.ID, -1)
|
||||
val isCard: Boolean = arguments!!.getBoolean(BundleConstant.EXTRA)
|
||||
if (savedInstanceState == null) {
|
||||
editText.setText(arguments!!.getString(BundleConstant.ITEM))
|
||||
editText.setText(arguments?.getString(BundleConstant.ITEM) ?: "")
|
||||
}
|
||||
toolbar.setOnMenuItemClickListener {
|
||||
if (it.itemId == R.id.submit) {
|
||||
|
||||
@ -288,6 +288,7 @@ public class UserPagerActivity extends BaseActivity<UserPagerMvp.View, UserPager
|
||||
if (!username.equalsIgnoreCase(this.login)) {
|
||||
menu.findItem(R.id.block)
|
||||
.setIcon(getPresenter().isUserBlocked() ? R.drawable.ic_unlock : R.drawable.ic_lock)
|
||||
.setTitle(getPresenter().isUserBlocked() ? getString(R.string.unblock) : getString(R.string.block))
|
||||
.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,29 +19,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/headerImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:background="@color/material_light_white"
|
||||
android:gravity="bottom|start"
|
||||
android:visibility="gone">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageButton
|
||||
android:id="@+id/banner_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/edit_banner"
|
||||
android:padding="@dimen/spacing_xs_large"
|
||||
android:src="@drawable/ic_edit"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -55,17 +32,8 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.fastaccess.ui.widgets.FontButton
|
||||
android:id="@+id/chooseBanner"
|
||||
style="@style/Base.Widget.AppCompat.ButtonBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/spacing_normal"
|
||||
android:background="?card_background"
|
||||
android:text="@string/edit_banner"
|
||||
android:visibility="gone"/>
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/spacing_xs_large">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/userInformation"
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
android:icon="@drawable/ic_lock"
|
||||
android:title="@string/block"
|
||||
android:visible="false"
|
||||
app:showAsAction="always"/>
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/share"
|
||||
|
||||
@ -365,7 +365,6 @@
|
||||
<string name="enable_signature_box_summary">Rodyti parašą, kai rašau komentarą</string>
|
||||
<string name="tags">Etiketės</string>
|
||||
<string name="add_comment">Pridėti komentarą</string>
|
||||
<string name="edit_banner">Pasirinkti viršelio nuotrauką</string>
|
||||
<string name="image_error">Nepavyko įkrauti paveikslėlį, dar kartą pabandykite vėliau.</string>
|
||||
<string name="trending">Populiaru</string>
|
||||
<string name="not_really_working">„GitHub“ neleidžia rūšiuoti pagal jaustukus dėl techninių limitacijų.</string>
|
||||
|
||||
@ -595,6 +595,7 @@
|
||||
<string name="disable_loading_image_summary">Disable loading image while on data plan</string>
|
||||
<string name="report_issue_warning">This issue will be submitted to FastHub\'s repo in GitHub</string>
|
||||
<string name="block">Block</string>
|
||||
<string name="unblock">Unblock</string>
|
||||
<string name="user_blocked">User blocked</string>
|
||||
<string name="user_unblocked">User unlocked</string>
|
||||
</resources>
|
||||
@ -23,7 +23,7 @@ buildscript {
|
||||
maven { url 'https://maven.fabric.io/public' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.0-alpha08'
|
||||
classpath 'com.android.tools.build:gradle:3.1.0-alpha09'
|
||||
classpath 'com.google.gms:google-services:3.0.0'
|
||||
classpath 'com.novoda:gradle-build-properties-plugin:0.3'
|
||||
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user