display history

This commit is contained in:
CiufudeanDani 2022-03-16 16:40:34 +02:00
parent 5349558ace
commit 4439687405
4 changed files with 482 additions and 533 deletions

View File

@ -9,12 +9,18 @@ import com.safemobile.lib.SM;
public class HistoryActivity extends AppCompatActivity { public class HistoryActivity extends AppCompatActivity {
public Bundle savedInstanceState; public Bundle savedInstanceState;
private TabLayoutActivity parentTab;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.savedInstanceState = savedInstanceState; this.savedInstanceState = savedInstanceState;
setContentView(R.layout.tabhistory); setContentView(R.layout.tabhistory);
parentTab = (TabLayoutActivity) getParent();
parentTab.historyActivity = this;
} }
public void UpdateMap() { public void UpdateMap() {

View File

@ -12,7 +12,6 @@ import java.util.Locale;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
/** fix import */
import com.safemobile.activities.AbstractEmptyActivity; import com.safemobile.activities.AbstractEmptyActivity;
import com.safemobile.activities.AbstractLiveActivity; import com.safemobile.activities.AbstractLiveActivity;
import com.safemobile.activities.AbstractMessagesActivity; import com.safemobile.activities.AbstractMessagesActivity;
@ -267,11 +266,11 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
tabHost = getTabHost(); // The activity TabHost tabHost = getTabHost(); // The activity TabHost
tabHost.setTag("Tab Panel"); tabHost.setTag("Tab Panel");
tabWidget = (TabWidget) findViewById(android.R.id.tabs); tabWidget = findViewById(android.R.id.tabs);
tabWidget.setVisibility(View.GONE); tabWidget.setVisibility(View.GONE);
intent = new Intent[7]; intent = new Intent[8];
tabspecs = new TabSpec[7]; tabspecs = new TabSpec[8];
// add live tab // add live tab
try try
@ -290,23 +289,6 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
.setContent(intent[0]); .setContent(intent[0]);
} }
// add history tab
try
{
//intent[1] = new Intent(context, HistoryActivity.class);
//tabspecs[1] = tabHost.newTabSpec("History")
// .setIndicator("History", res.getDrawable(R.drawable.ic_tab_history_selected))
// .setContent(intent[1]);
}
catch(NoClassDefFoundError e)
{
// exception when GoogleApi not exists
//intent[1] = new Intent(context, AbstractEmptyActivity.class);
//tabspecs[1] = tabHost.newTabSpec("History")
// .setIndicator("History", res.getDrawable(R.drawable.ic_tab_history_selected))
// .setContent(intent[1]);
}
// add text tab // add text tab
intent[1] = new Intent(context, MessagesActivity.class); intent[1] = new Intent(context, MessagesActivity.class);
tabspecs[1] = tabHost.newTabSpec("Text") tabspecs[1] = tabHost.newTabSpec("Text")
@ -343,6 +325,21 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
.setIndicator("SafeMobile", res.getDrawable(AppParams.DEMO ? R.drawable.icon_demo : R.drawable.ic_launcher)) .setIndicator("SafeMobile", res.getDrawable(AppParams.DEMO ? R.drawable.icon_demo : R.drawable.ic_launcher))
.setContent(intent[6]); .setContent(intent[6]);
// add history tab
try
{
intent[7] = new Intent(context, HistoryActivity.class);
tabspecs[7] = tabHost.newTabSpec("History")
.setIndicator("History", res.getDrawable(R.drawable.ic_tab_history_selected))
.setContent(intent[7]);
} catch(NoClassDefFoundError e) {
// exception when GoogleApi not exists
intent[7] = new Intent(context, AbstractEmptyActivity.class);
tabspecs[7] = tabHost.newTabSpec("History")
.setIndicator("History", res.getDrawable(R.drawable.ic_tab_history_selected))
.setContent(intent[1]);
}
// add tab in tabHost // add tab in tabHost
// for(int i=0;i<7;i++ // for(int i=0;i<7;i++
for (TabSpec tab: tabspecs) { for (TabSpec tab: tabspecs) {
@ -355,12 +352,9 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
imageViewSlideMenu = (ImageView) findViewById(R.id.imageViewSlideMenu); imageViewSlideMenu = (ImageView) findViewById(R.id.imageViewSlideMenu);
// get Live Button // get Live Button
buttonLive = (ImageButton) findViewById(R.id.buttonLive); buttonLive = findViewById(R.id.buttonLive);
buttonLive.setOnClickListener(new OnClickListener() { buttonLive.setOnClickListener(v -> {
@Override if (!buttonLive.isSelected()) {
public void onClick(View v) {
if(!buttonLive.isSelected())
{
// select button // select button
buttonLive.setSelected(true); buttonLive.setSelected(true);
// deselect other buttons // deselect other buttons
@ -374,16 +368,12 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
tabHost.setCurrentTabByTag("Live"); tabHost.setCurrentTabByTag("Live");
AppParams.crtTab = AppParams.Tabs.live; AppParams.crtTab = AppParams.Tabs.live;
} }
}
}); });
// get History Button // get History Button
buttonHistory = (ImageButton) findViewById(R.id.buttonHistory); buttonHistory = findViewById(R.id.buttonHistory);
buttonHistory.setOnClickListener(new OnClickListener() { buttonHistory.setOnClickListener(v -> {
@Override if (!buttonHistory.isSelected()) {
public void onClick(View v) {
if(!buttonHistory.isSelected())
{
// select button // select button
buttonHistory.setSelected(true); buttonHistory.setSelected(true);
// deselect other buttons // deselect other buttons
@ -397,16 +387,12 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
tabHost.setCurrentTabByTag("History"); tabHost.setCurrentTabByTag("History");
AppParams.crtTab = AppParams.Tabs.history; AppParams.crtTab = AppParams.Tabs.history;
} }
}
}); });
// get Text Button // get Text Button
buttonText= (ImageButton) findViewById(R.id.buttonText); buttonText= findViewById(R.id.buttonText);
buttonText.setOnClickListener(new OnClickListener() { buttonText.setOnClickListener(v -> {
@Override if (!buttonText.isSelected()) {
public void onClick(View v) {
if(!buttonText.isSelected())
{
// select button // select button
buttonText.setSelected(true); buttonText.setSelected(true);
// deselect other buttons // deselect other buttons
@ -426,7 +412,6 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
messageActivity.UpdateSMS(listSMS); messageActivity.UpdateSMS(listSMS);
} }
} }
}
}); });
// get Radio Button // get Radio Button
@ -611,24 +596,21 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
}); });
// get About Button // get About Button
buttonLogo = (ImageButton) findViewById(R.id.buttonLogo); buttonLogo = findViewById(R.id.buttonLogo);
buttonLogo.setOnClickListener(new OnClickListener() { buttonLogo.setOnClickListener(v -> {
@Override
public void onClick(View v) {
// create dialog // create dialog
final Dialog dialog = new Dialog(context); final Dialog dialog = new Dialog(context);
dialog.setTitle(AppParams.DEMO ? getString(R.string.app_name_demo) : getString(R.string.app_name)); dialog.setTitle(AppParams.DEMO ? getString(R.string.app_name_demo) : getString(R.string.app_name));
dialog.setContentView(R.layout.dialog); dialog.setContentView(R.layout.dialog);
ImageView image = (ImageView) dialog.findViewById(R.id.image); ImageView image = dialog.findViewById(R.id.image);
image.setImageResource(AppParams.DEMO ? R.drawable.icon_demo : R.drawable.ic_launcher); image.setImageResource(AppParams.DEMO ? R.drawable.icon_demo : R.drawable.ic_launcher);
TextView text = (TextView) dialog.findViewById(R.id.text); TextView text = dialog.findViewById(R.id.text);
TextView text2 = (TextView) dialog.findViewById(R.id.text2); TextView text2 = dialog.findViewById(R.id.text2);
text.setText(getString(R.string.version) + "1.0.8"); text.setText(getString(R.string.version) + "1.0.8");
text2.setText(getString(R.string.email) + ": support@safemobile.com"); text2.setText(getString(R.string.email) + ": support@safemobile.com");
dialog.setCancelable(true); dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true); dialog.setCanceledOnTouchOutside(true);
dialog.show(); dialog.show();
}
}); });
imageViewClose.setOnTouchListener(new OnTouchListener() { imageViewClose.setOnTouchListener(new OnTouchListener() {
@ -1457,28 +1439,19 @@ public class TabLayoutActivity extends AbstractSDParentActivity{
} }
// if tab is not TextTab // if tab is not TextTab
if(tabHost.getCurrentTab() != 2) if(tabHost.getCurrentTab() != 2) {
{
myHandler.post(UpdateResults); myHandler.post(UpdateResults);
//mHandler.dispatchMessage(new Message()); //mHandler.dispatchMessage(new Message());
} } else
else myHandler.post(() -> {
myHandler.post(new Runnable() {
@Override
public void run() {
// create Notification // create Notification
createNotification(AppParams.messageNotif); createNotification(AppParams.messageNotif);
}
}); });
//list for SMS //list for SMS
if(AppParams.crtTab == AppParams.Tabs.message && messageActivity!= null) if(AppParams.crtTab == AppParams.Tabs.message && messageActivity!= null) {
{
SM.Debug("currentActivity instanceof MessagesActivity - NewSMS | " + tempArr[0] + " | " + tempArr[1]); SM.Debug("currentActivity instanceof MessagesActivity - NewSMS | " + tempArr[0] + " | " + tempArr[1]);
messageActivity.NewSMS(tempArr[0], tempArr[1], time); messageActivity.NewSMS(tempArr[0], tempArr[1], time);
} }
} }
@Override @Override

View File

@ -105,9 +105,7 @@
android:layout_weight="0" android:layout_weight="0"
android:paddingRight="5dp" android:paddingRight="5dp"
android:visibility="gone"/> android:visibility="gone"/>
<!-- android:background="@drawable/addmessage_selector" -->
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
@ -120,8 +118,6 @@
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:weightSum="1"> android:weightSum="1">
<LinearLayout <LinearLayout
android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="fill_parent" android:layout_height="fill_parent"
@ -267,7 +263,6 @@
android:text="@string/display" /> android:text="@string/display" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -333,9 +328,5 @@
android:gravity="center_vertical"/> android:gravity="center_vertical"/>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -10,27 +10,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:background="#000000"> android:background="#000000">
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout2" android:orientation="vertical">
<!--
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout3">
<LinearLayout android:layout_width="80dp" android:id="@+id/linearLayout4" android:layout_height="wrap_content">
<Button android:layout_width="wrap_content" android:text="Create tabs" android:layout_height="wrap_content" android:id="@+id/button1"></Button>
</LinearLayout>
<LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout5" android:layout_width="match_parent">
<LinearLayout android:layout_width="100dp" android:layout_height="match_parent" android:id="@+id/linearLayout7" android:layout_weight="0.29" android:weightSum="1">
<Button android:text="Remove selected tab" android:layout_height="wrap_content" android:id="@+id/button3" android:layout_width="wrap_content"></Button>
</LinearLayout>
<EditText android:layout_width="wrap_content" android:id="@+id/editText1" android:layout_height="wrap_content" android:inputType="number" android:layout_weight="13.86">
<requestFocus></requestFocus>
</EditText>
<LinearLayout android:layout_width="80dp" android:layout_height="match_parent" android:id="@+id/linearLayout7" android:layout_weight="0.29" android:weightSum="1">
<Button android:layout_width="wrap_content" android:text="Add tab" android:layout_height="wrap_content" android:id="@+id/button2" android:layout_weight="0.25"></Button>
</LinearLayout>
</LinearLayout>
</LinearLayout>
-->
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:id="@+id/linearLayout6" android:id="@+id/linearLayout6"
@ -162,7 +142,6 @@
android:layout_gravity="center_vertical"/> android:layout_gravity="center_vertical"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>