mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2025-12-08 19:05:54 +00:00
this commit bring back debug flavor.
this commit also fixes orgs feeds happened in debug version, fixed trending langauge since it got broken by github html content changes & added different icon for debugging.
This commit is contained in:
parent
5a9d3b6f22
commit
f7da93b79c
@ -12,7 +12,7 @@ before_script:
|
||||
- (while sleep 3; do echo "y"; done) | $ANDROID_HOME/tools/bin/sdkmanager "platform-tools" "extras;android;m2repository" "extras;google;m2repository" "build-tools;26.0.0" "platforms;android-26"
|
||||
|
||||
script:
|
||||
- ./gradlew clean assembleNightlyDebug --stacktrace
|
||||
- ./gradlew clean assembleDebug --stacktrace
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
|
||||
@ -45,8 +45,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions "default"
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
@ -54,18 +52,15 @@ android {
|
||||
signingConfig signingConfigs.signing
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
nightly {
|
||||
flavorDimensions "default"
|
||||
signingConfig signingConfigs.signing
|
||||
debug {
|
||||
if (!rootProject.file('gradle.properties').exists()) {
|
||||
signingConfig signingConfigs.signing
|
||||
}
|
||||
applicationIdSuffix ".debug"
|
||||
versionNameSuffix "-debug"
|
||||
ext.alwaysUpdateBuildId = false
|
||||
}
|
||||
|
||||
production { flavorDimensions "default" }
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
BIN
app/src/debug/res/mipmap-hdpi/ic_launcher.png
Executable file
BIN
app/src/debug/res/mipmap-hdpi/ic_launcher.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
BIN
app/src/debug/res/mipmap-mdpi/ic_launcher.png
Executable file
BIN
app/src/debug/res/mipmap-mdpi/ic_launcher.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/debug/res/mipmap-xhdpi/ic_launcher.png
Executable file
BIN
app/src/debug/res/mipmap-xhdpi/ic_launcher.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
BIN
app/src/debug/res/mipmap-xxhdpi/ic_launcher.png
Executable file
BIN
app/src/debug/res/mipmap-xxhdpi/ic_launcher.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png
Executable file
BIN
app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@ -45,13 +45,7 @@ public class App extends Application {
|
||||
}
|
||||
|
||||
private void init() {
|
||||
Fabric fabric = new Fabric.Builder(this)
|
||||
.kits(new Crashlytics.Builder()
|
||||
.core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
|
||||
.build())
|
||||
.debuggable(BuildConfig.DEBUG)
|
||||
.build();
|
||||
Fabric.with(fabric);
|
||||
initFabric();
|
||||
RxBillingService.register(this);
|
||||
deleteDatabase("database.db");
|
||||
getDataStore();//init requery before anything.
|
||||
@ -64,6 +58,16 @@ public class App extends Application {
|
||||
ColorsProvider.load();
|
||||
}
|
||||
|
||||
private void initFabric() {
|
||||
Fabric fabric = new Fabric.Builder(this)
|
||||
.kits(new Crashlytics.Builder()
|
||||
.core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
|
||||
.build())
|
||||
.debuggable(BuildConfig.DEBUG)
|
||||
.build();
|
||||
Fabric.with(fabric);
|
||||
}
|
||||
|
||||
private void setupPreference() {
|
||||
PreferenceManager.setDefaultValues(this, R.xml.fasthub_settings, false);
|
||||
PreferenceManager.setDefaultValues(this, R.xml.about_settings, false);
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
package com.fastaccess.provider.changelog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.fastaccess.R;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
|
||||
/**
|
||||
* Created by Kosh on 26 Mar 2017, 10:07 PM
|
||||
*/
|
||||
|
||||
public class ChangelogProvider {
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored") public static Observable<String> getChangelog(@NonNull Context context) {
|
||||
return Observable.fromCallable(() -> {
|
||||
InputStream is = context.getResources().openRawResource(R.raw.changelog);
|
||||
try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream()) {
|
||||
byte[] buffer = new byte[is.available()];
|
||||
is.read(buffer);
|
||||
byteStream.write(buffer);
|
||||
byteStream.close();
|
||||
is.close();
|
||||
return byteStream.toString();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -34,7 +34,7 @@ import io.reactivex.Observable;
|
||||
|
||||
public class ColorsProvider {
|
||||
|
||||
private static List<String> popularLanguages = Stream.of("Java", "Kotlin", "JavaScript", "Python", "CSS", "PHP",
|
||||
private static List<String> POPULAR_LANG = Stream.of("Java", "Kotlin", "JavaScript", "Python", "CSS", "PHP",
|
||||
"Ruby", "C++", "C", "GO", "Swift").toList();//predefined languages.
|
||||
|
||||
private static Map<String, LanguageColorModel> colors = new LinkedHashMap<>();
|
||||
@ -45,11 +45,13 @@ public class ColorsProvider {
|
||||
.create(observableEmitter -> {
|
||||
try {
|
||||
Type type = new TypeToken<Map<String, LanguageColorModel>>() {}.getType();
|
||||
InputStream stream = App.getInstance().getAssets().open("colors.json");
|
||||
Gson gson = new Gson();
|
||||
JsonReader reader = new JsonReader(new InputStreamReader(stream));
|
||||
colors.putAll(gson.fromJson(reader, type));
|
||||
observableEmitter.onNext("");
|
||||
try (InputStream stream = App.getInstance().getAssets().open("colors.json")) {
|
||||
Gson gson = new Gson();
|
||||
try (JsonReader reader = new JsonReader(new InputStreamReader(stream))) {
|
||||
colors.putAll(gson.fromJson(reader, type));
|
||||
observableEmitter.onNext("");
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
observableEmitter.onError(e);
|
||||
@ -62,12 +64,12 @@ public class ColorsProvider {
|
||||
|
||||
@NonNull public static ArrayList<String> languages() {
|
||||
ArrayList<String> lang = new ArrayList<>();
|
||||
lang.add("All Language");
|
||||
lang.addAll(Stream.of(colors)
|
||||
.filter(value -> value != null && !InputHelper.isEmpty(value.getKey()))
|
||||
.map(Map.Entry::getKey)
|
||||
.sortBy(s -> !popularLanguages.contains(s))
|
||||
.collect(Collectors.toCollection(ArrayList::new)));
|
||||
lang.add(0, "All Language");
|
||||
lang.addAll(1, POPULAR_LANG);
|
||||
return lang;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
package com.fastaccess.provider.gson;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.fastaccess.R;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
|
||||
/**
|
||||
* Created by Kosh on 26 Mar 2017, 10:07 PM
|
||||
*/
|
||||
|
||||
public class ToGsonProvider {
|
||||
|
||||
public static Observable<String> getChangelog(@NonNull Context context) {
|
||||
return Observable.fromCallable(() -> {
|
||||
try (InputStream is = context.getResources().openRawResource(R.raw.changelog)) {
|
||||
try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream()) {
|
||||
byte[] buffer = new byte[is.available()];
|
||||
int read = is.read(buffer);//ignore lint
|
||||
byteStream.write(buffer);
|
||||
return byteStream.toString();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -38,9 +38,11 @@ open class TrendingViewHolder(itemView: View, adapter: BaseRecyclerAdapter<Trend
|
||||
fork.text = t.forks
|
||||
lang.text = t.language
|
||||
if (!t.language.isNullOrEmpty()) {
|
||||
lang.tintDrawables(ColorsProvider.getColorAsColor(t.language!!, itemView.context))
|
||||
lang.setTextColor(ColorsProvider.getColorAsColor(t.language, itemView.context))
|
||||
val color = ColorsProvider.getColorAsColor(t.language!!, itemView.context)
|
||||
lang.tintDrawables(color)
|
||||
lang.setTextColor(color)
|
||||
}
|
||||
todayStars.visibility = if (t.todayStars.isNullOrEmpty()) View.GONE else View.VISIBLE
|
||||
lang.visibility = if (t.language.isNullOrEmpty()) View.GONE else View.VISIBLE
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ package com.fastaccess.ui.modules.changelog;
|
||||
|
||||
import com.fastaccess.App;
|
||||
import com.fastaccess.helper.RxHelper;
|
||||
import com.fastaccess.provider.changelog.ChangelogProvider;
|
||||
import com.fastaccess.provider.gson.ToGsonProvider;
|
||||
import com.fastaccess.ui.base.mvp.presenter.BasePresenter;
|
||||
|
||||
import lombok.Getter;
|
||||
@ -15,7 +15,7 @@ import lombok.Getter;
|
||||
private String html;
|
||||
|
||||
@Override public void onLoadChangelog() {
|
||||
manageDisposable(RxHelper.getObserver(ChangelogProvider.getChangelog(App.getInstance()))
|
||||
manageDisposable(RxHelper.getObserver(ToGsonProvider.getChangelog(App.getInstance()))
|
||||
.subscribe(s -> {
|
||||
this.html = s;
|
||||
sendToView(view -> view.onChangelogLoaded(html));
|
||||
|
||||
@ -55,18 +55,14 @@ public class FeedsFragment extends BaseFragment<FeedsMvp.View, FeedsPresenter> i
|
||||
FeedsFragment feedsFragment = new FeedsFragment();
|
||||
feedsFragment.setArguments(Bundler.start()
|
||||
.put(BundleConstant.EXTRA, user)
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise)
|
||||
.put(BundleConstant.EXTRA_TWO, isOrg)
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise)
|
||||
.end());
|
||||
return feedsFragment;
|
||||
}
|
||||
|
||||
public static FeedsFragment newInstance(boolean isEnterprise) {
|
||||
FeedsFragment feedsFragment = new FeedsFragment();
|
||||
feedsFragment.setArguments(Bundler.start()
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise)
|
||||
.end());
|
||||
return feedsFragment;
|
||||
return newInstance(null, false, isEnterprise);
|
||||
}
|
||||
|
||||
@Override protected int fragmentLayout() {
|
||||
|
||||
@ -57,17 +57,16 @@ public class FeedsPresenter extends BasePresenter<FeedsMvp.View> implements Feed
|
||||
}
|
||||
setCurrentPage(page);
|
||||
if (Login.getUser() == null) return;// I can't understand how this could possibly be reached lol.
|
||||
Observable<Pageable<Event>> observable = null;
|
||||
Observable<Pageable<Event>> observable;
|
||||
if (user != null) {
|
||||
if (isOrg) {
|
||||
RestProvider.getOrgService().getReceivedEvents(user, page);
|
||||
observable = RestProvider.getOrgService().getReceivedEvents(user, page);
|
||||
} else {
|
||||
observable = RestProvider.getUserService().getUserEvents(user, page);
|
||||
}
|
||||
} else {
|
||||
observable = RestProvider.getUserService().getReceivedEvents(Login.getUser().getLogin(), page);
|
||||
}
|
||||
if (observable == null) return;
|
||||
makeRestCall(observable, response -> {
|
||||
lastPage = response.getLast();
|
||||
if (getCurrentPage() == 1) {
|
||||
|
||||
@ -15,7 +15,7 @@ class TrendingPresenter : BasePresenter<TrendingMvp.View>(), TrendingMvp.Present
|
||||
manageObservable(RxHelper.getObserver(Observable.fromIterable(ColorsProvider.languages()))
|
||||
.doOnSubscribe { sendToView { it.onClearMenu() } }
|
||||
.filter { it.toLowerCase().contains(key.toLowerCase()) }
|
||||
.doOnNext(this::sendWithColor))
|
||||
.doOnNext { sendWithColor(it) })
|
||||
}
|
||||
|
||||
private fun sendWithColor(t: String) {
|
||||
@ -26,13 +26,15 @@ class TrendingPresenter : BasePresenter<TrendingMvp.View>(), TrendingMvp.Present
|
||||
sendToView { it.onAppend(t, lanColor) }
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
sendToView { it.onAppend(t, 0) }
|
||||
sendToView { it.onAppend(t, Color.LTGRAY) }
|
||||
}
|
||||
} else {
|
||||
sendToView { it.onAppend(t, Color.LTGRAY) }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLoadLanguage() {
|
||||
manageObservable(RxHelper.getObserver(Observable.fromIterable(ColorsProvider.languages()))
|
||||
.doOnNext({ t: String -> sendWithColor(t) }))
|
||||
.doOnNext { sendWithColor(it) })
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ class TrendingFragmentPresenter : BasePresenter<TrendingFragmentMvp.View>(), Tre
|
||||
val stars = it.select(".f6 > a[href*=/stargazers]").text()
|
||||
val forks = it.select(".f6 > a[href*=/network]").text()
|
||||
val todayStars = it.select(".f6 > span.float-right").text()
|
||||
val language = it.select(".f6 > span[itemprop=programmingLanguage]").text()
|
||||
val language = it.select(".f6 .mr-3 > span[itemprop=programmingLanguage]").text()
|
||||
Logger.e(title, description, stars, forks, todayStars, language)
|
||||
s.onNext(TrendingModel(title, description, language, stars, forks, todayStars))
|
||||
}
|
||||
|
||||
@ -44,7 +44,6 @@ import shortbread.Shortcut;
|
||||
@Shortcut(id = "profile", icon = R.drawable.ic_profile_shortcut, shortLabelRes = R.string.profile, backStack = {MainActivity.class}, rank = 4)
|
||||
public class UserPagerActivity extends BaseActivity<UserPagerMvp.View, UserPagerPresenter> implements UserPagerMvp.View {
|
||||
|
||||
|
||||
@BindView(R.id.tabs) TabLayout tabs;
|
||||
@BindView(R.id.tabbedPager) ViewPagerView pager;
|
||||
@BindView(R.id.fab) FloatingActionButton fab;
|
||||
|
||||
@ -116,9 +116,6 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:paddingStart="@dimen/spacing_normal"
|
||||
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/transparent"
|
||||
android:completionThreshold="1"
|
||||
@ -127,6 +124,8 @@
|
||||
android:imeOptions="actionSearch"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:paddingEnd="@dimen/spacing_xs_large"
|
||||
android:paddingStart="@dimen/spacing_normal"
|
||||
android:textColorHint="?android:textColorSecondary"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.ForegroundImageView
|
||||
@ -134,6 +133,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/clear"
|
||||
android:padding="@dimen/spacing_micro"
|
||||
|
||||
@ -19,15 +19,15 @@ install:
|
||||
|
||||
build_script:
|
||||
- cmd: IF NOT [%APPVEYOR_PULL_REQUEST_NUMBER%] == [] cscs /ac C:\FH\.github\check_translations.cs
|
||||
- cmd: gradlew clean assembleNightlyDebug --stacktrace
|
||||
- cmd: gradlew clean assembleDebug --stacktrace
|
||||
|
||||
after_build:
|
||||
- cmd: RENAME C:\FH\app\build\outputs\apk\nightly\debug\app-nightly-debug.apk fasthub-nightly-%APPVEYOR_BUILD_VERSION%.apk
|
||||
- cmd: RENAME C:\FH\app\build\outputs\apk\debug\app-debug.apk fasthub-debug-%APPVEYOR_BUILD_VERSION%.apk
|
||||
|
||||
test: off
|
||||
|
||||
artifacts:
|
||||
- path: \app\build\outputs\apk\nightly\debug\fasthub-nightly-%APPVEYOR_BUILD_VERSION%.apk
|
||||
- path: \app\build\outputs\apk\debug\fasthub-debug-%APPVEYOR_BUILD_VERSION%.apk
|
||||
|
||||
deploy: off
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user