20 Haziran 2017 Salı

facebook login

http://abdullahbalta.com/android-facebook-sdkv4-entegrasyonu/

http://blog.nkdroidsolutions.com/android-facebook-login-example-v4/

7 Haziran 2017 Çarşamba

Android Token-- . net Token Beare

http://www.gokhan-gokalp.com/asp-net-web-api-token-based-authentication/


.net
------------------------------
android
https://yadi.sk/d/pmQLcOes3JviuK
---------------------------------

Json Object Parse

https://paste.ubuntu.com/24800939/
-----------------------------

package com.example.argede_8.wsclient;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.google.gson.JsonParser;

import org.java_websocket.client.WebSocketClient;
import org.json.JSONException;
import org.json.JSONObject;


import java.util.Map;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
import okio.ByteString;

public class MainActivity extends AppCompatActivity {
    private OkHttpClient okHttpClient;

    private final class EchoWebSocketListener extends WebSocketListener{
        private static final int Normal_Clouruse_Status = 1000;

        @Override        public void onOpen(okhttp3.WebSocket webSocket, Response response) {
            Log.e("asdasd","onopen");

        }

        @Override        public void onMessage(WebSocket webSocket, ByteString bytes) {
            Log.e("Geldi On Mesage =", String.valueOf(bytes));
           //JSONObject jsonObject = new JSONObject((Map) bytes);            //JsonParseObdData(jsonObject);        }

        @Override        public void onMessage(WebSocket webSocket, String text) {
            Log.e("OnMessage =",text);
           text.replace("","|wroomTXT|");
            JSONObject jsonObject = null;
            try {
                jsonObject = new JSONObject(text);
            } catch (JSONException e) {
                Log.e("jsonExcept = ",e.toString());
            }
            JsonParseObdData(jsonObject);
        }

        @Override        public void onClosing(WebSocket webSocket, int code, String reason) {
            webSocket.close(Normal_Clouruse_Status,null);
            Log.e("OnClosing","code ="+ String.valueOf(code) +" reason ="+reason);
            Dinle();
        }

        @Override        public void onFailure(WebSocket webSocket, Throwable t, Response response) {
            Log.e("OnError",t.toString());
            Dinle();
        }
    }
    private TextView a,b,c,d,e,f;
    private Button btn_dinle;

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        okHttpClient = new OkHttpClient();
         a = (TextView)findViewById(R.id.a);
         b = (TextView)findViewById(R.id.b);
         c =(TextView)findViewById(R.id.c);
         d =(TextView)findViewById(R.id.d);
         e = (TextView)findViewById(R.id.e);
         f = (TextView)findViewById(R.id.f);
        btn_dinle = (Button)findViewById(R.id.btn_dinle);
        btn_dinle.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View v) {
                Dinle();
            }
        });
    }
    public void Dinle(){
                Request request = new Request.Builder().url("ws://192.168.43.239:80").build();
                EchoWebSocketListener listener = new EchoWebSocketListener();
                WebSocket ws = okHttpClient.newWebSocket(request,listener);
               // okHttpClient.dispatcher().executorService().shutdown();  }
  private void  JsonParseObdData(JSONObject data){
      JSONObject jsonObject = (JSONObject) data;
     final Iot_Arac_OBD_Model model = new Iot_Arac_OBD_Model();
      try {
          model.seta(jsonObject.getString("a").toString());
          model.setb(jsonObject.getString("b").toString());
          model.setc(jsonObject.getString("c").toString());
          model.setd(jsonObject.getString("d").toString());
          model.sete(jsonObject.getString("e").toString());
          model.setf(jsonObject.getString("f").toString());
      } catch (JSONException e) {
         Log.e("JsonparseHata =",e.toString());
      }
      runOnUiThread(new Runnable() {
          public void run(){
              a.setText("(1)"+model.geta());
              b.setText("(2)"+model.getb());
              c.setText("(3)"+model.getc());
              d.setText("(4)"+model.getd());
              e.setText("(5)"+model.gete());
              f.setText("(6)"+model.getf());
          }
      });

  }
}
----------------------------------------
package com.example.argede_8.wsclient;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

/** * Created by ARGEDE_8 on 6/7/2017. */
public class Iot_Arac_OBD_Model {
    @SerializedName("a")
    @Expose    private String a;
    @SerializedName("b")
    @Expose    private String b;
    @SerializedName("c")
    @Expose    private String c;
    @SerializedName("d")
    @Expose    private String d;
    @SerializedName("e")
    @Expose    private String e;
    @SerializedName("f")
    @Expose    private String f;

    public void seta(String a){

        this.a = a;
    }
    public String geta(){

        return this.a;
    }
    public void setb(String b){

        this.b = b;
    }
    public String getb(){

        return this.b;
    }

    public void setc(String c){

        this.c = c;
    }
    public String getc(){

        return this.c;
    }

    public void setd(String d){

        this.d = d;
    }
    public String getd(){

        return this.d;
    }
    public void sete(String e){

        this.e = e;
    }
    public String gete(){

        return this.e;
    }

    public void setf(String f){

        this.f = f;
    }
    public String getf(){

        return this.f;
    }

}
-------------------
https://paste.ubuntu.com/24800942/

5 Haziran 2017 Pazartesi

İçinden Scrol+ itemler veya Scrol + Scroll Bulunan Layoutlar için Yapılandırma

public class MyGridView  extends GridView {

    public MyGridView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyGridView(Context context) {
        super(context);
    }

    public MyGridView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
                MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, expandSpec);
    }
}
---------------------------------------------------------------------------
public class NonScrollExpandableListView extends ExpandableListView {

    public NonScrollExpandableListView(Context context) {
        super(context);
    }

    public NonScrollExpandableListView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public NonScrollExpandableListView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec(
                Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom);
        ViewGroup.LayoutParams params = getLayoutParams();
        params.height = getMeasuredHeight();
    }
}
----------------------------------------------------------------------
      
<android.support.v4.widget.NestedScrollView    android:layout_below="@+id/Arama"    android:layout_width="match_parent"    android:layout_height="match_parent">
    <RelativeLayout        android:layout_width="match_parent"        android:layout_height="match_parent">


    <com.example.argede_8.birseylazimmi.customGrid.MyGridView
        android:id="@+id/listeolustur_Gridview"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:columnWidth="90dp"        android:numColumns="auto_fit"        android:stretchMode="columnWidth"        android:gravity="center"        android:layout_marginLeft="15dp"        android:layout_marginRight="15dp"        />

    <com.example.argede_8.birseylazimmi.customGrid.NonScrollExpandableListView        android:groupIndicator="@null"        android:layout_marginTop="5dp"        android:layout_below="@+id/listeolustur_Gridview"        android:id="@+id/expand_listview"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_marginLeft="15dp"        android:layout_marginRight="15dp"        android:layout_marginBottom="10dp"        >
    </com.example.argede_8.birseylazimmi.customGrid.NonScrollExpandableListView>
    </RelativeLayout>
</android.support.v4.widget.NestedScrollView>


















































Web Socket --- Connection Dogru Kullanım

https://www.youtube.com/watch?v=Zj4Y6Q2QzNU