michenux / yourappidea Goto Github PK
View Code? Open in Web Editor NEWProject template for android and demo app for tutorials on www.michenux.net
Project template for android and demo app for tutorials on www.michenux.net
How to test if user login?
It would be great if you add some docs too for this application.
Errors running builder 'Android Pre Compiler' on project 'YourAppMainActivity'.
java.lang.NullPointerException
when I open the project, that is the message what i get
Trying to add homeupenabled icon when fragments added in backstack.
onOptionsItemSelected -- method never getting called.
My Code changes.
Changes in YourAppMainActivity.
@OverRide
public boolean onOptionsItemSelected(MenuItem item) {
NavigationDrawerFragment navigationDrawerFragment = findNavDrawerFragment();
if (navigationDrawerFragment.getDrawerToggle().isDrawerIndicatorEnabled() &&
navigationDrawerFragment.getDrawerToggle().onOptionsItemSelected(item)) {
return true;
}
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
@OverRide
public void onBackStackChanged() {
NavigationDrawerFragment navigationDrawerFragment = findNavDrawerFragment();
ActionBar actionBar = getSupportActionBar();
//TODO - add support to childFragment manager
FragmentManager fm = getSupportFragmentManager();
Fragment currentFragment = fm.findFragmentById(R.id.content_frame);
if (currentFragment != null && fm.getBackStackEntryCount() > 0){
navigationDrawerFragment.getDrawerToggle().setDrawerIndicatorEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(true);
if (currentFragment instanceof MyFragment ) {
mToolBar.setTitle(((MyFragment) currentFragment).getTitle());
}
}else{
actionBar.setDisplayHomeAsUpEnabled(false);
navigationDrawerFragment.getDrawerToggle().setDrawerIndicatorEnabled(true);
navigationDrawerFragment.setTitleWithDrawerTitle();
}
}
Hi, I have recently found your app and it looks great as I have seen demo.
I am facing issue when I run it on android studio although its not app issue but I am newbie to android.
Error:FAILURE: Build completed with 2 failures. 1: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':YourAppIdea:compileDebugJavaWithJavac'. > When running gradle with java 5, 6 or 7, you must set the path to jdk8, either with property retrolambda.jdk or environment variable JAVA8_HOME * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. ============================================================================== 2: Task failed with an exception. ----------- * What went wrong: A problem was found with the configuration of task ':YourAppIdea:compileRetrolambdaDebug'. > Directory '/Users/sohailahmad/Downloads/YourAppIdea-master/YourAppIdea/build/retrolambda/debug' specified for property 'inputDir' does not exist. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. ==============================================================================
Hi, I need some help to fix an issue.
I have created custom mysql authentication fragment and its working fine. I have tried to follow same method as you had done for facebook/googlplus
I can login and headerview is changing perfectly. But I am not getting how to start a session. Once I close app i have to login again.
I tried to add
if (mUserSessionCallback != null) {
mUserSessionCallback.onLogin();
}
but no luck. Here is MySqlAuthFragment class its wokring fine
public class MySqlAuthFragment extends Fragment implements UserSessionCallback, OnClickListener {
// UI references.
private AutoCompleteTextView mEmailView;
private EditText mPasswordView;
@Inject
UserHelper mUserHelper;
private UserSessionCallback mUserSessionCallback;
private MySqlAuthDelegate mMySqlAuthDelegate ;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
((YourApplication) getActivity().getApplication()).inject(this);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.login_form, container, false);
// Set up the login form.
mEmailView = (AutoCompleteTextView) view.findViewById(R.id.email);
// populateAutoComplete();
mPasswordView = (EditText) view.findViewById(R.id.password);
mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
if (id == R.id.login || id == EditorInfo.IME_NULL) {
attemptLogin();
return true;
}
return false;
}
});
Button mEmailSignInButton = (Button) view.findViewById(R.id.buttonLogin);
mEmailSignInButton.setOnClickListener(this);
return view;
}
@Override
public void onClick(View view) {
attemptLogin();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mMySqlAuthDelegate.onActivityResult(requestCode, resultCode, data);
}
private void attemptLogin() {
// Reset errors.
mEmailView.setError(null);
mPasswordView.setError(null);
// Store values at the time of the login attempt.
final String email = mEmailView.getText().toString().trim();;
final String password = mPasswordView.getText().toString().trim();;
boolean cancel = false;
View focusView = null;
if (cancel) {
// There was an error; don't attempt login and focus the first
// form field with an error.
focusView.requestFocus();
} else {
//Creating a string request
StringRequest stringRequest = new StringRequest(Request.Method.POST, Config.URL_SIGN_IN_USER,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
//If we are getting success from server
if(response.equalsIgnoreCase(Config.LOGIN_SUCCESS)){
User currentUser = new User();
currentUser.setUserId("25"); // id from public_profile
currentUser.setDisplayName("Nomi"); // name from public_profile
currentUser.setMail(email); // name from email
currentUser.setProviderDisplayName("Custom Login");
mUserHelper.setCurrentUser(currentUser);
if (mUserSessionCallback != null) {
mUserSessionCallback.onLogin();
}
getActivity().finish();
Log.v("TAG:", "You are in now.");
}else{
//If the server response is not success
//Displaying an error message on toast//Toast.makeText(this, "Invalid username or password", Toast.LENGTH_LONG).show();
Log.v("TAG:", "Invalid username or password");
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//You can handle error here if you want
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> params = new HashMap<>();
//Adding parameters to request
params.put(Config.KEY_SIGN_IN_EMAIL, email);
params.put(Config.KEY_SIGN_IN_PASSWORD, password);
//returning parameter
return params;
}
};
//Adding the string request to the queue
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
requestQueue.add(stringRequest);
}
}
@Override
public void onLogin() {
if ( this.getActivity() != null ) {
this.getActivity().finish();
}
}
@Override
public void onLogout() {
// Signed out, show unauthenticated UI.
this.mUserSessionCallback.onLogout();
}
public void setUserSessionCallback(UserSessionCallback userSessionCallback) {
this.mUserSessionCallback = userSessionCallback;
}
}
04-30 04:14:52.968 16075-16075/org.michenux.yourappidea.debug D/AndroidRuntime: Shutting down VM
04-30 04:14:52.971 16075-16075/org.michenux.yourappidea.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.michenux.yourappidea.debug, PID: 16075
java.lang.RuntimeException: Unable to get provider org.michenux.yourappidea.aroundme.PlaceContentProvider: java.lang.ClassCastException: com.android.tools.fd.runtime.BootstrapApplication cannot be cast to org.michenux.drodrolib.MCXApplication
at android.app.ActivityThread.installProvider(ActivityThread.java:5156)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
_ Caused by: java.lang.ClassCastException: com.android.tools.fd.runtime.BootstrapApplication cannot be cast to org.michenux.drodrolib.MCXApplication_
at org.michenux.drodrolib.db.AbstractContentProvider.onCreate(AbstractContentProvider.java:40)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Hey,
I have used your Navigation Drawer and its really awesome. The best one I've used. I modified it a bit so I can have my own backgroundcolor and don't have to use an image. I added a method, that has the name createColor
and gets a color as an additional paramter to the create
-method.
What I have are 3 sections. The user is able to select one item from each section and the fragment gets changed dependent on the user selection. This works without any problems. The filtering works perfectly fine.
The only thing I want to do know is to highlight the selections by also giving them a blue background. But the problem is that only the settings that I've defined at the beginning are the ones that get blue
This is my Config
@OverRide
protected NavDrawerActivityConfiguration getNavDrawerConfiguration() {
NavMenuSection topCharts;
NavMenuSection sources;
NavMenuSection sort;
NavMenuSection links;
NavMenuItem today;
NavMenuItem week;
NavMenuItem month;
NavMenuItem year;
NavMenuItem allBlogs;
NavMenuItem onlyBlogs;
NavMenuItem allNetworks;
NavMenuItem facebook;
NavMenuItem twitter;
NavMenuItem google;
NavMenuItem fliesBlog;
NavMenuItem feedback;
NavMenuItem impress;
topCharts = NavMenuSection.create(100, "Top-Charts" );
sources = NavMenuSection.create(200, "Quellen" );
sort = NavMenuSection.create(300, "Sortierung" );
links = NavMenuSection.create(400, "Links" );
Log.v ( "getNavdrawerConfiguration" , "timefilter: " + this.getTimefilter() );
Log.v ( "getNavdrawerConfiguration" , "blogfilter: " + this.getBlogfilter() );
Log.v ( "getNavdrawerConfiguration" , "socialfilter: " + this.getSocialfilter() );
if ( this.getTimefilter() == null || this.getTimefilter().equals ( "main" ) ){
today = NavMenuItem.createColor (101, "Heute" , false, this, getResources().getColor(R.color.actionBarOwn));
week = NavMenuItem.create (102, "Woche" , false, this);
month = NavMenuItem.create (103, "Monat" , false, this);
year = NavMenuItem.create (104, "Jahr" , false, this);
} else if ( this.getTimefilter().equals ( "week" ) ){
today = NavMenuItem.create (101, "Heute" , false, this);
week = NavMenuItem.createColor (102, "Woche" , false, this, getResources().getColor(R.color.actionBarOwn));
month = NavMenuItem.create (103, "Monat" , false, this);
year = NavMenuItem.create (104, "Jahr" , false, this);
} else if ( this.getTimefilter().equals ( "month" ) ){
today = NavMenuItem.create (101, "Heute" , false, this);
week = NavMenuItem.create (102, "Woche" , false, this);
month = NavMenuItem.createColor (103, "Monat" , false, this, getResources().getColor(R.color.actionBarOwn));
year = NavMenuItem.create (104, "Jahr" , false, this);
} else {
today = NavMenuItem.create (101, "Heute" , false, this);
week = NavMenuItem.create (102, "Woche" , false, this);
month = NavMenuItem.create (103, "Monat" , false, this);
year = NavMenuItem.createColor (104, "Jahr" , false, this, getResources().getColor(R.color.actionBarOwn));
}
if ( this.getBlogfilter() == null || this.getBlogfilter().equals ( "main" ) ){
allBlogs = NavMenuItem.createColor (201, "Alle Quellen" , false, this, getResources().getColor(R.color.actionBarOwn));
onlyBlogs = NavMenuItem.create (202, "Nur Blogs" , false, this);
} else {
allBlogs = NavMenuItem.create (201, "Alle Quellen" , false, this);
onlyBlogs = NavMenuItem.createColor (202, "Nur Blogs" , false, this, getResources().getColor(R.color.actionBarOwn));
}
if ( this.getSocialfilter() == null || this.getSocialfilter().equals ( "main" ) ){
allNetworks = NavMenuItem.createColor (301, "Alle Netzwerke" , false, this, getResources().getColor(R.color.actionBarOwn));
facebook = NavMenuItem.create (302, "Facebook" , false, this);
twitter = NavMenuItem.create (303, "Twitter" , false, this);
google = NavMenuItem.create (304, "Google+" , false, this);
} else if ( this.getSocialfilter().equals ( "facebook" ) ){
allNetworks = NavMenuItem.create (301, "Alle Netzwerke" , false, this);
facebook = NavMenuItem.createColor (302, "Facebook" , false, this, getResources().getColor(R.color.actionBarOwn));
twitter = NavMenuItem.create (303, "Twitter" , false, this);
google = NavMenuItem.create (304, "Google+" , false, this);
} else if ( this.getSocialfilter().equals ( "twitter" ) ){
allNetworks = NavMenuItem.create (301, "Alle Netzwerke" , false, this);
facebook = NavMenuItem.create (302, "Facebook" , false, this);
twitter = NavMenuItem.createColor (303, "Twitter" , false, this, getResources().getColor(R.color.actionBarOwn));
google = NavMenuItem.create (304, "Google+" , false, this);
} else {
allNetworks = NavMenuItem.create (301, "Alle Netzwerke" , false, this);
facebook = NavMenuItem.create (302, "Facebook" , false, this);
twitter = NavMenuItem.create (303, "Twitter" , false, this);
google = NavMenuItem.createColor (304, "Google+" , false, this, getResources().getColor(R.color.actionBarOwn));
}
fliesBlog = NavMenuItem.create(401, "10000 Flies Blog", false, this);
feedback = NavMenuItem.create(402, "Feedback" , false, this);
impress = NavMenuItem.create(403, "Impressum" , false, this);
NavDrawerItem[] menu = new NavDrawerItem[] {
topCharts,
today,
week,
month,
year,
sources,
allBlogs,
onlyBlogs,
sort,
allNetworks,
facebook,
twitter,
google,
links,
fliesBlog,
feedback,
impress,
};
NavDrawerActivityConfiguration navDrawerActivityConfiguration = new NavDrawerActivityConfiguration();
navDrawerActivityConfiguration.setMainLayout(R.layout.activity_main);
navDrawerActivityConfiguration.setDrawerLayoutId(R.id.drawer_layout);
navDrawerActivityConfiguration.setLeftDrawerId(R.id.left_drawer);
navDrawerActivityConfiguration.setNavItems(menu);
navDrawerActivityConfiguration
.setDrawerShadow(R.drawable.drawer_shadow);
navDrawerActivityConfiguration.setDrawerOpenDesc(R.string.open_drawer);
navDrawerActivityConfiguration.setDrawerCloseDesc(R.string.mainTitle);
navDrawerActivityConfiguration.setBaseAdapter(new NavDrawerAdapter(
this, R.layout.navdrawer_item, menu));
return navDrawerActivityConfiguration;
}
As you can see, when a certain filter is set the Navigation Menu should change. The logcat, also tells me the set timefilter, socialfilter and blogfilter. So that would mean, that the app always comes again into the NavigationDrawreConfiguration but doesn't set it.
I tried so many things like invalidateOptionsmenu and clear the adapter. But none of them worked. I would be really happy if you could tell me how exactly I can do that!
I'm getting Error:(19, 24) error: cannot find symbol variable PACKAGE_NAME when I build it using Android Studio (1.0.2). Where do I define it? This error is coming from multiple files.
Please help.
Can you please help:
07-14 12:48:11.779 21178-21178/org.michenux.yourappidea.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.michenux.yourappidea.debug, PID: 21178
java.lang.RuntimeException: Unable to get provider org.michenux.yourappidea.tutorial.sync.TutorialContentProvider: java.lang.ClassCastException: com.android.tools.fd.runtime.BootstrapApplication cannot be cast to org.michenux.drodrolib.MCXApplication
at android.app.ActivityThread.installProvider(ActivityThread.java:5558)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5150)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5090)
at android.app.ActivityThread.access$1600(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1509)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5938)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Caused by: java.lang.ClassCastException: com.android.tools.fd.runtime.BootstrapApplication cannot be cast to org.michenux.drodrolib.MCXApplication
at org.michenux.drodrolib.db.AbstractContentProvider.onCreate(AbstractContentProvider.java:40)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1716)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1685)
at android.app.ActivityThread.installProvider(ActivityThread.java:5555)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5150)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5090)
at android.app.ActivityThread.access$1600(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1509)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5938)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Thank you for this starter app
As in Airport section, i wanted to list items from this json string
[
{
"id": "833",
"name": "ListName1",
"list_count": "3"
},
{
"id": "834",
"name": "ListName2",
"list_count": "427311"
}
]
But I've got this error
GSON throwing Expected BEGIN_OBJECT but was BEGIN_ARRAY
It's clear that my json response is an Array instead of Object,
But how to fix this for Array response here
https://github.com/Michenux/YourAppIdea/blob/master/YourAppIdea/src/main/java/org/michenux/yourappidea/airport/AirportListFragment.java#L144
Thank you
The *.iml files in .gitignore has wrong names. Could you please fix it? Thanks!
list/detail fragment - friends list not scrolling to buttom. its fixed height.
changed android:layout_height="wrap_content" to id-friend_recyclerview.
no luck. Please help
@Michenux How this can be achieved?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.