Skip to content

Commit

Permalink
Add Advanced options Like incrementing numbers, random numbers, Share…
Browse files Browse the repository at this point in the history
… button etc (#12)

* Advanced option add #4

Created a button and added a java func to show the radio button when pressed

The radio button is not working yet

Signed-off-by: Abir-Tx <28858998+Abir-Tx@users.noreply.github.com>

* New Icon Add, Advanced view click func add

XWriter icon 2.0 added
Fixed an error where no input in Counter.java caused app crash

* Add share button to the printScreen

closes #13
Icon Background changed to white
Minor layout.xml changes added

Signed-off-by: Mushfiqur Rahman Abir <28858998+Abir-Tx@users.noreply.github.com>

* Radio Button Group Add

- Fixed some warning in the layouts

- Fixed the onClick method was not working for the incremental Button

- A new radio button added named Nothing

Signed-off-by: Mushfiqur Rahman Abir <28858998+Abir-Tx@users.noreply.github.com>
  • Loading branch information
Abir-Tx authored Oct 29, 2020
1 parent d3298fc commit c75f99e
Show file tree
Hide file tree
Showing 23 changed files with 211 additions and 19 deletions.
Binary file modified app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 37 additions & 11 deletions app/src/main/java/com/example/xwriter/Counter.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Toast;

public class Counter extends AppCompatActivity {

EditText et;
RadioButton rb, rb2;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_counter);

et = findViewById(R.id.count);

rb = findViewById(R.id.incremental);
rb2 = findViewById(R.id.nothing);
}

public void print2(View view) {
Expand All @@ -28,19 +32,41 @@ public void print2(View view) {
Toast nullInputToast = Toast.makeText(getApplicationContext(), "Input a Number first", Toast.LENGTH_SHORT);
nullInputToast.show();
}
int checkNumber = Integer.parseInt(holder);
if (checkNumber > 200000){
Toast nullInputToast = Toast.makeText(getApplicationContext(), "Can not take more than 200000 input", Toast.LENGTH_SHORT);
nullInputToast.show();
}
else{
int i = Integer.parseInt(holder);
Intent in = new Intent(Counter.this, printScreen.class);
in.putExtra("COUNT",i);
in.putExtra("INPUT",inputHolder);
startActivity(in);
int checkNumber = Integer.parseInt(holder);
if (checkNumber > 200000){
Toast nullInputToast = Toast.makeText(getApplicationContext(), "Can not take more than 200000 input", Toast.LENGTH_SHORT);
nullInputToast.show();
}
else{
int i = Integer.parseInt(holder);
Intent in = new Intent(Counter.this, printScreen.class);
in.putExtra("COUNT",i);
in.putExtra("INPUT",inputHolder);
startActivity(in);
}
}

}

public void advanceView(View view){
if (rb.getVisibility() == View.VISIBLE){
rb.setVisibility(View.INVISIBLE);
rb2.setVisibility(View.INVISIBLE);
}
else{
rb.setVisibility(View.VISIBLE);
rb2.setVisibility(View.VISIBLE);
}
}

public void incremental(View view){
if (rb.isChecked()){
Toast test = Toast.makeText(getApplicationContext(),"Abir-Tx is Working on it. Will be available Soon", Toast.LENGTH_LONG);
test.show();
}
else{
System.out.println("hey bro");
}
}
}
10 changes: 10 additions & 0 deletions app/src/main/java/com/example/xwriter/printScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
Expand Down Expand Up @@ -44,4 +45,13 @@ public void copy(View view) {
Toast textCopied = Toast.makeText(getApplicationContext(), "Copied to clipboard", Toast.LENGTH_LONG);
textCopied.show();
}

public void share(View view){
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String shareBody = result.getText().toString();
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
}
}
78 changes: 78 additions & 0 deletions app/src/main/res/drawable/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group android:scaleX="0"
android:scaleY="0"
android:translateX="54"
android:translateY="54">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</group>
</vector>
44 changes: 43 additions & 1 deletion app/src/main/res/layout/activity_counter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,51 @@
android:layout_marginTop="20dp"
android:letterSpacing="1"
android:onClick="print2"
android:text="Submit"
android:text=""
android:textColor="@android:color/holo_blue_bright"
android:textSize="20sp"
android:visibility="visible" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:text="@string/advanceOptionsButtonText"
android:visibility="visible"
android:onClick="advanceView"

