Skip to content

Commit

Permalink
Merge pull request #27 from b-lam/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
b-lam authored May 25, 2017
2 parents 3be487d + 43b96b8 commit 9ff46c0
Show file tree
Hide file tree
Showing 26 changed files with 430 additions and 34 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.b_lam.resplash"
minSdkVersion 21
targetSdkVersion 25
versionCode 9
versionName "1.0.8"
versionCode 10
versionName "1.0.9"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildConfigField("String", "RELEASE_APP_ID", RELEASE_APP_ID)
buildConfigField("String", "RELEASE_SECRET", RELEASE_SECRET)
Expand Down
Binary file added app/resplash-1.0.9.apk
Binary file not shown.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<activity
android:name=".activities.SettingsActivity"
android:label="Settings"
android:configChanges="locale"
android:parentActivityName=".activities.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/com/b_lam/resplash/Resplash.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
Expand All @@ -16,9 +19,11 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import com.b_lam.resplash.BuildConfig;
import com.b_lam.resplash.data.tools.CustomApiManager;
import com.b_lam.resplash.util.LocaleUtils;

/**
* Created by Brandon on 10/6/2016.
Expand Down Expand Up @@ -142,6 +147,7 @@ public static String getLoginUrl(Context c){
private void initialize() {
instance = this;
activityList = new ArrayList<>();
LocaleUtils.loadLocale(this);
}

/** <br> data. */
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/b_lam/resplash/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.preference.PreferenceManager;
import android.view.View;

import com.b_lam.resplash.R;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.widget.TextView;

import com.b_lam.resplash.Resplash;
import com.b_lam.resplash.util.LocaleUtils;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.mikepenz.iconics.context.IconicsLayoutInflater;

