Commit 84fcfedc authored by Giacomo Lavermicocca's avatar Giacomo Lavermicocca Committed by Pietro Saccardi

removed some debugs checks

parent 08f3090b
package it.giacomo.sesamo;
import android.appwidget.AppWidgetManager;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.telephony.SmsManager;
import android.telephony.SubscriptionInfo;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import java.util.List;
import it.giacomo.sesamo.managers.SendSms;
public class Main1Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main1);
//Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//setSupportActionBar(toolbar);
String val = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("numero_sms", "");
Toast.makeText(getApplicationContext(), val, Toast.LENGTH_LONG).show();
//SmsManager.getSmsManagerForSubscriptionId(subscriptionId).sendTextMessage(destinationAddress, scAddress, text, sentIntent, deliveryIntent);
SendSms sms = new SendSms();
sms.Do(2, "", null, "OPEN_2", null, null);
Intent intent = getIntent();
Bundle extras = intent.getExtras();
if (extras != null) {
int mAppWidgetId = extras.getInt(
AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
Log.e("TAGG", mAppWidgetId+"");
//Snackbar.make(view, ""+mAppWidgetId, Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
finish();
}
}
......@@ -2,7 +2,6 @@ package it.giacomo.sesamo;
import android.app.Activity;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.content.BroadcastReceiver;
import android.content.ContentValues;
import android.content.Context;
......@@ -12,13 +11,8 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.telephony.SmsManager;
import android.telephony.SubscriptionInfo;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
......@@ -26,11 +20,6 @@ import android.widget.Toast;
import com.google.firebase.messaging.FirebaseMessaging;
import org.w3c.dom.Text;
import java.util.List;
import it.giacomo.sesamo.beans.SimInfo;
import it.giacomo.sesamo.managers.SendSms;
public class MainActivity extends AppCompatActivity {
......@@ -52,6 +41,12 @@ public class MainActivity extends AppCompatActivity {
FirebaseMessaging.getInstance().subscribeToTopic("OPEN");
TextView mTextField = (TextView) findViewById(R.id.timer);
mTextField.setText("Benvenuto");
TextView mTextSummary = (TextView) findViewById(R.id.tvSummary);
if(getIntent().getExtras() != null) {
String value = getIntent().getExtras().getString("OPEN");
......@@ -63,12 +58,6 @@ public class MainActivity extends AppCompatActivity {
sms.Do(prefOperatore, prefContatto, null, value, null, null);
Toast.makeText(getApplicationContext(), value, Toast.LENGTH_SHORT).show();
TextView mTextField = (TextView) findViewById(R.id.timer);
TextView mTextSummary = (TextView) findViewById(R.id.tvSummary);
SetText(mTextSummary, value);
CountD(mTextField);
......
......@@ -51,8 +51,6 @@ public class MainActivityWidget extends AppWidgetProvider {
nextIntent.putExtra("OPEN", intent.getAction());
context.startActivity(nextIntent);
Toast.makeText(context, intent.getAction(), Toast.LENGTH_SHORT).show();
}
}
}
\ No newline at end of file
......@@ -46,6 +46,8 @@ public class MyFirebaseMessagingService extends FirebaseMessagingService {
.setContentTitle("Sesamo")
.setContentText("OPEN :-)");
NextOperation(remoteMessage.getData().get("OPEN"));
Intent notificationIntent = new Intent(this, MainActivity.class);
// PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
// builder.setContentIntent(contentIntent);
......@@ -54,4 +56,13 @@ public class MyFirebaseMessagingService extends FirebaseMessagingService {
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(0, builder.build());
}
private void NextOperation(String val)
{
Intent nextIntent = new Intent(getApplicationContext(), MainActivity.class);
nextIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
nextIntent.putExtra("OPEN", val);
getApplicationContext().startActivity(nextIntent);
}
}
......@@ -40,5 +40,5 @@
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:gravity="center"
android:text="..." />
android:text="...sesamo..." />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="it.giacomo.sesamo.Main1Activity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main1" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
......@@ -31,14 +31,14 @@
android:id="@+id/btn_esco"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ESCI"
android:text="ESCO"
android:theme="@style/MyButton" />
<Button
android:id="@+id/btn_entro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ENTRA"
android:text="ENTRO"
android:theme="@style/MyButton" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="it.giacomo.sesamo.Main1Activity"
tools:showIn="@layout/activity_main1">
</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</android.support.constraint.ConstraintLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment