Skip to content

Instantly share code, notes, and snippets.

View ec84b4's full-sized avatar

Khaled Bakhtiari ec84b4

View GitHub Profile
1 sink(s) available.
* index: 0
name: <alsa_output.pci-0000_00_1f.3.analog-stereo>
driver: <module-alsa-card.c>
flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 9039
volume: front-left: 65536 / 100%, front-right: 65536 / 100%
balance 0.00
0xa6Ec0F9269572ed874c732Fbe7C96524d066F0ac
/**
* checks whether IranApps is installed on the device
*
* @return true if IranApps is installed on the device otherwise false.
*/
private boolean isIranAppsInstalled(Context context) {
try {
context.getPackageManager().getPackageInfo("ir.tgbs.android.iranapp", 0);
return true;
} catch (PackageManager.NameNotFoundException e) {
@ec84b4
ec84b4 / screenSize
Last active January 7, 2018 20:17
android screen size
public void setScreenSize(Context context) {
int x, y, orientation = context.getResources().getConfiguration().orientation;
WindowManager wm = ((WindowManager)
context.getSystemService(Context.WINDOW_SERVICE));
Display display = wm.getDefaultDisplay();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
Point screenSize = new Point();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
display.getRealSize(screenSize);
x = screenSize.x;
@ec84b4
ec84b4 / gist:d56c00fb5fd2dfaf279b
Last active June 26, 2018 06:22
recycler view header adapter
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
/**
* Created by khaled bakhtiari on 10/26/2014.
* <a href="http://about.me/kh.bakhtiari">
*/
package ir.khaled.mydictionary;
/**
* Created by khaled on 7/4/13 at 2:05 AM.
*/
public class ItemPackageShow {
private int id;
private String name;
private String meaningEn;
package ir.khaled.mydictionary;
/**
* Created by khaled on 7/4/13 at 2:05 AM.
*/
public class ItemPackage {
private int id;
private String name;
private String meaningEn;
package ir.khaled.mydictionary;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import java.util.ArrayList;
package ir.khaled.mydictionary;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.app.SearchManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
void checkSiteForVersionChange() throws PackageManager.NameNotFoundException {
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
final String currentVersion = pInfo.versionName;
class FtpTask extends AsyncTask<Void, Integer, Void> {
FTPClient con;
boolean succeed = false;
String error = "";
String errorS = "";
private Context context;