use of android.support.v4.widget.DrawerLayout in project Rocket.Chat.Android by RocketChat.
the class RoomFragment method setupSideMenu.
private void setupSideMenu() {
View sideMenu = rootView.findViewById(R.id.room_side_menu);
sideMenu.findViewById(R.id.btn_users).setOnClickListener(view -> {
UsersOfRoomDialogFragment.create(roomId, hostname).show(getFragmentManager(), "UsersOfRoomDialogFragment");
closeSideMenuIfNeeded();
});
DrawerLayout drawerLayout = (DrawerLayout) rootView.findViewById(R.id.drawer_layout);
SlidingPaneLayout pane = (SlidingPaneLayout) getActivity().findViewById(R.id.sliding_pane);
if (drawerLayout != null && pane != null) {
compositeDisposable.add(RxDrawerLayout.drawerOpen(drawerLayout, GravityCompat.END).compose(bindToLifecycle()).subscribe(opened -> {
try {
Field fieldSlidable = pane.getClass().getDeclaredField("mCanSlide");
fieldSlidable.setAccessible(true);
fieldSlidable.setBoolean(pane, !opened);
} catch (Exception exception) {
RCLog.w(exception);
}
}, Logger::report));
}
}
use of android.support.v4.widget.DrawerLayout in project aplicativo by InCasa.
the class HomeActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
exibeTelaPrincipalOuSolicitaLogin();
setContentView(R.layout.activity_home);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
SharedPreferences mSharedPreferences = getSharedPreferences("ServerAdress", 0);
this.ip = mSharedPreferences.getString("servidor", " ");
String URLTEMPERATURA = "http://" + ip + "/backend/temperaturaValor";
String URLUMIDADE = "http://" + ip + "/backend/umidadeValor";
getTemperatura(URLTEMPERATURA);
getUmidade(URLUMIDADE);
String URLGETTEMPERATURA = "http://" + ip + "/backend/temperatura/1";
String URLGETUMIDADE = "http://" + ip + "/backend/umidade/1";
String URLGETPRESENCA = "http://" + ip + "/backend/presenca/1";
String URLGETLUMINOSISADE = "http://" + ip + "/backend/luminosidade/1";
getSensorTemperatura(URLGETTEMPERATURA);
getSensorUmidade(URLGETUMIDADE);
getSensorPresenca(URLGETPRESENCA);
getSensorLuminosidade(URLGETLUMINOSISADE);
String URLGETARDUINO = "http://" + ip + "/backend/arduino/1";
getArduino(URLGETARDUINO);
String URLGETCELULAR = "http://" + ip + "/backend/aplicativo/1";
getCelular(URLGETCELULAR);
JSONObject jsonBody = new JSONObject();
User user = User.getInstancia();
try {
jsonBody.put("login", user.getLogin());
jsonBody.put("senha", user.getSenha());
} catch (JSONException e) {
e.printStackTrace();
}
String URLUSER = "http://" + ip + "/backend/getUser";
getUser(jsonBody, URLUSER);
String URLGETRELE1 = "http://" + ip + "/backend/rele/1";
String URLGETRELE2 = "http://" + ip + "/backend/rele/2";
String URLGETRELE3 = "http://" + ip + "/backend/rele/3";
String URLGETRELE4 = "http://" + ip + "/backend/rele/4";
getRele1(URLGETRELE1);
getRele2(URLGETRELE2);
getRele3(URLGETRELE3);
getRele4(URLGETRELE4);
}
use of android.support.v4.widget.DrawerLayout in project dobby-android by InceptAi.
the class MainActivity method onNavigationItemSelected.
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_wifi_scan) {
ListenableFuture<List<ScanResult>> scanFuture = networkLayer.wifiScan();
Toast.makeText(this, "Starting wifi scan...", Toast.LENGTH_SHORT).show();
WifiFragment fragment = (WifiFragment) setupFragment(WifiFragment.class, WifiFragment.FRAGMENT_TAG);
fragment.setWifiScanFuture(scanFuture, threadpool.getExecutor());
} else if (id == R.id.nav_debug) {
DebugFragment fragment = (DebugFragment) setupFragment(DebugFragment.class, DebugFragment.FRAGMENT_TAG);
} else if (id == R.id.nav_fake_data) {
FakeDataFragment fragment = (FakeDataFragment) setupFragment(FakeDataFragment.class, FakeDataFragment.FRAGMENT_TAG);
} else if (id == R.id.nav_manage) {
} else if (id == R.id.nav_share) {
} else if (id == R.id.nav_send) {
} else if (id == R.id.about_wifi_expert) {
showAboutAndPrivacyPolicy();
} else if (id == R.id.feedback_wifi_expert) {
showFeedbackForm();
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
item.setChecked(false);
return true;
}
use of android.support.v4.widget.DrawerLayout in project NoteText by ViWu.
the class MainActivity method onNavigationItemSelected.
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_view_all_sets) {
Intent intent = new Intent(MainActivity.this, MainMenu.class);
intent.putExtra("questions", questions);
intent.putExtra("answers", answers);
// intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
fileWrite();
startActivity(intent);
finish();
overridePendingTransition(R.anim.activity_open_scale, R.anim.activity_close_translate);
} else if (id == R.id.nav_shuffle_review) {
shuffle("true");
} else if (id == R.id.nav_review) {
shuffle("false");
} else if (id == R.id.nav_notification) {
setNotification();
} else /*else if (id == R.id.nav_settings) {
Toast.makeText(getBaseContext(),"Settings!",Toast.LENGTH_SHORT).show();
Intent intent = new Intent(MainActivity.this, Settings.class);
startActivity(intent);
}*/
if (id == R.id.nav_save) {
fileWrite();
Toast.makeText(getBaseContext(), "Set saved!", Toast.LENGTH_SHORT).show();
}
/* else if (id == R.id.nav_share) {
Toast.makeText(getBaseContext(),"Share!!",Toast.LENGTH_SHORT).show();
}*/
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
assert drawer != null;
drawer.closeDrawer(GravityCompat.START);
return true;
}
use of android.support.v4.widget.DrawerLayout in project android_frameworks_base by crdroidandroid.
the class DrawerController method create.
/**
* Returns a controller suitable for {@code Layout}.
*/
static DrawerController create(Activity activity) {
DrawerLayout layout = (DrawerLayout) activity.findViewById(R.id.drawer_layout);
if (layout == null) {
return new DummyDrawerController();
}
View drawer = activity.findViewById(R.id.drawer_roots);
Toolbar toolbar = (Toolbar) activity.findViewById(R.id.roots_toolbar);
drawer.getLayoutParams().width = calculateDrawerWidth(activity);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(activity, layout, R.drawable.ic_hamburger, R.string.drawer_open, R.string.drawer_close);
return new RuntimeDrawerController(layout, drawer, toggle, toolbar);
}
Aggregations