Skip to content

Commit

Permalink
Merge pull request #16 from arch10/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
arch10 authored Feb 8, 2019
2 parents 7ccb575 + bd3a1cc commit 1b45088
Show file tree
Hide file tree
Showing 24 changed files with 1,464 additions and 963 deletions.
6 changes: 3 additions & 3 deletions .idea/assetWizardSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.gigaworks.tech.calculator"
minSdkVersion 21
targetSdkVersion 27
versionCode 18
versionName "1.7.2"
versionCode 21
versionName "1.8.2"
buildConfigField "java.util.Date", "buildTime", "new java.util.Date(" + System.currentTimeMillis() + "L)"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand All @@ -23,7 +23,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.6'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ protected void onCreate(Bundle savedInstanceState) {
color = a.getColor(0, 0);
if(themeName.equals("default") || themeName.equals(""))
color = getResources().getColor(R.color.colorMaterialSteelGrey);

if(themeName.equals("material"))
color = getResources().getColor(R.color.colorMaterialDarkBlue);

//setting toolbar style manually
//setToolBarStyle(preferences.getStringPreference(AppPreferences.APP_THEME));
toolbar.setTitleTextColor(getResources().getColor(R.color.colorWhite));
toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
toolbar.setBackgroundColor(color);
Expand Down Expand Up @@ -117,27 +117,19 @@ private void setTheme(String themeName) {

setTheme(R.style.PurpleAppTheme);

} else if (themeName.equals("material")) {

setTheme(R.style.Material2);

} else if (themeName.equals("default")) {

setTheme(R.style.DefAppTheme);

} else if (themeName.equals("")) {

setTheme(R.style.DefAppTheme);
preferences.setStringPreference(AppPreferences.APP_THEME, "default");

}
}
setTheme(R.style.Material2);
preferences.setStringPreference(AppPreferences.APP_THEME, "material");

private int getThemeColor(String themeName) {
switch (themeName){
case "green": return getResources().getColor(R.color.colorGreenPrimary);
case "orange": return getResources().getColor(R.color.colorPrimary);
case "blue": return getResources().getColor(R.color.colorBluePrimary);
case "lgreen": return getResources().getColor(R.color.colorLightGreenPrimary);
case "pink": return getResources().getColor(R.color.colorPinkPrimary);
case "default": return getResources().getColor(R.color.colorMaterialSteelGrey);
default: return getResources().getColor(R.color.colorMaterialSteelGrey);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class AppPreferences {
final static String APP_EQUATION_STRING = "app.equation.string";
final static String APP_NUMBER_FORMATTER = "app.number.formatter";
final static String APP_SMART_CALCULATIONS = "app.smart.calculations";
final static String APP_HISTORY_SET = "app.is.history.set";
final static String APP_HISTORY_EQUATION = "app.history.equation";

public AppPreferences(Context context) {
ctx = context;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
package com.example.arch1.testapplication;

/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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.
*/

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

public class CalculatorPadViewPager extends ViewPager {

private final PagerAdapter mStaticPagerAdapter = new PagerAdapter() {
@Override
public int getCount() {
return getChildCount();
}

@Override
public Object instantiateItem(ViewGroup container, int position) {
return getChildAt(position);
}

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

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

@Override
public float getPageWidth(int position) {
return position == 1 ? 7.0f / 9.0f : 1.0f;
}
};

private final OnPageChangeListener mOnPageChangeListener = new SimpleOnPageChangeListener() {
private void recursivelySetEnabled(View view, boolean enabled) {
if (view instanceof ViewGroup) {
final ViewGroup viewGroup = (ViewGroup) view;
for (int childIndex = 0; childIndex < viewGroup.getChildCount(); ++childIndex) {
recursivelySetEnabled(viewGroup.getChildAt(childIndex), enabled);
}
} else {
view.setEnabled(enabled);
}
}

@Override
public void onPageSelected(int position) {
if (getAdapter() == mStaticPagerAdapter) {
for (int childIndex = 0; childIndex < getChildCount(); ++childIndex) {
// Only enable subviews of the current page.
recursivelySetEnabled(getChildAt(childIndex), childIndex == position);
}
}
}
};

private final PageTransformer mPageTransformer = new PageTransformer() {
@Override
public void transformPage(View view, float position) {
if (position < 0.0f) {
// Pin the left page to the left side.
view.setTranslationX(getWidth() * -position);
view.setAlpha(Math.max(1.0f + position, 0.0f));
} else {
// Use the default slide transition when moving to the next page.
view.setTranslationX(0.0f);
view.setAlpha(1.0f);
}
}
};

public CalculatorPadViewPager(Context context) {
this(context, null);
}

public CalculatorPadViewPager(Context context, AttributeSet attrs) {
super(context, attrs);

setAdapter(mStaticPagerAdapter);
//setBackgroundColor(getResources().getColor(android.R.color.black));
setOnPageChangeListener(mOnPageChangeListener);
setPageMargin(getResources().getDimensionPixelSize(R.dimen.pad_page_margin));
setPageTransformer(false, mPageTransformer);
}

@Override
protected void onFinishInflate() {
super.onFinishInflate();

// Invalidate the adapter's data set since children may have been added during inflation.
if (getAdapter() == mStaticPagerAdapter) {
mStaticPagerAdapter.notifyDataSetChanged();
}
}
}
Loading

0 comments on commit 1b45088

Please sign in to comment.