Skip to content

Commit

Permalink
Update v3.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeRooo committed Apr 28, 2018
1 parent 479376e commit c709c00
Show file tree
Hide file tree
Showing 20 changed files with 176 additions and 130 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ _This app is based on Toffeed by JakeLane (https://github.com/JakeLane/Toffeed).
**Version 3.7.8:**
- Bugfixes.

**Version 3.8.0:**
- Bugfixes.
- Text scale selector.


**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
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId "me.zeeroooo.materialfb"
minSdkVersion 17
targetSdkVersion 27
versionCode 63
versionName "3.7.8"
versionCode 66
versionName "3.8.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand All @@ -36,8 +36,8 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'org.jsoup:jsoup:1.11.2'
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@
android:launchMode="singleTask" />
<activity
android:name=".Activities.Video"
android:configChanges="orientation|screenSize"
android:launchMode="singleTask"
android:screenOrientation="sensorLandscape"
android:theme="@style/Media" />

</application>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private Uri mCapturedImageURI = null, sharedFromGallery;
private ValueCallback<Uri> mUploadMessage;
private int FILECHOOSER_RESULTCODE = 2888, INPUT_FILE_REQUEST_CODE = 1;
private String baseURL, mCameraPhotoPath, Url, css, urlIntent = null, previousPage;
private String baseURL, mCameraPhotoPath, Url, css, urlIntent = null;
private SwipeRefreshLayout swipeView;
private NavigationView mNavigationView;
private FloatingActionMenu mMenuFAB;
Expand All @@ -114,8 +114,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private Handler badgeUpdate;
private Runnable badgeTask;
private TextView mr_badge, fr_badge, notif_badge, msg_badge;
private boolean photoView = false;
private boolean showAnimation;
private Cursor cursor;
private View circleRevealView;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -158,10 +159,12 @@ protected void onCreate(Bundle savedInstanceState) {
DBHelper = new DatabaseHelper(this);
bookmarks = new ArrayList<>();

cursor = DBHelper.getListContents();
cursor = DBHelper.getReadableDatabase().rawQuery("SELECT TITLE, URL FROM mfb_table", null);
while (cursor != null && cursor.moveToNext()) {
bk = new BookmarksH(cursor.getString(1), cursor.getString(2));
bookmarks.add(bk);
if (cursor.getString(0) != null && cursor.getString(1) != null) {
bk = new BookmarksH(cursor.getString(0), cursor.getString(1));
bookmarks.add(bk);
}
}

BLAdapter = new BookmarksAdapter(this, bookmarks, DBHelper);
Expand Down Expand Up @@ -282,6 +285,7 @@ public void onScrollChange(WebView view, int scrollX, int scrollY, int oldScroll
});

mWebView.getSettings().setGeolocationEnabled(mPreferences.getBoolean("location_enabled", false));
mWebView.getSettings().setMinimumFontSize(Integer.parseInt(mPreferences.getString("textScale", "1")));
mWebView.addJavascriptInterface(new JavaScriptInterfaces(this), "android");
mWebView.addJavascriptInterface(this, "Vid");
mWebView.getSettings().setBlockNetworkImage(mPreferences.getBoolean("stop_images", false));
Expand Down Expand Up @@ -511,9 +515,6 @@ public void onPageFinished(WebView view, String url) {
view.loadUrl("javascript:(function(){try{document.querySelector('button#u_0_1.btn.btnD.mfss.touchable').click()}catch(_){}})()");
}

// Hide Orange highlight on focus
css += "*{-webkit-tap-highlight-color:transparent;outline:0}";

if (mPreferences.getBoolean("hide_menu_bar", true))
css += "#page{top:-45px}";
// Hide the status editor on the News Feed if setting is enabled
Expand All @@ -526,19 +527,28 @@ public void onPageFinished(WebView view, String url) {

// Hide birthday content from News Feed
if (mPreferences.getBoolean("hide_birthdays", true))
css += "article#u_1j_4{display:none}" + "article._55wm._5e4e._5fjt{display:none}";
css += "article#u_1j_4{display:none}article._55wm._5e4e._5fjt{display:none}";

if (mPreferences.getBoolean("comments_recently", true))
css += "._15ks+._4u3j{display:none}";

if (sharedFromGallery != null)
view.loadUrl("javascript:(function(){try{document.getElementsByClassName(\"_56bz _54k8 _52jh _5j35 _157e\")[0].click()}catch(_){document.getElementsByClassName(\"_50ux\")[0].click()}})()");

css += "article#u_0_q._d2r{display:none}";
css += "article#u_0_q._d2r{display:none}*{-webkit-tap-highlight-color:transparent;outline:0}";
}
});

