Skip to content

Commit

Permalink
Update v4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeRooo committed Apr 14, 2020
1 parent 63e37f9 commit fcbe08c
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 98 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ _This app is based on Toffeed by JakeLane (https://github.com/JakeLane/Toffeed).

<img src="http://i.imgur.com/VctN6iC.png"> </p>

[![MaterialFBook on fdroid.org](http://i.imgur.com/nyp9kHq.png "Download from fdroid.org")](https://f-droid.org/app/me.zeeroooo.materialfb) [![MaterialFBook on xda labs](http://i.imgur.com/yQrfgN8.png "Download from xda labs")](https://labs.xda-developers.com/store/app/me.zeerooo.materialfb)
[![MaterialFBook on fdroid.org](http://i.imgur.com/nyp9kHq.png "Download from fdroid.org")](https://f-droid.org/app/me.zeeroooo.materialfb)

## Changelog

Expand Down Expand Up @@ -344,6 +344,11 @@ _This app is based on Toffeed by JakeLane (https://github.com/JakeLane/Toffeed).
- Fixed some visual glitches.
- Copy & paste feature restored.

**Version 4.0.2:**
- Fixed facebook menu bar hiding when option is disabled.
- Fixed language selector.
- Disabled swipe to refresh feature when keyboard is shown (#217).

**Notes:**
_- Maybe some gifs cant be loaded because i need to add the url to the code. Report it as issue with the Facebook´s page link or website._

Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId "me.zeerooo.materialfb"
minSdkVersion 17
targetSdkVersion 29
versionCode 73
versionName "4.0.1"
versionCode 74
versionName "4.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -47,7 +47,7 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha05'
implementation 'androidx.appcompat:appcompat:1.2.0-beta01'
implementation "androidx.preference:preference:1.1.0"
implementation 'com.google.android.material:material:1.2.0-alpha05'
implementation 'com.google.android.material:material:1.2.0-alpha06'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
<activity
android:name=".activities.SettingsActivity"
android:configChanges="orientation|screenSize|screenLayout|locale"
android:label="@string/settings"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:resizeableActivity="true">
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/me/zeeroooo/materialfb/MFB.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

@AcraCore(buildConfigClass = BuildConfig.class)
@AcraMailSender(mailTo = "")
@AcraMailSender(mailTo = "[email protected]")
public class MFB extends Application {
public static int colorPrimary, colorPrimaryDark, colorAccent, textColor;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package me.zeeroooo.materialfb.activities;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
Expand All @@ -25,6 +25,14 @@ public class MFBActivity extends AppCompatActivity {
protected SharedPreferences sharedPreferences;
private boolean darkTheme;
protected byte themeMode;
private MFBResources mfbResources = null;

@Override
protected void attachBaseContext(Context newBase) {
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(newBase);

super.attachBaseContext(updateResources(newBase));
}

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
Expand All @@ -33,12 +41,12 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

@Override
public Resources getResources() {
return new MFBResources(super.getResources());
if (mfbResources == null)
mfbResources = new MFBResources(super.getResources());
return mfbResources;
}

protected void create(Bundle savedInstanceState) {
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

darkTheme = sharedPreferences.getBoolean("darkMode", false);

if (darkTheme)
Expand All @@ -62,20 +70,28 @@ else if (ColorUtils.calculateLuminance(MFB.colorPrimary) > 0.8) // light theme w

@Override
public void setContentView(int layoutResID) {

final Locale locale = new Locale(PreferenceManager.getDefaultSharedPreferences(this).getString("defaultLocale", Locale.getDefault().getLanguage()));
Locale.setDefault(locale);

final Configuration config = new Configuration();
config.locale = locale;
config.setLocale(locale);
getResources().updateConfiguration(config, getResources().getDisplayMetrics());

themeMode = getThemeMode();

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && (themeMode == 2 || themeMode == 3))
getWindow().getDecorView().setSystemUiVisibility(getWindow().getDecorView().getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

super.setContentView(layoutResID);
}

private Context updateResources(Context context) {
final Locale locale = new Locale(sharedPreferences.getString("defaultLocale", Locale.getDefault().getLanguage()));
Locale.setDefault(locale);

final Resources resources = context.getResources();
final Configuration config = new Configuration(resources.getConfiguration());
if (Build.VERSION.SDK_INT >= 17) {
config.setLocale(locale);
context = context.createConfigurationContext(config);
} else {
config.locale = locale;
resources.updateConfiguration(config, resources.getDisplayMetrics());
}

return context;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.net.Uri;
import android.net.UrlQuerySanitizer;
Expand Down Expand Up @@ -97,8 +98,8 @@ public class MainActivity extends MFBActivity implements NavigationView.OnNaviga
private ValueCallback<Uri[]> mFilePathCallback;
private Uri mCapturedImageURI = null, sharedFromGallery;
private ValueCallback<Uri> mUploadMessage;
private int FILECHOOSER_RESULTCODE = 2888, INPUT_FILE_REQUEST_CODE = 1, lastEvent;
private boolean showAnimation, showHeader = false, loadCss = true;
private int lastEvent, screenHeight;
private boolean showAnimation, showHeader = false, loadCss = true, hideHeaderPref;
private String baseURL, mCameraPhotoPath, Url;
private SwipeRefreshLayout swipeView;
private NavigationView mNavigationView;
Expand Down Expand Up @@ -133,9 +134,10 @@ protected void create(Bundle savedInstanceState) {
final AppBarLayout appBarLayout = findViewById(R.id.appbarlayout);
appBarLayout.setBackgroundColor(MFB.colorPrimary);

findViewById(R.id.app_bar_main_root_view).setBackgroundColor(MFB.colorPrimary);
final CoordinatorLayout coordinatorLayoutRootView = findViewById(R.id.app_bar_main_root_view);
coordinatorLayoutRootView.setBackgroundColor(MFB.colorPrimary);

CoordinatorLayout coordinatorLayout = findViewById(R.id.app_bar_main_coordinator_layout);
final CoordinatorLayout coordinatorLayout = findViewById(R.id.app_bar_main_coordinator_layout);
ViewCompat.setOnApplyWindowInsetsListener(coordinatorLayout, (view, insets) ->
ViewCompat.onApplyWindowInsets(coordinatorLayout, insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), 0, insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()))
);
Expand Down Expand Up @@ -183,7 +185,6 @@ protected void create(Bundle savedInstanceState) {

UrlIntent(getIntent());

// Start the Swipe to reload listener
swipeView = findViewById(R.id.swipeLayout);
if (themeMode == 0 | themeMode == 1)
swipeView.setColorSchemeResources(android.R.color.white);
Expand All @@ -192,6 +193,15 @@ protected void create(Bundle savedInstanceState) {
swipeView.setProgressBackgroundColorSchemeColor(getResources().getColor(R.color.colorPrimary));
swipeView.setOnRefreshListener(() -> mWebView.reload());

final Rect rect = new Rect();
coordinatorLayoutRootView.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
coordinatorLayoutRootView.getWindowVisibleDisplayFrame(rect);

screenHeight = coordinatorLayoutRootView.getHeight();

swipeView.setEnabled((screenHeight - rect.bottom) < screenHeight * 0.15);
});

// Inflate the FAB menu
mfbFloatingActionButton = findViewById(R.id.menuFAB);

Expand Down Expand Up @@ -304,7 +314,7 @@ protected void onPostCreate(@Nullable Bundle savedInstanceState) {
}
});

showHeader = sharedPreferences.getBoolean("hide_menu_bar", true);
hideHeaderPref = sharedPreferences.getBoolean("hide_menu_bar", true);

mWebView.getSettings().setGeolocationEnabled(sharedPreferences.getBoolean("location_enabled", false));
mWebView.getSettings().setMinimumFontSize(Integer.parseInt(sharedPreferences.getString("textScale", "1")));
Expand Down Expand Up @@ -435,9 +445,9 @@ public void onLoadResource(WebView view, String url) {
showHeader = true;

if (loadCss) {
if (showHeader)
if (showHeader || !hideHeaderPref) {
css.append("#header { display: inherit; }");
else
} else
css.append("#header { display: none; }");

css.append(Helpers.cssThemeEngine(themeMode));
Expand Down Expand Up @@ -567,7 +577,7 @@ public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathC
chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);
startActivityForResult(chooserIntent, 1);
}
return true;
}
Expand Down Expand Up @@ -606,7 +616,7 @@ private void openFileChooser(ValueCallback uploadMsg, String acceptType) {
if (sharedFromGallery == null) {
final Intent chooserIntent = Intent.createChooser(i, "Image Chooser");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Parcelable[]{captureIntent});
startActivityForResult(chooserIntent, FILECHOOSER_RESULTCODE);
startActivityForResult(chooserIntent, 2888);
}
}

Expand Down Expand Up @@ -743,7 +753,7 @@ protected void onActivityResult(final int requestCode, final int resultCode, fin
// Thanks to Koras for the tutorial. http://dev.indywidualni.org/2015/02/an-advanced-webview-with-some-cool-features
super.onActivityResult(requestCode, resultCode, data);
if (Build.VERSION.SDK_INT >= 21) {
if (requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null)
if (requestCode != 1 || mFilePathCallback == null)
return;

Uri[] results = null;
Expand All @@ -765,7 +775,7 @@ protected void onActivityResult(final int requestCode, final int resultCode, fin
mFilePathCallback.onReceiveValue(results);
mFilePathCallback = null;
} else {
if (requestCode == FILECHOOSER_RESULTCODE) {
if (requestCode == 2888) {
if (null == this.mUploadMessage)
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ protected void create(Bundle savedInstanceState) {
findViewById(R.id.settings_root_view).setBackgroundColor(MFB.colorPrimary);

final Toolbar mToolbar = findViewById(R.id.settings_toolbar);
mToolbar.setTitle(getString(R.string.settings));
mToolbar.setNavigationIcon(R.mipmap.ic_launcher);

final Drawable backArrowDrawable = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ else if (ColorUtils.calculateLuminance(colorPrimary) < 0.01 && switchMaterial.is
mPreferences.edit().putInt("colorAccent", colorAccent).apply();
mPreferences.edit().putBoolean("darkMode", switchMaterial.isChecked()).apply();

CookingAToast.cooking(getActivity(), getString(R.string.required_restart), Color.WHITE, colorPrimary, R.drawable.ic_error, true).show();
getActivity().recreate();
//CookingAToast.cooking(getActivity(), getString(R.string.required_restart), Color.WHITE, colorPrimary, R.drawable.ic_error, true).show();
});

mfbColorPickerDialog.setView(rootView);
Expand Down
26 changes: 0 additions & 26 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,32 +129,6 @@
<item>Top Meldungen</item>
<item>Nachrichten</item>
</string-array>
<string-array name="appLocalesNames">
<item>Arabic [ar]</item>
<item>Czech [cs]</item>
<item>Danish [da]</item>
<item>Deutsch [de]</item>
<item>Greek [el]</item>
<item>Spanish [es]</item>
<item>English [en]</item>
<item>Filipino [fil]</item>
<item>French [fr]</item>
<item>Hungarian [hu]</item>
<item>Indonesian [in]</item>
<item>Italian [it]</item>
<item>Italian (Italy) [it_IT]</item>
<item>Hebrew [iw]</item>
<item>Kurdish [ku]</item>
<item>Dutch [nl]</item>
<item>Polish [pl]</item>
<item>Portuguese [pt]</item>
<item>Romanian [ro]</item>
<item>Russian [ru]</item>
<item>Russian (Russia) [ru_RU]</item>
<item>Serbian [sr]</item>
<item>Turkish [tr]</item>
<item>Vietnamese [vi]</item>
</string-array>
<string-array name="scalesText">
<item>Standard</item>
<item>Mittel</item>
Expand Down
26 changes: 0 additions & 26 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,32 +129,6 @@
<item>HistoriasPopulares</item>
<item>Mensajes</item>
</string-array>
<string-array name="appLocalesNames">
<item>Árabe [ar]</item>
<item>Checo [cs]</item>
<item>Danés [da]</item>
<item>Alemán [de]</item>
<item>Griego [el]</item>
<item>Español [es]</item>
<item>Inglés [en]</item>
<item>Filipino [fil]</item>
<item>Francés [fr]</item>
<item>Húngaro [hu]</item>
<item>Indonesio [in]</item>
<item>Italiano [it]</item>
<item>Italiano (Italy) [it_IT]</item>
<item>Hebreo [iw]</item>
<item>Kurdo [ku]</item>
<item>Holandés [nl]</item>
<item>Polaco [pl]</item>
<item>Portugués [pt]</item>
<item>Romano [ro]</item>
<item>Ruso [ru]</item>
<item>Ruso (Russia) [ru_RU]</item>
<item>Serbio [sr]</item>
<item>Turco [tr]</item>
<item>Vietnamita [vi]</item>
</string-array>
<string-array name="scalesText">
<item>Normal</item>
<item>Media</item>
Expand Down
17 changes: 10 additions & 7 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,32 @@
</string-array>

<string-array name="appLocales">
<item>am</item>
<item>ar</item>
<item>cs</item>
<item>da</item>
<item>de</item>
<item>el</item>
<item>es</item>
<item>nl</item>
<item>en</item>
<item>fil</item>
<item>fr</item>
<item>de</item>
<item>el</item>
<item>iw</item>
<item>hu</item>
<item>in</item>
<item>it</item>
<item>it_IT</item>
<item>iw</item>
<item>it</item>
<item>ku</item>
<item>nl</item>
<item>pl</item>
<item>pt</item>
<item>ro</item>
<item>ru</item>
<item>ru_RU</item>
<item>ru</item>
<item>sc</item>
<item>sr</item>
<item>es</item>
<item>tr</item>
<item>uk</item>
<item>vi</item>
</string-array>

Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/values/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
<resources>
<string name="changelog_list" translatable="false">
<![CDATA[
<b>**Version 4.0.2:**</b>
<br>
- Fixed facebook menu bar hiding when option is disabled.
<br>
- Fixed language selector.
<br>
- Disabled swipe to refresh feature when keyboard is shown (#217).
<br>
<br>
<b>**Version 4.0.1:**</b>
<br>
- Fixed some visual glitches.
Expand Down
Loading

0 comments on commit fcbe08c

Please sign in to comment.