diff --git a/app/build.gradle b/app/build.gradle index 42237068..f5e892fd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,8 +23,8 @@ android { applicationId "arun.com.chromer" minSdkVersion 16 targetSdkVersion 25 - versionCode 32 - versionName "1.7.1" + versionCode 33 + versionName "1.7.2" buildConfigField "String", "BASE_64", getBase64() manifestPlaceholders = [crashlyticsApiKey: getFabricKey()] @@ -62,11 +62,11 @@ dependencies { debugCompile 'com.facebook.stetho:stetho:1.4.2' // Support - compile 'com.android.support:design:25.2.0' - compile 'com.android.support:customtabs:25.2.0' - compile 'com.android.support:preference-v14:25.2.0' - compile 'com.android.support:cardview-v7:25.2.0' - compile 'com.android.support:palette-v7:25.2.0' + compile 'com.android.support:design:25.3.1' + compile 'com.android.support:customtabs:25.3.1' + compile 'com.android.support:preference-v14:25.3.1' + compile 'com.android.support:cardview-v7:25.3.1' + compile 'com.android.support:palette-v7:25.3.1' // Intro compile 'com.github.paolorotolo:appintro:4.1.0' @@ -86,9 +86,11 @@ dependencies { // Butterknife, Timber, Cache compile 'com.jakewharton.timber:timber:4.3.1' compile 'com.jakewharton:butterknife:8.4.0' - compile 'com.jakewharton:disklrucache:2.0.2' annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0' + // MVP + compile 'com.hannesdorfmann.mosby3:mvp:3.0.2' + // Image loading compile 'com.github.bumptech.glide:glide:3.7.0' diff --git a/app/src/main/java/arun/com/chromer/Chromer.java b/app/src/main/java/arun/com/chromer/Chromer.java index a458fce3..3e7f1704 100644 --- a/app/src/main/java/arun/com/chromer/Chromer.java +++ b/app/src/main/java/arun/com/chromer/Chromer.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer; import android.app.Application; diff --git a/app/src/main/java/arun/com/chromer/MainActivity.java b/app/src/main/java/arun/com/chromer/MainActivity.java index 20547bde..759aad5f 100644 --- a/app/src/main/java/arun/com/chromer/MainActivity.java +++ b/app/src/main/java/arun/com/chromer/MainActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer; import android.content.BroadcastReceiver; @@ -6,23 +24,17 @@ import android.content.IntentFilter; import android.net.Uri; import android.os.Bundle; -import android.speech.RecognizerIntent; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.support.design.widget.AppBarLayout; -import android.support.design.widget.CollapsingToolbarLayout; +import android.support.design.widget.BottomNavigationView; import android.support.design.widget.CoordinatorLayout; -import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.content.LocalBroadcastManager; -import android.support.v4.widget.NestedScrollView; import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; -import android.widget.CheckBox; +import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; @@ -32,11 +44,9 @@ import com.afollestad.materialdialogs.StackingBehavior; import com.crashlytics.android.answers.Answers; import com.crashlytics.android.answers.CustomEvent; -import com.crashlytics.android.answers.SearchEvent; import com.crashlytics.android.answers.ShareEvent; import com.flipboard.bottomsheet.BottomSheetLayout; import com.mikepenz.community_material_typeface_library.CommunityMaterial; -import com.mikepenz.iconics.IconicsDrawable; import com.mikepenz.materialdrawer.AccountHeaderBuilder; import com.mikepenz.materialdrawer.Drawer; import com.mikepenz.materialdrawer.DrawerBuilder; @@ -47,170 +57,89 @@ import java.util.Collections; import java.util.List; +import arun.com.chromer.activities.BrowserInterceptActivity; +import arun.com.chromer.activities.SnackHelper; import arun.com.chromer.activities.about.AboutAppActivity; import arun.com.chromer.activities.about.changelog.Changelog; -import arun.com.chromer.activities.history.HistoryActivity; +import arun.com.chromer.activities.history.HistoryFragment; import arun.com.chromer.activities.intro.ChromerIntro; import arun.com.chromer.activities.intro.WebHeadsIntro; +import arun.com.chromer.activities.main.home.HomeFragment; import arun.com.chromer.activities.payments.DonateActivity; import arun.com.chromer.activities.settings.Preferences; import arun.com.chromer.activities.settings.SettingsGroupActivity; -import arun.com.chromer.customtabs.CustomTabManager; import arun.com.chromer.customtabs.CustomTabs; -import arun.com.chromer.data.website.WebsiteRepository; -import arun.com.chromer.data.website.model.WebSite; -import arun.com.chromer.search.SuggestionItem; import arun.com.chromer.shared.Constants; -import arun.com.chromer.util.RxUtils; import arun.com.chromer.util.ServiceUtil; import arun.com.chromer.util.Utils; import arun.com.chromer.util.cache.FontCache; -import arun.com.chromer.views.searchview.MaterialSearchView; -import arun.com.chromer.webheads.WebHeadService; import butterknife.BindView; import butterknife.ButterKnife; -import butterknife.OnClick; -import rx.subscriptions.CompositeSubscription; import timber.log.Timber; -import static android.view.View.GONE; -import static android.view.View.VISIBLE; import static arun.com.chromer.shared.Constants.ACTION_CLOSE_ROOT; -import static arun.com.chromer.shared.Constants.REQUEST_CODE_VOICE; +import static arun.com.chromer.util.cache.FontCache.MONO; -public class MainActivity extends AppCompatActivity implements Home.View { +public class MainActivity extends AppCompatActivity implements SnackHelper { @BindView(R.id.bottomsheet) public BottomSheetLayout bottomSheetLayout; - @BindView(R.id.material_search_view) - public MaterialSearchView materialSearchView; @BindView(R.id.toolbar) public Toolbar toolbar; @BindView(R.id.coordinator_layout) public CoordinatorLayout coordinatorLayout; - @BindView(R.id.chromer) - TextView chromer; - @BindView(R.id.incognito_mode) - CheckBox incognitoMode; - @BindView(R.id.recents_list) - RecyclerView recentsList; - @BindView(R.id.fab) - FloatingActionButton fab; @BindView(R.id.root) LinearLayout root; - @BindView(R.id.collapsing_toolbar) - CollapsingToolbarLayout collapsingToolbar; @BindView(R.id.appbar) AppBarLayout appbar; - @BindView(R.id.nested_scroll_view) - NestedScrollView nestedScrollView; - @BindView(R.id.recent_missing_text) - TextView recentMissingText; - @BindView(R.id.history) - TextView history; - + @BindView(R.id.bottom_navigation) + BottomNavigationView bottomNavigation; - private CustomTabManager customTabManager; - private Drawer drawer; private BroadcastReceiver closeReceiver; - private RecentsAdapter recentsAdapter; - - private Home.Presenter presenter; - - private final CompositeSubscription subscriptions = new CompositeSubscription(); - @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.AppTheme_NoActionBar); super.onCreate(savedInstanceState); - presenter = new Home.Presenter(this); setContentView(R.layout.activity_main); ButterKnife.bind(this); - setSupportActionBar(toolbar); - if (getSupportActionBar() != null) { - getSupportActionBar().setHomeButtonEnabled(false); - getSupportActionBar().setDisplayHomeAsUpEnabled(false); - getSupportActionBar().setDisplayShowHomeEnabled(false); - getSupportActionBar().setDisplayShowTitleEnabled(false); - } - appbar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { - boolean shown = false; - int scrollRange = -1; - - @Override - public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { - if (scrollRange == -1) { - scrollRange = appBarLayout.getTotalScrollRange(); - } - if (scrollRange + verticalOffset == 0) { - collapsingToolbar.setTitle(getString(R.string.app_name)); - chromer.setText(" "); - shown = true; - } else if (shown) { - collapsingToolbar.setTitle(" "); - chromer.setText(getString(R.string.app_name)); - shown = false; - } - } - }); - collapsingToolbar.setCollapsedTitleTypeface(FontCache.get(FontCache.MONO, this)); - chromer.setTypeface(FontCache.get(FontCache.MONO, this)); - if (Preferences.get(this).isFirstRun()) { startActivity(new Intent(this, ChromerIntro.class)); } Changelog.conditionalShow(this); - setupMaterialSearch(); setupDrawer(); - setupCustomTab(); - setupRecents(); - checkAndEducateUser(false); - ServiceUtil.takeCareOfServices(getApplicationContext()); registerCloseReceiver(); - } - - private void setupRecents() { - recentMissingText.setCompoundDrawablePadding(Utils.dpToPx(8)); - recentMissingText.setCompoundDrawables(new IconicsDrawable(this) - .icon(CommunityMaterial.Icon.cmd_history) - .colorRes(R.color.accent) - .sizeDp(24), null, null, null); - recentsList.setLayoutManager(new GridLayoutManager(this, 4)); - recentsAdapter = new RecentsAdapter(); - recentsList.setAdapter(recentsAdapter); - } - - @Override - protected void onStart() { - super.onStart(); - customTabManager.bindCustomTabsService(this); - } - - @Override - protected void onResume() { - super.onResume(); - invalidateState(); + bottomNavigation.setOnNavigationItemSelectedListener(item -> { + switch (item.getItemId()) { + case R.id.home: + selectHome(); + break; + case R.id.history: + getSupportFragmentManager().beginTransaction() + .replace(R.id.fragment_container, new HistoryFragment()) + .commit(); + break; + } + return false; + }); + bottomNavigation.setSelectedItemId(R.id.home); } - @Override - protected void onStop() { - super.onStop(); - customTabManager.unbindCustomTabsService(this); + private void selectHome() { + getSupportFragmentManager().beginTransaction() + .replace(R.id.fragment_container, new HomeFragment()) + .commit(); } @Override protected void onDestroy() { LocalBroadcastManager.getInstance(this).unregisterReceiver(closeReceiver); - subscriptions.clear(); - presenter.cleanUp(); - presenter = null; super.onDestroy(); } @@ -230,20 +159,6 @@ public boolean onOptionsItemSelected(MenuItem item) { return true; } - private void invalidateState() { - incognitoMode.setChecked(Preferences.get(this).incognitoMode()); - incognitoMode.setCompoundDrawablePadding(Utils.dpToPx(5)); - incognitoMode.setCompoundDrawables(new IconicsDrawable(this) - .icon(CommunityMaterial.Icon.cmd_incognito) - .colorRes(R.color.material_dark_color) - .sizeDp(24), null, null, null); - incognitoMode.setOnCheckedChangeListener((buttonView, isChecked) -> - Preferences.get(getApplicationContext()).incognitoMode(isChecked)); - - presenter.loadRecents(this); - } - - private void registerCloseReceiver() { closeReceiver = new BroadcastReceiver() { @Override @@ -255,55 +170,6 @@ public void onReceive(Context context, Intent intent) { LocalBroadcastManager.getInstance(this).registerReceiver(closeReceiver, new IntentFilter(ACTION_CLOSE_ROOT)); } - private void setupMaterialSearch() { - materialSearchView.clearFocus(); - presenter.registerSearch(materialSearchView.getEditText()); - materialSearchView.setInteractionListener(new MaterialSearchView.SearchViewInteractionListener() { - @Override - public void onVoiceIconClick() { - Answers.getInstance().logSearch(new SearchEvent().putCustomAttribute("Mode", "Voice")); - if (Utils.isVoiceRecognizerPresent(getApplicationContext())) { - startActivityForResult(Utils.getRecognizerIntent(MainActivity.this), REQUEST_CODE_VOICE); - } else { - snack(getString(R.string.no_voice_rec_apps)); - } - } - - @Override - public void onSearchPerformed(@NonNull String url) { - launchCustomTab(url); - Answers.getInstance().logSearch(new SearchEvent()); - } - - @Override - public void onHamburgerClick() { - if (drawer.isDrawerOpen()) { - drawer.closeDrawer(); - } else { - drawer.openDrawer(); - } - } - }); - - } - - @Override - public void setSuggestions(@NonNull List suggestions) { - materialSearchView.setSuggestions(suggestions); - } - - @Override - public void setRecents(@NonNull List webSites) { - recentsAdapter.setWebSites(webSites); - if (webSites.isEmpty()) { - recentMissingText.setVisibility(VISIBLE); - history.setVisibility(GONE); - } else { - recentMissingText.setVisibility(GONE); - history.setVisibility(VISIBLE); - } - } - @Override public void snack(@NonNull String textToSnack) { Snackbar.make(coordinatorLayout, textToSnack, Snackbar.LENGTH_SHORT).show(); @@ -316,8 +182,11 @@ public void snackLong(@NonNull String textToSnack) { private void setupDrawer() { - drawer = new DrawerBuilder() + setSupportActionBar(toolbar); + setToolbarTypeFace(); + final Drawer drawer = new DrawerBuilder() .withActivity(this) + .withToolbar(toolbar) .withAccountHeader(new AccountHeaderBuilder() .withActivity(this) .withHeaderBackground(R.drawable.chromer) @@ -368,7 +237,7 @@ private void setupDrawer() { break; case 3: Utils.openPlayStore(MainActivity.this, getPackageName()); - Answers.getInstance().logCustom(new CustomEvent("Send feedback")); + Answers.getInstance().logCustom(new CustomEvent("Rate on Play Store")); break; case 4: startActivity(new Intent(MainActivity.this, ChromerIntro.class)); @@ -414,55 +283,16 @@ private void showJoinBetaDialog() { final Intent googleIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.G_COMMUNITY_URL)); startActivity(googleIntent); }) - .onNeutral((dialog, which) -> launchCustomTab(Constants.APP_TESTING_URL)) + .onNeutral((dialog, which) -> { + final Intent intent = new Intent(this, BrowserInterceptActivity.class); + intent.putExtra(Constants.EXTRA_KEY_FROM_OUR_APP, true); + intent.setData(Uri.parse(Constants.APP_TESTING_URL)); + startActivity(intent); + }) .build() .show(); } - private void launchCustomTab(@Nullable String url) { - if (url != null) { - if (Preferences.get(this).webHeads()) { - if (Utils.isOverlayGranted(this)) { - final Intent webHeadService = new Intent(this, WebHeadService.class); - webHeadService.setData(Uri.parse(url)); - startService(webHeadService); - } else { - Utils.openDrawOverlaySettings(this); - } - } else { - CustomTabs.from(this) - .forUrl(url) - .withSession(customTabManager.getSession()) - .prepare() - .launch(); - } - WebsiteRepository.getInstance(this).getWebsite(url) - .compose(RxUtils.applySchedulers()) - .doOnError(Timber::e) - .subscribe(); - } - } - - private void setupCustomTab() { - customTabManager = new CustomTabManager(); - customTabManager.setConnectionCallback( - new CustomTabManager.ConnectionCallback() { - @Override - public void onCustomTabsConnected() { - Timber.d("Connected to custom tabs"); - try { - customTabManager.mayLaunchUrl(Uri.parse(Constants.GOOGLE_URL), null, null); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void onCustomTabsDisconnected() { - } - }); - } - private void checkAndEducateUser(boolean forceShow) { final List packages; if (!forceShow) { @@ -487,11 +317,6 @@ private void checkAndEducateUser(boolean forceShow) { @Override public void onBackPressed() { - if (materialSearchView.hasFocus()) { - materialSearchView.clearFocus(); - return; - } - if (bottomSheetLayout.isSheetShowing()) { bottomSheetLayout.dismissSheet(); return; @@ -499,33 +324,16 @@ public void onBackPressed() { super.onBackPressed(); } - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == REQUEST_CODE_VOICE) { - switch (resultCode) { - case RESULT_OK: - final List resultList = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); - if (resultList != null && !resultList.isEmpty()) { - launchCustomTab(Utils.getSearchUrl(resultList.get(0))); - } + public void setToolbarTypeFace() { + for (int i = 0; i < toolbar.getChildCount(); i++) { + final View view = toolbar.getChildAt(i); + if (view instanceof TextView) { + TextView tv = (TextView) view; + if (tv.getText().equals(toolbar.getTitle())) { + tv.setTypeface(FontCache.get(MONO, this)); break; - default: + } } } - super.onActivityResult(requestCode, resultCode, data); - } - - @OnClick(R.id.fab) - public void onFabClick() { - if (materialSearchView.hasFocus() && materialSearchView.getText().length() > 0) { - launchCustomTab(materialSearchView.getURL()); - } else { - launchCustomTab(Constants.GOOGLE_URL); - } - } - - @OnClick(R.id.history) - public void onClick() { - startActivity(new Intent(this, HistoryActivity.class)); } } diff --git a/app/src/main/java/arun/com/chromer/activities/BrowserInterceptActivity.java b/app/src/main/java/arun/com/chromer/activities/BrowserInterceptActivity.java index c47640bc..f2c78ac9 100644 --- a/app/src/main/java/arun/com/chromer/activities/BrowserInterceptActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/BrowserInterceptActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities; import android.annotation.SuppressLint; @@ -27,6 +45,8 @@ import arun.com.chromer.util.SafeIntent; import arun.com.chromer.util.Utils; import arun.com.chromer.webheads.ui.ProxyActivity; +import rx.Subscription; +import rx.subscriptions.CompositeSubscription; import timber.log.Timber; import static android.content.Intent.ACTION_VIEW; @@ -37,25 +57,32 @@ import static android.os.Build.VERSION_CODES.LOLLIPOP; import static android.widget.Toast.LENGTH_SHORT; import static arun.com.chromer.shared.Constants.EXTRA_KEY_FROM_NEW_TAB; +import static arun.com.chromer.shared.Constants.EXTRA_KEY_FROM_OUR_APP; @SuppressLint("GoogleAppIndexingApiWarning") public class BrowserInterceptActivity extends AppCompatActivity { private MaterialDialog dialog; private SafeIntent safeIntent; private boolean isFromNewTab; + private boolean isFromOurApp; + + private final CompositeSubscription subs = new CompositeSubscription(); @TargetApi(LOLLIPOP) @Override protected void onCreate(Bundle savedInstanceState) { - DocumentUtils.closeRootActivity(this); super.onCreate(savedInstanceState); - safeIntent = new SafeIntent(getIntent()); if (safeIntent.getData() == null) { invalidLink(); return; } isFromNewTab = safeIntent.getBooleanExtra(EXTRA_KEY_FROM_NEW_TAB, false); + isFromOurApp = safeIntent.getBooleanExtra(EXTRA_KEY_FROM_OUR_APP, false); + + if (!isFromOurApp) { + DocumentUtils.closeRootActivity(this); + } // Check if we should blacklist the launching app if (Preferences.get(this).blacklist()) { @@ -82,7 +109,8 @@ protected void onCreate(Bundle savedInstanceState) { .content(R.string.grabbing_amp_link) .dismissListener(d -> finish()) .show(); - WebsiteRepository.getInstance(this) + + final Subscription subscription = WebsiteRepository.getInstance(this) .getWebsite(safeIntent.getData().toString()) .compose(RxUtils.applySchedulers()) .doOnNext(webSite -> { @@ -104,6 +132,7 @@ protected void onCreate(Bundle savedInstanceState) { articleAwareLaunch(); dialog.dismiss(); }).subscribe(); + subs.add(subscription); } else if (Preferences.get(this).articleMode()) { // User just wants article, load it. launchArticle(); @@ -112,6 +141,12 @@ protected void onCreate(Bundle savedInstanceState) { } } + @Override + protected void onDestroy() { + super.onDestroy(); + subs.clear(); + } + private void articleAwareLaunch() { if (Preferences.get(this).articleMode()) { launchArticle(); @@ -186,12 +221,12 @@ private void showSecondaryBrowserHandlingError(@StringRes int stringRes) { .theme(Theme.LIGHT) .positiveColorRes(R.color.colorAccent) .negativeColorRes(R.color.colorAccent) - .onPositive((dialog1, which) -> { + .onPositive((dialog, which) -> { final Intent chromerIntent = getPackageManager().getLaunchIntentForPackage(getPackageName()); chromerIntent.addFlags(FLAG_ACTIVITY_CLEAR_TOP); startActivity(chromerIntent); }) - .dismissListener(dialog12 -> finish()).show(); + .dismissListener(dialog -> finish()).show(); } private void closeDialogs() { @@ -203,7 +238,7 @@ private void closeDialogs() { private void launchWebHead() { final Intent webHeadLauncher = new Intent(this, ProxyActivity.class); webHeadLauncher.addFlags(FLAG_ACTIVITY_NEW_TASK); - if (!isFromNewTab) { + if (!isFromNewTab && !isFromOurApp) { webHeadLauncher.addFlags(FLAG_ACTIVITY_CLEAR_TASK); } webHeadLauncher.putExtra(EXTRA_KEY_FROM_NEW_TAB, isFromNewTab); diff --git a/app/src/main/java/arun/com/chromer/activities/CustomTabActivity.java b/app/src/main/java/arun/com/chromer/activities/CustomTabActivity.java index 7319df8d..515aa83d 100644 --- a/app/src/main/java/arun/com/chromer/activities/CustomTabActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/CustomTabActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities; import android.annotation.TargetApi; diff --git a/app/src/main/java/arun/com/chromer/activities/MoreMenuActivity.java b/app/src/main/java/arun/com/chromer/activities/MoreMenuActivity.java index 05ec98db..ae4a5eec 100644 --- a/app/src/main/java/arun/com/chromer/activities/MoreMenuActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/MoreMenuActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities; import android.content.Intent; diff --git a/app/src/main/java/arun/com/chromer/activities/NewTabDialogActivity.java b/app/src/main/java/arun/com/chromer/activities/NewTabDialogActivity.java index a3f8b989..4d443fb4 100644 --- a/app/src/main/java/arun/com/chromer/activities/NewTabDialogActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/NewTabDialogActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities; import android.content.Intent; diff --git a/app/src/main/java/arun/com/chromer/activities/OpenIntentWithActivity.java b/app/src/main/java/arun/com/chromer/activities/OpenIntentWithActivity.java index fdcc4648..d9d9376d 100644 --- a/app/src/main/java/arun/com/chromer/activities/OpenIntentWithActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/OpenIntentWithActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities; import android.content.Intent; diff --git a/app/src/main/java/arun/com/chromer/activities/ShareInterceptActivity.java b/app/src/main/java/arun/com/chromer/activities/ShareInterceptActivity.java index ffc3163c..c2817743 100644 --- a/app/src/main/java/arun/com/chromer/activities/ShareInterceptActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/ShareInterceptActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities; import android.annotation.SuppressLint; diff --git a/app/src/main/java/arun/com/chromer/activities/SnackHelper.java b/app/src/main/java/arun/com/chromer/activities/SnackHelper.java index 47295c5b..1e96e918 100644 --- a/app/src/main/java/arun/com/chromer/activities/SnackHelper.java +++ b/app/src/main/java/arun/com/chromer/activities/SnackHelper.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities; import android.support.annotation.NonNull; diff --git a/app/src/main/java/arun/com/chromer/activities/about/AboutAppActivity.java b/app/src/main/java/arun/com/chromer/activities/about/AboutAppActivity.java index bd950fb8..0fffc7b6 100644 --- a/app/src/main/java/arun/com/chromer/activities/about/AboutAppActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/about/AboutAppActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.about; import android.os.Build; diff --git a/app/src/main/java/arun/com/chromer/activities/about/AboutFragment.java b/app/src/main/java/arun/com/chromer/activities/about/AboutFragment.java index 9833b102..f68e8542 100644 --- a/app/src/main/java/arun/com/chromer/activities/about/AboutFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/about/AboutFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.about; import android.content.Intent; diff --git a/app/src/main/java/arun/com/chromer/activities/about/changelog/Changelog.java b/app/src/main/java/arun/com/chromer/activities/about/changelog/Changelog.java index a6005694..4b071928 100644 --- a/app/src/main/java/arun/com/chromer/activities/about/changelog/Changelog.java +++ b/app/src/main/java/arun/com/chromer/activities/about/changelog/Changelog.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.about.changelog; import android.annotation.SuppressLint; @@ -7,6 +25,7 @@ import android.content.SharedPreferences; import android.net.Uri; import android.support.annotation.NonNull; +import android.support.v7.preference.PreferenceManager; import android.view.LayoutInflater; import android.view.View; import android.webkit.WebResourceRequest; @@ -19,14 +38,20 @@ import arun.com.chromer.BuildConfig; import arun.com.chromer.R; +import arun.com.chromer.data.website.WebsiteRepository; +import arun.com.chromer.util.RxUtils; import arun.com.chromer.util.Utils; import butterknife.ButterKnife; import me.zhanghai.android.materialprogressbar.MaterialProgressBar; +import timber.log.Timber; /** * Created by Arun on 25/12/2015. */ public class Changelog { + private static final String PREF_VERSION_CODE_KEY = "version_code"; + private static final int DOES_NT_EXIST = -1; + public static void show(final Activity activity) { try { @SuppressLint("InflateParams") @@ -79,17 +104,21 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { public static void conditionalShow(@NonNull final Activity activity) { if (shouldShow(activity)) { show(activity); + handleMigration(activity); } } + private static void handleMigration(@NonNull final Activity activity) { + WebsiteRepository.getInstance(activity) + .clearCache() + .compose(RxUtils.applySchedulers()) + .doOnError(Timber::e) + .subscribe(); + } + private static boolean shouldShow(@NonNull final Context context) { - final String PREF_VERSION_CODE_KEY = "version_code"; - final int DOES_NT_EXIST = -1; - // Get current version code int currentVersionCode = BuildConfig.VERSION_CODE; - final SharedPreferences prefs = context.getSharedPreferences( - context.getPackageName(), - Context.MODE_PRIVATE); + final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); int savedVersionCode = prefs.getInt(PREF_VERSION_CODE_KEY, DOES_NT_EXIST); prefs.edit().putInt(PREF_VERSION_CODE_KEY, currentVersionCode).apply(); diff --git a/app/src/main/java/arun/com/chromer/activities/base/SubActivity.java b/app/src/main/java/arun/com/chromer/activities/base/SubActivity.java index f460e118..7d189c45 100644 --- a/app/src/main/java/arun/com/chromer/activities/base/SubActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/base/SubActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.base; import android.support.v7.app.AppCompatActivity; diff --git a/app/src/main/java/arun/com/chromer/activities/blacklist/Blacklist.java b/app/src/main/java/arun/com/chromer/activities/blacklist/Blacklist.java index d12053b6..a7cc0d47 100644 --- a/app/src/main/java/arun/com/chromer/activities/blacklist/Blacklist.java +++ b/app/src/main/java/arun/com/chromer/activities/blacklist/Blacklist.java @@ -1,16 +1,33 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.blacklist; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import java.lang.ref.WeakReference; import java.util.Comparator; import java.util.List; +import arun.com.chromer.activities.mvp.Base; import arun.com.chromer.data.apps.AppRepository; import arun.com.chromer.data.common.App; import arun.com.chromer.util.RxUtils; @@ -18,15 +35,13 @@ import rx.Observable; import rx.SingleSubscriber; import rx.Subscription; -import rx.functions.Func1; -import rx.subscriptions.CompositeSubscription; import timber.log.Timber; /** * Blacklist screen interface holding View and Presenter classes. */ interface Blacklist { - interface View { + interface View extends Base.View { void setApps(@NonNull List apps); void setRefreshing(boolean refreshing); @@ -35,23 +50,7 @@ interface View { /** * Presenter containing all business logic for this screen. */ - class Presenter { - final WeakReference viewRef; - private final CompositeSubscription compositeSubscription = new CompositeSubscription(); - - Presenter(@NonNull View view) { - viewRef = new WeakReference<>(view); - } - - boolean isViewAttached() { - return viewRef.get() != null; - } - - @NonNull - View getView() { - return viewRef.get(); - } - + class Presenter extends Base.Presenter { void loadAppList(@NonNull final Context context) { if (isViewAttached()) { getView().setRefreshing(true); @@ -62,12 +61,8 @@ void loadAppList(@NonNull final Context context) { final Subscription subscription = Observable .fromCallable(() -> pm.queryIntentActivities(intent, 0)) - .flatMap(new Func1, Observable>() { - @Override - public Observable call(List resolveInfos) { - return Observable.from(resolveInfos); - } - }).filter(resolveInfo -> resolveInfo != null + .flatMapIterable(resolveInfos -> resolveInfos) + .filter(resolveInfo -> resolveInfo != null && !resolveInfo.activityInfo.packageName.equalsIgnoreCase(context.getPackageName())) .map(resolveInfo -> { final App app = Utils.createApp(context, resolveInfo.activityInfo.packageName); @@ -94,11 +89,6 @@ public void onError(Throwable error) { compositeSubscription.add(subscription); } - void cleanUp() { - viewRef.clear(); - compositeSubscription.clear(); - } - void updateBlacklist(@NonNull Context context, @Nullable App app) { if (app != null) { if (app.blackListed) { @@ -114,5 +104,10 @@ void updateBlacklist(@NonNull Context context, @Nullable App app) { } } } + + void handleSelections(final Context context, Observable clicks) { + final Subscription subscription = clicks.subscribe(app -> updateBlacklist(context, app)); + compositeSubscription.add(subscription); + } } } diff --git a/app/src/main/java/arun/com/chromer/activities/blacklist/BlacklistAdapter.java b/app/src/main/java/arun/com/chromer/activities/blacklist/BlacklistAdapter.java index cbcfc8f1..14436173 100644 --- a/app/src/main/java/arun/com/chromer/activities/blacklist/BlacklistAdapter.java +++ b/app/src/main/java/arun/com/chromer/activities/blacklist/BlacklistAdapter.java @@ -1,8 +1,25 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.blacklist; import android.app.Activity; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.support.v7.widget.AppCompatCheckBox; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -22,6 +39,8 @@ import arun.com.chromer.data.common.App; import butterknife.BindView; import butterknife.ButterKnife; +import rx.Observable; +import rx.subjects.PublishSubject; /** * Created by Arun on 24/01/2016. @@ -30,15 +49,10 @@ class BlacklistAdapter extends RecyclerView.Adapter activityRef = new WeakReference<>(null); private final List apps = new ArrayList<>(); - private BlackListItemClickedListener listener = app -> { - // no-op - }; + private PublishSubject clickSubject = PublishSubject.create(); - BlacklistAdapter(@NonNull Activity activity, @Nullable BlackListItemClickedListener listener) { + BlacklistAdapter(@NonNull Activity activity) { this.activityRef = new WeakReference<>(activity); - if (listener != null) { - this.listener = listener; - } setHasStableIds(true); } @@ -67,6 +81,10 @@ public void onViewRecycled(BlackListItemViewHolder holder) { Glide.clear(holder.appIcon); } + public Observable clicks() { + return clickSubject.asObservable(); + } + @Override public int getItemCount() { return apps.size(); @@ -90,10 +108,6 @@ void cleanUp() { } } - interface BlackListItemClickedListener { - void onBlackListItemClick(App app); - } - class BlackListItemViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { @BindView(R.id.app_list_icon) ImageView appIcon; @@ -120,7 +134,7 @@ public void onClick(View v) { if (position != RecyclerView.NO_POSITION) { final App app = apps.get(position); app.blackListed = appCheckbox.isChecked(); - listener.onBlackListItemClick(app); + clickSubject.onNext(app); } } } diff --git a/app/src/main/java/arun/com/chromer/activities/blacklist/BlacklistManagerActivity.java b/app/src/main/java/arun/com/chromer/activities/blacklist/BlacklistManagerActivity.java index 5f741088..faa4d909 100644 --- a/app/src/main/java/arun/com/chromer/activities/blacklist/BlacklistManagerActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/blacklist/BlacklistManagerActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.blacklist; import android.annotation.TargetApi; @@ -9,7 +27,6 @@ import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.Snackbar; import android.support.v4.widget.SwipeRefreshLayout; -import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.SwitchCompat; @@ -24,16 +41,15 @@ import arun.com.chromer.R; import arun.com.chromer.activities.SnackHelper; +import arun.com.chromer.activities.mvp.BaseActivity; import arun.com.chromer.activities.settings.Preferences; import arun.com.chromer.data.common.App; import arun.com.chromer.util.ServiceUtil; import arun.com.chromer.util.Utils; import butterknife.BindView; -import butterknife.ButterKnife; -public class BlacklistManagerActivity extends AppCompatActivity implements +public class BlacklistManagerActivity extends BaseActivity implements Blacklist.View, - BlacklistAdapter.BlackListItemClickedListener, CompoundButton.OnCheckedChangeListener, SwipeRefreshLayout.OnRefreshListener, SnackHelper { @BindView(R.id.toolbar) @@ -45,21 +61,17 @@ public class BlacklistManagerActivity extends AppCompatActivity implements @BindView(R.id.swipe_refresh_layout) SwipeRefreshLayout swipeRefreshLayout; - private Blacklist.Presenter presenter; - private BlacklistAdapter blacklistAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - presenter = new Blacklist.Presenter(this); - setContentView(R.layout.activity_blacklist); - ButterKnife.bind(this); setupToolbar(); - blacklistAdapter = new BlacklistAdapter(this, this); + blacklistAdapter = new BlacklistAdapter(this); blackListedAppsList.setLayoutManager(new LinearLayoutManager(this)); blackListedAppsList.setAdapter(blacklistAdapter); + presenter.handleSelections(this, blacklistAdapter.clicks()); loadApps(); } @@ -80,14 +92,19 @@ private void setupToolbar() { @Override protected void onDestroy() { - presenter.cleanUp(); blacklistAdapter.cleanUp(); super.onDestroy(); } + @NonNull + @Override + public Blacklist.Presenter createPresenter() { + return new Blacklist.Presenter(); + } + @Override - public void onBlackListItemClick(App app) { - presenter.updateBlacklist(this, app); + protected int getLayoutRes() { + return R.layout.activity_blacklist; } @Override diff --git a/app/src/main/java/arun/com/chromer/activities/browsing/article/ArticleLauncher.java b/app/src/main/java/arun/com/chromer/activities/browsing/article/ArticleLauncher.java index 708fcb62..41a03021 100644 --- a/app/src/main/java/arun/com/chromer/activities/browsing/article/ArticleLauncher.java +++ b/app/src/main/java/arun/com/chromer/activities/browsing/article/ArticleLauncher.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.browsing.article; import android.annotation.TargetApi; diff --git a/app/src/main/java/arun/com/chromer/activities/browsing/article/ChromerArticleActivity.java b/app/src/main/java/arun/com/chromer/activities/browsing/article/ChromerArticleActivity.java index bc94f24a..d1b16566 100644 --- a/app/src/main/java/arun/com/chromer/activities/browsing/article/ChromerArticleActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/browsing/article/ChromerArticleActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.browsing.article; import android.content.BroadcastReceiver; diff --git a/app/src/main/java/arun/com/chromer/activities/browsing/incognito/WebViewActivity.java b/app/src/main/java/arun/com/chromer/activities/browsing/incognito/WebViewActivity.java index 65301b7d..cb220ee3 100644 --- a/app/src/main/java/arun/com/chromer/activities/browsing/incognito/WebViewActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/browsing/incognito/WebViewActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.browsing.incognito; import android.annotation.TargetApi; diff --git a/app/src/main/java/arun/com/chromer/activities/history/History.java b/app/src/main/java/arun/com/chromer/activities/history/History.java index dd78568d..7902a00b 100644 --- a/app/src/main/java/arun/com/chromer/activities/history/History.java +++ b/app/src/main/java/arun/com/chromer/activities/history/History.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.history; import android.content.Context; @@ -5,52 +23,27 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import java.lang.ref.WeakReference; - import arun.com.chromer.R; import arun.com.chromer.activities.SnackHelper; +import arun.com.chromer.activities.mvp.Base; import arun.com.chromer.data.history.HistoryRepository; import arun.com.chromer.data.website.model.WebSite; import arun.com.chromer.util.RxUtils; import rx.Observable; import rx.functions.Func1; -import rx.subscriptions.CompositeSubscription; import timber.log.Timber; /** * Created by arunk on 06-03-2017. */ interface History { - interface View extends SnackHelper { + interface View extends SnackHelper, Base.View { void loading(boolean loading); void setCursor(@Nullable Cursor cursor); } - class Presenter { - WeakReference viewRef; - private final CompositeSubscription compositeSubscription = new CompositeSubscription(); - - Presenter(@NonNull History.View view) { - viewRef = new WeakReference<>(view); - } - - boolean isViewAttached() { - return viewRef != null && viewRef.get() != null; - } - - History.View getView() { - return viewRef.get(); - } - - void cleanUp() { - if (viewRef != null) { - viewRef.clear(); - viewRef = null; - } - compositeSubscription.clear(); - } - + class Presenter extends Base.Presenter { void loadHistory(@NonNull Context context) { compositeSubscription.add(HistoryRepository.getInstance(context).getAllItemsCursor() .compose(RxUtils.applySchedulers()) diff --git a/app/src/main/java/arun/com/chromer/activities/history/HistoryActivity.java b/app/src/main/java/arun/com/chromer/activities/history/HistoryActivity.java index ac67031d..8d81d972 100644 --- a/app/src/main/java/arun/com/chromer/activities/history/HistoryActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/history/HistoryActivity.java @@ -1,47 +1,45 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.history; -import android.database.Cursor; import android.os.Bundle; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.support.design.widget.CoordinatorLayout; -import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; -import android.support.v4.content.ContextCompat; -import android.support.v4.widget.SwipeRefreshLayout; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; -import android.support.v7.widget.helper.ItemTouchHelper; - -import com.afollestad.materialdialogs.MaterialDialog; +import android.view.MenuItem; import arun.com.chromer.R; +import arun.com.chromer.activities.SnackHelper; import arun.com.chromer.activities.base.SubActivity; import butterknife.BindView; import butterknife.ButterKnife; -import butterknife.OnClick; -public class HistoryActivity extends SubActivity implements History.View { +public class HistoryActivity extends SubActivity implements SnackHelper { @BindView(R.id.toolbar) Toolbar toolbar; - @BindView(R.id.history_list) - RecyclerView historyList; - @BindView(R.id.swipe_refresh_layout) - SwipeRefreshLayout swipeRefreshLayout; @BindView(R.id.coordinator_layout) CoordinatorLayout coordinatorLayout; - @BindView(R.id.fab) - FloatingActionButton fab; - - private HistoryAdapter historyAdapter; - - History.Presenter presenter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - presenter = new History.Presenter(this); setContentView(R.layout.activity_history); ButterKnife.bind(this); @@ -50,50 +48,10 @@ protected void onCreate(Bundle savedInstanceState) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } - final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); - historyList.setLayoutManager(linearLayoutManager); - historyAdapter = new HistoryAdapter(linearLayoutManager); - historyList.setAdapter(historyAdapter); - historyList.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrolled(RecyclerView recyclerView, int dx, int dy) { - historyAdapter.onRangeChanged(); - } - }); - - swipeRefreshLayout.setColorSchemeColors(ContextCompat.getColor(this, R.color.colorPrimary), - ContextCompat.getColor(this, R.color.accent)); - swipeRefreshLayout.setOnRefreshListener(() -> presenter.loadHistory(this)); - - final ItemTouchHelper.SimpleCallback swipeTouch = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { - @Override - public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { - return false; - } - - @Override - public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { - presenter.deleteHistory(getApplicationContext(), historyAdapter.getWebsiteAt(viewHolder.getAdapterPosition())); - } - }; - final ItemTouchHelper itemTouchHelper = new ItemTouchHelper(swipeTouch); - itemTouchHelper.attachToRecyclerView(historyList); - } - - @Override - protected void onResume() { - super.onResume(); - presenter.loadHistory(this); - } - - @Override - public void loading(boolean loading) { - swipeRefreshLayout.setRefreshing(loading); - } - - @Override - public void setCursor(@Nullable Cursor cursor) { - historyAdapter.setCursor(cursor); + getSupportFragmentManager() + .beginTransaction() + .replace(R.id.fragment_container, new HistoryFragment()) + .commit(); } @Override @@ -107,22 +65,22 @@ public void snackLong(@NonNull String textToSnack) { } @Override - protected void onDestroy() { - super.onDestroy(); - historyAdapter.cleanUp(); - presenter.cleanUp(); + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == android.R.id.home) { + finishWithTransition(); + return true; + } + return super.onOptionsItemSelected(item); } - @OnClick(R.id.fab) - public void onFabDeleteClick() { - if (historyAdapter.getItemCount() != 0) { - new MaterialDialog.Builder(this) - .title(R.string.are_you_sure) - .content(R.string.history_deletion_confirmation_content) - .positiveText(android.R.string.yes) - .negativeText(android.R.string.no) - .onPositive((dialog, which) -> presenter.deleteAll(getApplicationContext())) - .show(); - } + @Override + public void onBackPressed() { + finishWithTransition(); + super.onBackPressed(); + } + + private void finishWithTransition() { + finish(); + // overridePendingTransition(R.anim.slide_in_left_medium, R.anim.slide_out_right_medium); } } diff --git a/app/src/main/java/arun/com/chromer/activities/history/HistoryAdapter.java b/app/src/main/java/arun/com/chromer/activities/history/HistoryAdapter.java index 810ea097..4359d0ef 100644 --- a/app/src/main/java/arun/com/chromer/activities/history/HistoryAdapter.java +++ b/app/src/main/java/arun/com/chromer/activities/history/HistoryAdapter.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.history; import android.content.Intent; @@ -20,6 +38,7 @@ import arun.com.chromer.R; import arun.com.chromer.activities.BrowserInterceptActivity; import arun.com.chromer.data.website.model.WebSite; +import arun.com.chromer.shared.Constants; import butterknife.BindView; import butterknife.ButterKnife; import rx.Observable; @@ -37,7 +56,7 @@ class HistoryAdapter extends RecyclerView.Adapter { final Intent intent = new Intent(holder.itemView.getContext(), BrowserInterceptActivity.class); intent.setData(Uri.parse(webSite.preferredUrl())); + intent.putExtra(Constants.EXTRA_KEY_FROM_OUR_APP, true); holder.itemView.getContext().startActivity(intent); }); if (!TextUtils.isEmpty(webSite.faviconUrl)) { @@ -107,6 +127,7 @@ public void onBindViewHolder(final HistoryViewHolder holder, int position) { .crossFade() .into(holder.historyFavicon); } else { + Glide.clear(holder.itemView); } } } diff --git a/app/src/main/java/arun/com/chromer/activities/history/HistoryFragment.java b/app/src/main/java/arun/com/chromer/activities/history/HistoryFragment.java new file mode 100644 index 00000000..1781df7d --- /dev/null +++ b/app/src/main/java/arun/com/chromer/activities/history/HistoryFragment.java @@ -0,0 +1,161 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package arun.com.chromer.activities.history; + +import android.database.Cursor; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.design.widget.FloatingActionButton; +import android.support.v4.content.ContextCompat; +import android.support.v4.widget.SwipeRefreshLayout; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.helper.ItemTouchHelper; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import com.afollestad.materialdialogs.MaterialDialog; + +import arun.com.chromer.R; +import arun.com.chromer.activities.SnackHelper; +import arun.com.chromer.activities.mvp.BaseFragment; +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + +/** + * Created by arunk on 07-04-2017. + */ + +public class HistoryFragment extends BaseFragment implements History.View { + @BindView(R.id.history_list) + RecyclerView historyList; + @BindView(R.id.swipe_refresh_layout) + SwipeRefreshLayout swipeRefreshLayout; + @BindView(R.id.fab) + FloatingActionButton fab; + @BindView(R.id.error) + TextView error; + private HistoryAdapter historyAdapter; + + @Override + public void snack(@NonNull String message) { + ((SnackHelper) getActivity()).snack(message); + } + + @Override + public void snackLong(@NonNull String message) { + ((SnackHelper) getActivity()).snackLong(message); + } + + + @Override + public void loading(boolean loading) { + swipeRefreshLayout.setRefreshing(loading); + } + + @Override + public void setCursor(@Nullable Cursor cursor) { + historyAdapter.setCursor(cursor); + error.setVisibility(cursor == null || cursor.isClosed() || cursor.getCount() == 0 ? View.VISIBLE : View.GONE); + } + + @Override + protected int getLayoutRes() { + return R.layout.fragment_history; + } + + @NonNull + @Override + public History.Presenter createPresenter() { + return new History.Presenter(); + } + + @Override + public void onDestroy() { + super.onDestroy(); + historyAdapter.cleanUp(); + } + + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity()); + historyList.setLayoutManager(linearLayoutManager); + historyAdapter = new HistoryAdapter(linearLayoutManager); + historyList.setAdapter(historyAdapter); + historyList.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrolled(RecyclerView recyclerView, int dx, int dy) { + historyAdapter.onRangeChanged(); + } + }); + + swipeRefreshLayout.setColorSchemeColors( + ContextCompat.getColor(getContext(), R.color.colorPrimary), + ContextCompat.getColor(getContext(), R.color.accent)); + swipeRefreshLayout.setOnRefreshListener(() -> presenter.loadHistory(getContext())); + + final ItemTouchHelper.SimpleCallback swipeTouch = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { + @Override + public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { + return false; + } + + @Override + public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { + presenter.deleteHistory(getContext(), historyAdapter.getWebsiteAt(viewHolder.getAdapterPosition())); + } + }; + final ItemTouchHelper itemTouchHelper = new ItemTouchHelper(swipeTouch); + itemTouchHelper.attachToRecyclerView(historyList); + } + + @Override + public void onResume() { + super.onResume(); + presenter.loadHistory(getContext()); + getActivity().setTitle(R.string.title_history); + } + + @OnClick(R.id.fab) + public void onClearAllFabClick() { + if (historyAdapter.getItemCount() != 0) { + new MaterialDialog.Builder(getActivity()) + .title(R.string.are_you_sure) + .content(R.string.history_deletion_confirmation_content) + .positiveText(android.R.string.yes) + .negativeText(android.R.string.no) + .onPositive((dialog, which) -> presenter.deleteAll(getContext())) + .show(); + } + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + // TODO: inflate a fragment view + View rootView = super.onCreateView(inflater, container, savedInstanceState); + ButterKnife.bind(this, rootView); + return rootView; + } +} diff --git a/app/src/main/java/arun/com/chromer/activities/intro/AppIntroFragment.java b/app/src/main/java/arun/com/chromer/activities/intro/AppIntroFragment.java index c54db96c..8070bf58 100644 --- a/app/src/main/java/arun/com/chromer/activities/intro/AppIntroFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/intro/AppIntroFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.intro; import android.os.Bundle; diff --git a/app/src/main/java/arun/com/chromer/activities/intro/ChromerIntro.java b/app/src/main/java/arun/com/chromer/activities/intro/ChromerIntro.java index 7e8cef5f..d26f963f 100644 --- a/app/src/main/java/arun/com/chromer/activities/intro/ChromerIntro.java +++ b/app/src/main/java/arun/com/chromer/activities/intro/ChromerIntro.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.intro; import android.os.Build; diff --git a/app/src/main/java/arun/com/chromer/activities/intro/TextIntroFragment.java b/app/src/main/java/arun/com/chromer/activities/intro/TextIntroFragment.java index 0854f107..da26cfc6 100644 --- a/app/src/main/java/arun/com/chromer/activities/intro/TextIntroFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/intro/TextIntroFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.intro; import android.os.Bundle; diff --git a/app/src/main/java/arun/com/chromer/activities/intro/WebHeadIntroExplainFragment.java b/app/src/main/java/arun/com/chromer/activities/intro/WebHeadIntroExplainFragment.java index 6fdac2da..758cf47d 100644 --- a/app/src/main/java/arun/com/chromer/activities/intro/WebHeadIntroExplainFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/intro/WebHeadIntroExplainFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.intro; import android.content.Intent; diff --git a/app/src/main/java/arun/com/chromer/activities/intro/WebHeadsIntro.java b/app/src/main/java/arun/com/chromer/activities/intro/WebHeadsIntro.java index 21b50d2a..3614c6e0 100644 --- a/app/src/main/java/arun/com/chromer/activities/intro/WebHeadsIntro.java +++ b/app/src/main/java/arun/com/chromer/activities/intro/WebHeadsIntro.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.intro; import android.os.Build; diff --git a/app/src/main/java/arun/com/chromer/Home.java b/app/src/main/java/arun/com/chromer/activities/main/home/Home.java similarity index 73% rename from app/src/main/java/arun/com/chromer/Home.java rename to app/src/main/java/arun/com/chromer/activities/main/home/Home.java index 1c6bdb71..a13b6849 100644 --- a/app/src/main/java/arun/com/chromer/Home.java +++ b/app/src/main/java/arun/com/chromer/activities/main/home/Home.java @@ -1,4 +1,22 @@ -package arun.com.chromer; +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package arun.com.chromer.activities.main.home; import android.content.Context; import android.support.annotation.NonNull; @@ -8,42 +26,27 @@ import com.arun.rxsuggestions.RxSuggestions; import com.jakewharton.rxbinding.widget.RxTextView; -import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; import arun.com.chromer.activities.SnackHelper; +import arun.com.chromer.activities.mvp.Base; import arun.com.chromer.data.history.HistoryRepository; import arun.com.chromer.data.website.model.WebSite; import arun.com.chromer.search.SuggestionItem; import arun.com.chromer.util.RxUtils; import rx.android.schedulers.AndroidSchedulers; -import rx.subscriptions.CompositeSubscription; import timber.log.Timber; interface Home { - interface View extends SnackHelper { + interface View extends SnackHelper, Base.View { void setSuggestions(@NonNull List suggestions); void setRecents(@NonNull List webSites); } - class Presenter { - WeakReference viewRef; - private final CompositeSubscription compositeSubscription = new CompositeSubscription(); - - Presenter(@NonNull Home.View view) { - viewRef = new WeakReference<>(view); - } - - boolean isViewAttached() { - return viewRef != null && viewRef.get() != null; - } - - Home.View getView() { - return viewRef.get(); - } + class Presenter extends Base.Presenter { void registerSearch(@NonNull EditText editText) { compositeSubscription.add(RxTextView.afterTextChangeEvents(editText) @@ -79,13 +82,5 @@ void loadRecents(@NonNull Context context) { }) .subscribe()); } - - void cleanUp() { - if (viewRef != null) { - viewRef.clear(); - viewRef = null; - } - compositeSubscription.clear(); - } } } diff --git a/app/src/main/java/arun/com/chromer/activities/main/home/HomeFragment.java b/app/src/main/java/arun/com/chromer/activities/main/home/HomeFragment.java new file mode 100644 index 00000000..f53ff2f4 --- /dev/null +++ b/app/src/main/java/arun/com/chromer/activities/main/home/HomeFragment.java @@ -0,0 +1,262 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package arun.com.chromer.activities.main.home; + +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.speech.RecognizerIntent; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.v7.widget.GridLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.view.View; +import android.widget.CheckBox; +import android.widget.TextView; + +import com.crashlytics.android.answers.Answers; +import com.crashlytics.android.answers.SearchEvent; +import com.mikepenz.community_material_typeface_library.CommunityMaterial; +import com.mikepenz.iconics.IconicsDrawable; + +import java.util.List; + +import arun.com.chromer.R; +import arun.com.chromer.activities.SnackHelper; +import arun.com.chromer.activities.mvp.BaseFragment; +import arun.com.chromer.activities.settings.Preferences; +import arun.com.chromer.customtabs.CustomTabManager; +import arun.com.chromer.customtabs.CustomTabs; +import arun.com.chromer.data.website.WebsiteRepository; +import arun.com.chromer.data.website.model.WebSite; +import arun.com.chromer.search.SuggestionItem; +import arun.com.chromer.shared.Constants; +import arun.com.chromer.util.RxUtils; +import arun.com.chromer.util.Utils; +import arun.com.chromer.views.searchview.MaterialSearchView; +import arun.com.chromer.webheads.WebHeadService; +import butterknife.BindView; +import butterknife.OnClick; +import timber.log.Timber; + +import static android.view.View.GONE; +import static android.view.View.VISIBLE; +import static arun.com.chromer.shared.Constants.REQUEST_CODE_VOICE; + +/** + * Created by Arunkumar on 07-04-2017. + */ +public class HomeFragment extends BaseFragment implements Home.View { + + @BindView(R.id.material_search_view) + MaterialSearchView materialSearchView; + @BindView(R.id.incognito_mode) + CheckBox incognitoMode; + @BindView(R.id.recent_missing_text) + TextView recentMissingText; + @BindView(R.id.recents_list) + RecyclerView recentsList; + @BindView(R.id.recents_header) + TextView recentsHeader; + + + private CustomTabManager customTabManager; + private RecentsAdapter recentsAdapter; + + @Override + public Home.Presenter createPresenter() { + return new Home.Presenter(); + } + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + setupMaterialSearch(); + setupCustomTab(); + setupRecents(); + } + + @Override + public void onStart() { + super.onStart(); + customTabManager.bindCustomTabsService(getActivity()); + } + + @Override + public void onResume() { + super.onResume(); + invalidateState(); + getActivity().setTitle(R.string.app_name); + } + + + @Override + public void onStop() { + super.onStop(); + customTabManager.unbindCustomTabsService(getActivity()); + } + + + @Override + public void snack(@NonNull String message) { + ((SnackHelper) getActivity()).snack(message); + } + + @Override + public void snackLong(@NonNull String message) { + ((SnackHelper) getActivity()).snackLong(message); + } + + @Override + public void setSuggestions(@NonNull List suggestions) { + materialSearchView.setSuggestions(suggestions); + } + + @Override + public void setRecents(@NonNull List webSites) { + recentsAdapter.setWebSites(webSites); + if (webSites.isEmpty()) { + recentMissingText.setVisibility(VISIBLE); + } else { + recentMissingText.setVisibility(GONE); + } + } + + @Override + protected int getLayoutRes() { + return R.layout.fragment_home; + } + + private void setupMaterialSearch() { + materialSearchView.clearFocus(); + presenter.registerSearch(materialSearchView.getEditText()); + materialSearchView.setInteractionListener(new MaterialSearchView.SearchViewInteractionListener() { + @Override + public void onVoiceIconClick() { + Answers.getInstance().logSearch(new SearchEvent().putCustomAttribute("Mode", "Voice")); + if (Utils.isVoiceRecognizerPresent(getActivity())) { + startActivityForResult(Utils.getRecognizerIntent(getActivity()), REQUEST_CODE_VOICE); + } else { + snack(getString(R.string.no_voice_rec_apps)); + } + } + + @Override + public void onSearchPerformed(@NonNull String url) { + launchCustomTab(url); + Answers.getInstance().logSearch(new SearchEvent()); + } + }); + } + + private void invalidateState() { + incognitoMode.setChecked(Preferences.get(getContext()).incognitoMode()); + incognitoMode.setCompoundDrawablePadding(Utils.dpToPx(5)); + incognitoMode.setCompoundDrawables(new IconicsDrawable(getContext()) + .icon(CommunityMaterial.Icon.cmd_incognito) + .colorRes(R.color.material_dark_color) + .sizeDp(24), null, null, null); + incognitoMode.setOnCheckedChangeListener((buttonView, isChecked) -> + Preferences.get(getContext()).incognitoMode(isChecked)); + presenter.loadRecents(getContext()); + } + + private void setupRecents() { + recentsHeader.setCompoundDrawablePadding(Utils.dpToPx(8)); + recentsHeader.setCompoundDrawables(new IconicsDrawable(getContext()) + .icon(CommunityMaterial.Icon.cmd_history) + .colorRes(R.color.accent) + .sizeDp(20), null, null, null); + recentsList.setLayoutManager(new GridLayoutManager(getActivity(), 4)); + recentsAdapter = new RecentsAdapter(); + recentsList.setAdapter(recentsAdapter); + } + + private void launchCustomTab(@Nullable String url) { + if (url != null) { + if (Preferences.get(getContext()).webHeads()) { + if (Utils.isOverlayGranted(getContext())) { + final Intent webHeadService = new Intent(getContext(), WebHeadService.class); + webHeadService.setData(Uri.parse(url)); + getActivity().startService(webHeadService); + } else { + Utils.openDrawOverlaySettings(getActivity()); + } + } else { + CustomTabs.from(getActivity()) + .forUrl(url) + .withSession(customTabManager.getSession()) + .prepare() + .launch(); + } + WebsiteRepository.getInstance(getActivity()) + .getWebsite(url) + .compose(RxUtils.applySchedulers()) + .doOnError(Timber::e) + .subscribe(); + } + } + + private void setupCustomTab() { + customTabManager = new CustomTabManager(); + customTabManager.setConnectionCallback( + new CustomTabManager.ConnectionCallback() { + @Override + public void onCustomTabsConnected() { + Timber.d("Connected to custom tabs"); + try { + customTabManager.mayLaunchUrl(Uri.parse(Constants.GOOGLE_URL), null, null); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void onCustomTabsDisconnected() { + } + }); + } + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == REQUEST_CODE_VOICE) { + switch (resultCode) { + case Activity.RESULT_OK: + final List resultList = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); + if (resultList != null && !resultList.isEmpty()) { + launchCustomTab(Utils.getSearchUrl(resultList.get(0))); + } + break; + default: + } + } + super.onActivityResult(requestCode, resultCode, data); + } + + + @OnClick(R.id.fab) + public void onFabClick() { + if (materialSearchView.hasFocus() && materialSearchView.getText().length() > 0) { + launchCustomTab(materialSearchView.getURL()); + } else { + launchCustomTab(Constants.GOOGLE_URL); + } + } +} diff --git a/app/src/main/java/arun/com/chromer/RecentsAdapter.java b/app/src/main/java/arun/com/chromer/activities/main/home/RecentsAdapter.java similarity index 69% rename from app/src/main/java/arun/com/chromer/RecentsAdapter.java rename to app/src/main/java/arun/com/chromer/activities/main/home/RecentsAdapter.java index e9439247..3eca2f30 100644 --- a/app/src/main/java/arun/com/chromer/RecentsAdapter.java +++ b/app/src/main/java/arun/com/chromer/activities/main/home/RecentsAdapter.java @@ -1,4 +1,22 @@ -package arun.com.chromer; +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package arun.com.chromer.activities.main.home; import android.content.Intent; import android.net.Uri; @@ -16,18 +34,20 @@ import java.util.ArrayList; import java.util.List; +import arun.com.chromer.R; import arun.com.chromer.activities.BrowserInterceptActivity; import arun.com.chromer.data.website.model.WebSite; +import arun.com.chromer.shared.Constants; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by arunk on 07-03-2017. */ -class RecentsAdapter extends RecyclerView.Adapter { +public class RecentsAdapter extends RecyclerView.Adapter { private final List webSites = new ArrayList<>(); - RecentsAdapter() { + public RecentsAdapter() { } @Override @@ -42,6 +62,7 @@ public void onBindViewHolder(RecentsViewHolder holder, int position) { holder.label.setText(website.safeLabel()); holder.itemView.setOnClickListener(v -> { final Intent intent = new Intent(holder.itemView.getContext(), BrowserInterceptActivity.class); + intent.putExtra(Constants.EXTRA_KEY_FROM_OUR_APP, true); intent.setData(Uri.parse(website.preferredUrl())); holder.itemView.getContext().startActivity(intent); }); @@ -63,7 +84,7 @@ public int getItemCount() { return webSites.size(); } - void setWebSites(@NonNull List webSites) { + public void setWebSites(@NonNull List webSites) { this.webSites.clear(); this.webSites.addAll(webSites); notifyDataSetChanged(); diff --git a/app/src/main/java/arun/com/chromer/activities/mvp/Base.java b/app/src/main/java/arun/com/chromer/activities/mvp/Base.java new file mode 100644 index 00000000..6bc7a563 --- /dev/null +++ b/app/src/main/java/arun/com/chromer/activities/mvp/Base.java @@ -0,0 +1,47 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package arun.com.chromer.activities.mvp; + +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; +import com.hannesdorfmann.mosby3.mvp.MvpView; + +import rx.subscriptions.CompositeSubscription; + +/** + * Created by Arunkumar on 05-04-2017. + */ +public interface Base { + abstract class Presenter extends MvpBasePresenter { + protected final CompositeSubscription compositeSubscription = new CompositeSubscription(); + + void onDestroy() { + compositeSubscription.clear(); + } + + void onResume() { + } + + void onPause() { + } + } + + interface View extends MvpView { + + } +} diff --git a/app/src/main/java/arun/com/chromer/activities/mvp/BaseActivity.java b/app/src/main/java/arun/com/chromer/activities/mvp/BaseActivity.java new file mode 100644 index 00000000..0be2b57e --- /dev/null +++ b/app/src/main/java/arun/com/chromer/activities/mvp/BaseActivity.java @@ -0,0 +1,65 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package arun.com.chromer.activities.mvp; + +import android.os.Bundle; +import android.support.annotation.LayoutRes; + +import com.hannesdorfmann.mosby3.mvp.MvpActivity; + +import butterknife.ButterKnife; +import butterknife.Unbinder; + +/** + * Created by Arunkumar on 05-04-2017. + */ +public abstract class BaseActivity> + extends MvpActivity { + + protected Unbinder unbinder; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(getLayoutRes()); + unbinder = ButterKnife.bind(this); + } + + @Override + protected void onResume() { + super.onResume(); + presenter.onResume(); + } + + @Override + protected void onPause() { + super.onPause(); + presenter.onPause(); + } + + @Override + protected void onDestroy() { + presenter.onDestroy(); + unbinder.unbind(); + super.onDestroy(); + } + + @LayoutRes + protected abstract int getLayoutRes(); +} \ No newline at end of file diff --git a/app/src/main/java/arun/com/chromer/activities/mvp/BaseFragment.java b/app/src/main/java/arun/com/chromer/activities/mvp/BaseFragment.java new file mode 100644 index 00000000..56f3909b --- /dev/null +++ b/app/src/main/java/arun/com/chromer/activities/mvp/BaseFragment.java @@ -0,0 +1,71 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package arun.com.chromer.activities.mvp; + +import android.os.Bundle; +import android.support.annotation.LayoutRes; +import android.support.annotation.Nullable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.hannesdorfmann.mosby3.mvp.MvpFragment; + +import butterknife.ButterKnife; +import butterknife.Unbinder; + +/** + * Created by Arunkumar on 05-04-2017. + */ +public abstract class BaseFragment> + extends MvpFragment { + + + private Unbinder unbinder; + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + final View view = inflater.inflate(getLayoutRes(), container, false); + unbinder = ButterKnife.bind(this, view); + return view; + } + + @Override + public void onResume() { + super.onResume(); + presenter.onResume(); + } + + @Override + public void onPause() { + super.onPause(); + presenter.onPause(); + } + + @Override + public void onDestroy() { + presenter.onDestroy(); + super.onDestroy(); + unbinder.unbind(); + } + + @LayoutRes + protected abstract int getLayoutRes(); +} \ No newline at end of file diff --git a/app/src/main/java/arun/com/chromer/activities/payments/DonateActivity.java b/app/src/main/java/arun/com/chromer/activities/payments/DonateActivity.java index b0c16747..5e3a0fcb 100644 --- a/app/src/main/java/arun/com/chromer/activities/payments/DonateActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/payments/DonateActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.payments; import android.content.DialogInterface; diff --git a/app/src/main/java/arun/com/chromer/activities/payments/util/IabBroadcastReceiver.java b/app/src/main/java/arun/com/chromer/activities/payments/util/IabBroadcastReceiver.java index 07742777..209510a0 100644 --- a/app/src/main/java/arun/com/chromer/activities/payments/util/IabBroadcastReceiver.java +++ b/app/src/main/java/arun/com/chromer/activities/payments/util/IabBroadcastReceiver.java @@ -1,16 +1,19 @@ -/* Copyright (c) 2014 Google Inc. +/* + * Chromer + * Copyright (C) 2017 Arunkumar * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package arun.com.chromer.activities.payments.util; diff --git a/app/src/main/java/arun/com/chromer/activities/payments/util/IabException.java b/app/src/main/java/arun/com/chromer/activities/payments/util/IabException.java index 9daacd46..0e79827f 100644 --- a/app/src/main/java/arun/com/chromer/activities/payments/util/IabException.java +++ b/app/src/main/java/arun/com/chromer/activities/payments/util/IabException.java @@ -1,16 +1,19 @@ -/* Copyright (c) 2012 Google Inc. +/* + * Chromer + * Copyright (C) 2017 Arunkumar * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package arun.com.chromer.activities.payments.util; diff --git a/app/src/main/java/arun/com/chromer/activities/payments/util/IabHelper.java b/app/src/main/java/arun/com/chromer/activities/payments/util/IabHelper.java index 0bfbfebd..9fef15bd 100644 --- a/app/src/main/java/arun/com/chromer/activities/payments/util/IabHelper.java +++ b/app/src/main/java/arun/com/chromer/activities/payments/util/IabHelper.java @@ -1,16 +1,19 @@ -/* Copyright (c) 2012 Google Inc. +/* + * Chromer + * Copyright (C) 2017 Arunkumar * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package arun.com.chromer.activities.payments.util; diff --git a/app/src/main/java/arun/com/chromer/activities/payments/util/IabResult.java b/app/src/main/java/arun/com/chromer/activities/payments/util/IabResult.java index f7fdd0b0..0ec5c78d 100644 --- a/app/src/main/java/arun/com/chromer/activities/payments/util/IabResult.java +++ b/app/src/main/java/arun/com/chromer/activities/payments/util/IabResult.java @@ -1,16 +1,19 @@ -/* Copyright (c) 2012 Google Inc. +/* + * Chromer + * Copyright (C) 2017 Arunkumar * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package arun.com.chromer.activities.payments.util; diff --git a/app/src/main/java/arun/com/chromer/activities/payments/util/Inventory.java b/app/src/main/java/arun/com/chromer/activities/payments/util/Inventory.java index 7eb6259e..89d82a34 100644 --- a/app/src/main/java/arun/com/chromer/activities/payments/util/Inventory.java +++ b/app/src/main/java/arun/com/chromer/activities/payments/util/Inventory.java @@ -1,16 +1,19 @@ -/* Copyright (c) 2012 Google Inc. +/* + * Chromer + * Copyright (C) 2017 Arunkumar * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package arun.com.chromer.activities.payments.util; diff --git a/app/src/main/java/arun/com/chromer/activities/payments/util/Purchase.java b/app/src/main/java/arun/com/chromer/activities/payments/util/Purchase.java index 0cf26dcb..83e5cbfc 100644 --- a/app/src/main/java/arun/com/chromer/activities/payments/util/Purchase.java +++ b/app/src/main/java/arun/com/chromer/activities/payments/util/Purchase.java @@ -1,16 +1,19 @@ -/* Copyright (c) 2012 Google Inc. +/* + * Chromer + * Copyright (C) 2017 Arunkumar * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package arun.com.chromer.activities.payments.util; diff --git a/app/src/main/java/arun/com/chromer/activities/payments/util/Security.java b/app/src/main/java/arun/com/chromer/activities/payments/util/Security.java index 9dfa7510..c4b2bc40 100644 --- a/app/src/main/java/arun/com/chromer/activities/payments/util/Security.java +++ b/app/src/main/java/arun/com/chromer/activities/payments/util/Security.java @@ -1,16 +1,19 @@ -/* Copyright (c) 2012 Google Inc. +/* + * Chromer + * Copyright (C) 2017 Arunkumar * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package arun.com.chromer.activities.payments.util; diff --git a/app/src/main/java/arun/com/chromer/activities/payments/util/SkuDetails.java b/app/src/main/java/arun/com/chromer/activities/payments/util/SkuDetails.java index 1783dd5b..01928eca 100644 --- a/app/src/main/java/arun/com/chromer/activities/payments/util/SkuDetails.java +++ b/app/src/main/java/arun/com/chromer/activities/payments/util/SkuDetails.java @@ -1,16 +1,19 @@ -/* Copyright (c) 2012 Google Inc. +/* + * Chromer + * Copyright (C) 2017 Arunkumar * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package arun.com.chromer.activities.payments.util; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/Preferences.java b/app/src/main/java/arun/com/chromer/activities/settings/Preferences.java index 9b4bd5bd..30dc2f7b 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/Preferences.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/Preferences.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings; import android.content.ComponentName; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/SettingsGroupActivity.java b/app/src/main/java/arun/com/chromer/activities/settings/SettingsGroupActivity.java index 04732f99..a33d70bc 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/SettingsGroupActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/SettingsGroupActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings; import android.content.BroadcastReceiver; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/SettingsGroupAdapter.java b/app/src/main/java/arun/com/chromer/activities/settings/SettingsGroupAdapter.java index 22b4d927..c6c41981 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/SettingsGroupAdapter.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/SettingsGroupAdapter.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/browsingmode/BrowseFasterPreferenceFragment.java b/app/src/main/java/arun/com/chromer/activities/settings/browsingmode/BrowseFasterPreferenceFragment.java index fd00a209..e581897a 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/browsingmode/BrowseFasterPreferenceFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/browsingmode/BrowseFasterPreferenceFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.browsingmode; import android.content.SharedPreferences; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/browsingmode/BrowsingModeActivity.java b/app/src/main/java/arun/com/chromer/activities/settings/browsingmode/BrowsingModeActivity.java index 688a50be..c8c1daaf 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/browsingmode/BrowsingModeActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/browsingmode/BrowsingModeActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.browsingmode; import android.os.Bundle; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/browsingmode/BrowsingModeAdapter.java b/app/src/main/java/arun/com/chromer/activities/settings/browsingmode/BrowsingModeAdapter.java index bab7a9ad..957dbf98 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/browsingmode/BrowsingModeAdapter.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/browsingmode/BrowsingModeAdapter.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.browsingmode; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/BehaviorPreferenceFragment.java b/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/BehaviorPreferenceFragment.java index a3d4af66..250a252d 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/BehaviorPreferenceFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/BehaviorPreferenceFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.browsingoptions; import android.app.ActivityOptions; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/BottomBarPreferenceFragment.java b/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/BottomBarPreferenceFragment.java index d2d2413a..6edeb001 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/BottomBarPreferenceFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/BottomBarPreferenceFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.browsingoptions; import android.content.SharedPreferences; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/BrowsingOptionsActivity.java b/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/BrowsingOptionsActivity.java index 91e5c62b..1da73e7a 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/BrowsingOptionsActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/BrowsingOptionsActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.browsingoptions; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/WebHeadOptionsFragment.java b/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/WebHeadOptionsFragment.java index 53ef5090..ab803374 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/WebHeadOptionsFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/browsingoptions/WebHeadOptionsFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.browsingoptions; import android.content.SharedPreferences; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/fragments/CustomizeFragment.java b/app/src/main/java/arun/com/chromer/activities/settings/fragments/CustomizeFragment.java index c1dfe8a9..08c02ed5 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/fragments/CustomizeFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/fragments/CustomizeFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.fragments; import android.os.Bundle; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/fragments/OptionsFragment.java b/app/src/main/java/arun/com/chromer/activities/settings/fragments/OptionsFragment.java index eb26cadc..e9d382a8 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/fragments/OptionsFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/fragments/OptionsFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.fragments; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/ArticlePreferenceFragment.java b/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/ArticlePreferenceFragment.java index 4f5dba4d..a07a94d9 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/ArticlePreferenceFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/ArticlePreferenceFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.lookandfeel; import android.content.SharedPreferences; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/LookAndFeelActivity.java b/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/LookAndFeelActivity.java index e05cf985..1361f957 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/LookAndFeelActivity.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/LookAndFeelActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.lookandfeel; import android.content.Intent; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/PersonalizationPreferenceFragment.java b/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/PersonalizationPreferenceFragment.java index 53f5847e..8b58ed4d 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/PersonalizationPreferenceFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/PersonalizationPreferenceFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.lookandfeel; import android.annotation.TargetApi; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/WebHeadPreferenceFragment.java b/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/WebHeadPreferenceFragment.java index f9c96ec8..9fe352d3 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/WebHeadPreferenceFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/lookandfeel/WebHeadPreferenceFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.lookandfeel; import android.content.BroadcastReceiver; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/preferences/BasePreferenceFragment.java b/app/src/main/java/arun/com/chromer/activities/settings/preferences/BasePreferenceFragment.java index 2ae8ccd3..9561cf25 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/preferences/BasePreferenceFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/preferences/BasePreferenceFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.preferences; import android.content.BroadcastReceiver; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/preferences/PrefetchPreferenceFragment.java b/app/src/main/java/arun/com/chromer/activities/settings/preferences/PrefetchPreferenceFragment.java index f1155cbd..bd235410 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/preferences/PrefetchPreferenceFragment.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/preferences/PrefetchPreferenceFragment.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.preferences; import android.content.Intent; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/widgets/AppPreferenceCardView.java b/app/src/main/java/arun/com/chromer/activities/settings/widgets/AppPreferenceCardView.java index 2c74aa10..eb9f94f0 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/widgets/AppPreferenceCardView.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/widgets/AppPreferenceCardView.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.widgets; import android.content.ComponentName; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/widgets/ColorPreference.java b/app/src/main/java/arun/com/chromer/activities/settings/widgets/ColorPreference.java index 8b54e732..4fc325c5 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/widgets/ColorPreference.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/widgets/ColorPreference.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.widgets; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/widgets/IconCheckboxPreference.java b/app/src/main/java/arun/com/chromer/activities/settings/widgets/IconCheckboxPreference.java index 6ed751a9..3e14e6e2 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/widgets/IconCheckboxPreference.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/widgets/IconCheckboxPreference.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.widgets; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/widgets/IconListPreference.java b/app/src/main/java/arun/com/chromer/activities/settings/widgets/IconListPreference.java index 03342dcb..b20626ee 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/widgets/IconListPreference.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/widgets/IconListPreference.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.widgets; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/widgets/IconSwitchPreference.java b/app/src/main/java/arun/com/chromer/activities/settings/widgets/IconSwitchPreference.java index 75b666ea..8402ff7b 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/widgets/IconSwitchPreference.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/widgets/IconSwitchPreference.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.widgets; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/widgets/PreferenceIconLayoutHelper.java b/app/src/main/java/arun/com/chromer/activities/settings/widgets/PreferenceIconLayoutHelper.java index 983ad55a..9782deb7 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/widgets/PreferenceIconLayoutHelper.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/widgets/PreferenceIconLayoutHelper.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.widgets; import android.graphics.Color; diff --git a/app/src/main/java/arun/com/chromer/activities/settings/widgets/SubCheckBoxPreference.java b/app/src/main/java/arun/com/chromer/activities/settings/widgets/SubCheckBoxPreference.java index 1a97903c..5291c287 100644 --- a/app/src/main/java/arun/com/chromer/activities/settings/widgets/SubCheckBoxPreference.java +++ b/app/src/main/java/arun/com/chromer/activities/settings/widgets/SubCheckBoxPreference.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.activities.settings.widgets; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/customtabs/CustomTabManager.java b/app/src/main/java/arun/com/chromer/customtabs/CustomTabManager.java index 4999e79f..bf89b629 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/CustomTabManager.java +++ b/app/src/main/java/arun/com/chromer/customtabs/CustomTabManager.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.customtabs; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/customtabs/CustomTabs.java b/app/src/main/java/arun/com/chromer/customtabs/CustomTabs.java index ed823793..d278befa 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/CustomTabs.java +++ b/app/src/main/java/arun/com/chromer/customtabs/CustomTabs.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.customtabs; import android.annotation.TargetApi; diff --git a/app/src/main/java/arun/com/chromer/customtabs/KeepAliveService.java b/app/src/main/java/arun/com/chromer/customtabs/KeepAliveService.java index 2467e477..84815df1 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/KeepAliveService.java +++ b/app/src/main/java/arun/com/chromer/customtabs/KeepAliveService.java @@ -1,16 +1,20 @@ -// Copyright 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package arun.com.chromer.customtabs; diff --git a/app/src/main/java/arun/com/chromer/customtabs/ServiceConnection.java b/app/src/main/java/arun/com/chromer/customtabs/ServiceConnection.java index 263dd621..ed147502 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/ServiceConnection.java +++ b/app/src/main/java/arun/com/chromer/customtabs/ServiceConnection.java @@ -1,16 +1,20 @@ -// Copyright 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package arun.com.chromer.customtabs; diff --git a/app/src/main/java/arun/com/chromer/customtabs/ServiceConnectionCallback.java b/app/src/main/java/arun/com/chromer/customtabs/ServiceConnectionCallback.java index 2e934e0d..59a671bf 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/ServiceConnectionCallback.java +++ b/app/src/main/java/arun/com/chromer/customtabs/ServiceConnectionCallback.java @@ -1,16 +1,20 @@ -// Copyright 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package arun.com.chromer.customtabs; diff --git a/app/src/main/java/arun/com/chromer/customtabs/bottombar/BottomBarManager.java b/app/src/main/java/arun/com/chromer/customtabs/bottombar/BottomBarManager.java index 7b80898a..00ca3aca 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/bottombar/BottomBarManager.java +++ b/app/src/main/java/arun/com/chromer/customtabs/bottombar/BottomBarManager.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.customtabs.bottombar; import android.app.PendingIntent; diff --git a/app/src/main/java/arun/com/chromer/customtabs/bottombar/BottomBarReceiver.java b/app/src/main/java/arun/com/chromer/customtabs/bottombar/BottomBarReceiver.java index cad0a353..4b0089c9 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/bottombar/BottomBarReceiver.java +++ b/app/src/main/java/arun/com/chromer/customtabs/bottombar/BottomBarReceiver.java @@ -1,16 +1,20 @@ -// Copyright 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package arun.com.chromer.customtabs.bottombar; diff --git a/app/src/main/java/arun/com/chromer/customtabs/callbacks/AddHomeShortcutService.java b/app/src/main/java/arun/com/chromer/customtabs/callbacks/AddHomeShortcutService.java index b41d4796..a0ec1130 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/callbacks/AddHomeShortcutService.java +++ b/app/src/main/java/arun/com/chromer/customtabs/callbacks/AddHomeShortcutService.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.customtabs.callbacks; import android.app.IntentService; diff --git a/app/src/main/java/arun/com/chromer/customtabs/callbacks/ClipboardService.java b/app/src/main/java/arun/com/chromer/customtabs/callbacks/ClipboardService.java index 7a1f2a11..c845a747 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/callbacks/ClipboardService.java +++ b/app/src/main/java/arun/com/chromer/customtabs/callbacks/ClipboardService.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.customtabs.callbacks; import android.app.IntentService; diff --git a/app/src/main/java/arun/com/chromer/customtabs/callbacks/FavShareBroadcastReceiver.java b/app/src/main/java/arun/com/chromer/customtabs/callbacks/FavShareBroadcastReceiver.java index 35078912..b962b397 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/callbacks/FavShareBroadcastReceiver.java +++ b/app/src/main/java/arun/com/chromer/customtabs/callbacks/FavShareBroadcastReceiver.java @@ -1,16 +1,20 @@ -// Copyright 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package arun.com.chromer.customtabs.callbacks; diff --git a/app/src/main/java/arun/com/chromer/customtabs/callbacks/MinimizeBroadcastReceiver.java b/app/src/main/java/arun/com/chromer/customtabs/callbacks/MinimizeBroadcastReceiver.java index 1dcaa558..451b1091 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/callbacks/MinimizeBroadcastReceiver.java +++ b/app/src/main/java/arun/com/chromer/customtabs/callbacks/MinimizeBroadcastReceiver.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.customtabs.callbacks; import android.content.BroadcastReceiver; diff --git a/app/src/main/java/arun/com/chromer/customtabs/callbacks/OpenInChromeReceiver.java b/app/src/main/java/arun/com/chromer/customtabs/callbacks/OpenInChromeReceiver.java index 1b3ac628..6afa3168 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/callbacks/OpenInChromeReceiver.java +++ b/app/src/main/java/arun/com/chromer/customtabs/callbacks/OpenInChromeReceiver.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.customtabs.callbacks; import android.content.ActivityNotFoundException; diff --git a/app/src/main/java/arun/com/chromer/customtabs/callbacks/SecondaryBrowserReceiver.java b/app/src/main/java/arun/com/chromer/customtabs/callbacks/SecondaryBrowserReceiver.java index c6637435..63c8e571 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/callbacks/SecondaryBrowserReceiver.java +++ b/app/src/main/java/arun/com/chromer/customtabs/callbacks/SecondaryBrowserReceiver.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.customtabs.callbacks; import android.annotation.SuppressLint; diff --git a/app/src/main/java/arun/com/chromer/customtabs/callbacks/ShareBroadcastReceiver.java b/app/src/main/java/arun/com/chromer/customtabs/callbacks/ShareBroadcastReceiver.java index ca5bf083..4b6ae932 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/callbacks/ShareBroadcastReceiver.java +++ b/app/src/main/java/arun/com/chromer/customtabs/callbacks/ShareBroadcastReceiver.java @@ -1,16 +1,20 @@ -// Copyright 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package arun.com.chromer.customtabs.callbacks; diff --git a/app/src/main/java/arun/com/chromer/customtabs/dynamictoolbar/AppColorExtractorService.java b/app/src/main/java/arun/com/chromer/customtabs/dynamictoolbar/AppColorExtractorService.java index 65244b3e..c2324105 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/dynamictoolbar/AppColorExtractorService.java +++ b/app/src/main/java/arun/com/chromer/customtabs/dynamictoolbar/AppColorExtractorService.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.customtabs.dynamictoolbar; import android.app.IntentService; diff --git a/app/src/main/java/arun/com/chromer/customtabs/dynamictoolbar/WebColorExtractorService.java b/app/src/main/java/arun/com/chromer/customtabs/dynamictoolbar/WebColorExtractorService.java index e8704e45..1f3ebb0a 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/dynamictoolbar/WebColorExtractorService.java +++ b/app/src/main/java/arun/com/chromer/customtabs/dynamictoolbar/WebColorExtractorService.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.customtabs.dynamictoolbar; import android.app.IntentService; diff --git a/app/src/main/java/arun/com/chromer/customtabs/prefetch/ScannerService.java b/app/src/main/java/arun/com/chromer/customtabs/prefetch/ScannerService.java index cf6ba787..790c52c7 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/prefetch/ScannerService.java +++ b/app/src/main/java/arun/com/chromer/customtabs/prefetch/ScannerService.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.customtabs.prefetch; import android.accessibilityservice.AccessibilityService; diff --git a/app/src/main/java/arun/com/chromer/customtabs/warmup/WarmUpService.java b/app/src/main/java/arun/com/chromer/customtabs/warmup/WarmUpService.java index 80f5f97c..fdd35a9e 100644 --- a/app/src/main/java/arun/com/chromer/customtabs/warmup/WarmUpService.java +++ b/app/src/main/java/arun/com/chromer/customtabs/warmup/WarmUpService.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.customtabs.warmup; import android.app.Service; diff --git a/app/src/main/java/arun/com/chromer/data/apps/AppDiskStore.java b/app/src/main/java/arun/com/chromer/data/apps/AppDiskStore.java index 59c374fd..71d0ac56 100644 --- a/app/src/main/java/arun/com/chromer/data/apps/AppDiskStore.java +++ b/app/src/main/java/arun/com/chromer/data/apps/AppDiskStore.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.apps; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/data/apps/AppRepository.java b/app/src/main/java/arun/com/chromer/data/apps/AppRepository.java index d896917e..da84cbbf 100644 --- a/app/src/main/java/arun/com/chromer/data/apps/AppRepository.java +++ b/app/src/main/java/arun/com/chromer/data/apps/AppRepository.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.apps; import android.annotation.SuppressLint; diff --git a/app/src/main/java/arun/com/chromer/data/apps/AppStore.java b/app/src/main/java/arun/com/chromer/data/apps/AppStore.java index 9b484977..66a72305 100644 --- a/app/src/main/java/arun/com/chromer/data/apps/AppStore.java +++ b/app/src/main/java/arun/com/chromer/data/apps/AppStore.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.apps; import arun.com.chromer.data.common.BookStore; diff --git a/app/src/main/java/arun/com/chromer/data/apps/BaseAppRepository.java b/app/src/main/java/arun/com/chromer/data/apps/BaseAppRepository.java index 523f8f8a..f1f97bce 100644 --- a/app/src/main/java/arun/com/chromer/data/apps/BaseAppRepository.java +++ b/app/src/main/java/arun/com/chromer/data/apps/BaseAppRepository.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.apps; import android.support.annotation.ColorInt; diff --git a/app/src/main/java/arun/com/chromer/data/common/App.java b/app/src/main/java/arun/com/chromer/data/common/App.java index 6cf1b12d..2b1cd82b 100644 --- a/app/src/main/java/arun/com/chromer/data/common/App.java +++ b/app/src/main/java/arun/com/chromer/data/common/App.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.common; import android.os.Parcel; diff --git a/app/src/main/java/arun/com/chromer/data/common/BookStore.java b/app/src/main/java/arun/com/chromer/data/common/BookStore.java index 784f5e82..bf9e6834 100644 --- a/app/src/main/java/arun/com/chromer/data/common/BookStore.java +++ b/app/src/main/java/arun/com/chromer/data/common/BookStore.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.common; import io.paperdb.Book; diff --git a/app/src/main/java/arun/com/chromer/data/history/HistoryDiskStore.java b/app/src/main/java/arun/com/chromer/data/history/HistoryDiskStore.java index 1ebfc871..75d974b7 100644 --- a/app/src/main/java/arun/com/chromer/data/history/HistoryDiskStore.java +++ b/app/src/main/java/arun/com/chromer/data/history/HistoryDiskStore.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.history; import android.content.ContentValues; diff --git a/app/src/main/java/arun/com/chromer/data/history/HistoryRepository.java b/app/src/main/java/arun/com/chromer/data/history/HistoryRepository.java index 5cfbd887..bcf3f749 100644 --- a/app/src/main/java/arun/com/chromer/data/history/HistoryRepository.java +++ b/app/src/main/java/arun/com/chromer/data/history/HistoryRepository.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.history; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/data/history/HistoryStore.java b/app/src/main/java/arun/com/chromer/data/history/HistoryStore.java index 79ede281..51dd8dc6 100644 --- a/app/src/main/java/arun/com/chromer/data/history/HistoryStore.java +++ b/app/src/main/java/arun/com/chromer/data/history/HistoryStore.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.history; import android.database.Cursor; diff --git a/app/src/main/java/arun/com/chromer/data/history/model/HistoryTable.java b/app/src/main/java/arun/com/chromer/data/history/model/HistoryTable.java index be798cd2..cd00bfc5 100644 --- a/app/src/main/java/arun/com/chromer/data/history/model/HistoryTable.java +++ b/app/src/main/java/arun/com/chromer/data/history/model/HistoryTable.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.history.model; /** diff --git a/app/src/main/java/arun/com/chromer/data/website/BaseWebsiteRepository.java b/app/src/main/java/arun/com/chromer/data/website/BaseWebsiteRepository.java index 2bae2c07..3b78044b 100644 --- a/app/src/main/java/arun/com/chromer/data/website/BaseWebsiteRepository.java +++ b/app/src/main/java/arun/com/chromer/data/website/BaseWebsiteRepository.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.website; import android.support.annotation.NonNull; @@ -19,4 +37,7 @@ interface BaseWebsiteRepository { @NonNull Observable saveWebColor(final String url); + + @NonNull + Observable clearCache(); } \ No newline at end of file diff --git a/app/src/main/java/arun/com/chromer/data/website/WebsiteDiskStore.java b/app/src/main/java/arun/com/chromer/data/website/WebsiteDiskStore.java index 5772fffc..6849fbf7 100644 --- a/app/src/main/java/arun/com/chromer/data/website/WebsiteDiskStore.java +++ b/app/src/main/java/arun/com/chromer/data/website/WebsiteDiskStore.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.website; import android.content.Context; @@ -6,6 +24,7 @@ import android.support.annotation.NonNull; import java.io.IOException; +import java.util.concurrent.Callable; import arun.com.chromer.data.common.BookStore; import arun.com.chromer.data.website.model.WebColor; @@ -64,6 +83,18 @@ public Observable getWebsite(@NonNull final String url) { }); } + @NonNull + @Override + public Observable clearCache() { + return Observable.fromCallable(new Callable() { + @Override + public Void call() throws Exception { + webSiteDiskCache.clear(); + return null; + } + }); + } + @NonNull @Override public Observable saveWebsite(@NonNull final WebSite webSite) { diff --git a/app/src/main/java/arun/com/chromer/data/website/WebsiteNetworkStore.java b/app/src/main/java/arun/com/chromer/data/website/WebsiteNetworkStore.java index ac69964a..e3dcee1c 100644 --- a/app/src/main/java/arun/com/chromer/data/website/WebsiteNetworkStore.java +++ b/app/src/main/java/arun/com/chromer/data/website/WebsiteNetworkStore.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.website; import android.content.Context; @@ -44,6 +62,12 @@ public Observable call(Pair urlArticlePair) { }).compose(RxUtils.applySchedulers()); } + @NonNull + @Override + public Observable clearCache() { + return Observable.empty(); + } + @NonNull @Override public Observable saveWebsite(@NonNull WebSite webSite) { diff --git a/app/src/main/java/arun/com/chromer/data/website/WebsiteRepository.java b/app/src/main/java/arun/com/chromer/data/website/WebsiteRepository.java index 7983407f..2b7e4a44 100644 --- a/app/src/main/java/arun/com/chromer/data/website/WebsiteRepository.java +++ b/app/src/main/java/arun/com/chromer/data/website/WebsiteRepository.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.website; import android.annotation.SuppressLint; @@ -28,12 +46,12 @@ public class WebsiteRepository implements BaseWebsiteRepository { // Network store private final WebsiteStore webNetworkStore; // Cache store - private final WebsiteStore cacheStore; + private final WebsiteStore diskStore; private WebsiteRepository(@NonNull Context context) { this.context = context.getApplicationContext(); webNetworkStore = new WebsiteNetworkStore(context); - cacheStore = new WebsiteDiskStore(context); + diskStore = new WebsiteDiskStore(context); } public static synchronized WebsiteRepository getInstance(@NonNull Context context) { @@ -46,7 +64,7 @@ public static synchronized WebsiteRepository getInstance(@NonNull Context contex @NonNull @Override public Observable getWebsite(@NonNull final String url) { - final Observable cache = cacheStore.getWebsite(url) + final Observable cache = diskStore.getWebsite(url) .doOnNext(webSite -> { if (webSite != null) { HistoryRepository.getInstance(context).update(webSite).subscribe(); @@ -63,7 +81,7 @@ public Observable getWebsite(@NonNull final String url) { final Observable remote = webNetworkStore.getWebsite(url) .filter(webSite -> webSite != null) .doOnNext(webSite -> { - cacheStore.saveWebsite(webSite).subscribe(); + diskStore.saveWebsite(webSite).subscribe(); HistoryRepository.getInstance(context).insert(webSite).subscribe(); }); @@ -75,7 +93,7 @@ public Observable getWebsite(@NonNull final String url) { @Override public int getWebsiteColorSync(@NonNull String url) { - return cacheStore.getWebsiteColor(url).toBlocking().first().color; + return diskStore.getWebsiteColor(url).toBlocking().first().color; } @NonNull @@ -87,7 +105,7 @@ public Observable saveWebColor(String url) { @Override public Observable call(WebSite webSite) { if (webSite != null && webSite.themeColor() != NO_COLOR) { - return cacheStore.saveWebsiteColor(Uri.parse(webSite.url).getHost(), webSite.themeColor()); + return diskStore.saveWebsiteColor(Uri.parse(webSite.url).getHost(), webSite.themeColor()); } else { return Observable.empty(); } @@ -95,4 +113,10 @@ public Observable call(WebSite webSite) { }); } + @NonNull + @Override + public Observable clearCache() { + return diskStore.clearCache(); + } + } diff --git a/app/src/main/java/arun/com/chromer/data/website/WebsiteStore.java b/app/src/main/java/arun/com/chromer/data/website/WebsiteStore.java index 8cf7109e..2d6c0fee 100644 --- a/app/src/main/java/arun/com/chromer/data/website/WebsiteStore.java +++ b/app/src/main/java/arun/com/chromer/data/website/WebsiteStore.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.website; import android.support.annotation.ColorInt; @@ -15,6 +33,9 @@ interface WebsiteStore { @NonNull Observable getWebsite(@NonNull String url); + @NonNull + Observable clearCache(); + @NonNull Observable saveWebsite(@NonNull WebSite webSite); diff --git a/app/src/main/java/arun/com/chromer/data/website/model/WebColor.java b/app/src/main/java/arun/com/chromer/data/website/model/WebColor.java index 7e56027e..bfdbfd72 100644 --- a/app/src/main/java/arun/com/chromer/data/website/model/WebColor.java +++ b/app/src/main/java/arun/com/chromer/data/website/model/WebColor.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.website.model; import android.support.annotation.ColorInt; diff --git a/app/src/main/java/arun/com/chromer/data/website/model/WebSite.java b/app/src/main/java/arun/com/chromer/data/website/model/WebSite.java index 9fef3780..ad3fd65c 100644 --- a/app/src/main/java/arun/com/chromer/data/website/model/WebSite.java +++ b/app/src/main/java/arun/com/chromer/data/website/model/WebSite.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.data.website.model; import android.database.Cursor; diff --git a/app/src/main/java/arun/com/chromer/glide/AppIconModelLoader.java b/app/src/main/java/arun/com/chromer/glide/AppIconModelLoader.java index 1928a767..2dd3e822 100644 --- a/app/src/main/java/arun/com/chromer/glide/AppIconModelLoader.java +++ b/app/src/main/java/arun/com/chromer/glide/AppIconModelLoader.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.glide; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/glide/ChromerGideModule.java b/app/src/main/java/arun/com/chromer/glide/ChromerGideModule.java index 13a5a9f5..add72d87 100644 --- a/app/src/main/java/arun/com/chromer/glide/ChromerGideModule.java +++ b/app/src/main/java/arun/com/chromer/glide/ChromerGideModule.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.glide; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/parser/RxParser.java b/app/src/main/java/arun/com/chromer/parser/RxParser.java index 0d3c5a98..59e0d649 100644 --- a/app/src/main/java/arun/com/chromer/parser/RxParser.java +++ b/app/src/main/java/arun/com/chromer/parser/RxParser.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.parser; import android.support.annotation.Nullable; @@ -7,7 +25,6 @@ import com.chimbori.crux.articles.ArticleExtractor; import com.chimbori.crux.urls.CruxURL; -import arun.com.chromer.util.Utils; import rx.Observable; import rx.functions.Func1; import timber.log.Timber; @@ -47,10 +64,9 @@ public static Article parseUrlSync(@Nullable String url) { //noinspection UnusedAssignment webSiteString = null; - Utils.printThread(); } } catch (Exception | OutOfMemoryError e) { - Timber.e(e.getMessage()); + Timber.e(e); Observable.error(e); } return new Pair<>(url, article); diff --git a/app/src/main/java/arun/com/chromer/parser/WebsiteUtilities.java b/app/src/main/java/arun/com/chromer/parser/WebsiteUtilities.java index f32e0d99..543f205e 100644 --- a/app/src/main/java/arun/com/chromer/parser/WebsiteUtilities.java +++ b/app/src/main/java/arun/com/chromer/parser/WebsiteUtilities.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.parser; import android.support.annotation.NonNull; diff --git a/app/src/main/java/arun/com/chromer/qs/AmpTile.java b/app/src/main/java/arun/com/chromer/qs/AmpTile.java index 897c8588..b8cee45b 100644 --- a/app/src/main/java/arun/com/chromer/qs/AmpTile.java +++ b/app/src/main/java/arun/com/chromer/qs/AmpTile.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.qs; import android.graphics.drawable.Icon; diff --git a/app/src/main/java/arun/com/chromer/qs/ArticleTile.java b/app/src/main/java/arun/com/chromer/qs/ArticleTile.java index 6a83fa0c..41a20948 100644 --- a/app/src/main/java/arun/com/chromer/qs/ArticleTile.java +++ b/app/src/main/java/arun/com/chromer/qs/ArticleTile.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.qs; import android.graphics.drawable.Icon; diff --git a/app/src/main/java/arun/com/chromer/qs/WebHeadTile.java b/app/src/main/java/arun/com/chromer/qs/WebHeadTile.java index 0cc261cf..7608c251 100644 --- a/app/src/main/java/arun/com/chromer/qs/WebHeadTile.java +++ b/app/src/main/java/arun/com/chromer/qs/WebHeadTile.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.qs; import android.graphics.Color; diff --git a/app/src/main/java/arun/com/chromer/search/SuggestionAdapter.java b/app/src/main/java/arun/com/chromer/search/SuggestionAdapter.java index 8f71f115..146d08b6 100644 --- a/app/src/main/java/arun/com/chromer/search/SuggestionAdapter.java +++ b/app/src/main/java/arun/com/chromer/search/SuggestionAdapter.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.search; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/search/SuggestionItem.java b/app/src/main/java/arun/com/chromer/search/SuggestionItem.java index 131a5bb5..f44ad74d 100644 --- a/app/src/main/java/arun/com/chromer/search/SuggestionItem.java +++ b/app/src/main/java/arun/com/chromer/search/SuggestionItem.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.search; import android.support.annotation.IntDef; diff --git a/app/src/main/java/arun/com/chromer/shared/AppDetectService.java b/app/src/main/java/arun/com/chromer/shared/AppDetectService.java index 92943f3d..97629dd8 100644 --- a/app/src/main/java/arun/com/chromer/shared/AppDetectService.java +++ b/app/src/main/java/arun/com/chromer/shared/AppDetectService.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.shared; import android.annotation.TargetApi; diff --git a/app/src/main/java/arun/com/chromer/shared/AppDetectionManager.java b/app/src/main/java/arun/com/chromer/shared/AppDetectionManager.java index 30779c07..ec7a29fb 100644 --- a/app/src/main/java/arun/com/chromer/shared/AppDetectionManager.java +++ b/app/src/main/java/arun/com/chromer/shared/AppDetectionManager.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.shared; import android.annotation.SuppressLint; diff --git a/app/src/main/java/arun/com/chromer/shared/Constants.java b/app/src/main/java/arun/com/chromer/shared/Constants.java index c90ba4c7..f354a7fc 100644 --- a/app/src/main/java/arun/com/chromer/shared/Constants.java +++ b/app/src/main/java/arun/com/chromer/shared/Constants.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.shared; import android.content.Intent; @@ -56,6 +74,7 @@ public class Constants { public static final String EXTRA_PACKAGE_NAME = "EXTRA_PACKAGE_NAME"; public static final String EXTRA_KEY_ORIGINAL_URL = "EXTRA_KEY_ORIGINAL_URL"; public static final String EXTRA_KEY_FROM_ARTICLE = "EXTRA_KEY_FROM_ARTICLE"; + public static final String EXTRA_KEY_FROM_OUR_APP = "EXTRA_KEY_FROM_OUR_APP"; // Request codes public static final int REQUEST_CODE_VOICE = 10001; diff --git a/app/src/main/java/arun/com/chromer/util/ColorUtil.java b/app/src/main/java/arun/com/chromer/util/ColorUtil.java index fd54f8cd..b3effc46 100644 --- a/app/src/main/java/arun/com/chromer/util/ColorUtil.java +++ b/app/src/main/java/arun/com/chromer/util/ColorUtil.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.util; import android.content.res.ColorStateList; @@ -12,8 +30,7 @@ import android.support.v4.graphics.ColorUtils; import android.support.v7.graphics.Palette; -import java.util.ArrayList; -import java.util.Collections; +import java.util.LinkedList; import java.util.List; import java.util.SortedMap; import java.util.TreeMap; @@ -66,7 +83,8 @@ public class ColorUtil { @NonNull public static List getSwatchListFromPalette(@NonNull Palette palette) { - final List swatchList = new ArrayList<>(); + final List swatchList = new LinkedList<>(); + Palette.Swatch prominentSwatch = palette.getDominantSwatch(); Palette.Swatch vibrantSwatch = palette.getVibrantSwatch(); Palette.Swatch vibrantDarkSwatch = palette.getDarkVibrantSwatch(); Palette.Swatch vibrantLightSwatch = palette.getLightVibrantSwatch(); @@ -74,6 +92,7 @@ public static List getSwatchListFromPalette(@NonNull Palette pal Palette.Swatch mutedDarkSwatch = palette.getDarkMutedSwatch(); Palette.Swatch mutedLightSwatch = palette.getLightMutedSwatch(); + swatchList.add(prominentSwatch); swatchList.add(vibrantSwatch); swatchList.add(vibrantDarkSwatch); swatchList.add(vibrantLightSwatch); @@ -105,17 +124,10 @@ public static int getClosestAccentColor(@ColorInt int color) { public static int getBestFaviconColor(@Nullable Palette palette) { if (palette != null) { final List sortedSwatch = getSwatchListFromPalette(palette); - // Descending - Collections.sort(sortedSwatch, - (swatch1, swatch2) -> { - int a = swatch1 == null ? 0 : swatch1.getPopulation(); - int b = swatch2 == null ? 0 : swatch2.getPopulation(); - return b - a; - }); // We want the vibrant color but we will avoid it if it is the most prominent one. // Instead we will choose the next prominent color int vibrantColor = palette.getVibrantColor(NO_COLOR); - int prominentColor = sortedSwatch.get(0).getRgb(); + int prominentColor = sortedSwatch.get(0) != null ? sortedSwatch.get(0).getRgb() : NO_COLOR; if (vibrantColor == NO_COLOR) { int darkVibrantColor = palette.getDarkVibrantColor(NO_COLOR); if (darkVibrantColor != NO_COLOR) { diff --git a/app/src/main/java/arun/com/chromer/util/DocumentUtils.java b/app/src/main/java/arun/com/chromer/util/DocumentUtils.java index cbbe9a5e..ed0e8e34 100644 --- a/app/src/main/java/arun/com/chromer/util/DocumentUtils.java +++ b/app/src/main/java/arun/com/chromer/util/DocumentUtils.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.util; import android.annotation.TargetApi; diff --git a/app/src/main/java/arun/com/chromer/util/RxUtils.java b/app/src/main/java/arun/com/chromer/util/RxUtils.java index 20fba141..30d92305 100644 --- a/app/src/main/java/arun/com/chromer/util/RxUtils.java +++ b/app/src/main/java/arun/com/chromer/util/RxUtils.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.util; import rx.Observable; diff --git a/app/src/main/java/arun/com/chromer/util/SafeIntent.java b/app/src/main/java/arun/com/chromer/util/SafeIntent.java index a996e460..f31d4e18 100644 --- a/app/src/main/java/arun/com/chromer/util/SafeIntent.java +++ b/app/src/main/java/arun/com/chromer/util/SafeIntent.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.util; /* diff --git a/app/src/main/java/arun/com/chromer/util/ServiceUtil.java b/app/src/main/java/arun/com/chromer/util/ServiceUtil.java index 2f2c0c16..c146abd1 100644 --- a/app/src/main/java/arun/com/chromer/util/ServiceUtil.java +++ b/app/src/main/java/arun/com/chromer/util/ServiceUtil.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.util; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/util/Utils.java b/app/src/main/java/arun/com/chromer/util/Utils.java index 83b5dac7..be26449c 100644 --- a/app/src/main/java/arun/com/chromer/util/Utils.java +++ b/app/src/main/java/arun/com/chromer/util/Utils.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.util; import android.annotation.SuppressLint; @@ -387,6 +405,7 @@ public static Spanned html(@NonNull Context context, @StringRes int res) { } public static void doAfterLayout(@NonNull final View view, @NonNull final Runnable end) { + view.requestLayout(); final ViewTreeObserver viewTreeObserver = view.getViewTreeObserver(); if (viewTreeObserver.isAlive()) { viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { diff --git a/app/src/main/java/arun/com/chromer/util/cache/DiskCache.java b/app/src/main/java/arun/com/chromer/util/cache/DiskCache.java index e0513510..181617a3 100644 --- a/app/src/main/java/arun/com/chromer/util/cache/DiskCache.java +++ b/app/src/main/java/arun/com/chromer/util/cache/DiskCache.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.util.cache; import java.util.List; diff --git a/app/src/main/java/arun/com/chromer/util/cache/FontCache.java b/app/src/main/java/arun/com/chromer/util/cache/FontCache.java index efa90076..eb4ea349 100644 --- a/app/src/main/java/arun/com/chromer/util/cache/FontCache.java +++ b/app/src/main/java/arun/com/chromer/util/cache/FontCache.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.util.cache; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/util/cache/ParcelDiskCache.java b/app/src/main/java/arun/com/chromer/util/cache/ParcelDiskCache.java index b1f3d5db..288b71a7 100644 --- a/app/src/main/java/arun/com/chromer/util/cache/ParcelDiskCache.java +++ b/app/src/main/java/arun/com/chromer/util/cache/ParcelDiskCache.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.util.cache; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/views/IntentPickerSheetView.java b/app/src/main/java/arun/com/chromer/views/IntentPickerSheetView.java index c20e394e..8957312b 100644 --- a/app/src/main/java/arun/com/chromer/views/IntentPickerSheetView.java +++ b/app/src/main/java/arun/com/chromer/views/IntentPickerSheetView.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.views; diff --git a/app/src/main/java/arun/com/chromer/views/TabView.java b/app/src/main/java/arun/com/chromer/views/TabView.java index 803b3e01..cf04ab2e 100644 --- a/app/src/main/java/arun/com/chromer/views/TabView.java +++ b/app/src/main/java/arun/com/chromer/views/TabView.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.views; import android.animation.Animator; diff --git a/app/src/main/java/arun/com/chromer/views/searchview/MaterialSearchView.java b/app/src/main/java/arun/com/chromer/views/searchview/MaterialSearchView.java index 87981bf1..23adc9a3 100644 --- a/app/src/main/java/arun/com/chromer/views/searchview/MaterialSearchView.java +++ b/app/src/main/java/arun/com/chromer/views/searchview/MaterialSearchView.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.views.searchview; import android.animation.Animator; @@ -85,11 +103,6 @@ public void onVoiceIconClick() { public void onSearchPerformed(@NonNull String url) { // no op } - - @Override - public void onHamburgerClick() { - // no op - } }; private int maxSuggestions = 5; @@ -119,7 +132,7 @@ private void init(Context context) { .color(normalColor) .sizeDp(18); menuIcon = new IconicsDrawable(context) - .icon(CommunityMaterial.Icon.cmd_menu) + .icon(CommunityMaterial.Icon.cmd_magnify) .color(normalColor) .sizeDp(18); addView(LayoutInflater.from(getContext()).inflate(R.layout.widget_material_search_view, this, false)); @@ -171,7 +184,6 @@ public void afterTextChanged(Editable s) { }); menuIconView.setImageDrawable(menuIcon); - menuIconView.setOnClickListener(view -> listener.onHamburgerClick()); voiceIconView.setImageDrawable(voiceIcon); voiceIconView.setOnClickListener(v -> { @@ -383,7 +395,5 @@ public interface SearchViewInteractionListener { void onVoiceIconClick(); void onSearchPerformed(@NonNull String url); - - void onHamburgerClick(); } } diff --git a/app/src/main/java/arun/com/chromer/webheads/OverlayService.java b/app/src/main/java/arun/com/chromer/webheads/OverlayService.java index cdafaf86..b55c1509 100644 --- a/app/src/main/java/arun/com/chromer/webheads/OverlayService.java +++ b/app/src/main/java/arun/com/chromer/webheads/OverlayService.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads; import android.app.Notification; @@ -53,6 +71,7 @@ protected void checkForOverlayPermission() { if (!Utils.isOverlayGranted(this)) { Toast.makeText(this, getString(R.string.web_head_permission_toast), LENGTH_LONG).show(); final Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName())); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); Timber.d("Exited overlay service since overlay permission was revoked"); stopSelf(); diff --git a/app/src/main/java/arun/com/chromer/webheads/WebHeadService.java b/app/src/main/java/arun/com/chromer/webheads/WebHeadService.java index 7d6e29e0..e0ba79b6 100644 --- a/app/src/main/java/arun/com/chromer/webheads/WebHeadService.java +++ b/app/src/main/java/arun/com/chromer/webheads/WebHeadService.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads; import android.animation.Animator; diff --git a/app/src/main/java/arun/com/chromer/webheads/WebHeads.java b/app/src/main/java/arun/com/chromer/webheads/WebHeads.java index 875d1f6d..9b661df5 100644 --- a/app/src/main/java/arun/com/chromer/webheads/WebHeads.java +++ b/app/src/main/java/arun/com/chromer/webheads/WebHeads.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads; import android.app.Notification; diff --git a/app/src/main/java/arun/com/chromer/webheads/helper/ColorExtractionTask.java b/app/src/main/java/arun/com/chromer/webheads/helper/ColorExtractionTask.java index 57287f92..e9da08a2 100644 --- a/app/src/main/java/arun/com/chromer/webheads/helper/ColorExtractionTask.java +++ b/app/src/main/java/arun/com/chromer/webheads/helper/ColorExtractionTask.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.helper; import android.graphics.Bitmap; diff --git a/app/src/main/java/arun/com/chromer/webheads/physics/Coordinate.java b/app/src/main/java/arun/com/chromer/webheads/physics/Coordinate.java index 1ea40c39..99bd9ce7 100644 --- a/app/src/main/java/arun/com/chromer/webheads/physics/Coordinate.java +++ b/app/src/main/java/arun/com/chromer/webheads/physics/Coordinate.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.physics; import android.support.annotation.NonNull; diff --git a/app/src/main/java/arun/com/chromer/webheads/physics/MovementTracker.java b/app/src/main/java/arun/com/chromer/webheads/physics/MovementTracker.java index 486fd543..8b4e38a2 100644 --- a/app/src/main/java/arun/com/chromer/webheads/physics/MovementTracker.java +++ b/app/src/main/java/arun/com/chromer/webheads/physics/MovementTracker.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.physics; import android.support.annotation.NonNull; diff --git a/app/src/main/java/arun/com/chromer/webheads/physics/SpringChain2D.java b/app/src/main/java/arun/com/chromer/webheads/physics/SpringChain2D.java index 3e13da39..dcbb2bca 100644 --- a/app/src/main/java/arun/com/chromer/webheads/physics/SpringChain2D.java +++ b/app/src/main/java/arun/com/chromer/webheads/physics/SpringChain2D.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.physics; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/webheads/physics/SpringConfigs.java b/app/src/main/java/arun/com/chromer/webheads/physics/SpringConfigs.java index 43cc07f6..8dbad740 100644 --- a/app/src/main/java/arun/com/chromer/webheads/physics/SpringConfigs.java +++ b/app/src/main/java/arun/com/chromer/webheads/physics/SpringConfigs.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.physics; import com.facebook.rebound.SpringConfig; diff --git a/app/src/main/java/arun/com/chromer/webheads/ui/ProxyActivity.java b/app/src/main/java/arun/com/chromer/webheads/ui/ProxyActivity.java index e3077587..4fe59a42 100644 --- a/app/src/main/java/arun/com/chromer/webheads/ui/ProxyActivity.java +++ b/app/src/main/java/arun/com/chromer/webheads/ui/ProxyActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.ui; import android.content.Intent; diff --git a/app/src/main/java/arun/com/chromer/webheads/ui/WebHeadContract.java b/app/src/main/java/arun/com/chromer/webheads/ui/WebHeadContract.java index 34344ffe..9b123a53 100644 --- a/app/src/main/java/arun/com/chromer/webheads/ui/WebHeadContract.java +++ b/app/src/main/java/arun/com/chromer/webheads/ui/WebHeadContract.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.ui; import android.support.annotation.NonNull; diff --git a/app/src/main/java/arun/com/chromer/webheads/ui/context/WebHeadContextActivity.java b/app/src/main/java/arun/com/chromer/webheads/ui/context/WebHeadContextActivity.java index 99b55385..cf07b6c3 100644 --- a/app/src/main/java/arun/com/chromer/webheads/ui/context/WebHeadContextActivity.java +++ b/app/src/main/java/arun/com/chromer/webheads/ui/context/WebHeadContextActivity.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.ui.context; import android.content.BroadcastReceiver; diff --git a/app/src/main/java/arun/com/chromer/webheads/ui/context/WebsiteAdapter.java b/app/src/main/java/arun/com/chromer/webheads/ui/context/WebsiteAdapter.java index 6617603c..f9bde7dc 100644 --- a/app/src/main/java/arun/com/chromer/webheads/ui/context/WebsiteAdapter.java +++ b/app/src/main/java/arun/com/chromer/webheads/ui/context/WebsiteAdapter.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.ui.context; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/webheads/ui/views/BaseWebHead.java b/app/src/main/java/arun/com/chromer/webheads/ui/views/BaseWebHead.java index 46b7c30d..5fd05b2b 100644 --- a/app/src/main/java/arun/com/chromer/webheads/ui/views/BaseWebHead.java +++ b/app/src/main/java/arun/com/chromer/webheads/ui/views/BaseWebHead.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.ui.views; import android.animation.Animator; @@ -190,8 +208,6 @@ private void inflateContent(@NonNull Context context) { final int pad = dpToPx(5); badgeView.setPadding(pad, pad, pad, pad); } - requestLayout(); - Utils.doAfterLayout(this, this::setInitialSpawnLocation); } private void initDisplayMetrics() { diff --git a/app/src/main/java/arun/com/chromer/webheads/ui/views/CircleView.java b/app/src/main/java/arun/com/chromer/webheads/ui/views/CircleView.java index 7820afb7..e3cd15ba 100644 --- a/app/src/main/java/arun/com/chromer/webheads/ui/views/CircleView.java +++ b/app/src/main/java/arun/com/chromer/webheads/ui/views/CircleView.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.ui.views; import android.content.Context; diff --git a/app/src/main/java/arun/com/chromer/webheads/ui/views/ElevatedCircleView.java b/app/src/main/java/arun/com/chromer/webheads/ui/views/ElevatedCircleView.java index 03f19e80..9e7b324b 100644 --- a/app/src/main/java/arun/com/chromer/webheads/ui/views/ElevatedCircleView.java +++ b/app/src/main/java/arun/com/chromer/webheads/ui/views/ElevatedCircleView.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.ui.views; import android.annotation.TargetApi; diff --git a/app/src/main/java/arun/com/chromer/webheads/ui/views/RemoveWebHead.java b/app/src/main/java/arun/com/chromer/webheads/ui/views/RemoveWebHead.java index ba28bff3..90000a43 100644 --- a/app/src/main/java/arun/com/chromer/webheads/ui/views/RemoveWebHead.java +++ b/app/src/main/java/arun/com/chromer/webheads/ui/views/RemoveWebHead.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.ui.views; import android.annotation.SuppressLint; diff --git a/app/src/main/java/arun/com/chromer/webheads/ui/views/Trashy.java b/app/src/main/java/arun/com/chromer/webheads/ui/views/Trashy.java index 5a7d1486..20f10740 100644 --- a/app/src/main/java/arun/com/chromer/webheads/ui/views/Trashy.java +++ b/app/src/main/java/arun/com/chromer/webheads/ui/views/Trashy.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.ui.views; import android.annotation.SuppressLint; @@ -91,7 +109,9 @@ private void setInitialLocation() { } private void updateView() { - windowManager.updateViewLayout(this, windowParams); + if (windowParams != null) { + windowManager.updateViewLayout(this, windowParams); + } } public static void init(@NonNull Context context) { diff --git a/app/src/main/java/arun/com/chromer/webheads/ui/views/WebHead.java b/app/src/main/java/arun/com/chromer/webheads/ui/views/WebHead.java index e4e15db6..58680cba 100644 --- a/app/src/main/java/arun/com/chromer/webheads/ui/views/WebHead.java +++ b/app/src/main/java/arun/com/chromer/webheads/ui/views/WebHead.java @@ -1,3 +1,21 @@ +/* + * Chromer + * Copyright (C) 2017 Arunkumar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package arun.com.chromer.webheads.ui.views; import android.animation.Animator; @@ -381,23 +399,22 @@ public void onAnimationEnd(Animator animation) { } public void reveal(@Nullable final Runnable endAction) { - Timber.d("Reveal %s", webSite.url); - animateContentScale(TOUCH_UP_SCALE, endAction); - scaledDown = false; + Utils.doAfterLayout(this, () -> { + setInitialSpawnLocation(); + Timber.d("Reveal %s", webSite.url); + animateContentScale(TOUCH_UP_SCALE, endAction); + scaledDown = false; + }); } private void touchDown() { if (!scaledDown) { - // scaleSpring.setEndValue(TOUCH_DOWN_SCALE); - // animateContentScale(TOUCH_DOWN_SCALE); scaledDown = true; } } private void touchUp() { if (scaledDown) { - // scaleSpring.setEndValue(TOUCH_UP_SCALE); - // animateContentScale(TOUCH_UP_SCALE); scaledDown = false; } } diff --git a/app/src/main/res/anim/launch_task_behind_source.xml b/app/src/main/res/anim/launch_task_behind_source.xml index b33e7c9a..5b770dad 100644 --- a/app/src/main/res/anim/launch_task_behind_source.xml +++ b/app/src/main/res/anim/launch_task_behind_source.xml @@ -1,20 +1,20 @@ + ~ Chromer + ~ Copyright (C) 2017 Arunkumar + ~ + ~ This program is free software: you can redistribute it and/or modify + ~ it under the terms of the GNU General Public License as published by + ~ the Free Software Foundation, either version 3 of the License, or + ~ (at your option) any later version. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ~ GNU General Public License for more details. + ~ + ~ You should have received a copy of the GNU General Public License + ~ along with this program. If not, see . + --> + ~ Chromer + ~ Copyright (C) 2017 Arunkumar + ~ + ~ This program is free software: you can redistribute it and/or modify + ~ it under the terms of the GNU General Public License as published by + ~ the Free Software Foundation, either version 3 of the License, or + ~ (at your option) any later version. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ~ GNU General Public License for more details. + ~ + ~ You should have received a copy of the GNU General Public License + ~ along with this program. If not, see . + --> + + + + + + + + + + + + + + + + . + --> + . + --> + . + --> + . + --> + . + --> + . + --> + + + + diff --git a/app/src/main/res/drawable/ic_home_24dp.xml b/app/src/main/res/drawable/ic_home_24dp.xml new file mode 100644 index 00000000..29ae3e08 --- /dev/null +++ b/app/src/main/res/drawable/ic_home_24dp.xml @@ -0,0 +1,27 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_launch_white_24dp.xml b/app/src/main/res/drawable/ic_launch_white_24dp.xml index 292c7134..1fe8d756 100644 --- a/app/src/main/res/drawable/ic_launch_white_24dp.xml +++ b/app/src/main/res/drawable/ic_launch_white_24dp.xml @@ -1,3 +1,21 @@ + + . + --> + . + --> + . + --> + + + diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index bf3a7a5e..74772688 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -1,4 +1,21 @@ - + + + + + + . + --> + + + + + . + --> + + + + + + + + + - - - - - - + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> diff --git a/app/src/main/res/layout/activity_history_list_item_template.xml b/app/src/main/res/layout/activity_history_list_item_template.xml index 0aa9c7f3..e6fab3cd 100644 --- a/app/src/main/res/layout/activity_history_list_item_template.xml +++ b/app/src/main/res/layout/activity_history_list_item_template.xml @@ -1,4 +1,21 @@ - + + + + + + + + - - - - - - - + android:layout_height="?attr/actionBarSize" + app:layout_collapseMode="pin" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> - - - - - - - + android:layout_height="0dp" + android:layout_weight="1" /> - - - - - - - - - - - - - - - - - + + diff --git a/app/src/main/res/layout/activity_main_recents_item_template.xml b/app/src/main/res/layout/activity_main_recents_item_template.xml index 627663c0..cf034fe3 100644 --- a/app/src/main/res/layout/activity_main_recents_item_template.xml +++ b/app/src/main/res/layout/activity_main_recents_item_template.xml @@ -1,4 +1,21 @@ - + + + + + + + + + + + + + app:cardUseCompatPadding="true" + app:contentPaddingBottom="8dp" + app:contentPaddingTop="8dp"> . + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml new file mode 100644 index 00000000..fff9af15 --- /dev/null +++ b/app/src/main/res/layout/fragment_home.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_options.xml b/app/src/main/res/layout/fragment_options.xml index 6272a675..c89dc809 100644 --- a/app/src/main/res/layout/fragment_options.xml +++ b/app/src/main/res/layout/fragment_options.xml @@ -1,4 +1,21 @@ - + + + + + + + + + + + + + + + + . + --> + + + + + + + diff --git a/app/src/main/res/layout/widget_suggestions_item_template.xml b/app/src/main/res/layout/widget_suggestions_item_template.xml index bef396ed..23e983e2 100644 --- a/app/src/main/res/layout/widget_suggestions_item_template.xml +++ b/app/src/main/res/layout/widget_suggestions_item_template.xml @@ -1,4 +1,21 @@ - + + + + + + + + + + + + diff --git a/app/src/main/res/menu/bottom_menu.xml b/app/src/main/res/menu/bottom_menu.xml new file mode 100644 index 00000000..fae52379 --- /dev/null +++ b/app/src/main/res/menu/bottom_menu.xml @@ -0,0 +1,28 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/home_menu.xml b/app/src/main/res/menu/home_menu.xml index 19e0927e..6bf4412f 100644 --- a/app/src/main/res/menu/home_menu.xml +++ b/app/src/main/res/menu/home_menu.xml @@ -1,4 +1,21 @@ - + + + + "Žádná " diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 89c68176..5681a377 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -1,4 +1,21 @@ - + + Keine diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 8fca0316..1d2b1dc5 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -1,4 +1,21 @@ - + + Κανένα diff --git a/app/src/main/res/values-es-rUS/strings.xml b/app/src/main/res/values-es-rUS/strings.xml index 930a013b..d8c08616 100644 --- a/app/src/main/res/values-es-rUS/strings.xml +++ b/app/src/main/res/values-es-rUS/strings.xml @@ -1,4 +1,21 @@ - + + Ninguno diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 4e362539..54b3c4e8 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1,4 +1,21 @@ - + + Aucun diff --git a/app/src/main/res/values-hi-rIN/strings.xml b/app/src/main/res/values-hi-rIN/strings.xml index 8070b276..fbee5e85 100644 --- a/app/src/main/res/values-hi-rIN/strings.xml +++ b/app/src/main/res/values-hi-rIN/strings.xml @@ -1,4 +1,21 @@ - + + कुछ नहीं diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index de96e9f2..64b9c8be 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -1,4 +1,21 @@ - + + Nijedna diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 1c90f2ab..0101731e 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -1,4 +1,21 @@ - + + Nessuno diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index bfa64fd6..915cb03a 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -1,4 +1,21 @@ - + + なし diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 4a84850a..31b0cdfe 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -1,4 +1,21 @@ - + + Geen diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 13f3b75e..11a0709b 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -1,4 +1,21 @@ - + + Nenhum diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index ffaebc77..c763c2bd 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -1,4 +1,21 @@ - + + Ничего diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 1472ab0c..bd5ea4bb 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -1,4 +1,21 @@ - + + Žiadna diff --git a/app/src/main/res/values-sw700dp/dimens.xml b/app/src/main/res/values-sw700dp/dimens.xml index 926a3dd8..960ceaea 100644 --- a/app/src/main/res/values-sw700dp/dimens.xml +++ b/app/src/main/res/values-sw700dp/dimens.xml @@ -1,4 +1,21 @@ - + + 128dp 123dp diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 6857c685..74ae6f62 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -1,4 +1,21 @@ - + + Hiçbiri diff --git a/app/src/main/res/values-v21/dimens.xml b/app/src/main/res/values-v21/dimens.xml index 40b536c6..34d0cc96 100644 --- a/app/src/main/res/values-v21/dimens.xml +++ b/app/src/main/res/values-v21/dimens.xml @@ -1,4 +1,21 @@ - + + 66dp 76dp diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml index 7852d850..62b00c86 100644 --- a/app/src/main/res/values-v21/styles.xml +++ b/app/src/main/res/values-v21/styles.xml @@ -1,3 +1,21 @@ + +