commit 500075454a94f92dfb7e981ccf7ea75f2078cf0c Author: arrase arrase@gmail.com Date: Thu Dec 8 15:45:16 2016 +0100
fix typo --- .../ui/hiddenservices/ClientCookiesActivity.java | 6 +- .../adapters/ClienCookiesAdapter.java | 64 ---------------------- .../adapters/ClientCookiesAdapter.java | 64 ++++++++++++++++++++++ 3 files changed, 67 insertions(+), 67 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/ui/hiddenservices/ClientCookiesActivity.java b/app/src/main/java/org/torproject/android/ui/hiddenservices/ClientCookiesActivity.java index ffbe3d5..a766a5c 100644 --- a/app/src/main/java/org/torproject/android/ui/hiddenservices/ClientCookiesActivity.java +++ b/app/src/main/java/org/torproject/android/ui/hiddenservices/ClientCookiesActivity.java @@ -24,7 +24,7 @@ import com.google.zxing.integration.android.IntentResult; import org.json.JSONException; import org.json.JSONObject; import org.torproject.android.R; -import org.torproject.android.ui.hiddenservices.adapters.ClienCookiesAdapter; +import org.torproject.android.ui.hiddenservices.adapters.ClientCookiesAdapter; import org.torproject.android.ui.hiddenservices.dialogs.AddCookieDialog; import org.torproject.android.ui.hiddenservices.dialogs.CookieActionsDialog; import org.torproject.android.ui.hiddenservices.dialogs.SelectCookieBackupDialog; @@ -35,7 +35,7 @@ public class ClientCookiesActivity extends AppCompatActivity { public final int WRITE_EXTERNAL_STORAGE_FROM_COOKIE_ACTIONBAR = 3;
private ContentResolver mResolver; - private ClienCookiesAdapter mAdapter; + private ClientCookiesAdapter mAdapter;
@Override protected void onCreate(Bundle savedInstanceState) { @@ -57,7 +57,7 @@ public class ClientCookiesActivity extends AppCompatActivity { } });
- mAdapter = new ClienCookiesAdapter( + mAdapter = new ClientCookiesAdapter( this, mResolver.query(CookieContentProvider.CONTENT_URI, CookieContentProvider.PROJECTION, null, null, null) , 0); diff --git a/app/src/main/java/org/torproject/android/ui/hiddenservices/adapters/ClienCookiesAdapter.java b/app/src/main/java/org/torproject/android/ui/hiddenservices/adapters/ClienCookiesAdapter.java deleted file mode 100644 index a9d782b..0000000 --- a/app/src/main/java/org/torproject/android/ui/hiddenservices/adapters/ClienCookiesAdapter.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.torproject.android.ui.hiddenservices.adapters; - -import android.content.ContentResolver; -import android.content.ContentValues; -import android.content.Context; -import android.database.Cursor; -import android.support.v4.widget.CursorAdapter; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.CompoundButton; -import android.widget.Switch; -import android.widget.TextView; -import android.widget.Toast; - -import org.torproject.android.R; -import org.torproject.android.ui.hiddenservices.providers.CookieContentProvider; - -public class ClienCookiesAdapter extends CursorAdapter { - private LayoutInflater cursorInflater; - - public ClienCookiesAdapter(Context context, Cursor c, int flags) { - super(context, c, flags); - - cursorInflater = (LayoutInflater) context.getSystemService( - Context.LAYOUT_INFLATER_SERVICE); - } - - @Override - public void bindView(View view, Context context, Cursor cursor) { - final Context mContext = context; - int id = cursor.getInt(cursor.getColumnIndex(CookieContentProvider.ClientCookie._ID)); - final String where = CookieContentProvider.ClientCookie._ID + "=" + id; - - TextView domain = (TextView) view.findViewById(R.id.cookie_onion); - domain.setText(cursor.getString(cursor.getColumnIndex(CookieContentProvider.ClientCookie.DOMAIN))); - - Switch enabled = (Switch) view.findViewById(R.id.cookie_switch); - enabled.setChecked( - cursor.getInt(cursor.getColumnIndex(CookieContentProvider.ClientCookie.ENABLED)) == 1 - ); - - enabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - ContentResolver resolver = mContext.getContentResolver(); - ContentValues fields = new ContentValues(); - fields.put(CookieContentProvider.ClientCookie.ENABLED, isChecked); - resolver.update( - CookieContentProvider.CONTENT_URI, fields, where, null - ); - - Toast.makeText( - mContext, R.string.please_restart_Orbot_to_enable_the_changes, Toast.LENGTH_LONG - ).show(); - } - }); - } - - @Override - public View newView(Context context, Cursor cursor, ViewGroup parent) { - return cursorInflater.inflate(R.layout.layout_client_cookie_list_item, parent, false); - } -} diff --git a/app/src/main/java/org/torproject/android/ui/hiddenservices/adapters/ClientCookiesAdapter.java b/app/src/main/java/org/torproject/android/ui/hiddenservices/adapters/ClientCookiesAdapter.java new file mode 100644 index 0000000..bbc317a --- /dev/null +++ b/app/src/main/java/org/torproject/android/ui/hiddenservices/adapters/ClientCookiesAdapter.java @@ -0,0 +1,64 @@ +package org.torproject.android.ui.hiddenservices.adapters; + +import android.content.ContentResolver; +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.support.v4.widget.CursorAdapter; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.CompoundButton; +import android.widget.Switch; +import android.widget.TextView; +import android.widget.Toast; + +import org.torproject.android.R; +import org.torproject.android.ui.hiddenservices.providers.CookieContentProvider; + +public class ClientCookiesAdapter extends CursorAdapter { + private LayoutInflater cursorInflater; + + public ClientCookiesAdapter(Context context, Cursor c, int flags) { + super(context, c, flags); + + cursorInflater = (LayoutInflater) context.getSystemService( + Context.LAYOUT_INFLATER_SERVICE); + } + + @Override + public void bindView(View view, Context context, Cursor cursor) { + final Context mContext = context; + int id = cursor.getInt(cursor.getColumnIndex(CookieContentProvider.ClientCookie._ID)); + final String where = CookieContentProvider.ClientCookie._ID + "=" + id; + + TextView domain = (TextView) view.findViewById(R.id.cookie_onion); + domain.setText(cursor.getString(cursor.getColumnIndex(CookieContentProvider.ClientCookie.DOMAIN))); + + Switch enabled = (Switch) view.findViewById(R.id.cookie_switch); + enabled.setChecked( + cursor.getInt(cursor.getColumnIndex(CookieContentProvider.ClientCookie.ENABLED)) == 1 + ); + + enabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + ContentResolver resolver = mContext.getContentResolver(); + ContentValues fields = new ContentValues(); + fields.put(CookieContentProvider.ClientCookie.ENABLED, isChecked); + resolver.update( + CookieContentProvider.CONTENT_URI, fields, where, null + ); + + Toast.makeText( + mContext, R.string.please_restart_Orbot_to_enable_the_changes, Toast.LENGTH_LONG + ).show(); + } + }); + } + + @Override + public View newView(Context context, Cursor cursor, ViewGroup parent) { + return cursorInflater.inflate(R.layout.layout_client_cookie_list_item, parent, false); + } +}
tor-commits@lists.torproject.org