diff --git a/app/build.gradle b/app/build.gradle
index b7c35f630..32992fbe1 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -28,8 +28,8 @@ android {
applicationId "com.fastaccess.github"
minSdkVersion 21
targetSdkVersion 26
- versionCode 402
- versionName "4.0.2"
+ versionCode 403
+ versionName "4.0.3"
buildConfigString "GITHUB_CLIENT_ID", (buildProperties.secrets['github_client_id'] | buildProperties.notThere['github_client_id']).string
buildConfigString "GITHUB_SECRET", (buildProperties.secrets['github_secret'] | buildProperties.notThere['github_secret']).string
buildConfigString "IMGUR_CLIENT_ID", (buildProperties.secrets['imgur_client_id'] | buildProperties.notThere['imgur_client_id']).string
diff --git a/app/src/main/java/com/fastaccess/data/dao/AppLanguageModel.java b/app/src/main/java/com/fastaccess/data/dao/AppLanguageModel.java
new file mode 100644
index 000000000..1fbeb5b27
--- /dev/null
+++ b/app/src/main/java/com/fastaccess/data/dao/AppLanguageModel.java
@@ -0,0 +1,48 @@
+package com.fastaccess.data.dao;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Created by kosh on 20/07/2017.
+ */
+
+@Getter @Setter @AllArgsConstructor public class AppLanguageModel implements Parcelable {
+ private String value;
+ private String label;
+
+ @Override public int describeContents() { return 0; }
+
+ @Override public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(this.value);
+ dest.writeString(this.label);
+ }
+
+ protected AppLanguageModel(Parcel in) {
+ this.value = in.readString();
+ this.label = in.readString();
+ }
+
+ @Override public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ AppLanguageModel that = (AppLanguageModel) o;
+
+ return label != null ? label.equals(that.label) : that.label == null;
+ }
+
+ @Override public int hashCode() {
+ return label != null ? label.hashCode() : 0;
+ }
+
+ public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
+ @Override public AppLanguageModel createFromParcel(Parcel source) {return new AppLanguageModel(source);}
+
+ @Override public AppLanguageModel[] newArray(int size) {return new AppLanguageModel[size];}
+ };
+}
diff --git a/app/src/main/java/com/fastaccess/data/dao/ReactionsModel.java b/app/src/main/java/com/fastaccess/data/dao/ReactionsModel.java
index 317ab47fb..00e9f1f72 100644
--- a/app/src/main/java/com/fastaccess/data/dao/ReactionsModel.java
+++ b/app/src/main/java/com/fastaccess/data/dao/ReactionsModel.java
@@ -18,7 +18,7 @@
private long id;
private String url;
private int total_count;
- @SerializedName("+1") private int plusOne; // FIXME check this code
+ @SerializedName("+1") private int plusOne;
@SerializedName("-1") private int minusOne;
private int laugh;
private int hooray;
diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractNotification.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractNotification.java
index 3a97c77bc..d7ce2f6a4 100644
--- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractNotification.java
+++ b/app/src/main/java/com/fastaccess/data/dao/model/AbstractNotification.java
@@ -81,8 +81,8 @@ public static Disposable save(@android.support.annotation.Nullable List dataStore = App.getInstance().getDataStore().toBlocking();
for (Notification entity : models) {
dataStore.delete(Notification.class).where(Notification.ID.eq(entity.getId())).get().value();
- dataStore.insert(entity);
}
+ dataStore.insert(models);
s.onNext(true);
} catch (Exception e) {
e.printStackTrace();
diff --git a/app/src/main/java/com/fastaccess/helper/AppHelper.java b/app/src/main/java/com/fastaccess/helper/AppHelper.java
index b40651f25..17a83e845 100644
--- a/app/src/main/java/com/fastaccess/helper/AppHelper.java
+++ b/app/src/main/java/com/fastaccess/helper/AppHelper.java
@@ -70,15 +70,17 @@ public static String getFastHubIssueTemplate(boolean enterprise) {
StringBuilder builder = new StringBuilder()
.append("**FastHub Version: ").append(BuildConfig.VERSION_NAME).append(enterprise ? " Enterprise**" : "**").append(" \n")
.append(!isInstalledFromPlaySore(App.getInstance()) ? "**APK Source: Unknown** \n" : "")
- .append("**Android Version: ").append(String.valueOf(Build.VERSION.RELEASE)).append(" (SDK: ")
- .append(String.valueOf(Build.VERSION.SDK_INT)).append(")**").append(" \n")
+ .append("**Android Version: ").append(String.valueOf(Build.VERSION.RELEASE))
+ .append(" (SDK: ")
+ .append(String.valueOf(Build.VERSION.SDK_INT)).append(")**").append(" \n")
.append("**Device Information:**").append(" \n")
- .append("- " + (!model.equalsIgnoreCase(brand) ? "MANUFACTURER" : "MANUFACTURER&BRAND") + ": ").append(Build.MANUFACTURER).append(" \n");
+ .append("- " + (!model.equalsIgnoreCase(brand) ? "MANUFACTURER" : "MANUFACTURER&BRAND") + ": ")
+ .append(Build.MANUFACTURER).append("\n");
if (!model.equalsIgnoreCase(brand)) {
builder.append("- BRAND: ").append(brand).append(" \n");
}
builder.append("- MODEL: ").append(model).append(" \n")
- .append("---").append("\n\n");
+ .append("---").append("\n\n");
return builder.toString();
}
@@ -136,7 +138,7 @@ public static String getDeviceName() {
return brand.equalsIgnoreCase(model) ? InputHelper.capitalizeFirstLetter(model) : InputHelper.capitalizeFirstLetter(brand) + " " + model;
}
- private static boolean isEmulator() {
+ public static boolean isEmulator() {
return Build.FINGERPRINT.startsWith("generic")
|| Build.FINGERPRINT.startsWith("unknown")
|| Build.MODEL.contains("google_sdk")
diff --git a/app/src/main/java/com/fastaccess/provider/theme/ThemeEngine.kt b/app/src/main/java/com/fastaccess/provider/theme/ThemeEngine.kt
index cc200681b..dfdfc238a 100644
--- a/app/src/main/java/com/fastaccess/provider/theme/ThemeEngine.kt
+++ b/app/src/main/java/com/fastaccess/provider/theme/ThemeEngine.kt
@@ -33,7 +33,7 @@ object ThemeEngine {
}
private fun applyNavBarColor(activity: Activity) {
- if (!PrefGetter.isNavBarTintingDisabled()) {
+ if (!PrefGetter.isNavBarTintingDisabled() && PrefGetter.getThemeType() != PrefGetter.LIGHT) {
activity.window.navigationBarColor = ViewHelper.getPrimaryColor(activity)
}
}
diff --git a/app/src/main/java/com/fastaccess/provider/uil/UILProvider.java b/app/src/main/java/com/fastaccess/provider/uil/UILProvider.java
index 4c4e256f0..cb92718ed 100644
--- a/app/src/main/java/com/fastaccess/provider/uil/UILProvider.java
+++ b/app/src/main/java/com/fastaccess/provider/uil/UILProvider.java
@@ -5,19 +5,11 @@
import android.support.annotation.NonNull;
import com.fastaccess.BuildConfig;
-import com.fastaccess.helper.Logger;
-import com.fastaccess.helper.PrefGetter;
import com.nostra13.universalimageloader.cache.disc.impl.LimitedAgeDiskCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
-import com.nostra13.universalimageloader.core.download.BaseImageDownloader;
-
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.util.HashMap;
-import java.util.Map;
/**
* Created by Kosh on 26 Nov 2016, 10:48 AM
@@ -33,7 +25,6 @@ public static void initUIL(@NonNull Context context) {
ImageLoader imageLoader = ImageLoader.getInstance();
if (!imageLoader.isInited()) {
ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(context)
- .imageDownloader(new GithubAuthDownloader(context))
.defaultDisplayImageOptions(getOptions())
.denyCacheImageMultipleSizesInMemory()
.diskCache(new LimitedAgeDiskCache(context.getCacheDir(), ONE_DAY));
@@ -45,14 +36,8 @@ public static void initUIL(@NonNull Context context) {
}
private static DisplayImageOptions getOptions() {
- Map headers = new HashMap<>();
- if (PrefGetter.isEnterprise()) {
- String authToken = PrefGetter.getEnterpriseToken();
- headers.put("Authorization", authToken.startsWith("Basic") ? authToken : "token " + authToken);
- }
return new DisplayImageOptions.Builder()
.delayBeforeLoading(0)
- .extraForDownloader(headers)
.resetViewBeforeLoading(true)
.cacheOnDisk(true)
.cacheInMemory(true)
@@ -68,19 +53,4 @@ public static void destoryUIL(@NonNull Context context) {
}
}
- private static class GithubAuthDownloader extends BaseImageDownloader {
- GithubAuthDownloader(Context context) {super(context);}
-
- @SuppressWarnings("unchecked") @Override protected HttpURLConnection createConnection(String url, Object extra) throws IOException {
- HttpURLConnection conn = super.createConnection(url, extra);
- Map headers = (Map) extra;
- if (headers != null && !headers.isEmpty()) {
- Logger.e(headers.keySet(), headers.values());
- for (Map.Entry header : headers.entrySet()) {
- conn.setRequestProperty(header.getKey(), header.getValue());
- }
- }
- return conn;
- }
- }
}
diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/MainActivity.java b/app/src/main/java/com/fastaccess/ui/modules/main/MainActivity.java
index 92c8d35a6..c48cea445 100644
--- a/app/src/main/java/com/fastaccess/ui/modules/main/MainActivity.java
+++ b/app/src/main/java/com/fastaccess/ui/modules/main/MainActivity.java
@@ -87,9 +87,6 @@ public class MainActivity extends BaseActivity impl
@Override public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.search_menu, menu);
- if (isLoggedIn() && Notification.hasUnreadNotifications()) {
- ViewHelper.tintDrawable(menu.findItem(R.id.notifications).setIcon(R.drawable.ic_ring).getIcon(), ViewHelper.getAccentColor(this));
- }
return super.onCreateOptionsMenu(menu);
}
@@ -108,6 +105,13 @@ public class MainActivity extends BaseActivity impl
return super.onOptionsItemSelected(item);
}
+ @Override public boolean onPrepareOptionsMenu(Menu menu) {
+ if (isLoggedIn() && Notification.hasUnreadNotifications()) {
+ ViewHelper.tintDrawable(menu.findItem(R.id.notifications).setIcon(R.drawable.ic_ring).getIcon(), ViewHelper.getAccentColor(this));
+ }
+ return super.onPrepareOptionsMenu(menu);
+ }
+
@Override public void onNavigationChanged(@MainMvp.NavigationType int navType) {
if (navType == MainMvp.PROFILE) {
getPresenter().onModuleChanged(getSupportFragmentManager(), navType);
@@ -129,6 +133,10 @@ public class MainActivity extends BaseActivity impl
UserPagerActivity.startActivity(this, Login.getUser().getLogin(), false, PrefGetter.isEnterprise(), -1);
}
+ @Override public void onInvalidateNotification() {
+ invalidateOptionsMenu();
+ }
+
@Shortcut(id = "myIssues", icon = R.drawable.ic_app_shortcut_issues, shortLabelRes = R.string.issues, rank = 2, action = "myIssues")
public void myIssues() {}//do nothing
diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/MainMvp.java b/app/src/main/java/com/fastaccess/ui/modules/main/MainMvp.java
index 902f394a8..f9be72747 100644
--- a/app/src/main/java/com/fastaccess/ui/modules/main/MainMvp.java
+++ b/app/src/main/java/com/fastaccess/ui/modules/main/MainMvp.java
@@ -39,6 +39,8 @@ interface View extends BaseMvp.FAView {
void onUpdateDrawerMenuHeader();
void onOpenProfile();
+
+ void onInvalidateNotification();
}
interface Presenter extends BaseMvp.FAPresenter,
diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/MainPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/main/MainPresenter.java
index b55af41fe..a409d2950 100644
--- a/app/src/main/java/com/fastaccess/ui/modules/main/MainPresenter.java
+++ b/app/src/main/java/com/fastaccess/ui/modules/main/MainPresenter.java
@@ -7,8 +7,11 @@
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
+import com.annimon.stream.Stream;
import com.fastaccess.R;
import com.fastaccess.data.dao.model.Login;
+import com.fastaccess.data.dao.model.Notification;
+import com.fastaccess.helper.ParseDateFormat;
import com.fastaccess.helper.PrefGetter;
import com.fastaccess.helper.RxHelper;
import com.fastaccess.provider.rest.RestProvider;
@@ -17,6 +20,8 @@
import com.fastaccess.ui.modules.main.issues.pager.MyIssuesPagerFragment;
import com.fastaccess.ui.modules.main.pullrequests.pager.MyPullsPagerFragment;
+import io.reactivex.Observable;
+
import static com.fastaccess.helper.ActivityHelper.getVisibleFragment;
import static com.fastaccess.helper.AppHelper.getFragmentByTag;
@@ -40,9 +45,18 @@ public class MainPresenter extends BasePresenter implements MainMv
current.setCompany(current.getCompany());
return login.update(current);
})
- .subscribe(login -> {
- sendToView(MainMvp.View::onUpdateDrawerMenuHeader);
- }, Throwable::printStackTrace/*fail silently*/));
+ .flatMap(login -> RestProvider.getNotificationService(isEnterprise()).getNotifications(ParseDateFormat.getLastWeekDate()))
+ .flatMap(notificationPageable -> {
+ if (notificationPageable != null && notificationPageable.getItems() == null && !notificationPageable.getItems().isEmpty()) {
+ manageDisposable(Notification.save(notificationPageable.getItems()));
+ return Observable.just(Stream.of(notificationPageable.getItems()).anyMatch(Notification::isUnread));
+ }
+ return Observable.empty();
+ })
+ .subscribe(unread -> sendToView(view -> {
+ view.onInvalidateNotification();
+ view.onUpdateDrawerMenuHeader();
+ }), Throwable::printStackTrace/*fail silently*/));
}
@Override public boolean canBackPress(@NonNull DrawerLayout drawerLayout) {
diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/donation/CheckPurchaseActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/main/donation/CheckPurchaseActivity.kt
index d4ff4c404..cd46c88ce 100644
--- a/app/src/main/java/com/fastaccess/ui/modules/main/donation/CheckPurchaseActivity.kt
+++ b/app/src/main/java/com/fastaccess/ui/modules/main/donation/CheckPurchaseActivity.kt
@@ -3,51 +3,58 @@ package com.fastaccess.ui.modules.main.donation
import android.app.Activity
import android.content.Intent
import android.os.Bundle
+import android.os.Handler
import com.fastaccess.App
import com.fastaccess.BuildConfig
import com.fastaccess.helper.AppHelper
+import com.fastaccess.helper.Logger
import com.fastaccess.helper.RxHelper
-import com.fastaccess.provider.tasks.notification.NotificationSchedulerJobTask
import com.fastaccess.ui.modules.main.MainActivity
-import com.google.android.gms.common.ConnectionResult
-import com.google.android.gms.common.GoogleApiAvailability
import com.miguelbcr.io.rx_billing_service.RxBillingService
import com.miguelbcr.io.rx_billing_service.entities.ProductType
import io.reactivex.Observable
+import java.util.concurrent.TimeUnit
/**
* Created by kosh on 14/07/2017.
*/
-class CheckPurchaseActivity : Activity() {
+class CheckPurchaseActivity : Activity(), Runnable {
+
+ val handler = Handler()
+ var isDone = false
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- NotificationSchedulerJobTask.scheduleOneTimeJob(applicationContext)
- if (AppHelper.isGoogleAvailable(this)) {
- RxHelper.getObservable(Observable.fromPublisher { publisher ->
- try { // this could be simplified, but yet, people might download the app from outside playstore which will CRASH in somewhere.
- val purchases = RxBillingService.getInstance(this, BuildConfig.DEBUG)
- .getPurchases(ProductType.IN_APP)
- .toMaybe()
- .blockingGet(mutableListOf())
- if (!purchases.isEmpty()) {
- purchases.filterNotNull()
- .map { it.sku() }
- .filterNot { !it.isNullOrBlank() }
- .onEach { DonateActivity.enableProduct(it, App.getInstance()) }
- }
- publisher.onNext(true)
- } catch (ex: Exception) {
- ex.printStackTrace()
- publisher.onError(ex)
+ handler.postDelayed(this, TimeUnit.SECONDS.toMillis(10))//fallback to some devices that I got no idea how they passed the GPS check
+ if (AppHelper.isGoogleAvailable(this) && !AppHelper.isEmulator()) {
+ RxHelper.getObservable(Observable.fromCallable {
+ val purchases = RxBillingService.getInstance(this, BuildConfig.DEBUG)
+ .getPurchases(ProductType.IN_APP)
+ .toMaybe()
+ .blockingGet(mutableListOf())
+ if (!purchases.isEmpty()) {
+ purchases.filterNotNull()
+ .map { it.sku() }
+ .filterNot { !it.isNullOrBlank() }
+ .onEach { DonateActivity.enableProduct(it, App.getInstance()) }
}
- publisher.onComplete()
+ return@fromCallable true
}).subscribe({ /*do nothing*/ }, ::println, { startMainActivity() })
} else {
startMainActivity()
}
}
+ override fun run() {
+ Logger.e(isDone)
+ if (!isDone) startMainActivity()
+ }
+
+ override fun onBackPressed() {}
+
private fun startMainActivity() {
+ isDone = true
+ handler.removeCallbacks(this)
startActivity(Intent(this, MainActivity::class.java))
overridePendingTransition(0, 0)
finish()
diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerActivity.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerActivity.java
index 941fe0119..1c7c0845d 100644
--- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerActivity.java
+++ b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerActivity.java
@@ -20,6 +20,7 @@
import com.fastaccess.data.dao.model.Comment;
import com.fastaccess.data.dao.model.Commit;
import com.fastaccess.helper.ActivityHelper;
+import com.fastaccess.helper.AppHelper;
import com.fastaccess.helper.BundleConstant;
import com.fastaccess.helper.Bundler;
import com.fastaccess.helper.InputHelper;
@@ -139,6 +140,7 @@ public static void createIntentForOffline(@NonNull Context context, @NonNull Com
@Override public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.share_menu, menu);
menu.findItem(R.id.browser).setVisible(true);
+ menu.findItem(R.id.copyUrl).setVisible(true);
return super.onCreateOptionsMenu(menu);
}
@@ -152,6 +154,9 @@ public static void createIntentForOffline(@NonNull Context context, @NonNull Com
} else if (item.getItemId() == R.id.browser) {
if (getPresenter().getCommit() != null) ActivityHelper.startCustomTab(this, getPresenter().getCommit().getHtmlUrl());
return true;
+ } else if (item.getItemId() == R.id.copyUrl) {
+ if (getPresenter().getCommit() != null) AppHelper.copyToClipboard(this, getPresenter().getCommit().getHtmlUrl());
+ return true;
}
return super.onOptionsItemSelected(item);
}
diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesFragment.java
index 0b56840ee..dc3cfb1e7 100644
--- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesFragment.java
+++ b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesFragment.java
@@ -26,6 +26,7 @@
import com.fastaccess.ui.widgets.StateLayout;
import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -46,7 +47,7 @@ public class CommitFilesFragment extends BaseFragment(), this, this);
adapter.setListener(getPresenter());
recycler.setAdapter(adapter);
- if (savedInstanceState == null || adapter.isEmpty()) {
- getPresenter().onFragmentCreated(getArguments());
- }
+ getPresenter().onFragmentCreated(getArguments());
}
@NonNull @Override public CommitFilesPresenter providePresenter() {
diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesMvp.java
index 170b7bc27..b99fb1d15 100644
--- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesMvp.java
+++ b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesMvp.java
@@ -13,7 +13,6 @@
import com.fastaccess.ui.modules.reviews.callback.ReviewCommentListener;
import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder;
-import java.util.ArrayList;
import java.util.List;
/**
@@ -35,8 +34,6 @@ interface Presenter extends BaseMvp.FAPresenter, BaseViewHolder.OnItemClickListe
void onFragmentCreated(@Nullable Bundle bundle);
- @NonNull ArrayList getFiles();
-
void onSubmitComment(@NonNull String comment, @NonNull CommitLinesModel item, @Nullable Bundle bundle);
}
diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesPresenter.java
index fc26b65d5..8ea900403 100644
--- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesPresenter.java
+++ b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesPresenter.java
@@ -24,8 +24,6 @@
import com.fastaccess.ui.base.mvp.presenter.BasePresenter;
import com.fastaccess.ui.modules.code.CodeViewerActivity;
-import java.util.ArrayList;
-
import io.reactivex.Observable;
/**
@@ -34,7 +32,6 @@
class CommitFilesPresenter extends BasePresenter implements CommitFilesMvp.Presenter {
@com.evernote.android.state.State String sha;
- private ArrayList files = new ArrayList<>();
@Override public void onItemClick(int position, View v, CommitFileChanges model) {
if (v.getId() == R.id.open) {
@@ -78,8 +75,8 @@ class CommitFilesPresenter extends BasePresenter implements
manageObservable(Observable.just(commitFiles)
.map(CommitFileChanges::construct)
.doOnSubscribe(disposable -> sendToView(CommitFilesMvp.View::clearAdapter))
- .doFinally(() -> sendToView(BaseMvp.FAView::hideProgress))
- .doOnNext(commitFileChanges -> sendToView(view -> view.onNotifyAdapter(commitFileChanges))));
+ .doOnNext(commitFileChanges -> sendToView(view -> view.onNotifyAdapter(commitFileChanges)))
+ .doFinally(() -> sendToView(BaseMvp.FAView::hideProgress)));
}
}
@@ -88,10 +85,6 @@ class CommitFilesPresenter extends BasePresenter implements
}
}
- @NonNull @Override public ArrayList getFiles() {
- return files;
- }
-
@Override public void onSubmitComment(@NonNull String comment, @NonNull CommitLinesModel item, @Nullable Bundle bundle) {
if (bundle != null) {
String blob = bundle.getString(BundleConstant.ITEM);
diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/LanguageBottomSheetDialog.java b/app/src/main/java/com/fastaccess/ui/modules/settings/LanguageBottomSheetDialog.java
index 9f88b1d53..c0eea555c 100644
--- a/app/src/main/java/com/fastaccess/ui/modules/settings/LanguageBottomSheetDialog.java
+++ b/app/src/main/java/com/fastaccess/ui/modules/settings/LanguageBottomSheetDialog.java
@@ -10,13 +10,16 @@
import android.widget.RadioButton;
import android.widget.RadioGroup;
+import com.annimon.stream.Stream;
import com.fastaccess.R;
-import com.fastaccess.helper.PrefHelper;
+import com.fastaccess.data.dao.AppLanguageModel;
+import com.fastaccess.helper.Logger;
+import com.fastaccess.helper.PrefGetter;
import com.fastaccess.ui.base.BaseBottomSheetDialog;
import com.fastaccess.ui.widgets.FontButton;
import com.fastaccess.ui.widgets.FontTextView;
-import java.util.Arrays;
+import java.util.List;
import butterknife.BindView;
import io.reactivex.functions.Action;
@@ -32,9 +35,6 @@ public interface LanguageDialogListener {
public static final String TAG = LanguageBottomSheetDialog.class.getSimpleName();
- private String names[];
- private String values[];
-
@BindView(R.id.title) FontTextView title;
@BindView(R.id.picker) RadioGroup radioGroup;
@BindView(R.id.cancel) FontButton cancel;
@@ -46,8 +46,6 @@ public interface LanguageDialogListener {
if (context instanceof LanguageDialogListener) {
listener = (LanguageDialogListener) context;
}
- names = context.getResources().getStringArray(R.array.languages_array);
- values = context.getResources().getStringArray(R.array.languages_array_values);
}
@Override public void onDetach() {
@@ -61,26 +59,33 @@ public interface LanguageDialogListener {
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- String language = PrefHelper.getString("app_language");
- int selected = Arrays.asList(values).indexOf(language);
+ String language = PrefGetter.getAppLanguage();
ok.setVisibility(View.GONE);
cancel.setVisibility(View.GONE);
- for (int i = 0; i < names.length; i++) {
+ String[] values = getResources().getStringArray(R.array.languages_array_values);
+ List languageModels = Stream.of(getResources().getStringArray(R.array.languages_array))
+ .mapIndexed((index, s) -> new AppLanguageModel(values[index], s))
+ .sortBy(AppLanguageModel::getLabel)
+ .toList();
+ int padding = getResources().getDimensionPixelSize(R.dimen.spacing_xs_large);
+ for (int i = 0; i < languageModels.size(); i++) {
RadioButton radioButtonView = new RadioButton(getContext());
RadioGroup.LayoutParams params = new RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
radioButtonView.setLayoutParams(params);
- radioButtonView.setText(names[i]);
+ AppLanguageModel model = languageModels.get(i);
+ radioButtonView.setText(model.getLabel());
radioButtonView.setId(i);
+ radioButtonView.setTag(model.getValue());
radioButtonView.setGravity(Gravity.CENTER_VERTICAL);
- int padding = getResources().getDimensionPixelSize(R.dimen.spacing_xs_large);
radioButtonView.setPadding(padding, padding, padding, padding);
radioGroup.addView(radioButtonView);
- if (i == selected) radioGroup.check(i);
+ if (model.getValue().equalsIgnoreCase(language)) radioGroup.check(i);
}
radioGroup.setOnCheckedChangeListener((group, checkedId) -> {
- int index = radioGroup.indexOfChild(radioGroup.findViewById(radioGroup.getCheckedRadioButtonId()));
- PrefHelper.set("app_language", values[index]);
- if (!values[index].equalsIgnoreCase(language)) {
+ String tag = (String) radioGroup.getChildAt(checkedId).getTag();
+ Logger.e(tag);
+ if (!tag.equalsIgnoreCase(language)) {
+ PrefGetter.setAppLangauge(tag);
if (listener != null) listener.onLanguageChanged(this::dismiss);
}
});
diff --git a/app/src/main/res/drawable/ic_app_shortcut_github.xml b/app/src/main/res/drawable/ic_app_shortcut_github.xml
index 33dda636a..db14b0760 100644
--- a/app/src/main/res/drawable/ic_app_shortcut_github.xml
+++ b/app/src/main/res/drawable/ic_app_shortcut_github.xml
@@ -1,7 +1,20 @@
-
-
+
+
-
+ android:strokeAlpha="1"
+ android:strokeColor="#00000000"
+ android:strokeWidth="1"/>
+
+
diff --git a/app/src/main/res/menu/share_menu.xml b/app/src/main/res/menu/share_menu.xml
index 50e51327c..b66cc86da 100644
--- a/app/src/main/res/menu/share_menu.xml
+++ b/app/src/main/res/menu/share_menu.xml
@@ -15,4 +15,11 @@
android:visible="false"
app:showAsAction="always"/>
+
+
\ No newline at end of file
diff --git a/app/src/main/res/raw/changelog.html b/app/src/main/res/raw/changelog.html
index ef8cd8452..fd88f5be7 100644
--- a/app/src/main/res/raw/changelog.html
+++ b/app/src/main/res/raw/changelog.html
@@ -1,6 +1,6 @@
FastHub changelog
-Version 4.0.2 (Multiple Accounts, Enterprise & PR changes)
+Version 4.0.3 (Multiple Accounts, Enterprise & PR changes)
Thanks to
@@ -24,9 +24,15 @@
Version
FastHub
-Bugs , Enhancements & new Features (4.0.2 & 4.0.0)
+Bugs , Enhancements & new Features (4.0.3 & 4.0.0)
+ - (4.0.3 Fix) Disabled tinting in light theme
+ - (4.0.3 Fix) Fixed some notification crashes on some devices
+ - (4.0.3 Fix) Updated app shortcuts icons (thanks @lucasvalenteds)
+ - (4.0.3 Fix) Ordering langauge locales
+ - (4.0.3 Fix) Attempt to fix a crash on some devices when browsing large number of Commit files
+ - (4.0.3 New) Added copy URL to commit
- (4.0.2 New) Added a way to disable navigation bar tinitng in different themes (Settings/Customization)
- (4.0.2 Fix) Fixed clicking on notification might crash on some devices
- (4.0.2 Fix) Fixed app shortcut icons to follow material design guidelines
diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml
index e6d4c09e3..b19627193 100644
--- a/app/src/main/res/values-cs/strings.xml
+++ b/app/src/main/res/values-cs/strings.xml
@@ -13,7 +13,6 @@
Přihlásit
Sdílet
Načíst znovu
- Novinky
Profil
Chyba
Stiskněte znovu pro ukončení
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 7618914ec..abb2a00d7 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -12,7 +12,6 @@
Anmelden
Teilen
Neu laden
- Feeds
Profil
Fehler
Nochmal drücken zum beenden
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 368ca92f2..0baed60c1 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -13,7 +13,6 @@
Iniciar sesión
Compartir
Recargar
- Noticias
Perfil
Error
Presione una vez más para salir
diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml
index 3f0d5af03..57e00dbe5 100644
--- a/app/src/main/res/values-in/strings.xml
+++ b/app/src/main/res/values-in/strings.xml
@@ -16,7 +16,6 @@
Masuk
Bagikan
Memuat ulang
- Feed
Profil
Kesalahan
Tekan sekali lagi untuk keluar
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index 14da3a289..f98470e3b 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -12,7 +12,6 @@
Accedi
Condividi
Ricarica
- Attività
Profilo
Errore
Premi nuovamente per uscire
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
index 2c76cca8d..637071f8c 100644
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -13,7 +13,6 @@
サインイン
共有
再読み込み
- フィード
プロファイル
エラー
もう一度押すと終了します
diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml
index cb1f112b2..68faf1603 100644
--- a/app/src/main/res/values-lt/strings.xml
+++ b/app/src/main/res/values-lt/strings.xml
@@ -14,7 +14,6 @@
Prisijungti
Dalintis
Perkrauti
- Srautas
Profilis
Klaida
Spustelėkite dar vieną kartą, norint išeiti
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml
index 94424b11d..d587f9411 100644
--- a/app/src/main/res/values-pt-rBR/strings.xml
+++ b/app/src/main/res/values-pt-rBR/strings.xml
@@ -13,7 +13,6 @@
Entrar
Compartilhar
Recarregar
- Feeds
Perfil
Erro
Toque novamente para sair
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index c57ec9cca..a2f154c5b 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -14,7 +14,6 @@
Войти
Поделиться
Обновить
- Обновления
Профиль
Ошибка
Нажмите ещё раз для выхода
diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml
index d6c2e1884..043a4406e 100644
--- a/app/src/main/res/values-tr/strings.xml
+++ b/app/src/main/res/values-tr/strings.xml
@@ -12,7 +12,6 @@
Giriş yap
Paylaş
Yenile
- Akış
Profil
Hata
Çıkmak için bir kez daha basınız
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 429a0c7e2..dd9e83d65 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -12,7 +12,6 @@
登录
分享
重新加载
- Feeds
概况
错误
再按一次退出
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index 54b83acfb..04f9e57a0 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -35,7 +35,6 @@ APP
登入
分享
重新整理
- 動態
個人檔案
錯誤
再點一次以離開
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d2238bf0f..b81d35dfc 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -120,6 +120,8 @@
Purchase All for ($ 7.99)
Unlock
Unlock Everything
+ Feeds
+
Loading, please wait…
@@ -136,7 +138,6 @@
Sign in
Share
Reload
- Feeds
Profile
Error
Press once again to exit
diff --git a/build.gradle b/build.gradle
index 665f99d71..7e5021a50 100644
--- a/build.gradle
+++ b/build.gradle
@@ -24,7 +24,7 @@ buildscript {
google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.0.0-alpha6'
+ classpath 'com.android.tools.build:gradle:3.0.0-alpha7'
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.1'