Skip to content

Commit

Permalink
Few improvements, added option to use external downloader, added turk…
Browse files Browse the repository at this point in the history
…ish translation (Thanks berkantkz), Updated slovak translation
  • Loading branch information
vojta-horanek committed Mar 15, 2017
1 parent 483f735 commit a7b506e
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 36 deletions.
6 changes: 2 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "cf.vojtechh.apkmirror"
minSdkVersion 21
targetSdkVersion 25
versionCode 120317
versionName "3.0.2"
versionCode 150317
versionName "3.0.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildConfigField("String", "AD_MOB_APP_KEY", AD_MOB_APP_KEY)
resValue("string", "AD_MOB_SETTINGS_BANNER_AD_KEY", AD_MOB_SETTINGS_BANNER_AD_KEY)
Expand Down Expand Up @@ -46,8 +46,6 @@ dependencies {
compile 'com.afollestad.material-dialogs:core:0.9.2.3'
//Bottom navigation
compile 'com.roughike:bottom-bar:2.1.1'
//Progressbar
compile 'me.zhanghai.android.materialprogressbar:library:1.3.0'
//ads
compile 'com.google.firebase:firebase-ads:10.2.0'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@

import cf.vojtechh.apkmirror.BuildConfig;
import cf.vojtechh.apkmirror.R;
import cf.vojtechh.apkmirror.classes.ObservableWebView;
import cf.vojtechh.apkmirror.classes.PageAsync;
import cf.vojtechh.apkmirror.interfaces.AsyncResponse;
import im.delight.android.webview.AdvancedWebView;
Expand All @@ -60,7 +59,7 @@

public class MainActivity extends AppCompatActivity implements AdvancedWebView.Listener, AsyncResponse {

private ObservableWebView webView;
private AdvancedWebView webView;
private ProgressBar progressBar;
private BottomBar navigation;
private FloatingActionButton fabSearch;
Expand Down Expand Up @@ -102,7 +101,7 @@ protected void onCreate(Bundle savedInstanceState) {
settingsLayoutFragment = (RelativeLayout) findViewById(R.id.settings_layout_fragment);
webContainer = (RelativeLayout) findViewById(R.id.web_container);
firstLoadingView = (LinearLayout) findViewById(R.id.first_loading_view);
webView = (ObservableWebView) findViewById(R.id.main_webview);
webView = (AdvancedWebView) findViewById(R.id.main_webview);
fabSearch = (FloatingActionButton) findViewById(R.id.fab_search);
progressBarContainer = (FrameLayout) findViewById(R.id.main_progress_bar_container);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
Expand All @@ -119,9 +118,9 @@ protected void onCreate(Bundle savedInstanceState) {
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);

;
//Analytics
if (sharedPreferences.getBoolean("firebase", true)) {
if (sharedPreferences.getBoolean("firebase", true) || BuildConfig.DEBUG) {
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
}

Expand Down Expand Up @@ -234,12 +233,6 @@ protected void onResume() {

@Override
protected void onPause() {
//Doing this here for the app to have some time to save it
if (saveUrl) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("last_url", webView.getUrl());
editor.apply();
}
webView.onPause();
super.onPause();
}
Expand All @@ -250,6 +243,16 @@ protected void onDestroy() {
super.onDestroy();
}

@Override
protected void onStop(){
if (saveUrl) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("last_url", webView.getUrl());
editor.apply();
}
super.onStop();
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
Expand Down Expand Up @@ -280,10 +283,11 @@ public void onBackPressed() {
}

}else {
if (!webView.getUrl().equals(APKMIRROR_UPLOAD_URL)){
navigation.selectTabWithId(R.id.navigation_home);
}else {
if (webView != null && webView.getUrl().equals(APKMIRROR_UPLOAD_URL)){
navigation.selectTabWithId(R.id.navigation_upload);
}else {
navigation.selectTabWithId(R.id.navigation_home);

}
return;
}
Expand Down Expand Up @@ -419,12 +423,18 @@ public void onAnimationEnd(Animator animation) {

private void download(String url, String name) {

if (AdvancedWebView.handleDownload(this, url, name)) {
Toast.makeText(MainActivity.this, getString(R.string.download_started), Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this, getString(R.string.cant_download), Toast.LENGTH_SHORT).show();
if (!sharedPreferences.getBoolean("external_download", false)){
if (AdvancedWebView.handleDownload(this, url, name)) {
Toast.makeText(MainActivity.this, getString(R.string.download_started), Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this, getString(R.string.cant_download), Toast.LENGTH_SHORT).show();
}
}else {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}



}

private boolean isWritePermissionGranted() {
Expand Down Expand Up @@ -578,6 +588,7 @@ public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which)
@Override
public void onDownloadRequested(String url, String suggestedFilename, String mimeType, long contentLength, String contentDisposition, String userAgent) {

runAsync(webView.getUrl());
if (isWritePermissionGranted()) {
download(url, suggestedFilename);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public void onCreate(final Bundle savedInstanceState) {
addPreferencesFromResource(R.xml.preferences);
prefsFragment = PreferenceManager.getDefaultSharedPreferences(this.getActivity());


Preference github = findPreference("github");
Preference libs = findPreference("libs");
Preference xda = findPreference("xda");
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<cf.vojtechh.apkmirror.classes.ObservableWebView
<im.delight.android.webview.AdvancedWebView
android:id="@+id/main_webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/res/values-sk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<string name="fab_pref">Zobraziť tlačidlo pre vyhľadávanie</string>
<string name="fab_pref_summ">Zakázanie skryje plávajúce tlačidlo pre vyhľadávanie (pre aplikovanie zmien je potrebné reštartovať aplikáciu)</string>
<string name="save_url_pref">Zapamätať poslednú adresu</string>
<string name="save_url_summ">Chcete aby sa aplikácia otvorila na posledne použitej adrese?</string>
<string name="exit_pref">Zobraziť tlačidlo ukončiť v navigačnej lište</string>
<string name="exit_summ">Chcete aby sa zobrazilo tlačidlo pre ukončenie aplikácie v spodnej lište? (pre aplikovanie zmien je potrebné reštartovať aplikáciu)</string>

<string name="external_download_summ">Use apps like ADM or Download Accelerator to download apks</string>


<string name="about">O aplikácií</string>
<string name="github_summ">Zaujíma vás ako aplikácia funguje?</string>
<string name="libraries">Knižnice</string>
Expand Down Expand Up @@ -47,5 +47,7 @@
<string name="search">Hľadať</string>
<string name="please_enter_text">Prosím, zadajte text</string>
<string name="settingsrestart">Reštartovanie</string>
<string name="restart_required">Pre aplikovanie zmien je potrebné reštartovať aplikáciu</string>


</resources>
9 changes: 3 additions & 6 deletions app/src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,18 @@
<string name="download_started">İndirme başladı…</string>
<string name="search">Ara</string>
<string name="cancel">İptal</string>
<string name="author" translatable="false">Vojtěch Hořánek</string>
<string name="github" translatable="false">GitHub</string>
<string name="about">Hakkında</string>
<string name="please_enter_text">Lütfen metin girin</string>

<string name="ads_info">Reklâmlar hakkında bilgi</string>
<string name="ads_info_dialog">Reklâmlar, APKMirror'un çalışması için gereklidir çünkü bu servis ücretsizdir, eğer kullanmaya devam etmek istiyorsanız lütfen reklâm engelleyiciyi kapatma hakkında düşünün. Ayarlardaki reklâm, APKMirror'dansa, geliştiriciyi desteklemek için bulunmaktadır.</string>
<string name="ads_info_dialog">Reklâmlar, APKMirror\'un çalışması için gereklidir çünkü bu servis ücretsizdir, eğer kullanmaya devam etmek istiyorsanız lütfen reklâm engelleyiciyi kapatma hakkında düşünün. Ayarlardaki reklâm, APKMirror\'dansa, geliştiriciyi desteklemek için bulunmaktadır.</string>
<string name="ok">TAMAM</string>
<string name="fab_pref_summ">Bunu devredışı bırakmak yüzen arama düğmesini gizleyecek (değişikliğin uygulanması için yeniden başlatma gerekli)</string>
<string name="fab_pref">Yüzen arama düğmesini göster</string>
<string name="firebase_pref">Analizi etkinleştir</string>
<string name="firebase_pref_summ">Analizleri ve sonuçlarını geliştiriciye gönder (değişikliğin uygulanması için yeniden başlatma gerekli)</string>
<string name="cant_download">İndirme başlatılamadı, cihazınızda indirme yöneticisi olduğundan emin olun.</string>
<string name="save_url_summ">Uygulamadan çıkışta en son adresi hatırlamak istiyor musunuz? (değişikliğin uygulanması için yeniden başlatma gerekli)</string>
<string name="save_url_pref">Son adresi hatırla</string>
<string name="exit_summ">Alt yönetim çubuğunda çıkış düğmesi göstermek istiyor musunuz? (değişikliğin uygulanması için yeniden başlatma gerekli)</string>
<string name="exit_pref">Alt yönetim çubuğunda çıkış düğmesi göster</string>
<string name="refresh">Yenile</string>
<string name="with_thanks">Aşağıdaki kişilere teşekkürlerle:</string>
Expand All @@ -47,7 +43,8 @@
<string name="lib_summ">Bu uygulamada kullanılan açık kaynak kütüphanelerini gör</string>
<string name="xda_summ">Bunun hakkında diğer insanlarla tartış!</string>
<string name="ads_summ">Materyal diyalog içerisinde reklâmlar hakkında bilgi al</string>
<string name="restart_required">Değişikliğin uygulanması için yeniden başlatma gerekli</string>
<string name="external_download_summ">Use apps like ADM or Download Accelerator to download apks</string>

<string name="nothing" translatable="false"/>

</resources>
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
<string name="firebase_pref">Enable analytics</string>
<string name="firebase_pref_summ">Send analytics to the developer (restart is required in order to change this settings)</string>
<string name="cant_download">Can\'t start download, please make sure you have download manager installed.</string>
<string name="save_url_summ">Do you want to remember the last url on app exit? (restart is required in order to change this settings)</string>
<string name="save_url_pref">Remember last url</string>
<string name="exit_summ">Do you want to show exit button in the bottom navigation? (restart is required in order to change this settings)</string>
<string name="exit_pref">Show exit button in navigation</string>
<string name="refresh">Refresh</string>
<string name="with_thanks">With thanks to the following people:</string>
Expand All @@ -47,8 +45,10 @@
<string name="lib_summ">View the used open source libraries in this app</string>
<string name="xda_summ">Discuss about this with other people!</string>
<string name="ads_summ">View the info about ads, in a nice material dialog</string>
<string name="restart_required">Restart is required in order to change this settings</string>

<string name="nothing" translatable="false"/>
<string name="external_download_summ">Use apps like ADM or Download Accelerator to download apks</string>

</resources>

10 changes: 8 additions & 2 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,21 @@
<SwitchPreference
android:defaultValue="false"
android:key="save_url"
android:summary="@string/save_url_summ"
android:summary="@string/restart_required"
android:title="@string/save_url_pref" />

<SwitchPreference
android:defaultValue="false"
android:key="show_exit"
android:summary="@string/exit_summ"
android:summary="@string/restart_required"
android:title="@string/exit_pref" />

<SwitchPreference
android:defaultValue="false"
android:key="external_download"
android:summary="@string/external_download_summ"
android:title="Use external download app" />

<PreferenceCategory android:title="@string/about" />
<Preference
android:key="github"
Expand Down

0 comments on commit a7b506e

Please sign in to comment.