Skip to content

Commit

Permalink
Merge branch 'abhayst007' of https://github.com/abhayst007/Androapps
Browse files Browse the repository at this point in the history
…into abhayst007
  • Loading branch information
abhayst007 committed Oct 15, 2022
2 parents f229c4e + b9c2e51 commit 1034860
Show file tree
Hide file tree
Showing 189 changed files with 5,572 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import java.util.HashSet;
import java.util.Set;
Expand All @@ -23,11 +28,12 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().hide();
data=findViewById(R.id.data);
output=findViewById(R.id.output);
oset.add('+'); oset.add('-'); oset.add('*'); oset.add('/'); oset.add('%');
data.setMovementMethod(new ScrollingMovementMethod());
}

public void numberEvent(View view) {
if(data.getText().toString().equals("0"))
data.setText("");
Expand Down Expand Up @@ -166,14 +172,23 @@ public static Double applyOp(char op, Double b, Double a) {
}

public void equalEvent(View view) {
String newNumber=data.getText().toString();
double result=0.0;
result = Double.parseDouble(String.valueOf(evaluate(newNumber)));
output.setText(result+"");
try {
String newNumber=data.getText().toString();
double result=0.0;
result = Double.parseDouble(String.valueOf(evaluate(newNumber)));
if((int)result==result){
output.setText((int)result+"");
}else{
output.setText(result+"");
}
}catch (Exception e){
Toast.makeText(this, "Invalid Operation!!", Toast.LENGTH_SHORT).show();
}
}

public void clearEvent(View view) {
data.setText("0");
output.setText("0");
newOp= true;
}

Expand All @@ -193,4 +208,14 @@ public void percentEvent(View view) {
data.setText(curr);
newOp=true;
}

public void backspaceEvent(View view) {
String number= data.getText().toString();
if(number.length()>0){
number=number.substring(0,number.length()-1);
}
data.setText(number);
if(number.equals(""))
data.setText("0");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M22,3L7,3c-0.69,0 -1.23,0.35 -1.59,0.88L0,12l5.41,8.11c0.36,0.53 0.9,0.89 1.59,0.89h15c1.1,0 2,-0.9 2,-2L24,5c0,-1.1 -0.9,-2 -2,-2zM19,15.59L17.59,17 14,13.41 10.41,17 9,15.59 12.59,12 9,8.41 10.41,7 14,10.59 17.59,7 19,8.41 15.41,12 19,15.59z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#573f3f">
<item>
<shape android:shape="oval">
<solid android:color="#1D1D1D"/>
<size
android:width="48dp"
android:height="40dp"/>
</shape>
</item>
</ripple>
63 changes: 45 additions & 18 deletions Calculator App/Calculator/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#1D1D1D"
tools:context=".MainActivity">

<LinearLayout
Expand All @@ -13,30 +14,22 @@
android:weightSum="2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/linearLayout">

<TextView
android:id="@+id/data"
android:layout_width="match_parent"
android:layout_height="124dp"
android:layout_weight="1"
android:background="#1D1D1D"
android:gravity="end|bottom"
android:text="@string/zero"
android:textColor="@color/colorWhite"
android:textSize="40sp" />

<TextView
android:id="@+id/output"
android:layout_width="match_parent"
android:layout_height="292dp"
android:layout_weight="1"
android:layout_height="0dp"
android:minHeight="128dp"
android:layout_weight="2"
android:scrollbars = "vertical"
android:background="#1D1D1D"
android:gravity="end|center"
android:text="@string/zero"
android:paddingHorizontal="15dp"
android:textColor="@color/colorWhite"
android:textSize="40sp" />

</LinearLayout>

<LinearLayout
Expand All @@ -48,6 +41,40 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">

<TextView
android:id="@+id/output"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginVertical="20dp"
android:layout_weight="1"
android:background="#1D1D1D"
android:gravity="end"
android:paddingHorizontal="15dp"
android:text="@string/zero"
android:textColor="@color/colorWhite"
android:textSize="40sp" />


<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="30dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal">

<ImageView
android:id="@+id/backspace"
android:layout_width="0dp"
android:layout_height="44dp"
android:padding="10dp"
android:background="@drawable/ripple_effect_backspace"
android:clickable="true"
android:layout_weight="1"
android:src="@drawable/ic_backspace"
android:onClick="backspaceEvent"/>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -58,7 +85,7 @@
android:layout_width="0dp"
android:layout_height="80dp"
android:layout_weight="1"
android:background="@drawable/ripple_effect_numbers"
android:background="@drawable/ripple_effect_operations"
android:text="@string/add_subtract"
android:textColor="@color/colorWhite"
android:textSize="30sp"
Expand All @@ -69,7 +96,7 @@
android:layout_width="0dp"
android:layout_height="80dp"
android:layout_weight="1"
android:background="@drawable/ripple_effect_numbers"
android:background="@drawable/ripple_effect_operations"
android:text="@string/parenthesis"
android:textColor="@color/colorWhite"
android:textSize="30sp"
Expand All @@ -80,7 +107,7 @@
android:layout_width="0dp"
android:layout_height="80dp"
android:layout_weight="1"
android:background="@drawable/ripple_effect_numbers"
android:background="@drawable/ripple_effect_operations"
android:text="@string/modulus"
android:textColor="@color/colorWhite"
android:textSize="30sp"
Expand Down
4 changes: 2 additions & 2 deletions Calculator App/Calculator/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorPrimary">#808080</color>
<color name="colorPrimaryDark">#808080</color>
<color name="colorAccent">#03DAC5</color>
<color name="colorBlack">#000000</color>
<color name="colorWhite">#ffffff</color>
Expand Down
Binary file added Image2Text/2nd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image2Text/3rd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image2Text/4th.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image2Text/5th.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image2Text/6th.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions Image2Text/Image2Text/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
3 changes: 3 additions & 0 deletions Image2Text/Image2Text/.idea/.gitignore

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

6 changes: 6 additions & 0 deletions Image2Text/Image2Text/.idea/compiler.xml

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

19 changes: 19 additions & 0 deletions Image2Text/Image2Text/.idea/gradle.xml

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

18 changes: 18 additions & 0 deletions Image2Text/Image2Text/.idea/misc.xml

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

1 change: 1 addition & 0 deletions Image2Text/Image2Text/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
46 changes: 46 additions & 0 deletions Image2Text/Image2Text/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
plugins {
id 'com.android.application'
}

android {
compileSdk 32

defaultConfig {
applicationId "com.rahulsoni0.image2text"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

buildFeatures {
viewBinding true
}

}

dependencies {

implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

//ml kit
implementation 'com.google.android.gms:play-services-mlkit-text-recognition:18.0.2'
}
21 changes: 21 additions & 0 deletions Image2Text/Image2Text/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.rahulsoni0.image2text;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.rahulsoni0.image2text", appContext.getPackageName());
}
}
Loading

0 comments on commit 1034860

Please sign in to comment.