Formatting

This commit is contained in:
GaidamakUA 2016-03-14 17:30:03 +02:00
parent c7ecfbceae
commit 5d65210766

View file

@ -54,7 +54,6 @@ import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
@ -123,7 +122,6 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
protected static final int LOGIN_ID = 12;
public static final int LIST_REFRESH_MSG_ID = OsmAndConstants.UI_HANDLER_SEARCH + 30;
public static final long RECENT_THRESHOLD = 60000;
private static final int LIST_REFRESH_MSG_ID = OsmAndConstants.UI_HANDLER_SEARCH + 30;
private static final int WIDTH_IN_DP = 24;
private static final int HEIGHT_ID_DP = 24;
@ -171,6 +169,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
}
}
setContentView(R.layout.osmo_group_list);
//noinspection ConstantConditions
getSupportActionBar().setTitle(R.string.osmo);
setSupportProgressBarIndeterminateVisibility(false);
setupHeader();
@ -265,7 +264,6 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
});
TextView mtd = (TextView) header.findViewById(R.id.motd);
SessionInfo si = osMoPlugin.getService().getCurrentSessionInfo();
boolean visible = si != null && si.motd != null && si.motd.length() > 0;
@ -320,6 +318,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
long lastUpdateTime;
private Drawable blinkImg;
private void blink(final ImageView status, Drawable bigger, final Drawable smaller) {
blinkImg = smaller;
status.setImageDrawable(bigger);
@ -496,7 +495,6 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
}
this.menu = menu;
group = (OsMoGroup) (o instanceof OsMoGroup ? o : null);
MenuItem mi = null;
if (group != null) {
createActionModeMenuItem(actionMode, menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
@ -507,23 +505,6 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
R.drawable.ic_action_delete_dark,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
if (mi != null) {
final LayoutInflater inflater = LayoutInflater.from(OsMoGroupsActivity.this);
FrameLayout l = new FrameLayout(OsMoGroupsActivity.this);
View view = inflater.inflate(R.layout.check_item_rel, l);
final CompoundButton check = (CompoundButton) view.findViewById(R.id.check_item);
check.setChecked(group != null && group.isActive() && group.isEnabled());
check.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
onOffAction(check);
}
});
MenuItemCompat.setActionView(mi, l);
}
return true;
}
@ -590,7 +571,6 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
}
protected void showGroupInfo(final OsMoGroup group) {
AlertDialog.Builder bld = new AlertDialog.Builder(this);
bld.setTitle(R.string.osmo_group);
@ -793,6 +773,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
setSupportProgressBarIndeterminateVisibility(false);
wv.requestFocus(View.FOCUS_DOWN);
}
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.contains(OsMoService.SIGNED_IN_CONTAINS)) {
Uri data = Uri.parse(url);
@ -950,7 +931,6 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
mgv.setVisibility(View.VISIBLE);
builder.setView(v);
builder.setNegativeButton(R.string.shared_string_cancel, null);
builder.setPositiveButton(R.string.shared_string_apply, new DialogInterface.OnClickListener() {
@ -1063,7 +1043,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
@Override
public void run() {
String top = OsMoGroupsActivity.this.operation;
if(operation == top || (operation != null && operation.equals(top))) {
if (top.equals(operation) || (operation != null && operation.equals(top))) {
hideProgressBar();
}
if (joinGroup && (operation != null && operation.startsWith("GROUP_CONNECT"))) {
@ -1073,10 +1053,11 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
if (group != null) {
adapter.update(group);
adapter.notifyDataSetChanged();
} else if (operation.startsWith("GROUP_GET_ALL")
} else if (operation != null &&
(operation.startsWith("GROUP_GET_ALL")
|| operation.startsWith("DEVICE_GET_ALL")
|| operation.startsWith("SUBSCRIBE")
|| operation.startsWith("UNSUBSCRIBE")) {
|| operation.startsWith("UNSUBSCRIBE"))) {
adapter.synchronizeGroups();
}
updateStatus();
@ -1094,8 +1075,8 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
class OsMoGroupsAdapter extends OsmandBaseExpandableListAdapter {
private List<OsMoGroup> sortedGroups = new ArrayList<OsMoGroup>();
private Map<OsMoGroup, List<OsMoDevice>> users = new LinkedHashMap<OsMoGroup, List<OsMoDevice>>();
private List<OsMoGroup> sortedGroups = new ArrayList<>();
private Map<OsMoGroup, List<OsMoDevice>> users = new LinkedHashMap<>();
private OsMoGroups grs;
private OsMoTracker tracker;
private OsMoService srv;
@ -1335,7 +1316,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
icon.setImageDrawable(directionDrawable);
int dist = (int) mes[0];
long seconds = Math.max(0, (now - location.getTime()) / 1000);
String time = "";
String time;
if (seconds < 60) {
seconds = (seconds / 5) * 5;
time = seconds + " " + getString(R.string.seconds_ago);
@ -1375,7 +1356,6 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
}
@Override
public void updateCompassValue(float value) {
float vl = lastCompass;
@ -1400,7 +1380,6 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
}
@Override
public void deviceLocationChanged(OsMoDevice device) {
refreshList();
@ -1524,7 +1503,6 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
}
public void handleConnect() {
app.runInUIThread(new Runnable() {
@Override