-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
340 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
package worten.aebd.com.worten; | ||
|
||
import android.app.ActionBar; | ||
import android.app.Activity; | ||
import android.app.Fragment; | ||
import android.app.FragmentManager; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v4.widget.DrawerLayout; | ||
import android.view.LayoutInflater; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.Button; | ||
import android.widget.Toast; | ||
|
||
|
||
public class Ticket extends Activity | ||
implements NavigationDrawerFragment.NavigationDrawerCallbacks { | ||
|
||
/** | ||
* Fragment managing the behaviors, interactions and presentation of the navigation drawer. | ||
*/ | ||
private NavigationDrawerFragment mNavigationDrawerFragment; | ||
|
||
/** | ||
* Used to store the last screen title. For use in {@link #restoreActionBar()}. | ||
*/ | ||
private CharSequence mTitle; | ||
|
||
private Button ok; | ||
|
||
private boolean cambio = false; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_ticket); | ||
|
||
mNavigationDrawerFragment = (NavigationDrawerFragment) | ||
getFragmentManager().findFragmentById(R.id.navigation_drawer); | ||
mTitle = getTitle(); | ||
|
||
// Set up the drawer. | ||
mNavigationDrawerFragment.setUp( | ||
R.id.navigation_drawer, | ||
(DrawerLayout) findViewById(R.id.drawer_layout),1); | ||
|
||
ok = (Button) findViewById(R.id.button); | ||
/* | ||
mListView = (ListView) findViewById(R.id.product_label); | ||
mListView.setAdapter(new ArrayAdapter<String>(getActionBar().getThemedContext(), | ||
android.R.layout.simple_list_item_1, categorias)); | ||
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { | ||
@Override | ||
public void onItemClick(AdapterView<?> pariente, View view, int posicion, long id) { | ||
String elegido = (String) pariente.getItemAtPosition(posicion); | ||
CharSequence texto = "Seleccionado: " + elegido; | ||
Toast toast = Toast.makeText(Shop.this, texto, Toast.LENGTH_LONG); | ||
toast.show(); | ||
} | ||
});*/ | ||
|
||
ok.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
Carro.erase(); | ||
Intent mainIntent = new Intent(); | ||
mainIntent = new Intent().setClass( | ||
Ticket.this, Shop.class); | ||
startActivity(mainIntent); | ||
} | ||
}); | ||
|
||
|
||
} | ||
|
||
@Override | ||
public void onNavigationDrawerItemSelected(int position) { | ||
// update the main content by replacing fragments | ||
FragmentManager fragmentManager = getFragmentManager(); | ||
fragmentManager.beginTransaction() | ||
.replace(R.id.container, PlaceholderFragment.newInstance(position + 1)) | ||
.commit(); | ||
|
||
} | ||
|
||
public void onSectionAttached(int number) { | ||
if(cambio){ | ||
Intent mainIntent = new Intent(); | ||
if(Session.isLogin()){ | ||
switch (number) { | ||
case 1: | ||
mainIntent = new Intent().setClass( | ||
Ticket.this, Shop.class); | ||
startActivity(mainIntent); | ||
break; | ||
case 2: | ||
mainIntent = new Intent().setClass( | ||
Ticket.this, Scaner.class); | ||
startActivity(mainIntent); | ||
break; | ||
case 3: | ||
mainIntent = new Intent().setClass( | ||
Ticket.this, Games.class); | ||
startActivity(mainIntent); | ||
break; | ||
case 4: | ||
mainIntent = new Intent().setClass( | ||
Ticket.this, Ticket.class); | ||
startActivity(mainIntent); | ||
break; | ||
case 5: | ||
mainIntent = new Intent().setClass( | ||
Ticket.this, Compra.class); | ||
startActivity(mainIntent); | ||
break; | ||
default:break; | ||
}}else{ | ||
|
||
switch (number) { | ||
case 1: | ||
mainIntent = new Intent().setClass( | ||
Ticket.this, Shop.class); | ||
startActivity(mainIntent); | ||
break; | ||
case 2: | ||
mainIntent = new Intent().setClass( | ||
Ticket.this, Login.class); | ||
startActivity(mainIntent); | ||
break; | ||
case 3: | ||
mainIntent = new Intent().setClass( | ||
Ticket.this, Login.class); | ||
startActivity(mainIntent); | ||
break; | ||
case 4: | ||
mainIntent = new Intent().setClass( | ||
Ticket.this, Login.class); | ||
startActivity(mainIntent); | ||
break; | ||
case 5: | ||
mainIntent = new Intent().setClass( | ||
Ticket.this, Login.class); | ||
startActivity(mainIntent); | ||
break; | ||
default:break; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
}}else{ | ||
cambio = true; | ||
} | ||
} | ||
|
||
public void restoreActionBar() { | ||
ActionBar actionBar = getActionBar(); | ||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); | ||
actionBar.setDisplayShowTitleEnabled(true); | ||
actionBar.setTitle(mTitle); | ||
} | ||
|
||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
if (!mNavigationDrawerFragment.isDrawerOpen()) { | ||
// Only show items in the action bar relevant to this screen | ||
// if the drawer is not showing. Otherwise, let the drawer | ||
// decide what to show in the action bar. | ||
getMenuInflater().inflate(R.menu.shop, menu); | ||
menu.getItem(1).setVisible(Session.isLogin()); | ||
restoreActionBar(); | ||
return true; | ||
} | ||
return super.onCreateOptionsMenu(menu); | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
// Handle action bar item clicks here. The action bar will | ||
// automatically handle clicks on the Home/Up button, so long | ||
// as you specify a parent activity in AndroidManifest.xml. | ||
int id = item.getItemId(); | ||
if (id == R.id.close_settings) { | ||
|
||
Session.closeSesion(); | ||
|
||
CharSequence texto = "Has cerrado sesion"; | ||
Toast toast = Toast.makeText(Ticket.this, texto, Toast.LENGTH_LONG); | ||
toast.show(); | ||
|
||
Intent mainIntent = new Intent(); | ||
mainIntent = new Intent().setClass( | ||
Ticket.this, Shop.class); | ||
startActivity(mainIntent); | ||
finish(); | ||
|
||
return true; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
|
||
/** | ||
* A placeholder fragment containing a simple view. | ||
*/ | ||
public static class PlaceholderFragment extends Fragment { | ||
/** | ||
* The fragment argument representing the section number for this | ||
* fragment. | ||
*/ | ||
private static final String ARG_SECTION_NUMBER = "section_number"; | ||
|
||
/** | ||
* Returns a new instance of this fragment for the given section | ||
* number. | ||
*/ | ||
public static PlaceholderFragment newInstance(int sectionNumber) { | ||
PlaceholderFragment fragment = new PlaceholderFragment(); | ||
Bundle args = new Bundle(); | ||
args.putInt(ARG_SECTION_NUMBER, sectionNumber); | ||
fragment.setArguments(args); | ||
return fragment; | ||
} | ||
|
||
public PlaceholderFragment() { | ||
} | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) { | ||
View rootView = inflater.inflate(R.layout.fragment_shop, container, false); | ||
return rootView; | ||
} | ||
|
||
@Override | ||
public void onAttach(Activity activity) { | ||
super.onAttach(activity); | ||
((Ticket) activity).onSectionAttached( | ||
getArguments().getInt(ARG_SECTION_NUMBER)); | ||
} | ||
} | ||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. --> | ||
<android.support.v4.widget.DrawerLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/drawer_layout" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".Ticket"> | ||
|
||
<!-- As the main content view, the view below consumes the entire | ||
space available using match_parent in both dimensions. --> | ||
<FrameLayout android:id="@+id/container" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<LinearLayout | ||
android:orientation="vertical" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent"> | ||
|
||
<TextView | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:textAppearance="?android:attr/textAppearanceLarge" | ||
android:text="¡¡ Gracias por su Compra !!" | ||
android:id="@+id/textView2" | ||
android:gravity="center" /> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:textAppearance="?android:attr/textAppearanceMedium" | ||
android:text="Por favor, acuda a recoger su pedido en los próximos XX días en en su centro Worten YY más cercano.\n" | ||
android:id="@+id/textView" | ||
android:layout_gravity="center_horizontal|top" /> | ||
|
||
<ImageView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:id="@+id/imageView" | ||
android:layout_gravity="center" | ||
android:src="@drawable/im_qr" /> | ||
|
||
<TextView | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:textAppearance="?android:attr/textAppearanceMedium" | ||
android:text="Entrega por favor este código QR para a la hora de la recogida" | ||
android:id="@+id/textView3" /> | ||
|
||
<Button | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Hecho" | ||
android:id="@+id/button" | ||
android:layout_gravity="center" /> | ||
</LinearLayout> | ||
|
||
</FrameLayout> | ||
|
||
|
||
<!-- android:layout_gravity="start" tells DrawerLayout to treat | ||
this as a sliding drawer on the left side for left-to-right | ||
languages and on the right side for right-to-left languages. | ||
If you're not building against API 17 or higher, use | ||
android:layout_gravity="left" instead. --> | ||
<!-- The drawer is given a fixed width in dp and extends the full height of | ||
the container. --> | ||
<fragment android:id="@+id/navigation_drawer" | ||
android:layout_width="@dimen/navigation_drawer_width" | ||
android:layout_height="match_parent" | ||
android:layout_gravity="start" | ||
android:name="worten.aebd.com.worten.NavigationDrawerFragment" | ||
tools:layout="@layout/fragment_shop" /> | ||
|
||
|
||
</android.support.v4.widget.DrawerLayout> |