mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-19 06:51:57 +02:00
update GUI changes immediately via activity result
This commit is contained in:
@@ -56,7 +56,7 @@ public class MainActivity extends ActionBarActivity implements
|
||||
* becomes too memory intensive, it may be best to switch to a
|
||||
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
|
||||
*/
|
||||
public static SectionsPagerAdapter mSectionsPagerAdapter;
|
||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
||||
|
||||
private static boolean firstAppStart = true;
|
||||
private static int bluetoothStatusIcon = R.drawable.bluetooth_disabled;
|
||||
@@ -149,7 +149,7 @@ public class MainActivity extends ActionBarActivity implements
|
||||
|
||||
if (id == R.id.action_general_settings) {
|
||||
Intent intent = new Intent(this, SettingsActivity.class);
|
||||
startActivityForResult(intent, 0);
|
||||
startActivityForResult(intent, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -259,7 +259,15 @@ public class MainActivity extends ActionBarActivity implements
|
||||
public void onTabReselected(ActionBar.Tab tab,
|
||||
FragmentTransaction fragmentTransaction) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
|
||||
if (requestCode == 1) {
|
||||
mSectionsPagerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
|
||||
* one of the sections/tabs/pages.
|
||||
@@ -315,14 +323,15 @@ public class MainActivity extends ActionBarActivity implements
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemPosition(Object object) {
|
||||
return POSITION_NONE;
|
||||
}
|
||||
@Override
|
||||
public int getItemPosition(Object object) {
|
||||
return POSITION_NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void notifyDataSetChanged() {
|
||||
super.notifyDataSetChanged();
|
||||
super.notifyDataSetChanged();
|
||||
|
||||
tableFrag = new TableFragment();
|
||||
graphFrag = new GraphFragment();
|
||||
overviewFrag = new OverviewFragment();
|
||||
|
@@ -16,7 +16,6 @@
|
||||
package com.health.openscale.gui;
|
||||
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.util.Log;
|
||||
|
||||
import com.health.openscale.R;
|
||||
|
||||
@@ -25,7 +24,6 @@ import java.util.List;
|
||||
|
||||
public class SettingsActivity extends PreferenceActivity {
|
||||
private static List<String> fragments = new ArrayList<String>();
|
||||
static int backPressed = 0;
|
||||
|
||||
@Override
|
||||
public void onBuildHeaders(List<Header> target) {
|
||||
@@ -41,13 +39,4 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
protected boolean isValidFragment(String fragmentName) {
|
||||
return fragments.contains(fragmentName);
|
||||
}
|
||||
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
backPressed++;
|
||||
if (backPressed == 1) {
|
||||
MainActivity.mSectionsPagerAdapter.notifyDataSetChanged();
|
||||
backPressed = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user