Skip to content
This repository has been archived by the owner on Jan 10, 2019. It is now read-only.

Commit

Permalink
Merge branch 'release/3.0.17'
Browse files Browse the repository at this point in the history
  • Loading branch information
fgei committed May 4, 2017
2 parents bee9a68 + 8f9f4f5 commit 387925a
Show file tree
Hide file tree
Showing 19 changed files with 461 additions and 649 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.duckduckgo.mobile.android"
android:installLocation="auto"
android:versionCode="78"
android:versionName="3.0.16">
android:versionCode="79"
android:versionName="3.0.17">

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
2 changes: 1 addition & 1 deletion src/com/duckduckgo/mobile/android/activity/DuckDuckGo.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public void onBackStackChanged() {
DDGActionBarManager.getInstance().updateActionBar(fragmentManager, tag, backPressed);
backPressed = false;
}
Log.e(TAG, "Fragment Back Stack current tag: " + DDGControlVar.mDuckDuckGoContainer.currentFragmentTag);
Log.d(TAG, "Fragment Back Stack current tag: " + DDGControlVar.mDuckDuckGoContainer.currentFragmentTag);
showAllFragments();
}
}
Expand Down
23 changes: 4 additions & 19 deletions src/com/duckduckgo/mobile/android/activity/OnboardingActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
import android.graphics.Point;
import android.os.Build;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.transition.Fade;
import android.transition.TransitionManager;
import android.view.Display;
import android.view.View;
import android.view.ViewTreeObserver;
Expand All @@ -20,17 +17,11 @@
import android.widget.LinearLayout;

import com.duckduckgo.mobile.android.R;
import com.duckduckgo.mobile.android.adapters.OnboardingAdapter;
import com.duckduckgo.mobile.android.adapters.OnboardingPageAdapter;
import com.duckduckgo.mobile.android.dialogs.InstructionDialogFragment;
import com.duckduckgo.mobile.android.fragment.onboarding.EndOnboardingFragment;
import com.duckduckgo.mobile.android.fragment.onboarding.NoAdsFragment;
import com.duckduckgo.mobile.android.fragment.onboarding.NoTrackingFragment;
import com.duckduckgo.mobile.android.fragment.onboarding.PrivacyFragment;
import com.duckduckgo.mobile.android.fragment.onboarding.RightFragment;
import com.duckduckgo.mobile.android.util.CompatUtils;
import com.duckduckgo.mobile.android.util.OnboardingHelper;
import com.duckduckgo.mobile.android.util.OnboardingTransformer;
import com.duckduckgo.mobile.android.util.PreferencesManager;
import com.duckduckgo.mobile.android.views.pageindicator.OnboardingPageIndicator;

import java.util.Arrays;
Expand All @@ -44,7 +35,7 @@ public static Intent getStartIntent(Context context) {
private FrameLayout activityContainer;
private LinearLayout containerLayout;
private ViewPager viewPager;
private FragmentPagerAdapter adapter;
private OnboardingPageAdapter adapter;
private OnboardingPageIndicator pageIndicator;
private Button addToHomeScreenButton;

Expand Down Expand Up @@ -94,7 +85,7 @@ public void onClick(View v) {
}
});

adapter = new OnboardingAdapter(getSupportFragmentManager());
adapter = new OnboardingPageAdapter(this, getSupportFragmentManager());

viewPager = (ViewPager) findViewById(R.id.view_pager);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
Expand All @@ -115,16 +106,10 @@ public void onPageScrollStateChanged(int state) {
});
viewPager.setAdapter(adapter);

int[] backgroundColors = new int[] {
ContextCompat.getColor(this, PrivacyFragment.BACKGROUND_COLOR),
ContextCompat.getColor(this, NoAdsFragment.BACKGROUND_COLOR),
ContextCompat.getColor(this, NoTrackingFragment.BACKGROUND_COLOR),
ContextCompat.getColor(this, RightFragment.BACKGROUND_COLOR),
ContextCompat.getColor(this, EndOnboardingFragment.BACKGROUND_COLOR)};
pageIndicator = (OnboardingPageIndicator) findViewById(R.id.page_indicator);
pageIndicator.setViewPager(viewPager, adapter.getCount() - 1);

