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 Bundle savedInstanceState;
private TabLayoutActivity parentTab;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.savedInstanceState = savedInstanceState;
setContentView(R.layout.tabhistory);
parentTab = (TabLayoutActivity) getParent();
parentTab.historyActivity = this;
}
public void UpdateMap() {

View File

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

View File

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

View File

@ -10,27 +10,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
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
android:layout_width="fill_parent"
android:id="@+id/linearLayout6"
@ -162,7 +142,6 @@
android:layout_gravity="center_vertical"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>