mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2025-12-08 19:05:54 +00:00
Fix Header Bug.
Preivously, if you have multiple gists, headers may not have showed up. Now they do.
This commit is contained in:
parent
8cd5c2ecd7
commit
ef949afda7
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.fastaccess">
|
||||
<manifest package="com.fastaccess"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
@ -14,7 +14,7 @@
|
||||
android:resource="@drawable/ic_notification"/>
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
android:name="com.fastaccess.App"
|
||||
android:allowBackup="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
@ -48,8 +48,8 @@
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
|
||||
<data
|
||||
android:host="login"
|
||||
android:scheme="fasthub"/>
|
||||
android:host="fast-for-github.firebaseapp.com"
|
||||
android:scheme="https"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
@ -165,17 +165,6 @@
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ui.modules.repos.RepoPagerActivity"/>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ui.modules.settings.SettingsActivity"/>
|
||||
<activity android:name=".ui.modules.settings.category.SettingsCategoryActivity"/>
|
||||
<activity
|
||||
android:name=".ui.modules.repos.code.releases.ReleasesListActivity"
|
||||
android:parentActivityName=".ui.modules.repos.RepoPagerActivity"
|
||||
android:label="@string/releases">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ui.modules.repos.RepoPagerActivity"/>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.modules.parser.LinksParserActivity"
|
||||
android:configChanges="keyboard|orientation|screenSize"
|
||||
@ -214,22 +203,22 @@
|
||||
|
||||
<service
|
||||
android:name=".provider.tasks.notification.NotificationSchedulerJobTask"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE"/>
|
||||
<service android:name=".provider.tasks.notification.ReadNotificationService"/>
|
||||
<service android:name=".provider.tasks.git.GithubActionService"/>
|
||||
<service android:name=".provider.tasks.git.ReactionService"/>
|
||||
<service android:name=".provider.tasks.slack.SlackInvitationService"/>
|
||||
<service
|
||||
android:name=".provider.fcm.PushNotificationService"
|
||||
android:exported="false">
|
||||
<service android:name=".provider.fcm.PushNotificationService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<activity android:name=".ui.modules.settings.SettingsActivity">
|
||||
</activity>
|
||||
<activity android:name=".ui.modules.settings.category.SettingsCategoryActivity">
|
||||
</activity>
|
||||
<activity android:name=".ui.modules.profile.banner.BannerInfoActivity">
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
@ -16,6 +16,7 @@ import android.support.v4.widget.NestedScrollView;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
@ -68,6 +69,7 @@ import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static android.view.Gravity.TOP;
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
@ -153,7 +155,30 @@ public class ProfileOverviewFragment extends BaseFragment<ProfileOverviewMvp.Vie
|
||||
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
onInitOrgs(getPresenter().getOrgs());
|
||||
onInitContributions(getPresenter().getContributions());
|
||||
onHeaderLoaded(getPresenter().getHeader());
|
||||
if (getPresenter().getHeaderUrl()!=null) {
|
||||
ImageLoader.getInstance().loadImage(getPresenter().getHeaderUrl(), new ImageLoadingListener() {
|
||||
@Override
|
||||
public void onLoadingStarted(String s, View view) {
|
||||
Log.d(getClass().getSimpleName(), "LOADING STARTED :::");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingFailed(String s, View view, FailReason failReason) {
|
||||
Log.e(getClass().getSimpleName(), "LOADING FAILED :::");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingComplete(String s, View view, Bitmap bitmap) {
|
||||
onHeaderLoaded(bitmap);
|
||||
Log.d(getClass().getSimpleName(), "LOADING SUCCESSFUL :::");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingCancelled(String s, View view) {
|
||||
Log.e(getClass().getSimpleName(), "LOADING CANCELLED :::");
|
||||
}
|
||||
});
|
||||
}
|
||||
if (savedInstanceState == null) {
|
||||
getPresenter().onFragmentCreated(getArguments());
|
||||
} else {
|
||||
@ -329,14 +354,16 @@ public class ProfileOverviewFragment extends BaseFragment<ProfileOverviewMvp.Vie
|
||||
userInformation.setBackground(getResources().getDrawable(R.drawable.scrim));
|
||||
}
|
||||
chooseBanner.setVisibility(GONE);
|
||||
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()));
|
||||
} else {
|
||||
chooseBanner_pencil.setColorFilter(getResources().getColor(R.color.material_light_white));
|
||||
if (userModel.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));
|
||||
}
|
||||
}
|
||||
chooseBanner_pencil.animate().y(0).setDuration(0).start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -54,6 +54,6 @@ interface ProfileOverviewMvp {
|
||||
|
||||
@NonNull String getLogin();
|
||||
|
||||
@Nullable Bitmap getHeader();
|
||||
@Nullable String getHeaderUrl();
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ class ProfileOverviewPresenter extends BasePresenter<ProfileOverviewMvp.View> im
|
||||
@icepick.State boolean isSuccessResponse;
|
||||
@icepick.State boolean isFollowing;
|
||||
@icepick.State String login;
|
||||
@icepick.State Bitmap header = null;
|
||||
@icepick.State String headerUrl = null;
|
||||
@icepick.State ArrayList<User> userOrgs = new ArrayList<>();
|
||||
private ArrayList<ContributionsDay> contributions = new ArrayList<>();
|
||||
private static final String URL = "https://github.com/users/%s/contributions";
|
||||
@ -90,8 +90,9 @@ class ProfileOverviewPresenter extends BasePresenter<ProfileOverviewMvp.View> im
|
||||
if (login != null) {
|
||||
loadOrgs();
|
||||
loadContributions();
|
||||
Gist.getMyGists(login).forEach(gists -> {
|
||||
for (Gist gist : gists) {
|
||||
RxHelper.getObserver(RestProvider.getGistService().getUserGists(login, 100, 1)).subscribe(gists -> {
|
||||
for (Gist gist : gists.getItems()) {
|
||||
Log.d(getClass().getSimpleName(), gist.getDescription() + ":::" + login);
|
||||
if (gist.getDescription().equalsIgnoreCase("header.fst")) {
|
||||
for(FilesListModel file : gist.getFilesAsList()) {
|
||||
makeRestCall(RestProvider.getRepoService(true).getFileAsStream(file.getRawUrl()), s -> {
|
||||
@ -108,7 +109,7 @@ class ProfileOverviewPresenter extends BasePresenter<ProfileOverviewMvp.View> im
|
||||
|
||||
@Override
|
||||
public void onLoadingComplete(String s, View view, Bitmap bitmap) {
|
||||
header = bitmap;
|
||||
headerUrl = s;
|
||||
sendToView(v -> v.onHeaderLoaded(bitmap));
|
||||
Log.d(getClass().getSimpleName(), "LOADING SUCCESSFUL :::");
|
||||
}
|
||||
@ -141,7 +142,29 @@ class ProfileOverviewPresenter extends BasePresenter<ProfileOverviewMvp.View> im
|
||||
return;
|
||||
}
|
||||
onSendUserToView(userModel);
|
||||
sendToView(view -> view.onHeaderLoaded(header));
|
||||
ImageLoader.getInstance().loadImage(headerUrl, new ImageLoadingListener() {
|
||||
@Override
|
||||
public void onLoadingStarted(String s, View view) {
|
||||
Log.d(getClass().getSimpleName(), "LOADING STARTED :::");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingFailed(String s, View view, FailReason failReason) {
|
||||
Log.e(getClass().getSimpleName(), "LOADING FAILED :::");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingComplete(String s, View view, Bitmap bitmap) {
|
||||
headerUrl = s;
|
||||
sendToView(v -> v.onHeaderLoaded(bitmap));
|
||||
Log.d(getClass().getSimpleName(), "LOADING SUCCESSFUL :::");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingCancelled(String s, View view) {
|
||||
Log.e(getClass().getSimpleName(), "LOADING CANCELLED :::");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override public void onSendUserToView(@Nullable User userModel) {
|
||||
@ -160,8 +183,8 @@ class ProfileOverviewPresenter extends BasePresenter<ProfileOverviewMvp.View> im
|
||||
return login;
|
||||
}
|
||||
|
||||
@Nullable @Override public Bitmap getHeader() {
|
||||
return header;
|
||||
@Nullable @Override public String getHeaderUrl() {
|
||||
return headerUrl;
|
||||
}
|
||||
|
||||
private void loadContributions() {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
<item name="colorAccent">@color/material_blue_accent_700</item>
|
||||
<item name="colorControlNormal">?colorAccent</item>
|
||||
<item name="icon_color">@color/white</item>
|
||||
<item name="card_background">@color/material_light_white</item>
|
||||
</style>
|
||||
|
||||
<style name="InfoTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user