viewPager.setPageTransformer(false, new OnboardingTransformer(backgroundColors, pageIndicator, Arrays.asList(pageIndicator, addToHomeScreenButton)));
viewPager.setPageTransformer(false, new OnboardingTransformer(adapter, pageIndicator, Arrays.asList(pageIndicator, addToHomeScreenButton)));

Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
Expand Down

This file was deleted.

62 changes: 0 additions & 62 deletions src/com/duckduckgo/mobile/android/adapters/OnboardingAdapter.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.duckduckgo.mobile.android.adapters;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.duckduckgo.mobile.android.R;
import com.duckduckgo.mobile.android.util.OnboardingPageConfiguration;

/**
* Created by fgei on 4/11/17.
*/

public class OnboardingBannerAdapter extends PagerAdapter {

private final OnboardingPageConfiguration[] items;

public OnboardingBannerAdapter() {
items = new OnboardingPageConfiguration[] {
OnboardingPageConfiguration.getPrivacy(),
OnboardingPageConfiguration.getNoAds(),
OnboardingPageConfiguration.getNoTracking(),
OnboardingPageConfiguration.getRight()
};
}

@Override
public Object instantiateItem(ViewGroup container, int position) {
OnboardingPageConfiguration onboardingPageConfiguration = getItem(position);
LayoutInflater inflater = LayoutInflater.from(container.getContext());
ViewGroup root = (ViewGroup) inflater.inflate(R.layout.viewholder_onboarding, container, false);
populate(root, onboardingPageConfiguration);
container.addView(root);
return root;
}

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}

@Override
public boolean isViewFromObject(View view, Object o) {
return view == o;
}

@Override
public int getCount() {
return items.length;
}

public OnboardingPageConfiguration getItem(int position) {
return items[position];
}

private void populate(View rootView, OnboardingPageConfiguration onboardingPageConfiguration) {
Context context = rootView.getContext();
TextView titleTextView = (TextView) rootView.findViewById(R.id.title_text_view);
String title = context.getString(onboardingPageConfiguration.title).replaceAll("\\n", " ");
titleTextView.setText(title);
TextView subtitleTextView = (TextView) rootView.findViewById(R.id.subtitle_text_view);
String subtitle = context.getString(onboardingPageConfiguration.subtitle).replaceAll("\\n", " ");
subtitleTextView.setText(subtitle);
ImageView iconImageView = (ImageView) rootView.findViewById(R.id.icon_image_view);
iconImageView.setImageResource(onboardingPageConfiguration.icon);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.duckduckgo.mobile.android.adapters;

import android.content.Context;
import android.support.annotation.ColorInt;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.content.ContextCompat;

import com.duckduckgo.mobile.android.fragment.OnboardingPageFragment;
import com.duckduckgo.mobile.android.util.OnboardingPageConfiguration;

/**
* Created by fgei on 4/4/17.
*/

public class OnboardingPageAdapter extends FragmentPagerAdapter {

private final OnboardingPageConfiguration[] items;
private Context context;

public OnboardingPageAdapter(Context context, FragmentManager fm) {
super(fm);
this.context = context;
items = new OnboardingPageConfiguration[] {
OnboardingPageConfiguration.getPrivacy(),
OnboardingPageConfiguration.getNoAds(),
OnboardingPageConfiguration.getNoTracking(),
OnboardingPageConfiguration.getRight(),
OnboardingPageConfiguration.getFadeOnboarding()
};
}

@Override
public Fragment getItem(int position) {
OnboardingPageConfiguration onboardingPageConfiguration = items[position];
return OnboardingPageFragment.newInstance(onboardingPageConfiguration, position);
}

@Override
public int getCount() {
return items.length;
}

@ColorInt
public int getBackgroundColor(int position) {
return ContextCompat.getColor(context, items[position].backgroundColor);
}
}
Loading

0 comments on commit 387925a

Please sign in to comment.