This file contains hidden or 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
public boolean isTablet(Context context) { | |
boolean xlarge = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == 4); | |
boolean large = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE); | |
return (xlarge || large); | |
} |
This file contains hidden or 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
/** | |
* Checks if the device is a tablet or a phone | |
* | |
* @param activityContext | |
* The Activity Context. | |
* @return Returns true if the device is a Tablet | |
*/ | |
public static boolean isTabletDevice(Context activityContext) { | |
// Verifies if the Generalized Size of the device is XLARGE to be | |
// considered a Tablet |
This file contains hidden or 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
public Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) { | |
int width = bm.getWidth(); | |
int height = bm.getHeight(); | |
float scaleWidth = ((float) newWidth) / width; | |
float scaleHeight = ((float) newHeight) / height; |
This file contains hidden or 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
public static Bitmap convertToMutable(Bitmap imgIn) { | |
try { | |
//this is the file going to use temporally to save the bytes. | |
// This file will not be a image, it will store the raw image data. | |
File file = new File(Environment.getExternalStorageDirectory() + File.separator + "temp.tmp"); | |
//Open an RandomAccessFile | |
//Make sure you have added uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" | |
//into AndroidManifest.xml file | |
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw"); |
This file contains hidden or 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
class CheckIn(db.Model): | |
__tablename__ = 'checkins' | |
id = db.Column(db.Integer, primary_key=True) | |
location_id = db.Column(db.Integer) | |
user_id = db.Column(db.Integer) | |
date = db.Column(db.DateTime) | |
def to_dict(self): | |
return{ |
This file contains hidden or 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
@app.route('/locations/add', methods=['POST']) | |
def add_loc(): | |
db.execute('insert into locations(name, blurb, phone_number, address, url) values(?,?,?,?,?)', [request.form['name'], request.form['blurb'], request.form['phone'], request.form['address'], request.form['url']]) | |
db.commit() | |
return |
NewerOlder