Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Issue 27 #30

Draft
wants to merge 3 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions app/src/main/java/ga/nikhilkumar/whatsappsender/Sender.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.Toast;

import com.android.volley.RequestQueue;
Expand All @@ -32,6 +33,7 @@ public class Sender extends AppCompatActivity {
SharedPreferences sp;
Context activityContext = this;
Button browsebtn, sendbtn, accbtn;
RadioGroup variantsopt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -41,6 +43,24 @@ protected void onCreate(Bundle savedInstanceState) {
browsebtn = findViewById(R.id.browsebtn);
sendbtn = findViewById(R.id.sendbtn);
accbtn = findViewById(R.id.accbtn);
variantsopt = findViewById(R.id.variantsopt);
switch (sp.getString("variant","com.whatsapp")){
case "com.whatsapp":
variantsopt.check(R.id.waradio);
case "com.whatsapp.w4b":
variantsopt.check(R.id.wa4bradio);
}
variantsopt.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
switch (radioGroup.getCheckedRadioButtonId()){
case R.id.waradio:
sp.edit().putString("variant","com.whatsapp").apply();
case R.id.wa4bradio:
sp.edit().putString("variant","com.whatsapp.w4b").apply();
}
}
});
setDefaultOnClick(browsebtn);
setDefaultOnClick(sendbtn);
setDefaultOnClick(accbtn);
Expand Down
25 changes: 25 additions & 0 deletions app/src/main/res/layout/activity_sender.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,31 @@
android:orientation="vertical"
tools:context=".Sender">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Choose your WhatsApp varient" />

<RadioGroup
android:id="@+id/variantsopt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="100dp">

<RadioButton
android:id="@+id/waradio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="WhatsApp" />

<RadioButton
android:id="@+id/wa4bradio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="WA Business" />
</RadioGroup>

<Button
android:id="@+id/browsebtn"
android:layout_width="wrap_content"
Expand Down