برترین های انجمن

  1. a.khosroabadi

    a.khosroabadi

    مدیر انجمن


    • امتیاز: پسندیدن (Likes)

      4

    • تعداد ارسال ها

      124


  2. Farzad Sarseifi

    Farzad Sarseifi

    مدیریت انجمن


    • امتیاز: پسندیدن (Likes)

      3

    • تعداد ارسال ها

      1,719


  3. Mohammad Amin

    Mohammad Amin

    توسعه دهنده اندروید


    • امتیاز: پسندیدن (Likes)

      1

    • تعداد ارسال ها

      5


  4. Roshanak Armandeh

    Roshanak Armandeh

    توسعه دهنده اندروید


    • امتیاز: پسندیدن (Likes)

      1

    • تعداد ارسال ها

      3



Popular Content

Showing most liked content since ۱۷/۰۴/۲۰ in all areas

  1. 2 likes
    سلام دوست عزیز میتونید پارامتر های زیر رو ست کنید که باعث میشه دیگه از کش نخونه هر مرتبه از رو سرور بخونه Picasso.with(context).load(url).networkPolicy(NetworkPolicy.NO_CACHE).memoryPolicy(MemoryPolicy.NO_CACHE);
  2. 1 like
    اینکار امکان پذیر نیستش ،فقط میتونید اینکارو کنید که مجوز ها به صورت گروهی داده شود activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="info.androidhive.mpermissions.MainActivity"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /> </android.support.design.widget.AppBarLayout> <RelativeLayout android:id="@+id/content_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="info.androidhive.mpermissions.MainActivity" tools:showIn="@layout/activity_main"> <Button android:id="@+id/btnLaunchMultiplePermission" android:layout_below="@+id/imageView" android:layout_marginTop="20dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Request Multiple Permissions"/> <Button android:id="@+id/btnLaunchPermissionFragment" android:layout_below="@+id/btnLaunchMultiplePermission" android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Request Permission on Fragment"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/single_permission_text" android:textAlignment="center" android:layout_alignParentBottom="true" android:layout_alignParentStart="true" android:layout_marginBottom="123dp" /> </RelativeLayout> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" app:srcCompat="@drawable/ic_file_download_black_24dp" /> </android.support.design.widget.CoordinatorLayout> Manifest : <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> import android.Manifest; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.net.Uri; import android.provider.Settings; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class MultiplePermissionsActivity extends AppCompatActivity { private static final int PERMISSION_CALLBACK_CONSTANT = 100; private static final int REQUEST_PERMISSION_SETTING = 101; String[] permissionsRequired = new String[]{Manifest.permission.CAMERA, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}; private TextView txtPermissions; private Button btnCheckPermissions; private SharedPreferences permissionStatus; private boolean sentToSettings = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_multiple_permissions); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); permissionStatus = getSharedPreferences("permissionStatus",MODE_PRIVATE); txtPermissions = (TextView) findViewById(R.id.txtPermissions); btnCheckPermissions = (Button) findViewById(R.id.btnCheckPermissions); btnCheckPermissions.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(ActivityCompat.checkSelfPermission(MultiplePermissionsActivity.this, permissionsRequired[0]) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(MultiplePermissionsActivity.this, permissionsRequired[1]) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(MultiplePermissionsActivity.this, permissionsRequired[2]) != PackageManager.PERMISSION_GRANTED){ if(ActivityCompat.shouldShowRequestPermissionRationale(MultiplePermissionsActivity.this,permissionsRequired[0]) || ActivityCompat.shouldShowRequestPermissionRationale(MultiplePermissionsActivity.this,permissionsRequired[1]) || ActivityCompat.shouldShowRequestPermissionRationale(MultiplePermissionsActivity.this,permissionsRequired[2])){ //Show Information about why you need the permission AlertDialog.Builder builder = new AlertDialog.Builder(MultiplePermissionsActivity.this); builder.setTitle("Need Multiple Permissions"); builder.setMessage("This app needs Camera and Location permissions."); builder.setPositiveButton("Grant", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); ActivityCompat.requestPermissions(MultiplePermissionsActivity.this,permissionsRequired,PERMISSION_CALLBACK_CONSTANT); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.show(); } else if (permissionStatus.getBoolean(permissionsRequired[0],false)) { //Previously Permission Request was cancelled with 'Dont Ask Again', // Redirect to Settings after showing Information about why you need the permission AlertDialog.Builder builder = new AlertDialog.Builder(MultiplePermissionsActivity.this); builder.setTitle("Need Multiple Permissions"); builder.setMessage("This app needs Camera and Location permissions."); builder.setPositiveButton("Grant", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); sentToSettings = true; Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts("package", getPackageName(), null); intent.setData(uri); startActivityForResult(intent, REQUEST_PERMISSION_SETTING); Toast.makeText(getBaseContext(), "Go to Permissions to Grant Camera and Location", Toast.LENGTH_LONG).show(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.show(); } else { //just request the permission ActivityCompat.requestPermissions(MultiplePermissionsActivity.this,permissionsRequired,PERMISSION_CALLBACK_CONSTANT); } txtPermissions.setText("Permissions Required"); SharedPreferences.Editor editor = permissionStatus.edit(); editor.putBoolean(permissionsRequired[0],true); editor.commit(); } else { //You already have the permission, just go ahead. proceedAfterPermission(); } } }); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if(requestCode == PERMISSION_CALLBACK_CONSTANT){ //check if all permissions are granted boolean allgranted = false; for(int i=0;i<grantResults.length;i++){ if(grantResults[i]==PackageManager.PERMISSION_GRANTED){ allgranted = true; } else { allgranted = false; break; } } if(allgranted){ proceedAfterPermission(); } else if(ActivityCompat.shouldShowRequestPermissionRationale(MultiplePermissionsActivity.this,permissionsRequired[0]) || ActivityCompat.shouldShowRequestPermissionRationale(MultiplePermissionsActivity.this,permissionsRequired[1]) || ActivityCompat.shouldShowRequestPermissionRationale(MultiplePermissionsActivity.this,permissionsRequired[2])){ txtPermissions.setText("Permissions Required"); AlertDialog.Builder builder = new AlertDialog.Builder(MultiplePermissionsActivity.this); builder.setTitle("Need Multiple Permissions"); builder.setMessage("This app needs Camera and Location permissions."); builder.setPositiveButton("Grant", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); ActivityCompat.requestPermissions(MultiplePermissionsActivity.this,permissionsRequired,PERMISSION_CALLBACK_CONSTANT); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.show(); } else { Toast.makeText(getBaseContext(),"Unable to get Permission",Toast.LENGTH_LONG).show(); } } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_PERMISSION_SETTING) { if (ActivityCompat.checkSelfPermission(MultiplePermissionsActivity.this, permissionsRequired[0]) == PackageManager.PERMISSION_GRANTED) { //Got Permission proceedAfterPermission(); } } } private void proceedAfterPermission() { txtPermissions.setText("We've got all permissions"); Toast.makeText(getBaseContext(), "We got All Permissions", Toast.LENGTH_LONG).show(); } @Override protected void onPostResume() { super.onPostResume(); if (sentToSettings) { if (ActivityCompat.checkSelfPermission(MultiplePermissionsActivity.this, permissionsRequired[0]) == PackageManager.PERMISSION_GRANTED) { //Got Permission proceedAfterPermission(); } } } } Download Sample M Permissions.zip
  3. 1 like
  4. 1 like
  5. 1 like
    خوب خداروشکر خواهش میکنم موفق باشید دوست عزیز
  6. 1 like
    برای اینکه بتونید از امکانات این کتابخونه استفاده کنید باید اونو به پروژه اضافه کنید به این صورت تو فایل gradle compile 'com.nineoldandroids:library:2.4.0'
  7. 1 like
    ساخت بازی سگا (همراه با سورس و تعدادی بازی ) در این آموزش سعی شده مرحله به مرحله همراه با عکس به شما آموزش داده شود که یک بازی سگا برای سیستم عامل اندروید در کمتر از 10 دقیقه و بدون هیچ دانش برنامه نویسی بسازید. بعد از ساخت این بازی می توانید از بازی خود لذت ببرید و یا بازی خود را در یک مارکت (مثل بازار) برای فروش قرار دهید و مثل خیلی از دوستان دیگر پول خوبی بدست آورید. پس لطفا مرحله به مرحله آموزش را با دقت فراوان انجام داده و در صورت هر گونه سوال یا مشکلی با ایمیل ذکر شده در قسمت " درباره ما " تماس بگیرید. موفق باشید. لینک دانلود
  8. 1 like
  9. 1 like
    ابتدا به آدرس زیر بروید : اسم پروژه و PackageName پروژه خودتون رو وارد کنید https://developers.google.com/mobile/add?platform=android&cntapi=signin&cntapp=Defaolt Demo App&cntpkg=com.google.samples.quickstart.signin&cnturl=https:%2F%2Fdevelopers.google.com%2Fidentity%2Fsign-in%2Fandroid%2Fstart%3Fconfigured%3Dtrue&cntlbl=Continue with Try Sign-In در این مرحله میبایستی گزیه Choose and configure services رو انتخاب کنید و سپس Google Sign In : در مرحله بعد میبایستید sh1 خودتون رو بدست بیارید .به مسیر زیر بروید نصب جاوا برید و فایل keytool رو اجرا کنید keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android دستور مک و لینوکس : keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android خروجی : اطلاعات SHA1 را کپی کرده و در بخش پایین وارد میکنیم در مرحله آخر فایل google-services.json را دانلود کنید و در پروژه خودتون کپی کنید سپس در فایل build.gradle : بخش project level dependencies { classpath 'com.android.tools.build:gradle:2.1.0' classpath 'com.google.gms:google-services:3.0.0' } سپس در فایل build.gradle : بخش app-level apply plugin: 'com.google.gms.google-services' طراحی رابط کاربری : <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="16dp" tools:context=".MainActivity" > <LinearLayout android:id="@+id/llProfile" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="20dp" android:orientation="horizontal" android:weightSum="3" android:visibility="gone"> <ImageView android:id="@+id/imgProfilePic" android:layout_width="80dp" android:layout_height="wrap_content" android:layout_weight="1"/> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:orientation="vertical" android:layout_weight="2" > <TextView android:id="@+id/txtName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dp" android:textSize="20dp" /> <TextView android:id="@+id/txtEmail" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dp" android:textSize="18dp" /> </LinearLayout> </LinearLayout> <com.google.android.gms.common.SignInButton android:id="@+id/btn_sign_in" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="20dp"/> <Button android:id="@+id/btn_sign_out" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/btn_logout_from_google" android:visibility="gone" android:layout_marginBottom="10dp"/> <Button android:id="@+id/btn_revoke_access" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/btn_revoke_access" android:visibility="gone" /> </LinearLayout> import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.auth.api.signin.GoogleSignInResult; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.SignInButton; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.OptionalPendingResult; import com.google.android.gms.common.api.ResultCallback; import com.google.android.gms.common.api.Status; public class MainActivity extends AppCompatActivity implements View.OnClickListener, GoogleApiClient.OnConnectionFailedListener { private static final String TAG = MainActivity.class.getSimpleName(); private static final int RC_SIGN_IN = 007; private GoogleApiClient mGoogleApiClient; private ProgressDialog mProgressDialog; private SignInButton btnSignIn; private Button btnSignOut, btnRevokeAccess; private LinearLayout llProfileLayout; private ImageView imgProfilePic; private TextView txtName, txtEmail; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnSignIn = (SignInButton) findViewById(R.id.btn_sign_in); btnSignOut = (Button) findViewById(R.id.btn_sign_out); btnRevokeAccess = (Button) findViewById(R.id.btn_revoke_access); llProfileLayout = (LinearLayout) findViewById(R.id.llProfile); imgProfilePic = (ImageView) findViewById(R.id.imgProfilePic); txtName = (TextView) findViewById(R.id.txtName); txtEmail = (TextView) findViewById(R.id.txtEmail); btnSignIn.setOnClickListener(this); btnSignOut.setOnClickListener(this); btnRevokeAccess.setOnClickListener(this); GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .build(); mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this, this) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); // Customizing G+ button btnSignIn.setSize(SignInButton.SIZE_STANDARD); btnSignIn.setScopes(gso.getScopeArray()); } private void signIn() { Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient); startActivityForResult(signInIntent, RC_SIGN_IN); } private void signOut() { Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback( new ResultCallback<Status>() { @Override public void onResult(Status status) { updateUI(false); } }); } private void revokeAccess() { Auth.GoogleSignInApi.revokeAccess(mGoogleApiClient).setResultCallback( new ResultCallback<Status>() { @Override public void onResult(Status status) { updateUI(false); } }); } private void handleSignInResult(GoogleSignInResult result) { Log.d(TAG, "handleSignInResult:" + result.isSuccess()); if (result.isSuccess()) { // Signed in successfully, show authenticated UI. GoogleSignInAccount acct = result.getSignInAccount(); Log.e(TAG, "display name: " + acct.getDisplayName()); String personName = acct.getDisplayName(); String personPhotoUrl = acct.getPhotoUrl().toString(); String email = acct.getEmail(); Log.e(TAG, "Name: " + personName + ", email: " + email + ", Image: " + personPhotoUrl); txtName.setText(personName); txtEmail.setText(email); Glide.with(getApplicationContext()).load(personPhotoUrl) .thumbnail(0.5f) .crossFade() .diskCacheStrategy(DiskCacheStrategy.ALL) .into(imgProfilePic); updateUI(true); } else { // Signed out, show unauthenticated UI. updateUI(false); } } @Override public void onClick(View v) { int id = v.getId(); switch (id) { case R.id.btn_sign_in: signIn(); break; case R.id.btn_sign_out: signOut(); break; case R.id.btn_revoke_access: revokeAccess(); break; } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...); if (requestCode == RC_SIGN_IN) { GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); handleSignInResult(result); } } @Override public void onStart() { super.onStart(); OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient); if (opr.isDone()) { // If the user's cached credentials are valid, the OptionalPendingResult will be "done" // and the GoogleSignInResult will be available instantly. Log.d(TAG, "Got cached sign-in"); GoogleSignInResult result = opr.get(); handleSignInResult(result); } else { // If the user has not previously signed in on this device or the sign-in has expired, // this asynchronous branch will attempt to sign in the user silently. Cross-device // single sign-on will occur in this branch. showProgressDialog(); opr.setResultCallback(new ResultCallback<GoogleSignInResult>() { @Override public void onResult(GoogleSignInResult googleSignInResult) { hideProgressDialog(); handleSignInResult(googleSignInResult); } }); } } @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { // An unresolvable error has occurred and Google APIs (including Sign-In) will not // be available. Log.d(TAG, "onConnectionFailed:" + connectionResult); } private void showProgressDialog() { if (mProgressDialog == null) { mProgressDialog = new ProgressDialog(this); mProgressDialog.setMessage(getString(R.string.loading)); mProgressDialog.setIndeterminate(true); } mProgressDialog.show(); } private void hideProgressDialog() { if (mProgressDialog != null && mProgressDialog.isShowing()) { mProgressDialog.hide(); } } private void updateUI(boolean isSignedIn) { if (isSignedIn) { btnSignIn.setVisibility(View.GONE); btnSignOut.setVisibility(View.VISIBLE); btnRevokeAccess.setVisibility(View.VISIBLE); llProfileLayout.setVisibility(View.VISIBLE); } else { btnSignIn.setVisibility(View.VISIBLE); btnSignOut.setVisibility(View.GONE); btnRevokeAccess.setVisibility(View.GONE); llProfileLayout.setVisibility(View.GONE); } } } دانلود مثال : G+Login.zip