@@ -14,13 +13,13 @@
|
-
+
|
- Awais Soomro
- Software Developer
+ AWAiS SOOMrO
+ [Developer]
+ https://awaisome.com
|
@@ -34,26 +33,20 @@ I am just some guy, trying to live the life.
If you have any queries, opinions or ideas contact me.
+
+
+
+ GitHub: awaisking
+
+ |
+
-
-
-
-
-
- GitHub: awaisking
- |
-
-
-
-
- Instagram: @the.badak
- |
-
-
-
+
+ Instagram: @awais.ome
+
|
diff --git a/app/src/main/java/awais/backworddictionary/DictionaryFragment.java b/app/src/main/java/awais/backworddictionary/DictionaryFragment.java
index 775ad01..42f9f76 100644
--- a/app/src/main/java/awais/backworddictionary/DictionaryFragment.java
+++ b/app/src/main/java/awais/backworddictionary/DictionaryFragment.java
@@ -18,6 +18,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.core.app.ActivityCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -88,8 +89,8 @@ public void onAttach(@NonNull final Context context) {
// check for tts before initializing it
if (Main.tts == null) {
try {
- startActivityForResult(new Intent(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA),
- Main.TTS_DATA_CHECK_CODE);
+ ActivityCompat.startActivityForResult(this.activity, new Intent(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA),
+ Main.TTS_DATA_CHECK_CODE, null);
} catch (final Throwable e) {
// tts check activity not found
Toast.makeText(this.activity, R.string.tts_act_not_found, Toast.LENGTH_SHORT).show();
@@ -190,17 +191,18 @@ else if (view == dictionaryBinding.filterSearchButton) {
filterCheck[2] = SettingsHelper.isFilterContains();
new MaterialAlertDialogBuilder(activity, R.style.MaterialAlertDialogTheme)
- .setTitle(R.string.select_filters).setMultiChoiceItems(new String[]{getString(R.string.words), getString(R.string.defs), getString(R.string.contains)},
- filterCheck, (dialogInterface, i, checked) -> {
+ .setTitle(R.string.select_filters)
+ .setMultiChoiceItems(new String[]{getString(R.string.words), getString(R.string.defs), getString(R.string.contains)}, filterCheck, (dialogInterface, i, checked) -> {
filterCheck[i] = checked;
if (i == 0) SettingsHelper.setFilter("filterWord", checked);
else if (i == 1) SettingsHelper.setFilter("filterDefinition", checked);
else if (i == 2) SettingsHelper.setFilter("filterContain", checked);
- }).setNeutralButton(R.string.ok, (dialogInterface, i) -> {
- if (wordList.size() > 2)
- wordsAdapter.getFilter().filter(dictionaryBinding.filterSearchEditor.getText());
- dialogInterface.dismiss();
- }).show();
+ })
+ .setNeutralButton(R.string.ok, (dialogInterface, i) -> {
+ if (wordList.size() > 2)
+ wordsAdapter.getFilter().filter(dictionaryBinding.filterSearchEditor.getText());
+ dialogInterface.dismiss();
+ }).show();
} else {
dictionaryBinding.filterSearchEditor.setText("");
dictionaryBinding.filterSearchButton.setTag("filter");
@@ -215,7 +217,7 @@ public void onTextChanged(final CharSequence s, final int start, final int befor
}
@Override
- public void afterTextChanged(final Editable editable) {
+ public void afterTextChanged(@NonNull final Editable editable) {
if (editable.length() > 0) {
dictionaryBinding.filterSearchButton.setImageResource(R.drawable.ic_clear);
dictionaryBinding.filterSearchButton.setTag("clear");
diff --git a/app/src/main/java/awais/backworddictionary/LinkedApp.java b/app/src/main/java/awais/backworddictionary/LinkedApp.java
index ceb9004..0bae3f1 100644
--- a/app/src/main/java/awais/backworddictionary/LinkedApp.java
+++ b/app/src/main/java/awais/backworddictionary/LinkedApp.java
@@ -8,7 +8,13 @@
import androidx.core.content.res.ResourcesCompat;
import androidx.multidex.MultiDexApplication;
-import com.google.firebase.crashlytics.FirebaseCrashlytics;
+import com.applovin.mediation.MaxMediatedNetworkInfo;
+import com.applovin.sdk.AppLovinSdk;
+import com.inmobi.sdk.InMobiSdk;
+import com.startapp.sdk.adsbase.StartAppAd;
+import com.startapp.sdk.adsbase.StartAppSDK;
+
+import java.util.List;
import awais.backworddictionary.helpers.SettingsHelper;
import awais.backworddictionary.helpers.Utils;
@@ -21,7 +27,6 @@ public void onCreate() {
super.onCreate();
SettingsHelper.setPreferences(this);
- Utils.firebaseCrashlytics = FirebaseCrashlytics.getInstance();
Typeface fontBold = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@@ -32,7 +37,6 @@ public void onCreate() {
fontBold = resources.getFont(R.font.googlesans_bold);
} catch (final Exception e) {
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "LinkedApp", e);
- else Utils.firebaseCrashlytics.recordException(e);
}
}
@@ -45,5 +49,26 @@ public void onCreate() {
Utils.setDefaultFont("SERIF", fontMedium);
Utils.setDefaultFont("MONOSPACE", fontMedium);
Utils.setDefaultFont("DEFAULT_BOLD", fontBold);
+
+ {
+ if (SettingsHelper.showAds()) {
+ InMobiSdk.setLogLevel(BuildConfig.DEBUG ? InMobiSdk.LogLevel.DEBUG : InMobiSdk.LogLevel.NONE);
+ if (!InMobiSdk.isSDKInitialized())
+ InMobiSdk.init(this, "56047691bf7041f0a0b29e2497650619", null, null);
+
+ StartAppSDK.init(this, getString(R.string.startio_APP_ID), false);
+ StartAppSDK.setTestAdsEnabled(BuildConfig.DEBUG);
+ StartAppSDK.enableReturnAds(!BuildConfig.DEBUG);
+ StartAppSDK.setUserConsent(this, "pas", System.currentTimeMillis(), false);
+ StartAppAd.disableSplash();
+ if (BuildConfig.DEBUG) StartAppAd.disableAutoInterstitial();
+ else StartAppAd.enableAutoInterstitial();
+ }
+
+ final AppLovinSdk instance = AppLovinSdk.getInstance(this);
+ instance.setMediationProvider("max");
+ AppLovinSdk.initializeSdk(this, initStatus -> {
+ });
+ }
}
}
\ No newline at end of file
diff --git a/app/src/main/java/awais/backworddictionary/Main.java b/app/src/main/java/awais/backworddictionary/Main.java
index fc106a7..9e9875b 100644
--- a/app/src/main/java/awais/backworddictionary/Main.java
+++ b/app/src/main/java/awais/backworddictionary/Main.java
@@ -18,6 +18,7 @@
import android.text.TextUtils;
import android.text.style.StyleSpan;
import android.util.Log;
+import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -33,8 +34,11 @@
import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.TooltipCompat;
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
+import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
+import com.applovin.sdk.AppLovinSdk;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.tabs.TabLayout;
@@ -104,10 +108,6 @@ protected void onCreate(final Bundle savedInstanceState) {
if (nightMode != AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
AppCompatDelegate.setDefaultNightMode(nightMode);
- final View contentView = View.inflate(this, R.layout.activity_main, null);
- mainBinding = ActivityMainBinding.bind(contentView);
- setContentView(contentView);
-
final View decorView = window.getDecorView().findViewById(Window.ID_ANDROID_CONTENT);
if (Build.VERSION.SDK_INT == 19 && Utils.statusBarHeight > 0 && decorView instanceof ViewGroup) {
final ViewGroup viewGroup = (ViewGroup) decorView;
@@ -136,6 +136,10 @@ protected void onCreate(final Bundle savedInstanceState) {
}
}
+ mainBinding = ActivityMainBinding.inflate(LayoutInflater.from(this), null, false);
+ final CoordinatorLayout contentView = mainBinding.getRoot();
+ setContentView(contentView);
+
menuHelper = new MenuHelper(this);
Utils.adsBox(this);
@@ -147,8 +151,8 @@ protected void onCreate(final Bundle savedInstanceState) {
// check for tts before initializing it
try {
- startActivityForResult(new Intent(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA),
- TTS_DATA_CHECK_CODE);
+ ActivityCompat.startActivityForResult(this, new Intent(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA),
+ TTS_DATA_CHECK_CODE, null);
} catch (final Throwable e) {
// tts check activity not found
Toast.makeText(Main.this, R.string.tts_act_not_found, Toast.LENGTH_SHORT).show();
@@ -243,7 +247,6 @@ else if (prevItem.title != null && !prevItem.title.isEmpty()) {
currentItem.title = prevItem.title;
} catch (final Exception e) {
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "Main::loadFragments::onTabSelected", e);
- else Utils.firebaseCrashlytics.recordException(e);
}
}
@@ -415,7 +418,6 @@ public void onSearch(final String word) {
}
} catch (final Exception e) {
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "Main::onSearch", e);
- else Utils.firebaseCrashlytics.recordException(e);
}
}
diff --git a/app/src/main/java/awais/backworddictionary/adapters/DictionaryWordsAdapter.java b/app/src/main/java/awais/backworddictionary/adapters/DictionaryWordsAdapter.java
index 73fb7bf..82a5dca 100644
--- a/app/src/main/java/awais/backworddictionary/adapters/DictionaryWordsAdapter.java
+++ b/app/src/main/java/awais/backworddictionary/adapters/DictionaryWordsAdapter.java
@@ -182,11 +182,11 @@ public boolean onLongClick(final View view) {
this.filter = new Filter() {
private final FilterResults results = new FilterResults();
- private ArrayList filteredList;
@Override
protected FilterResults performFiltering(final CharSequence charSequence) {
results.values = wordList;
+ results.count = wordList != null ? wordList.size() : 0;
if (wordList == null) return results;
if (Utils.isEmpty(charSequence)) return results;
@@ -233,16 +233,16 @@ protected FilterResults performFiltering(final CharSequence charSequence) {
}
filteredList.trimToSize();
+ results.values = filteredList;
results.count = filteredList.size();
- this.filteredList = filteredList;
-
return results;
}
@Override
protected void publishResults(final CharSequence charSequence, FilterResults filterResults) {
- updateList(filteredList);
+ //noinspection unchecked
+ updateList((ArrayList) filterResults.values);
}
};
}
diff --git a/app/src/main/java/awais/backworddictionary/asyncs/SearchAsyncTask.java b/app/src/main/java/awais/backworddictionary/asyncs/SearchAsyncTask.java
index 5f22f36..9ccef0e 100644
--- a/app/src/main/java/awais/backworddictionary/asyncs/SearchAsyncTask.java
+++ b/app/src/main/java/awais/backworddictionary/asyncs/SearchAsyncTask.java
@@ -42,7 +42,6 @@ protected ArrayList doInBackground(final String param) {
}
} catch (final Exception e) {
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "SearchAsyncTask", e);
- else Utils.firebaseCrashlytics.recordException(e);
}
return arrayList;
diff --git a/app/src/main/java/awais/backworddictionary/asyncs/WordsAsync.java b/app/src/main/java/awais/backworddictionary/asyncs/WordsAsync.java
index 70ccc90..e5d584c 100644
--- a/app/src/main/java/awais/backworddictionary/asyncs/WordsAsync.java
+++ b/app/src/main/java/awais/backworddictionary/asyncs/WordsAsync.java
@@ -98,7 +98,6 @@ protected ArrayList doInBackground(final Void param) {
}
} catch (final Exception e) {
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "WordsAsync :: " + e, e);
- else Utils.firebaseCrashlytics.recordException(e);
}
return wordItemsList;
diff --git a/app/src/main/java/awais/backworddictionary/dialogs/WordDialog.java b/app/src/main/java/awais/backworddictionary/dialogs/WordDialog.java
index 777ce29..fb5d68f 100644
--- a/app/src/main/java/awais/backworddictionary/dialogs/WordDialog.java
+++ b/app/src/main/java/awais/backworddictionary/dialogs/WordDialog.java
@@ -13,13 +13,13 @@
import androidx.annotation.NonNull;
import androidx.appcompat.view.ContextThemeWrapper;
-import androidx.browser.customtabs.CustomTabsIntent;
import java.util.List;
import awais.backworddictionary.R;
import awais.backworddictionary.adapters.DefinitionsAdapter;
import awais.backworddictionary.databinding.WordDialogBinding;
+import awais.backworddictionary.helpers.CustomTabsHelper;
import awais.backworddictionary.helpers.URLEncoder;
import awais.backworddictionary.helpers.Utils;
import awais.backworddictionary.helpers.other.CustomTabActivityHelper;
@@ -32,10 +32,11 @@ public final class WordDialog extends Dialog implements android.view.View.OnClic
private final String word;
private final Context context;
private final List> defs;
- private final CustomTabsIntent.Builder customTabsIntent;
private final AdapterClickListener itemClickListener;
private final boolean anySearchAppFound;
+ private final CustomTabsHelper customTabsHelper = new CustomTabsHelper();
+
private WordDialogBinding wordDialogBinding;
public WordDialog(Context context, final String word, final List> defs, final AdapterClickListener itemClickListener) {
@@ -45,7 +46,6 @@ public WordDialog(Context context, final String word, final List> defs, final
this.word = word;
this.defs = defs;
this.itemClickListener = itemClickListener;
- this.customTabsIntent = new CustomTabsIntent.Builder();
}
@Override
@@ -109,8 +109,7 @@ public void onClick(@NonNull final View v) {
.putExtra(SearchManager.QUERY, word)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK));
} catch (final Exception e) {
- customTabsIntent.setToolbarColor(Utils.CUSTOM_TAB_COLORS[0]);
- CustomTabActivityHelper.openCustomTab(context, customTabsIntent.build(),
+ CustomTabActivityHelper.openCustomTab(context, customTabsHelper.setToolbarColor(Utils.CUSTOM_TAB_COLORS[0]),
Uri.parse("https://google.com/search?q=define+".concat(URLEncoder.encode(word))));
}
@@ -123,14 +122,12 @@ public void onClick(@NonNull final View v) {
final List resInfo = context.getPackageManager().queryIntentActivities(intent, 0);
if (resInfo.size() > 0) context.startActivity(intent);
else {
- customTabsIntent.setToolbarColor(Utils.CUSTOM_TAB_COLORS[1]);
- CustomTabActivityHelper.openCustomTab(context, customTabsIntent.build(),
+ CustomTabActivityHelper.openCustomTab(context, customTabsHelper.setToolbarColor(Utils.CUSTOM_TAB_COLORS[1]),
wordWikiUri);
}
} else if (v == wordDialogBinding.btnUrban) {
- customTabsIntent.setToolbarColor(Utils.CUSTOM_TAB_COLORS[2]);
- CustomTabActivityHelper.openCustomTab(context, customTabsIntent.build(),
+ CustomTabActivityHelper.openCustomTab(context, customTabsHelper.setToolbarColor(Utils.CUSTOM_TAB_COLORS[2]),
Uri.parse("https://www.urban".concat("dictionary.com/define.php?term=").concat(word)));
}
dismiss();
diff --git a/app/src/main/java/awais/backworddictionary/helpers/CustomTabsHelper.java b/app/src/main/java/awais/backworddictionary/helpers/CustomTabsHelper.java
new file mode 100644
index 0000000..8244a0d
--- /dev/null
+++ b/app/src/main/java/awais/backworddictionary/helpers/CustomTabsHelper.java
@@ -0,0 +1,76 @@
+package awais.backworddictionary.helpers;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.NonNull;
+import androidx.core.app.BundleCompat;
+import androidx.core.content.ContextCompat;
+
+import awais.backworddictionary.BuildConfig;
+
+public final class CustomTabsHelper {
+ private static final String EXTRA_USER_OPT_OUT_FROM_CUSTOM_TABS = "android.support.customtabs.extra.user_opt_out";
+ private static final String EXTRA_SESSION = "android.support.customtabs.extra.SESSION";
+ private static final String EXTRA_TOOLBAR_COLOR = "android.support.customtabs.extra.TOOLBAR_COLOR";
+ private static final String EXTRA_SECONDARY_TOOLBAR_COLOR = "android.support.customtabs.extra.SECONDARY_TOOLBAR_COLOR";
+ private static final String EXTRA_ENABLE_INSTANT_APPS = "android.support.customtabs.extra.EXTRA_ENABLE_INSTANT_APPS";
+ private static final String EXTRA_DEFAULT_SHARE_MENU_ITEM = "android.support.customtabs.extra.SHARE_MENU_ITEM";
+ private static final String EXTRA_ENABLE_URLBAR_HIDING = "android.support.customtabs.extra.ENABLE_URLBAR_HIDING";
+ private static final String EXTRA_TITLE_VISIBILITY_STATE = "android.support.customtabs.extra.TITLE_VISIBILITY";
+
+ private static final int NO_TITLE = 0;
+ private static final int SHOW_PAGE_TITLE = 1;
+
+ public final Intent intent;
+
+ public CustomTabsHelper() {
+ final Bundle bundle = new Bundle();
+ BundleCompat.putBinder(bundle, EXTRA_SESSION, null);
+
+ boolean showTitle = !BuildConfig.DEBUG;
+
+ this.intent = new Intent(Intent.ACTION_VIEW)
+ .putExtra(EXTRA_ENABLE_INSTANT_APPS, true)
+ .putExtra(EXTRA_TITLE_VISIBILITY_STATE, showTitle ? SHOW_PAGE_TITLE : NO_TITLE)
+ .putExtra(EXTRA_DEFAULT_SHARE_MENU_ITEM, true)
+ //.putExtra(EXTRA_ENABLE_URLBAR_HIDING, true)
+ .putExtras(bundle);
+ }
+
+ public CustomTabsHelper setToolbarColor(@ColorInt int color) {
+ intent.putExtra(EXTRA_TOOLBAR_COLOR, color);
+ return this;
+ }
+
+ public CustomTabsHelper setSecondaryToolbarColor(@ColorInt int color) {
+ intent.putExtra(EXTRA_SECONDARY_TOOLBAR_COLOR, color);
+ return this;
+ }
+
+ public CustomTabsHelper setUseNewTask() {
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ return this;
+ }
+
+ public void launchUrl(final Context context, final Uri url) {
+ intent.setData(url);
+ ContextCompat.startActivity(context, intent, null);
+ }
+
+ @NonNull
+ public static Intent setAlwaysUseBrowserUI(Intent intent) {
+ if (intent == null) intent = new Intent(Intent.ACTION_VIEW);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.putExtra(EXTRA_USER_OPT_OUT_FROM_CUSTOM_TABS, true);
+ return intent;
+ }
+
+ public static boolean shouldAlwaysUseBrowserUI(@NonNull Intent intent) {
+ return intent.getBooleanExtra(EXTRA_USER_OPT_OUT_FROM_CUSTOM_TABS, false)
+ && (intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/awais/backworddictionary/helpers/MenuHelper.java b/app/src/main/java/awais/backworddictionary/helpers/MenuHelper.java
index 44bba55..4a6e86e 100644
--- a/app/src/main/java/awais/backworddictionary/helpers/MenuHelper.java
+++ b/app/src/main/java/awais/backworddictionary/helpers/MenuHelper.java
@@ -16,7 +16,6 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
-import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.FragmentManager;
@@ -29,7 +28,7 @@
public final class MenuHelper {
private static SpannableStringBuilder examplesSpan, helpSpan, licensesSpan;
- private static CustomTabsIntent.Builder customTabsIntent;
+ private static CustomTabsHelper customTabsHelper;
private final MenuDialog menuDialog;
private final String creditsString;
private final FragmentManager fragmentManager;
@@ -39,7 +38,7 @@ public MenuHelper(@NonNull final AppCompatActivity activity) {
creditsString = resources.getString(R.string._credits);
fragmentManager = activity.getSupportFragmentManager();
menuDialog = new MenuDialog();
- customTabsIntent = new CustomTabsIntent.Builder();
+ customTabsHelper = new CustomTabsHelper();
final boolean helpEmpty = helpSpan == null || helpSpan.length() < 1;
final boolean examplesEmpty = examplesSpan == null || examplesSpan.length() < 1;
@@ -86,8 +85,8 @@ protected Void doInBackground(final Void param) {
helpBuilder.append("[" + activity.getString(R.string.wildcard_link_help).concat("]\n\n"), new BulletSpan(26, helpColor), new ClickableSpan() {
@Override
public void onClick(@NonNull final View view) {
- customTabsIntent.setToolbarColor(0xFFFFC400);
- CustomTabActivityHelper.openCustomTab(activity, customTabsIntent.build(), Uri.parse("https://www.one".concat("look.com/?c=faq#patterns")));
+ CustomTabActivityHelper.openCustomTab(activity, customTabsHelper.setToolbarColor(0xFFFFC400),
+ Uri.parse("https://www.one".concat("look.com/?c=faq#patterns")));
}
});
helpBuilder.append(activity.getString(R.string.synonyms).concat(":\n"), new RelativeSizeSpan(1.2f), new StyleSpan(Typeface.BOLD), new ForegroundColorSpan(helpColor));
@@ -114,8 +113,8 @@ public void onClick(@NonNull final View view) {
licensesBuilder.append("Android Asset Studio - Launcher icon generator\n\n", new BulletSpan(26, helpColor), new ClickableSpan() {
@Override
public void onClick(@NonNull final View view) {
- customTabsIntent.setToolbarColor(0xFF607D8B);
- CustomTabActivityHelper.openCustomTab(activity, customTabsIntent.build(), Uri.parse("https://romannurik.github.io/AndroidAssetStudio/"));
+ CustomTabActivityHelper.openCustomTab(activity, customTabsHelper.setToolbarColor(0xFF607D8B),
+ Uri.parse("https://romannurik.github.io/AndroidAssetStudio/"));
}
});
@@ -123,8 +122,8 @@ public void onClick(@NonNull final View view) {
licensesBuilder.append("Datamuse API\n\n", new BulletSpan(26, helpColor), new ClickableSpan() {
@Override
public void onClick(@NonNull final View view) {
- customTabsIntent.setToolbarColor(0xFF006FCC);
- CustomTabActivityHelper.openCustomTab(activity, customTabsIntent.build(), Uri.parse("https://www.datamuse.com/api/"));
+ CustomTabActivityHelper.openCustomTab(activity, customTabsHelper.setToolbarColor(0xFF006FCC),
+ Uri.parse("https://www.datamuse.com/api/"));
}
});
@@ -137,8 +136,8 @@ public void onClick(@NonNull final View view) {
licensesBuilder.append("Apache License 2.0", new BulletSpan(26, helpColor), new ClickableSpan() {
@Override
public void onClick(@NonNull final View view) {
- customTabsIntent.setToolbarColor(0xFFCB2533);
- CustomTabActivityHelper.openCustomTab(activity, customTabsIntent.build(), Uri.parse("https://www.apache.org/licenses/LICENSE-2.0"));
+ CustomTabActivityHelper.openCustomTab(activity, customTabsHelper.setToolbarColor(0xFFCB2533),
+ Uri.parse("https://www.apache.org/licenses/LICENSE-2.0"));
}
});
diff --git a/app/src/main/java/awais/backworddictionary/helpers/Utils.java b/app/src/main/java/awais/backworddictionary/helpers/Utils.java
index b0866aa..635622e 100644
--- a/app/src/main/java/awais/backworddictionary/helpers/Utils.java
+++ b/app/src/main/java/awais/backworddictionary/helpers/Utils.java
@@ -39,10 +39,7 @@
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.appcompat.widget.PopupMenu;
-import com.google.android.gms.ads.AdRequest;
-import com.google.android.gms.ads.AdView;
-import com.google.android.gms.ads.MobileAds;
-import com.google.firebase.crashlytics.FirebaseCrashlytics;
+import com.applovin.mediation.ads.MaxAdView;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@@ -69,7 +66,6 @@ public final class Utils {
public static final int[] CUSTOM_TAB_COLORS = new int[]{0xFF4888F2, 0xFF333333, 0xFF3B496B};
public static final String CHARSET = "UTF-8";
- public static FirebaseCrashlytics firebaseCrashlytics;
public static InputMethodManager inputMethodManager;
public static NotificationManager notificationManager;
public static Locale defaultLocale;
@@ -107,7 +103,6 @@ public static void setDefaultFont(final String typefaceName, final Typeface font
staticField.set(null, fontTypeface);
} catch (final Exception e) {
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "Utils::setDefaultFont", e);
- else firebaseCrashlytics.recordException(e);
}
}
@@ -142,13 +137,15 @@ public static void removeHandlerCallbacksSilent(final Handler handler, final Run
public static void adsBox(@NonNull final Activity activity) {
final View adLayout = activity.findViewById(R.id.adLayout);
- if (adLayout == null) return;
+ final MaxAdView adView = activity.findViewById(R.id.adView);
+ if (adLayout == null || adView == null) return;
if (SettingsHelper.showAds()) {
- MobileAds.initialize(activity, initializationStatus -> { });
- final AdView adView = activity.findViewById(R.id.adView);
- adView.setAdListener(new Listener(adLayout));
- adView.loadAd(new AdRequest.Builder().build());
- } else adLayout.setVisibility(View.GONE);
+ adView.setListener(new Listener(adLayout));
+ adView.loadAd();
+ } else {
+ adView.destroy();
+ adLayout.setVisibility(View.GONE);
+ }
}
public static int getStatusBarHeight(final Window window, final Resources resources) {
diff --git a/app/src/main/java/awais/backworddictionary/helpers/other/CustomTabActivityHelper.java b/app/src/main/java/awais/backworddictionary/helpers/other/CustomTabActivityHelper.java
index f62bf09..4258f91 100644
--- a/app/src/main/java/awais/backworddictionary/helpers/other/CustomTabActivityHelper.java
+++ b/app/src/main/java/awais/backworddictionary/helpers/other/CustomTabActivityHelper.java
@@ -8,12 +8,13 @@
import android.net.Uri;
import android.util.Log;
-import androidx.browser.customtabs.CustomTabsIntent;
+import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;
import awais.backworddictionary.BuildConfig;
+import awais.backworddictionary.helpers.CustomTabsHelper;
import awais.backworddictionary.helpers.Utils;
public final class CustomTabActivityHelper {
@@ -25,14 +26,16 @@ public final class CustomTabActivityHelper {
private static final String ACTION_CUSTOM_TABS_CONNECTION_ANDROID_X = "androidx.browser.customtabs.action.CustomTabsService";
private static String packageNameToUse;
- public static void openCustomTab(final Context context, final CustomTabsIntent customTabsIntent, final Uri uri) {
+ public static void openCustomTab(final Context context, @NonNull final CustomTabsHelper customTabsHelper, final Uri uri) {
final String packageName = getPackageNameToUse(context);
- if (packageName == null) context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
- else {
- customTabsIntent.intent.setPackage(packageName);
- customTabsIntent.launchUrl(context, uri);
- }
+ //if (packageName == null) context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
+ //else {
+ // customTabsHelper.intent.setPackage(packageName);
+ // customTabsHelper.launchUrl(context, uri);
+ //}
+ customTabsHelper.intent.setPackage(packageName);
+ customTabsHelper.launchUrl(context, uri);
}
private static String getPackageNameToUse(final Context context) {
diff --git a/app/src/main/java/awais/backworddictionary/helpers/other/Listener.java b/app/src/main/java/awais/backworddictionary/helpers/other/Listener.java
index 41d4a49..904801e 100644
--- a/app/src/main/java/awais/backworddictionary/helpers/other/Listener.java
+++ b/app/src/main/java/awais/backworddictionary/helpers/other/Listener.java
@@ -2,15 +2,22 @@
import android.view.View;
-import androidx.annotation.NonNull;
+import com.applovin.mediation.MaxAd;
+import com.applovin.mediation.MaxAdViewAdListener;
+import com.applovin.mediation.MaxError;
-import com.google.android.gms.ads.AdListener;
-import com.google.android.gms.ads.LoadAdError;
-
-public final class Listener extends AdListener {
+public final class Listener implements MaxAdViewAdListener {
private final View v;
- public Listener(final View v) { this.v = v; }
- @Override public void onAdLoaded() { v.setVisibility(View.VISIBLE); }
- @Override public void onAdClosed() { v.setVisibility(View.GONE); }
- @Override public void onAdFailedToLoad(@NonNull final LoadAdError loadAdError) { v.setVisibility(View.GONE); }
-}
+ public Listener(final View v) {this.v = v;}
+
+ @Override public void onAdClicked(final MaxAd ad) {}
+
+ @Override public void onAdLoaded(final MaxAd ad) {v.setVisibility(View.VISIBLE);}
+ @Override public void onAdExpanded(final MaxAd ad) {v.setVisibility(View.VISIBLE);}
+ @Override public void onAdDisplayed(final MaxAd ad) {v.setVisibility(View.VISIBLE);}
+
+ @Override public void onAdHidden(final MaxAd ad) {v.setVisibility(View.GONE);}
+ @Override public void onAdCollapsed(final MaxAd ad) {v.setVisibility(View.GONE);}
+ @Override public void onAdLoadFailed(final String adUnitId, final MaxError error) {v.setVisibility(View.GONE);}
+ @Override public void onAdDisplayFailed(final MaxAd ad, final MaxError error) {v.setVisibility(View.GONE);}
+}
\ No newline at end of file
diff --git a/app/src/main/java/awais/backworddictionary/interfaces/WordClickSearchListener.java b/app/src/main/java/awais/backworddictionary/interfaces/WordClickSearchListener.java
index e6530f2..cd6b05b 100644
--- a/app/src/main/java/awais/backworddictionary/interfaces/WordClickSearchListener.java
+++ b/app/src/main/java/awais/backworddictionary/interfaces/WordClickSearchListener.java
@@ -1,7 +1,5 @@
package awais.backworddictionary.interfaces;
-import static awais.backworddictionary.helpers.Utils.firebaseCrashlytics;
-
import android.app.Dialog;
import android.content.Context;
import android.util.Log;
@@ -40,7 +38,6 @@ public boolean onMenuItemClick(final MenuItem item) {
actMain.onSearch(word);
} catch (final Exception e) {
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "WordClickSearchListener", e);
- else firebaseCrashlytics.recordException(e);
}
} else {
Context baseContext = null;
diff --git a/app/src/main/java/awais/backworddictionary/interfaces/WordContextItemListener.java b/app/src/main/java/awais/backworddictionary/interfaces/WordContextItemListener.java
index 4e63710..648ad61 100644
--- a/app/src/main/java/awais/backworddictionary/interfaces/WordContextItemListener.java
+++ b/app/src/main/java/awais/backworddictionary/interfaces/WordContextItemListener.java
@@ -9,17 +9,17 @@
import androidx.annotation.NonNull;
import androidx.appcompat.widget.PopupMenu;
-import androidx.browser.customtabs.CustomTabsIntent;
import java.util.List;
import awais.backworddictionary.R;
+import awais.backworddictionary.helpers.CustomTabsHelper;
import awais.backworddictionary.helpers.URLEncoder;
import awais.backworddictionary.helpers.Utils;
import awais.backworddictionary.helpers.other.CustomTabActivityHelper;
public final class WordContextItemListener implements PopupMenu.OnMenuItemClickListener {
- private final CustomTabsIntent.Builder customTabsIntent = new CustomTabsIntent.Builder();
+ private final CustomTabsHelper customTabsHelper = new CustomTabsHelper();
private final Context context;
private String word;
@@ -48,8 +48,7 @@ public boolean onMenuItemClick(@NonNull final MenuItem menuItem) {
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK));
} catch (final Exception e) {
- customTabsIntent.setToolbarColor(Utils.CUSTOM_TAB_COLORS[0]);
- CustomTabActivityHelper.openCustomTab(context, customTabsIntent.build(),
+ CustomTabActivityHelper.openCustomTab(context, customTabsHelper.setToolbarColor(Utils.CUSTOM_TAB_COLORS[0]),
Uri.parse("https://google.com/search?q=define+" .concat(URLEncoder.encode(word))));
}
@@ -64,14 +63,12 @@ public boolean onMenuItemClick(@NonNull final MenuItem menuItem) {
final List resolveInfos = context.getPackageManager().queryIntentActivities(intent, 0);
if (resolveInfos.size() > 0) context.startActivity(intent);
else {
- customTabsIntent.setToolbarColor(Utils.CUSTOM_TAB_COLORS[1]);
- CustomTabActivityHelper.openCustomTab(context, customTabsIntent.build(),
+ CustomTabActivityHelper.openCustomTab(context, customTabsHelper.setToolbarColor(Utils.CUSTOM_TAB_COLORS[1]),
wordWikiUri);
}
} else if (itemId == R.id.action_urban) {
- customTabsIntent.setToolbarColor(Utils.CUSTOM_TAB_COLORS[2]);
- CustomTabActivityHelper.openCustomTab(context, customTabsIntent.build(),
+ CustomTabActivityHelper.openCustomTab(context, customTabsHelper.setToolbarColor(Utils.CUSTOM_TAB_COLORS[2]),
Uri.parse("https://www.urbandictionary.com/define.php?term=".concat(word)));
} else
diff --git a/app/src/main/java/awais/clans/FloatingActionMenu.java b/app/src/main/java/awais/clans/FloatingActionMenu.java
index 9d0dc0d..447fae1 100644
--- a/app/src/main/java/awais/clans/FloatingActionMenu.java
+++ b/app/src/main/java/awais/clans/FloatingActionMenu.java
@@ -118,6 +118,10 @@ public void onAnimationStart(final Animator animation) {
@Override
protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
+ if (isInEditMode()) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ return;
+ }
int maxLabelWidth = 0, maxButtonHeight = 0, height = 0;
measureChildWithMargins(imageToggle, widthMeasureSpec, 0, heightMeasureSpec, 0);
@@ -166,6 +170,7 @@ protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec
@Override
protected void onLayout(final boolean changed, final int left, final int top, final int right, final int bottom) {
+ if (isInEditMode()) return;
final int buttonsHorizontalCenter = right - left - maxButtonWidth / 2 - getPaddingRight();
final int imageToggleMeasuredHeight = imageToggle.getMeasuredHeight();
diff --git a/app/src/main/res/layout/bottom_view.xml b/app/src/main/res/layout/bottom_view.xml
index d0716b3..dda08e3 100644
--- a/app/src/main/res/layout/bottom_view.xml
+++ b/app/src/main/res/layout/bottom_view.xml
@@ -1,6 +1,5 @@
@@ -31,13 +30,12 @@
android:layout_height="wrap_content"
android:background="@android:color/white">
-
+ android:layout_height="56dp"
+ android:layout_gravity="center_horizontal|bottom"
+ maxads:adUnitId="@string/apl_UNIT_ID" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/dictionary_view.xml b/app/src/main/res/layout/dictionary_view.xml
index 4892a54..906bee8 100644
--- a/app/src/main/res/layout/dictionary_view.xml
+++ b/app/src/main/res/layout/dictionary_view.xml
@@ -73,9 +73,7 @@
android:importantForAutofill="no"
android:inputType="text"
android:paddingStart="12dp"
- android:paddingLeft="12dp"
android:paddingEnd="8dp"
- android:paddingRight="8dp"
android:singleLine="true"
android:textIsSelectable="true"
android:windowSoftInputMode="adjustPan" />
diff --git a/app/src/main/res/layout/word_dialog.xml b/app/src/main/res/layout/word_dialog.xml
index e528751..f4b9d08 100644
--- a/app/src/main/res/layout/word_dialog.xml
+++ b/app/src/main/res/layout/word_dialog.xml
@@ -11,10 +11,8 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="?dialogPreferredPadding"
- android:paddingLeft="?dialogPreferredPadding"
android:paddingTop="10dp"
- android:paddingEnd="12dp"
- android:paddingRight="12dp">
+ android:paddingEnd="12dp">
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index a3a5278..96ca5f5 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -55,7 +55,7 @@
-
diff --git a/build.gradle b/build.gradle
index 169f7fe..1fae6bc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,16 +2,19 @@ buildscript {
repositories {
google()
mavenCentral()
+ gradlePluginPortal()
+ maven { url 'https://jitpack.io' }
+ maven { url 'https://repo1.maven.org/maven2/' }
maven { url 'https://maven.java.net/content/groups/public/' }
+ maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
+ maven { url 'https://repository.apache.org/content/repositories/snapshots/' }
}
dependencies {
- classpath 'com.google.gms:google-services:4.3.10'
- classpath 'com.android.tools.build:gradle:7.1.1'
- classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
+ classpath 'com.android.tools.build:gradle:8.1.0-alpha11'
}
}
-task clean(type: Delete) {
+tasks.register('clean') {
delete rootProject.buildDir
}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index c304077..85c7b2c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,10 +1,14 @@
-#android.nonTransitiveRClass = true
-android.useAndroidX = true
-android.enableJetifier = true
##################
-org.gradle.daemon = true
-org.gradle.parallel = true
-org.gradle.caching = true
-org.gradle.vfs.watch = true
-org.gradle.jvmargs = -Xms128m -Xmx2048m -XX\:MaxPermSize\=1024m -XX\:ReservedCodeCacheSize\=1024m -XX\:+HeapDumpOnOutOfMemoryError -XX\:+UseParallelGC -Dfile.encoding\=UTF-8
-org.gradle.configureondemand = true
+android.nonTransitiveRClass = false
+##################
+android.nonFinalResIds = false
+android.useAndroidX = true
+android.enableJetifier = true
+##################
+#org.gradle.vfs.watch = true
+org.gradle.unsafe.configuration-cache = true
+org.gradle.configureondemand = true
+org.gradle.parallel = true
+org.gradle.caching = true
+org.gradle.daemon = false
+org.gradle.jvmargs = -Xms512m -Xmx2048m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=1024m -XX:+UseParallelGC -Dfile.encoding=UTF-8
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index f6b961f..e708b1c 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 67f7bde..75a9076 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Fri Jan 29 18:03:09 PKT 2021
+#Tue Jan 10 23:47:11 PKT 2023
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
-zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/settings.gradle b/settings.gradle
index 6ddb28b..1ef2cdf 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,11 +1,13 @@
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
+ //flatDir { dirs 'libs' }
google()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com/' }
- maven { url 'https://maven.java.net/content/groups/public/' }
+ maven { url 'https://repo1.maven.org/maven2/' }
+// maven { url 'https://maven.java.net/content/groups/public/' }
}
}