mWebView.setWebChromeClient(new WebChromeClient() {

@Override
public void onProgressChanged(WebView view, int progress) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && showAnimation && progress == 100) {
circleReveal();
showAnimation = false;
}
}

@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {

Expand Down Expand Up @@ -603,9 +613,9 @@ private void openFileChooser(ValueCallback uploadMsg, String acceptType) {
mUploadMessage = uploadMsg;

File imageStorageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
if (!imageStorageDir.exists()) {
if (!imageStorageDir.exists())
imageStorageDir.mkdirs();
}

// Create camera captured image file path and name
File file = new File(imageStorageDir + File.separator + "IMG_" + String.valueOf(System.currentTimeMillis()) + ".jpg");

Expand Down Expand Up @@ -739,11 +749,6 @@ public void run() {
badgeTask.run();
new UserInfo(MainActivity.this).execute();
}

if (photoView) {
// mWebView.loadUrl(previousPage);
photoView = false;
}
}

@Override
Expand Down Expand Up @@ -822,11 +827,11 @@ private Point getPointOfView(View view) {
}

@SuppressWarnings("NewApi")
private void circleReveal(View view) {
private void circleReveal() {
int radius = (int) Math.hypot(mWebView.getWidth(), mWebView.getHeight());
int x, y;
if (view != null) {
Point point = getPointOfView(view);
if (circleRevealView != null) {
Point point = getPointOfView(circleRevealView);
x = point.x;
y = point.y;
} else {
Expand All @@ -836,6 +841,7 @@ private void circleReveal(View view) {
Animator anim = ViewAnimationUtils.createCircularReveal(mWebView, x, y, 0, radius);
anim.setDuration(300);
anim.start();
mWebView.setVisibility(View.VISIBLE);
}

@Override
Expand Down Expand Up @@ -888,8 +894,10 @@ public boolean onCreateOptionsMenu(Menu menu) {
notif.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
circleReveal(v);
mWebView.setVisibility(View.INVISIBLE);
showAnimation = true;
circleRevealView = v;

mWebView.stopLoading();
mWebView.loadUrl(baseURL + "notifications.php");
setTitle(R.string.nav_notifications);
Expand All @@ -903,11 +911,12 @@ public void onClick(View v) {
msg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
circleReveal(v);
mWebView.setVisibility(View.INVISIBLE);
showAnimation = true;
circleRevealView = v;

mWebView.stopLoading();
mWebView.loadUrl(baseURL + "messages/");
//mWebView.loadUrl("javascript:(function(){try{document.querySelector('#messages_jewel > a').click()}catch(_){window.location.href='https://m.facebook.com/home.php'}})()");
setTitle(R.string.menu_messages);
NotificationsJIS.ClearbyId(MainActivity.this, 969);
Helpers.uncheckRadioMenu(mNavigationView.getMenu());
Expand All @@ -919,23 +928,30 @@ public void onClick(View v) {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
URLs();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
circleReveal(null);

showAnimation = true;
circleRevealView = null;
mWebView.stopLoading();
// Handle navigation view item clicks here.
switch (item.getItemId()) {
case R.id.nav_top_stories:
mWebView.setVisibility(View.INVISIBLE);

mWebView.loadUrl(baseURL + "home.php?sk=h_nor");
setTitle(R.string.menu_top_stories);
item.setChecked(true);
break;
case R.id.nav_most_recent:
mWebView.setVisibility(View.INVISIBLE);

mWebView.loadUrl(baseURL + "home.php?sk=h_chr'");
setTitle(R.string.menu_most_recent);
item.setChecked(true);
Helpers.uncheckRadioMenu(mNavigationView.getMenu());
break;
case R.id.nav_friendreq:
mWebView.setVisibility(View.INVISIBLE);

mWebView.loadUrl(baseURL + "friends/center/requests/");
setTitle(R.string.menu_friendreq);
item.setChecked(true);
Expand All @@ -952,11 +968,15 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
searchItem.expandActionView();
break;
case R.id.nav_groups:
mWebView.setVisibility(View.INVISIBLE);

mWebView.loadUrl(baseURL + "groups/?category=membership");
css += "._129- {position:initial}";
item.setChecked(true);
break;
case R.id.nav_mainmenu:
mWebView.setVisibility(View.INVISIBLE);

if (!mPreferences.getBoolean("save_data", false))
mWebView.loadUrl("javascript:(function()%7Btry%7Bdocument.querySelector('%23bookmarks_jewel%20%3E%20a').click()%7Dcatch(_)%7Bwindow.location.href%3D'" + "https%3A%2F%2Fm.facebook.com%2F" + "home.php'%7D%7D)()");
else
Expand All @@ -965,11 +985,15 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
item.setChecked(true);
break;
case R.id.nav_events:
mWebView.loadUrl(baseURL + "events/upcoming");
mWebView.setVisibility(View.INVISIBLE);

mWebView.loadUrl(baseURL + "events/");
css += "#page{top:0}";
item.setChecked(true);
break;
case R.id.nav_photos:
mWebView.setVisibility(View.INVISIBLE);

mWebView.loadUrl(baseURL + "photos/");
break;
case R.id.nav_settings:
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/me/zeeroooo/materialfb/Activities/More.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.support.v7.widget.Toolbar;
import android.text.Html;

import me.zeeroooo.materialfb.BuildConfig;
import me.zeeroooo.materialfb.Ui.Theme;
import me.zeeroooo.materialfb.R;

Expand All @@ -31,14 +32,13 @@ public static class MoreAndCredits extends PreferenceFragment implements Prefere
public void onCreate(final Bundle Instance) {
super.onCreate(Instance);
addPreferencesFromResource(R.xml.more);
Preference changelog = findPreference("changelog");
changelog.setOnPreferenceClickListener(this);
findPreference("changelog").setOnPreferenceClickListener(this);
findPreference("mfb_version").setSummary(getString(R.string.updates_summary, BuildConfig.VERSION_NAME));
}

@Override
public boolean onPreferenceClick(Preference preference) {
String key = preference.getKey();
switch (key) {
switch (preference.getKey()) {
case "changelog":
AlertDialog.Builder changelog = new AlertDialog.Builder(getActivity());
changelog.setTitle(getResources().getString(R.string.changelog));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,9 @@ else if (download) {
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(imageUrl));

// Set the download directory
File downloads_dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File downloads_dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES + "/MaterialFBook");
if (!downloads_dir.exists())
if (!downloads_dir.mkdirs())
return;
downloads_dir.mkdir();
File destinationFile = new File(downloads_dir, Uri.parse(imageUrl).getLastPathSegment());
request.setDestinationUri(Uri.fromFile(destinationFile));

Expand Down
12 changes: 4 additions & 8 deletions app/src/main/java/me/zeeroooo/materialfb/Activities/Video.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,9 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String permissi
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));

// Set the download directory
File downloads_dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
if (!downloads_dir.exists()) {
if (!downloads_dir.mkdirs()) {
return;
}
}
File downloads_dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES + "/MaterialFBook");
if (!downloads_dir.exists())
downloads_dir.mkdir();
File destinationFile = new File(downloads_dir, Uri.parse(url).getLastPathSegment());
request.setDestinationUri(Uri.fromFile(destinationFile));

Expand All @@ -213,9 +210,8 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String permissi
mDownloadManager.enqueue(request);

CookingAToast.cooking(this, getString(R.string.downloaded), Color.WHITE, Color.parseColor("#00C851"), R.drawable.ic_download, false).show();
} else {
} else
CookingAToast.cooking(this, getString(R.string.permission_denied), Color.WHITE, Color.parseColor("#ff4444"), R.drawable.ic_error, true).show();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import android.os.Bundle;
import android.preference.PreferenceFragment;

import me.zeeroooo.materialfb.R;

public class NavigationMenuFragment extends PreferenceFragment {

@Override
public void onCreate(final Bundle savedInstanceState)
{
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.navigation_menu_settings);
}
Expand Down
Loading

0 comments on commit c709c00

Please sign in to comment.