Expand All @@ -35,6 +36,9 @@ public class AboutActivity extends AppCompatActivity implements View.OnClickList
protected void onCreate(Bundle savedInstanceState) {
LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
super.onCreate(savedInstanceState);

LocaleUtils.loadLocale(this);

setContentView(R.layout.activity_about);

ButterKnife.bind(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.b_lam.resplash.data.data.Collection;
import com.b_lam.resplash.data.data.Photo;
import com.b_lam.resplash.data.service.PhotoService;
import com.b_lam.resplash.util.LocaleUtils;
import com.bumptech.glide.Glide;
import com.google.gson.Gson;
import com.mikepenz.fastadapter.FastAdapter;
Expand Down Expand Up @@ -76,6 +77,9 @@ public class CollectionDetailActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LocaleUtils.loadLocale(this);

setContentView(R.layout.activity_collection_detail);

ButterKnife.bind(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.b_lam.resplash.R;
import com.b_lam.resplash.Resplash;
import com.b_lam.resplash.data.tools.CustomApiManager;
import com.b_lam.resplash.util.LocaleUtils;
import com.mikepenz.iconics.context.IconicsLayoutInflater;

import butterknife.BindView;
Expand All @@ -30,6 +31,9 @@ public class CustomApiKeyActivity extends AppCompatActivity implements View.OnCl
protected void onCreate(Bundle savedInstanceState) {
LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
super.onCreate(savedInstanceState);

LocaleUtils.loadLocale(this);

setContentView(R.layout.activity_custom_api_key);

ButterKnife.bind(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com.b_lam.resplash.dialogs.InfoDialog;
import com.b_lam.resplash.dialogs.StatsDialog;
import com.b_lam.resplash.network.ImageDownloader;
import com.b_lam.resplash.util.LocaleUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
Expand Down Expand Up @@ -108,6 +109,9 @@ public class DetailActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LocaleUtils.loadLocale(this);

setContentView(R.layout.activity_detail);

ButterKnife.bind(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import com.b_lam.resplash.R;
import com.b_lam.resplash.Resplash;
import com.b_lam.resplash.util.LocaleUtils;
import com.b_lam.resplash.util.billing.IabBroadcastReceiver;
import com.b_lam.resplash.util.billing.IabHelper;
import com.b_lam.resplash.util.billing.IabResult;
Expand Down Expand Up @@ -59,6 +60,9 @@ public class DonateActivity extends AppCompatActivity implements View.OnClickLis
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LocaleUtils.loadLocale(this);

setContentView(R.layout.activity_donate);

ButterKnife.bind(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.b_lam.resplash.data.data.Me;
import com.b_lam.resplash.data.service.UserService;
import com.b_lam.resplash.data.tools.AuthManager;
import com.b_lam.resplash.util.LocaleUtils;
import com.mikepenz.iconics.context.IconicsLayoutInflater;

import butterknife.BindView;
Expand Down Expand Up @@ -55,6 +56,9 @@ public class EditProfileActivity extends AppCompatActivity implements UserServic
protected void onCreate(Bundle savedInstanceState) {
LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
super.onCreate(savedInstanceState);

LocaleUtils.loadLocale(this);

setContentView(R.layout.activity_edit_profile);

ButterKnife.bind(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import com.b_lam.resplash.util.LocaleUtils;
import com.pixelcan.inkpageindicator.InkPageIndicator;

import butterknife.BindView;
Expand All @@ -32,6 +33,9 @@ public class IntroActivity extends AppCompatActivity implements View.OnClickList
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LocaleUtils.loadLocale(this);

setContentView(R.layout.activity_intro);

ButterKnife.bind(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import butterknife.BindView;
import butterknife.ButterKnife;
import com.b_lam.resplash.R;
import com.b_lam.resplash.util.LocaleUtils;
import com.google.firebase.analytics.FirebaseAnalytics;

import retrofit2.Call;
Expand All @@ -39,6 +40,9 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LocaleUtils.loadLocale(this);

setContentView(R.layout.activity_login);

ButterKnife.bind(this);
Expand Down
20 changes: 13 additions & 7 deletions app/src/main/java/com/b_lam/resplash/activities/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.b_lam.resplash.fragments.CollectionFragment;
import com.b_lam.resplash.fragments.FeaturedFragment;
import com.b_lam.resplash.fragments.NewFragment;
import com.b_lam.resplash.util.LocaleUtils;
import com.bumptech.glide.Glide;
import com.mikepenz.community_material_typeface_library.CommunityMaterial;
import com.mikepenz.iconics.IconicsDrawable;
Expand Down Expand Up @@ -75,12 +76,15 @@ public class MainActivity extends AppCompatActivity implements AuthManager.OnAut
private AccountHeader drawerHeader = null;
private ProfileSettingDrawerItem drawerItemAddAccount, drawerItemViewProfile, drawerItemManageAccount, drawerItemLogout;
private IProfile profile;
private final IProfile profileDefault = new ProfileDrawerItem().withName("Resplash").withEmail("Free high-resolution photos").withIcon(R.drawable.intro_icon_image);
private IProfile profileDefault;
private MenuItem mItemFeaturedLatest, mItemFeaturedOldest, mItemFeaturedPopular, mItemNewLatest, mItemNewOldest, mItemNewPopular, mItemAll, mItemCurated, mItemFeatured;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LocaleUtils.loadLocale(this);

setContentView(R.layout.activity_main);

ButterKnife.bind(this);
Expand Down Expand Up @@ -109,6 +113,8 @@ public void run() {

isStoragePermissionGranted();

profileDefault = new ProfileDrawerItem().withName("Resplash").withEmail(getString(R.string.main_unsplash_description)).withIcon(R.drawable.intro_icon_image);

DrawerImageLoader.init(new AbstractDrawerImageLoader() {
@Override
public void set(ImageView imageView, Uri uri, Drawable placeholder) {
Expand Down Expand Up @@ -159,9 +165,9 @@ public Drawable placeholder(Context ctx, String tag) {
.withDelayDrawerClickEvent(200)
.withAccountHeader(drawerHeader)
.addDrawerItems(
new PrimaryDrawerItem().withName(getString(R.string.main_featured)).withIdentifier(1).withIcon(getDrawable(R.drawable.ic_whatshot_black_24dp)),
new PrimaryDrawerItem().withName(getString(R.string.main_new)).withIdentifier(2).withIcon(getDrawable(R.drawable.ic_trending_up_black_24dp)),
new PrimaryDrawerItem().withName(getString(R.string.main_collections)).withIdentifier(3).withIcon(getDrawable(R.drawable.ic_collections_black_24dp)),
new PrimaryDrawerItem().withName(getString(R.string.main_featured)).withIdentifier(1).withIcon(getDrawable(R.drawable.ic_whatshot_black_24dp)).withSelectedTextColorRes(R.color.md_black_1000),
new PrimaryDrawerItem().withName(getString(R.string.main_new)).withIdentifier(2).withIcon(getDrawable(R.drawable.ic_trending_up_black_24dp)).withSelectedTextColorRes(R.color.md_black_1000),
new PrimaryDrawerItem().withName(getString(R.string.main_collections)).withIdentifier(3).withIcon(getDrawable(R.drawable.ic_collections_black_24dp)).withSelectedTextColorRes(R.color.md_black_1000),
new DividerDrawerItem(),
new PrimaryDrawerItem().withName(getString(R.string.main_support_development)).withIdentifier(4).withIcon(new IconicsDrawable(this).icon(CommunityMaterial.Icon.cmd_heart).sizeDp(24).paddingDp(2)).withSelectable(false),
new PrimaryDrawerItem().withName(getString(R.string.main_settings)).withIdentifier(5).withIcon(getDrawable(R.drawable.ic_settings_black_24dp)).withSelectable(false),
Expand All @@ -173,9 +179,9 @@ public Drawable placeholder(Context ctx, String tag) {
drawer.getRecyclerView().setVerticalScrollBarEnabled(false);

PagerAdapter mPagerAdapter = new PagerAdapter(getSupportFragmentManager());
mPagerAdapter.addFragment(FeaturedFragment.newInstance("latest"), "Featured");
mPagerAdapter.addFragment(NewFragment.newInstance("latest"), "New");
mPagerAdapter.addFragment(CollectionFragment.newInstance("Featured"), "Collections");
mPagerAdapter.addFragment(FeaturedFragment.newInstance("latest"), getString(R.string.main_featured));
mPagerAdapter.addFragment(NewFragment.newInstance("latest"), getString(R.string.main_new));
mPagerAdapter.addFragment(CollectionFragment.newInstance("Featured"), getString(R.string.main_collections));
mViewPager.setAdapter(mPagerAdapter);
mViewPager.setOffscreenPageLimit(2);

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

import com.b_lam.resplash.Resplash;
import com.b_lam.resplash.data.data.Photo;
import com.b_lam.resplash.util.LocaleUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
Expand All @@ -30,6 +31,9 @@ public class PreviewActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LocaleUtils.loadLocale(this);

setTheme(R.style.PreviewTheme);
setContentView(R.layout.activity_preview);
ButterKnife.bind(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import butterknife.BindView;
import butterknife.ButterKnife;
import com.b_lam.resplash.R;
import com.b_lam.resplash.util.LocaleUtils;

public class SearchActivity extends AppCompatActivity implements EditText.OnEditorActionListener{

Expand All @@ -49,6 +50,9 @@ public class SearchActivity extends AppCompatActivity implements EditText.OnEdit
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LocaleUtils.loadLocale(this);

setContentView(R.layout.activity_search);

ButterKnife.bind(this);
Expand All @@ -61,9 +65,9 @@ protected void onCreate(Bundle savedInstanceState) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

PagerAdapter mPagerAdapter = new PagerAdapter(getSupportFragmentManager());
mPagerAdapter.addFragment(SearchPhotoFragment.newInstance(null), "Photos");
mPagerAdapter.addFragment(SearchCollectionFragment.newInstance(null), "Collections");
mPagerAdapter.addFragment(SearchUserFragment.newInstance(null), "Users");
mPagerAdapter.addFragment(SearchPhotoFragment.newInstance(null), getString(R.string.search_photos));
mPagerAdapter.addFragment(SearchCollectionFragment.newInstance(null), getString(R.string.search_collections));
mPagerAdapter.addFragment(SearchUserFragment.newInstance(null), getString(R.string.search_users));
mViewPager.setAdapter(mPagerAdapter);
mViewPager.setOffscreenPageLimit(2);
mTabLayout.setupWithViewPager(mViewPager);
Expand Down
Loading

0 comments on commit 9ff46c0

Please sign in to comment.