OliverParoczai
4 years ago
13 changed files with 6 additions and 458 deletions
@ -0,0 +1,6 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="VcsDirectoryMappings"> |
|||
<mapping directory="" vcs="Git" /> |
|||
</component> |
|||
</project> |
@ -1,102 +0,0 @@ |
|||
package hu.paroczaioliver.projectlancer; |
|||
|
|||
import android.content.Context; |
|||
import android.os.Bundle; |
|||
import android.preference.PreferenceManager; |
|||
import android.view.Gravity; |
|||
import android.view.MenuItem; |
|||
import android.view.View; |
|||
import android.view.Menu; |
|||
|
|||
import com.google.android.material.floatingactionbutton.FloatingActionButton; |
|||
import com.google.android.material.snackbar.Snackbar; |
|||
import com.google.android.material.navigation.NavigationView; |
|||
|
|||
import androidx.fragment.app.Fragment; |
|||
import androidx.fragment.app.FragmentManager; |
|||
import androidx.fragment.app.FragmentTransaction; |
|||
import androidx.navigation.NavController; |
|||
import androidx.navigation.Navigation; |
|||
import androidx.navigation.ui.AppBarConfiguration; |
|||
import androidx.navigation.ui.NavigationUI; |
|||
import androidx.drawerlayout.widget.DrawerLayout; |
|||
import androidx.appcompat.app.AppCompatActivity; |
|||
import androidx.appcompat.widget.Toolbar; |
|||
import android.content.Intent; |
|||
import android.widget.Toast; |
|||
|
|||
import org.osmdroid.config.Configuration; |
|||
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; |
|||
import org.osmdroid.views.MapView; |
|||
|
|||
import hu.paroczaioliver.projectlancer.ui.events.EventsFragment; |
|||
import hu.paroczaioliver.projectlancer.ui.home.HomeFragment; |
|||
|
|||
public class MainActivity extends AppCompatActivity { |
|||
|
|||
private AppBarConfiguration mAppBarConfiguration; |
|||
private Fragment mFragment; |
|||
|
|||
@Override |
|||
protected void onCreate(Bundle savedInstanceState) { |
|||
super.onCreate(savedInstanceState); |
|||
setContentView(R.layout.activity_main); |
|||
Toolbar toolbar = findViewById(R.id.toolbar); |
|||
setSupportActionBar(toolbar); |
|||
FloatingActionButton fab = findViewById(R.id.fab); |
|||
fab.setOnClickListener(new View.OnClickListener() { |
|||
@Override |
|||
public void onClick(View view) { |
|||
Snackbar.make(view, "Jelenleg letiltva", Snackbar.LENGTH_LONG) |
|||
.setAction("Action", null).show(); |
|||
} |
|||
}); |
|||
DrawerLayout drawer = findViewById(R.id.drawer_layout); |
|||
NavigationView navigationView = findViewById(R.id.nav_view); |
|||
mAppBarConfiguration = new AppBarConfiguration.Builder( |
|||
R.id.nav_home, R.id.nav_events, R.id.nav_schools, R.id.nav_map, R.id.nav_projects, R.id.nav_chats) |
|||
.setDrawerLayout(drawer) |
|||
.build(); |
|||
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); |
|||
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration); |
|||
NavigationUI.setupWithNavController(navigationView, navController); |
|||
navigationView.bringToFront(); |
|||
if(getIntent().getExtras() != null){ |
|||
navController.navigate(getIntent().getExtras().getInt("frgname")); |
|||
} |
|||
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { |
|||
@Override |
|||
public boolean onNavigationItemSelected(MenuItem item) { |
|||
if(item.getItemId() == R.id.nav_map) { |
|||
drawer.closeDrawer(Gravity.LEFT); |
|||
MainActivity.this.startActivity(new Intent(MainActivity.this, MapActivity.class).addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION)); |
|||
return false; |
|||
}else{ |
|||
drawer.closeDrawer(Gravity.LEFT); |
|||
navController.navigate(item.getItemId()); |
|||
item.setChecked(true); |
|||
return true; |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
@Override |
|||
public boolean onCreateOptionsMenu(Menu menu) { |
|||
getMenuInflater().inflate(R.menu.main, menu); |
|||
return true; |
|||
} |
|||
|
|||
@Override |
|||
public boolean onSupportNavigateUp() { |
|||
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); |
|||
return NavigationUI.navigateUp(navController, mAppBarConfiguration) |
|||
|| super.onSupportNavigateUp(); |
|||
} |
|||
|
|||
@Override |
|||
public void onBackPressed() { |
|||
finishAffinity(); |
|||
} |
|||
|
|||
} |
@ -1,88 +0,0 @@ |
|||
package hu.paroczaioliver.projectlancer; |
|||
|
|||
import androidx.appcompat.app.AppCompatActivity; |
|||
import androidx.appcompat.widget.Toolbar; |
|||
import androidx.drawerlayout.widget.DrawerLayout; |
|||
import androidx.navigation.NavController; |
|||
import androidx.navigation.Navigation; |
|||
import androidx.navigation.ui.AppBarConfiguration; |
|||
import androidx.navigation.ui.NavigationUI; |
|||
|
|||
import android.content.Context; |
|||
import android.content.Intent; |
|||
import android.os.Bundle; |
|||
import android.preference.PreferenceManager; |
|||
import android.view.Gravity; |
|||
import android.view.Menu; |
|||
import android.view.MenuItem; |
|||
import android.view.View; |
|||
|
|||
import com.google.android.material.floatingactionbutton.FloatingActionButton; |
|||
import com.google.android.material.navigation.NavigationView; |
|||
import com.google.android.material.snackbar.Snackbar; |
|||
|
|||
import org.osmdroid.api.IMapController; |
|||
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; |
|||
import org.osmdroid.util.GeoPoint; |
|||
import org.osmdroid.views.MapView; |
|||
import org.osmdroid.config.Configuration; |
|||
|
|||
public class MapActivity extends AppCompatActivity { |
|||
MapView map = null; |
|||
private AppBarConfiguration mAppBarConfiguration; |
|||
|
|||
@Override public void onCreate(Bundle savedInstanceState) { |
|||
super.onCreate(savedInstanceState); |
|||
setContentView(R.layout.activity_map); |
|||
Toolbar toolbar = findViewById(R.id.toolbar); |
|||
setSupportActionBar(toolbar); |
|||
DrawerLayout drawer = findViewById(R.id.drawer_layout); |
|||
NavigationView navigationView = findViewById(R.id.nav_view); |
|||
mAppBarConfiguration = new AppBarConfiguration.Builder( |
|||
R.id.nav_home, R.id.nav_events, R.id.nav_schools, R.id.nav_map, R.id.nav_projects, R.id.nav_chats) |
|||
.setDrawerLayout(drawer) |
|||
.build(); |
|||
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); |
|||
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration); |
|||
NavigationUI.setupWithNavController(navigationView, navController); |
|||
navigationView.setCheckedItem(R.id.nav_map); |
|||
Context ctx = getApplicationContext(); |
|||
Configuration.getInstance().load(ctx, PreferenceManager.getDefaultSharedPreferences(ctx)); |
|||
map = (MapView) findViewById(R.id.map); |
|||
map.setTileSource(TileSourceFactory.MAPNIK); |
|||
IMapController mapController = map.getController(); |
|||
mapController.setZoom(9.00); |
|||
GeoPoint startPoint = new GeoPoint(47.497913, 19.040236); |
|||
mapController.setCenter(startPoint); |
|||
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { |
|||
public boolean onNavigationItemSelected(MenuItem item) { |
|||
drawer.closeDrawer(Gravity.LEFT); |
|||
Intent i = new Intent(MapActivity.this, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); |
|||
i.putExtra("frgname", item.getItemId()); |
|||
startActivity(i); |
|||
return false; |
|||
} |
|||
}); |
|||
} |
|||
|
|||
@Override |
|||
public boolean onCreateOptionsMenu(Menu menu) { |
|||
getMenuInflater().inflate(R.menu.main, menu); |
|||
return true; |
|||
} |
|||
|
|||
@Override |
|||
public boolean onSupportNavigateUp() { |
|||
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); |
|||
return NavigationUI.navigateUp(navController, mAppBarConfiguration) |
|||
|| super.onSupportNavigateUp(); |
|||
} |
|||
|
|||
@Override |
|||
public void onBackPressed() { |
|||
finishAffinity(); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
@ -1,35 +0,0 @@ |
|||
package hu.paroczaioliver.projectlancer.ui.chats; |
|||
|
|||
import android.os.Bundle; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
import android.widget.TextView; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.annotation.Nullable; |
|||
import androidx.fragment.app.Fragment; |
|||
import androidx.lifecycle.Observer; |
|||
import androidx.lifecycle.ViewModelProvider; |
|||
|
|||
import hu.paroczaioliver.projectlancer.R; |
|||
|
|||
public class ChatsFragment extends Fragment { |
|||
|
|||
private ChatsViewModel chatsViewModel; |
|||
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, |
|||
ViewGroup container, Bundle savedInstanceState) { |
|||
chatsViewModel = |
|||
new ViewModelProvider(this).get(ChatsViewModel.class); |
|||
View root = inflater.inflate(R.layout.fragment_chats, container, false); |
|||
final TextView textView = root.findViewById(R.id.text_chats); |
|||
chatsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() { |
|||
@Override |
|||
public void onChanged(@Nullable String s) { |
|||
textView.setText(s); |
|||
} |
|||
}); |
|||
return root; |
|||
} |
|||
} |
@ -1,19 +0,0 @@ |
|||
package hu.paroczaioliver.projectlancer.ui.chats; |
|||
|
|||
import androidx.lifecycle.LiveData; |
|||
import androidx.lifecycle.MutableLiveData; |
|||
import androidx.lifecycle.ViewModel; |
|||
|
|||
public class ChatsViewModel extends ViewModel { |
|||
|
|||
private MutableLiveData<String> mText; |
|||
|
|||
public ChatsViewModel() { |
|||
mText = new MutableLiveData<>(); |
|||
mText.setValue("Üzenetek - Fejlesztés alatt"); |
|||
} |
|||
|
|||
public LiveData<String> getText() { |
|||
return mText; |
|||
} |
|||
} |
@ -1,35 +0,0 @@ |
|||
package hu.paroczaioliver.projectlancer.ui.events; |
|||
|
|||
import android.os.Bundle; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
import android.widget.TextView; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.annotation.Nullable; |
|||
import androidx.fragment.app.Fragment; |
|||
import androidx.lifecycle.Observer; |
|||
import androidx.lifecycle.ViewModelProvider; |
|||
|
|||
import hu.paroczaioliver.projectlancer.R; |
|||
|
|||
public class EventsFragment extends Fragment { |
|||
|
|||
private EventsViewModel eventViewModel; |
|||
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, |
|||
ViewGroup container, Bundle savedInstanceState) { |
|||
eventViewModel = |
|||
new ViewModelProvider(this).get(EventsViewModel.class); |
|||
View root = inflater.inflate(R.layout.fragment_events, container, false); |
|||
final TextView textView = root.findViewById(R.id.text_events); |
|||
eventViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() { |
|||
@Override |
|||
public void onChanged(@Nullable String s) { |
|||
textView.setText(s); |
|||
} |
|||
}); |
|||
return root; |
|||
} |
|||
} |
@ -1,19 +0,0 @@ |
|||
package hu.paroczaioliver.projectlancer.ui.events; |
|||
|
|||
import androidx.lifecycle.LiveData; |
|||
import androidx.lifecycle.MutableLiveData; |
|||
import androidx.lifecycle.ViewModel; |
|||
|
|||
public class EventsViewModel extends ViewModel { |
|||
|
|||
private MutableLiveData<String> mText; |
|||
|
|||
public EventsViewModel() { |
|||
mText = new MutableLiveData<>(); |
|||
mText.setValue("Rendezvények - Fejlesztés alatt"); |
|||
} |
|||
|
|||
public LiveData<String> getText() { |
|||
return mText; |
|||
} |
|||
} |
@ -1,33 +0,0 @@ |
|||
package hu.paroczaioliver.projectlancer.ui.home; |
|||
|
|||
import android.os.Bundle; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.annotation.Nullable; |
|||
import androidx.fragment.app.Fragment; |
|||
import androidx.lifecycle.Observer; |
|||
import androidx.lifecycle.ViewModelProvider; |
|||
|
|||
import hu.paroczaioliver.projectlancer.R; |
|||
|
|||
public class HomeFragment extends Fragment { |
|||
|
|||
private HomeViewModel homeViewModel; |
|||
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, |
|||
ViewGroup container, Bundle savedInstanceState) { |
|||
homeViewModel = |
|||
new ViewModelProvider(this).get(hu.paroczaioliver.projectlancer.ui.home.HomeViewModel.class); |
|||
View root = inflater.inflate(R.layout.fragment_home, container, false); |
|||
homeViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() { |
|||
@Override |
|||
public void onChanged(@Nullable String s) { |
|||
|
|||
} |
|||
}); |
|||
return root; |
|||
} |
|||
} |
@ -1,19 +0,0 @@ |
|||
package hu.paroczaioliver.projectlancer.ui.home; |
|||
|
|||
import androidx.lifecycle.LiveData; |
|||
import androidx.lifecycle.MutableLiveData; |
|||
import androidx.lifecycle.ViewModel; |
|||
|
|||
public class HomeViewModel extends ViewModel { |
|||
|
|||
private MutableLiveData<String> mText; |
|||
|
|||
public HomeViewModel() { |
|||
mText = new MutableLiveData<>(); |
|||
mText.setValue("Kezdőlap"); |
|||
} |
|||
|
|||
public LiveData<String> getText() { |
|||
return mText; |
|||
} |
|||
} |
@ -1,35 +0,0 @@ |
|||
package hu.paroczaioliver.projectlancer.ui.projects; |
|||
|
|||
import android.os.Bundle; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
import android.widget.TextView; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.annotation.Nullable; |
|||
import androidx.fragment.app.Fragment; |
|||
import androidx.lifecycle.Observer; |
|||
import androidx.lifecycle.ViewModelProvider; |
|||
|
|||
import hu.paroczaioliver.projectlancer.R; |
|||
|
|||
public class ProjectsFragment extends Fragment { |
|||
|
|||
private hu.paroczaioliver.projectlancer.ui.projects.ProjectsViewModel ProjectsViewModel; |
|||
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, |
|||
ViewGroup container, Bundle savedInstanceState) { |
|||
ProjectsViewModel = |
|||
new ViewModelProvider(this).get(hu.paroczaioliver.projectlancer.ui.projects.ProjectsViewModel.class); |
|||
View root = inflater.inflate(R.layout.fragment_projects, container, false); |
|||
final TextView textView = root.findViewById(R.id.text_projects); |
|||
ProjectsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() { |
|||
@Override |
|||
public void onChanged(@Nullable String s) { |
|||
textView.setText(s); |
|||
} |
|||
}); |
|||
return root; |
|||
} |
|||
} |
@ -1,19 +0,0 @@ |
|||
package hu.paroczaioliver.projectlancer.ui.projects; |
|||
|
|||
import androidx.lifecycle.LiveData; |
|||
import androidx.lifecycle.MutableLiveData; |
|||
import androidx.lifecycle.ViewModel; |
|||
|
|||
public class ProjectsViewModel extends ViewModel { |
|||
|
|||
private MutableLiveData<String> mText; |
|||
|
|||
public ProjectsViewModel() { |
|||
mText = new MutableLiveData<>(); |
|||
mText.setValue("Projektek - Fejlesztés alatt"); |
|||
} |
|||
|
|||
public LiveData<String> getText() { |
|||
return mText; |
|||
} |
|||
} |
@ -1,35 +0,0 @@ |
|||
package hu.paroczaioliver.projectlancer.ui.schools; |
|||
|
|||
import android.os.Bundle; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
import android.widget.TextView; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.annotation.Nullable; |
|||
import androidx.fragment.app.Fragment; |
|||
import androidx.lifecycle.Observer; |
|||
import androidx.lifecycle.ViewModelProvider; |
|||
|
|||
import hu.paroczaioliver.projectlancer.R; |
|||
|
|||
public class SchoolsFragment extends Fragment { |
|||
|
|||
private SchoolsViewModel schoolsViewModel; |
|||
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, |
|||
ViewGroup container, Bundle savedInstanceState) { |
|||
schoolsViewModel = |
|||
new ViewModelProvider(this).get(SchoolsViewModel.class); |
|||
View root = inflater.inflate(R.layout.fragment_schools, container, false); |
|||
final TextView textView = root.findViewById(R.id.text_schools); |
|||
schoolsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() { |
|||
@Override |
|||
public void onChanged(@Nullable String s) { |
|||
textView.setText(s); |
|||
} |
|||
}); |
|||
return root; |
|||
} |
|||
} |
@ -1,19 +0,0 @@ |
|||
package hu.paroczaioliver.projectlancer.ui.schools; |
|||
|
|||
import androidx.lifecycle.LiveData; |
|||
import androidx.lifecycle.MutableLiveData; |
|||
import androidx.lifecycle.ViewModel; |
|||
|
|||
public class SchoolsViewModel extends ViewModel { |
|||
|
|||
private MutableLiveData<String> mText; |
|||
|
|||
public SchoolsViewModel() { |
|||
mText = new MutableLiveData<>(); |
|||
mText.setValue("Iskolák - Fejlesztés alatt"); |
|||
} |
|||
|
|||
public LiveData<String> getText() { |
|||
return mText; |
|||
} |
|||
} |
Loading…
Reference in new issue