>

</Button>

<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="20dp"
>
<RadioButton
android:id="@+id/incremental"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/incrementalButtonText"
android:textColor="@android:color/background_light"
android:layout_marginTop="10dp"
android:visibility="invisible"
android:onClick="incremental"

/>
<RadioButton
android:id="@+id/nothing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/nothingButtonText"
android:textColor="@android:color/background_light"
android:layout_marginTop="10dp"
android:visibility="invisible"
android:onClick="incremental"

/>
</RadioGroup>
</LinearLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
android:background="@android:color/darker_gray"
android:outlineProvider="background"
android:outlineAmbientShadowColor="@android:color/holo_blue_dark"
android:textSize="40dp"
android:textSize="40sp"
android:padding="10dp"
android:focusable="true"
android:textIsSelectable="true"
Expand All @@ -46,7 +46,7 @@
android:layout_centerHorizontal="true"
android:padding="20dp"
android:text="@string/print"
android:textSize="25dp"
android:textSize="25sp"
android:hapticFeedbackEnabled="true"
android:background="@android:color/black"
android:textColor="@android:color/white"
Expand Down
32 changes: 27 additions & 5 deletions app/src/main/res/layout/activity_print_screen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,53 @@
android:id="@+id/result"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="30dp"
android:textSize="30sp"
android:layout_gravity="top"
android:textColor="@android:color/white"
android:layout_alignParentTop="true"
android:textIsSelectable="true"
>
</TextView>
</ScrollView>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:id="@+id/shareFab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="80dp"
android:onClick="share"
android:src="@android:drawable/ic_menu_share"
android:tint="#000000"
android:tooltipText="@string/shareButtonTip"
android:visibility="visible"
app:backgroundTint="#FFFFFF"
android:contentDescription="@string/shareButtonDescription" />


<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:onClick="copy"
android:src="?attr/actionModeCopyDrawable"
android:tint="#000000"
android:tooltipText="@string/copyButtonToolTip"
android:visibility="visible"
app:backgroundTint="#FFFFFF" />
app:backgroundTint="#FFFFFF"
android:contentDescription="@string/copyButtonDescription"
/>

</RelativeLayout>
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher.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 modified app/src/main/res/mipmap-hdpi/ic_launcher_foreground.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 modified app/src/main/res/mipmap-hdpi/ic_launcher_round.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 modified app/src/main/res/mipmap-mdpi/ic_launcher.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 modified app/src/main/res/mipmap-mdpi/ic_launcher_foreground.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 modified app/src/main/res/mipmap-mdpi/ic_launcher_round.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 modified app/src/main/res/mipmap-xhdpi/ic_launcher.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 modified app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.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 modified app/src/main/res/mipmap-xhdpi/ic_launcher_round.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 modified app/src/main/res/mipmap-xxhdpi/ic_launcher.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 modified app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.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 modified app/src/main/res/mipmap-xxhdpi/ic_launcher_round.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 modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.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 modified app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.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 modified app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,18 @@
<string name="input_tooltip">Input the text you want to print</string>
<string name="print">Print</string>
<string name="copyButtonToolTip">Press To Copy</string>
<string name="shareButtonTip">Press To Share</string>

<string name="shareButtonDescription">Opens the share menu for sharing copied text to different apps</string>
<string name="copyButtonDescription">Copies the text from this windows to the clipboard</string>

<!-- Advanced Button-->
<string name="advanceOptionsButtonText">Advanced Options</string>

<!-- Submit Button-->
<string name="submitButtonText">Submit</string>

<!-- Radio Button-->
<string name="incrementalButtonText">Incremental</string>
<string name="nothingButtonText">Nothing</string>
</resources>

0 comments on commit c75f99e

Please sign in to comment.