19
19
20
20
import androidx .annotation .NonNull ;
21
21
import androidx .annotation .Nullable ;
22
+
22
23
import io .syslogic .github .BuildConfig ;
23
24
import io .syslogic .github .Constants ;
25
+ import io .syslogic .github .R ;
24
26
import io .syslogic .github .activity .AuthenticatorActivity ;
25
27
import io .syslogic .github .activity .NavHostActivity ;
26
28
import io .syslogic .github .api .GithubClient ;
27
29
import io .syslogic .github .api .model .User ;
28
30
import io .syslogic .github .fragment .HomeScreenFragment ;
29
- import io .syslogic .github .fragment .HomeScreenFragmentDirections ;
30
31
31
32
import retrofit2 .Call ;
32
33
import retrofit2 .Callback ;
@@ -89,6 +90,7 @@ public static String getUsername(@NonNull Context context) {
89
90
}
90
91
}
91
92
93
+ @ Nullable
92
94
private static String loadTokenFromPackageMeta (@ NonNull Activity activity , AccountManager accountManager ) {
93
95
String token = null ;
94
96
try {
@@ -137,8 +139,7 @@ public void onResponse(@NonNull Call<User> call, @NonNull Response<User> respons
137
139
if (activity instanceof NavHostActivity activity2 ) {
138
140
if (activity2 .getCurrentFragment () instanceof HomeScreenFragment ) {
139
141
activity2 .getNavController ().navigate (
140
- HomeScreenFragmentDirections
141
- .actionHomeScreenFragmentToPreferencesFragment ()
142
+ R .id .action_homeScreenFragment_to_preferencesFragment
142
143
);
143
144
}
144
145
}
@@ -156,7 +157,8 @@ public void onFailure(@NonNull Call<User> call, @NonNull Throwable t) {
156
157
}
157
158
}
158
159
} catch (NullPointerException | PackageManager .NameNotFoundException e ) {
159
- e .printStackTrace ();
160
+ Log .e (LOG_TAG , e .getClass ().getSimpleName () + ": " + e .getMessage ());
161
+ return null ;
160
162
}
161
163
return token ;
162
164
}
0 commit comments