commit e6ff669828c95a1f645f06e20c88fadfec60ea44 Author: n8fr8 nathan@guardianproject.info Date: Wed Sep 4 08:24:02 2019 -0400
improve app-mini onboarding --- app-mini/build.gradle | 1 + app-mini/src/debug/AndroidManifest.xml | 4 +- app-mini/src/main/AndroidManifest.xml | 2 +- .../torproject/android/mini/MiniMainActivity.java | 356 +++++++++++---------- .../android/mini/ui/AppManagerActivity.java | 50 ++- .../mini/ui/onboarding/OnboardingActivity.java | 39 +-- .../src/main/res/layout/custom_slide_big_text.xml | 32 +- app-mini/src/main/res/layout/layout_apps_item.xml | 14 +- .../src/main/res/layout/layout_apps_listing.xml | 56 ++++ app-mini/src/main/res/layout/layout_main.xml | 19 +- app-mini/src/main/res/values/colors.xml | 1 + 11 files changed, 309 insertions(+), 265 deletions(-)
diff --git a/app-mini/build.gradle b/app-mini/build.gradle index 8f071b98..0ffb405d 100644 --- a/app-mini/build.gradle +++ b/app-mini/build.gradle @@ -98,6 +98,7 @@ android { dependencies { implementation project(':orbotservice') implementation 'com.github.apl-devs:appintro:v4.2.2' + implementation 'com.android.support:palette-v7:28.0.0' implementation 'com.github.javiersantos:AppUpdater:2.7' androidTestImplementation "tools.fastlane:screengrab:1.2.0" } diff --git a/app-mini/src/debug/AndroidManifest.xml b/app-mini/src/debug/AndroidManifest.xml index cd6d8b66..b3444211 100644 --- a/app-mini/src/debug/AndroidManifest.xml +++ b/app-mini/src/debug/AndroidManifest.xml @@ -77,7 +77,9 @@ <activity android:name=".ui.AppManagerActivity" android:label="@string/app_name" - android:theme="@style/Theme.AppCompat" /> + + android:theme="@style/Theme.AppCompat.Light" + />
<service android:name="org.torproject.android.service.TorService" diff --git a/app-mini/src/main/AndroidManifest.xml b/app-mini/src/main/AndroidManifest.xml index 94f3f119..18b8a6f2 100644 --- a/app-mini/src/main/AndroidManifest.xml +++ b/app-mini/src/main/AndroidManifest.xml @@ -69,7 +69,7 @@ <activity android:name=".ui.AppManagerActivity" android:label="@string/app_name" - android:theme="@style/Theme.AppCompat" /> + android:theme="@style/Theme.AppCompat.Light" />
<service android:name="org.torproject.android.service.TorService" diff --git a/app-mini/src/main/java/org/torproject/android/mini/MiniMainActivity.java b/app-mini/src/main/java/org/torproject/android/mini/MiniMainActivity.java index 4ab9939a..c495a6a5 100644 --- a/app-mini/src/main/java/org/torproject/android/mini/MiniMainActivity.java +++ b/app-mini/src/main/java/org/torproject/android/mini/MiniMainActivity.java @@ -3,6 +3,7 @@
package org.torproject.android.mini;
+import android.Manifest; import android.app.ActivityManager; import android.app.ActivityManager.RunningServiceInfo; import android.app.AlertDialog; @@ -13,8 +14,15 @@ import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.pm.ApplicationInfo; +import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Canvas; +import android.graphics.drawable.AdaptiveIconDrawable; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -22,6 +30,9 @@ import android.os.Message; import android.support.v4.content.LocalBroadcastManager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.AppCompatActivity; +import android.support.v7.graphics.Palette; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; import android.support.v7.widget.SwitchCompat; import android.support.v7.widget.Toolbar; import android.text.Html; @@ -34,6 +45,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnLongClickListener; +import android.view.ViewGroup; import android.view.animation.AccelerateInterpolator; import android.widget.Button; import android.widget.CompoundButton; @@ -57,6 +69,7 @@ import org.torproject.android.service.TorService; import org.torproject.android.service.TorServiceConstants; import org.torproject.android.service.util.Prefs; import org.torproject.android.service.util.TorServiceUtils; +import org.torproject.android.service.vpn.TorifiedApp; import org.torproject.android.service.vpn.VpnConstants; import org.torproject.android.service.vpn.VpnPrefs;
@@ -68,6 +81,9 @@ import java.net.URLDecoder; import java.net.URLEncoder; import java.text.NumberFormat; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; import java.util.Locale; import java.util.StringTokenizer;
@@ -111,11 +127,9 @@ public class MiniMainActivity extends AppCompatActivity private static final int MESSAGE_PORTS = 3;
- public final static String INTENT_ACTION_REQUEST_HIDDEN_SERVICE = "org.torproject.android.REQUEST_HS_PORT"; - public final static String INTENT_ACTION_REQUEST_START_TOR = "org.torproject.android.START_TOR"; - - + private RecyclerView rv;
+ ArrayList<String> pkgIds = new ArrayList<>();
/** * Called when the activity is first created. @@ -269,23 +283,6 @@ public class MiniMainActivity extends AppCompatActivity uploadText.setText(formatTotal(0) + " \u2191");
- /** - mBtnStart =(Button)findViewById(R.id.btnStart); - mBtnStart.setOnClickListener(new View.OnClickListener() - { - @Override - public void onClick(View v) { - - if (torStatus == TorServiceConstants.STATUS_OFF) { -// lblStatus.setText(getString(R.string.status_starting_up)); - startTor(); - } else { -// lblStatus.setText(getString(R.string.status_shutting_down)); - stopTor(); - } - } - });**/ - mBtnVPN = (SwitchCompat)findViewById(R.id.btnVPN); boolean useVPN = Prefs.useVpn(); @@ -304,76 +301,20 @@ public class MiniMainActivity extends AppCompatActivity });
- } - - /** - private void setCountrySpinner () - { - String currentExit = Prefs.getExitNodes(); - if (currentExit.length() > 4) - { - //someone put a complex value in, so let's disable - ArrayList<String> cList = new ArrayList<String>(); - cList.add(0, currentExit); - ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, cList); - spnCountries.setAdapter(adapter); - spnCountries.setEnabled(false); - } - else { - int selIdx = -1; - - ArrayList<String> cList = new ArrayList<String>(); - cList.add(0, getString(R.string.vpn_default_world)); - - for (int i = 0; i < COUNTRY_CODES.length; i++) { - Locale locale = new Locale("", COUNTRY_CODES[i]); - cList.add(locale.getDisplayCountry()); + rv = findViewById(R.id.rv); + LinearLayoutManager llm = new LinearLayoutManager(this); + llm.setOrientation(LinearLayoutManager.VERTICAL); + rv.setLayoutManager(llm);
- if (currentExit.contains(COUNTRY_CODES[i])) - selIdx = i + 1; + /** + findViewById(R.id.btnAdd).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + startActivityForResult(new Intent(MiniMainActivity.this, AppManagerActivity.class), REQUEST_VPN_APPS_SELECT); } + });**/ + }
- ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, cList); - spnCountries.setAdapter(adapter); - - if (selIdx > 0) - spnCountries.setSelection(selIdx,true); - - spnCountries.setOnItemSelectedListener(new OnItemSelectedListener() { - - int mOldPosition = spnCountries.getSelectedItemPosition(); - - @Override - public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) { - // your code here - - if (mOldPosition == position) - return; - - mOldPosition = position; //new position! - - String country = null; - - if (position == 0) - country = ""; - else - country = '{' + COUNTRY_CODES[position - 1] + '}'; - - Intent torService = new Intent(MiniMainActivity.this, TorService.class); - torService.setAction(TorServiceConstants.CMD_SET_EXIT); - torService.putExtra("exit", country); - startService(torService); - - } - - @Override - public void onNothingSelected(AdapterView<?> parentView) { - // your code here - } - - }); - } - }**/
@Override protected void attachBaseContext(Context base) { @@ -552,7 +493,6 @@ public class MiniMainActivity extends AppCompatActivity } else stopVpnService();
- addAppShortcuts(); }
@@ -688,9 +628,14 @@ public class MiniMainActivity extends AppCompatActivity else if (request == REQUEST_VPN_APPS_SELECT) { if (response == RESULT_OK && - torStatus == TorServiceConstants.STATUS_ON) + torStatus == TorServiceConstants.STATUS_ON) { refreshVPNApps();
+ String newPkgId = data.getStringExtra("package"); + //add new entry + + } + }
IntentResult scanResult = IntentIntegrator.parseActivityResult(request, response, data); @@ -794,12 +739,19 @@ public class MiniMainActivity extends AppCompatActivity else updateStatus(null, torStatus);
- addAppShortcuts(); - //now you can handle the intents properly handleIntents();
- } + pkgIds.clear(); + String tordAppString = mPrefs.getString(PREFS_KEY_TORIFIED, ""); + StringTokenizer st = new StringTokenizer(tordAppString, "|"); + while (st.hasMoreTokens()) + pkgIds.add(st.nextToken()); + + RVAdapter adapter = new RVAdapter(); + rv.setAdapter(adapter); + + }
AlertDialog aDialog = null;
@@ -841,7 +793,7 @@ public class MiniMainActivity extends AppCompatActivity * Update the layout_main UI based on the status of {@link TorService}. * {@code torServiceMsg} must never be {@code null} */ - private synchronized void updateStatus(String torServiceMsg, String newTorStatus) { + private void updateStatus(String torServiceMsg, String newTorStatus) {
if (!TextUtils.isEmpty(torServiceMsg)) { @@ -998,7 +950,6 @@ public class MiniMainActivity extends AppCompatActivity
if (torStatus == null && newTorStatus != null) //first time status { - findViewById(R.id.frameMain).setVisibility(View.VISIBLE); updateStatus(log, newTorStatus);
} @@ -1077,91 +1028,162 @@ public class MiniMainActivity extends AppCompatActivity // lblStatus.setText(getString(R.string.newnym)); }
- private void addAppShortcuts() { - - LinearLayout llBoxShortcuts = findViewById(R.id.frameMain); - - PackageManager pMgr = getPackageManager(); - - llBoxShortcuts.removeAllViews(); - - - if (Prefs.useVpn()) { - ArrayList<String> pkgIds = new ArrayList<>(); - String tordAppString = mPrefs.getString(PREFS_KEY_TORIFIED, ""); - - if (TextUtils.isEmpty(tordAppString)) { - addFullDeviceVpnView(llBoxShortcuts); - } else { - StringTokenizer st = new StringTokenizer(tordAppString, "|"); - while (st.hasMoreTokens() && pkgIds.size() < 4) - pkgIds.add(st.nextToken()); - int appsAdded = 0; - for (final String pkgId : pkgIds) { - try { - ApplicationInfo aInfo = getPackageManager().getApplicationInfo(pkgId, 0); - // skip disabled packages - if (!aInfo.enabled) continue; - ImageView iv = new ImageView(this); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); - params.setMargins(3, 3, 3, 3); - iv.setLayoutParams(params); - iv.setImageDrawable(pMgr.getApplicationIcon(pkgId)); - - iv.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - openBrowser(URL_TOR_CHECK, false, pkgId); - } - }); - - llBoxShortcuts.addView(iv); - appsAdded++; - } catch (Exception e) { - //package not installed? + + public class RVAdapter extends RecyclerView.Adapter<RVAdapter.AppViewHolder>{ + + + public class AppViewHolder extends RecyclerView.ViewHolder { + + ImageView iv; + TextView tv; + View parent; + + AppViewHolder(View itemView) { + super(itemView); + parent = itemView; + iv = itemView.findViewById(R.id.itemicon); + tv = itemView.findViewById(R.id.itemtext); + + } + + } + + @Override + public int getItemCount() { + + return pkgIds.size()+1; + } + + @Override + public AppViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { + + View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.layout_apps_listing, viewGroup, false); + final AppViewHolder avh = new AppViewHolder(v); + + + + return avh; + } + + @Override + public void onBindViewHolder(final AppViewHolder avh, int i) { + + + if (i < getItemCount()-1) { + String pkgId = pkgIds.get(i); + + ApplicationInfo aInfo = null; + try { + aInfo = getPackageManager().getApplicationInfo(pkgId, 0); + TorifiedApp app = getApp(aInfo); + + avh.tv.setText(app.getName()); + avh.iv.setImageDrawable(app.getIcon()); + + Palette.generateAsync(drawableToBitmap(app.getIcon()), new Palette.PaletteAsyncListener() { + public void onGenerated(Palette palette) { + // Do something with colors... + + int color = palette.getVibrantColor(0x000000); + avh.parent.setBackgroundColor(color); + } - } - if (appsAdded == 0) { + });
- addFullDeviceVpnView(llBoxShortcuts); - } + avh.iv.setVisibility(View.VISIBLE); + + avh.parent.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + + } + }); + } catch (NameNotFoundException e) { + e.printStackTrace(); } } else { - TextView tv = new TextView(this); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); - params.setMargins(12, 3, 3, 3); - tv.setLayoutParams(params); - tv.setText(R.string.vpn_disabled); - llBoxShortcuts.addView(tv); + avh.iv.setVisibility(View.INVISIBLE); + avh.tv.setText("+ ADD APP"); + avh.parent.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + showAppPicker(); + + } + }); } + } + + private TorifiedApp getApp (ApplicationInfo aInfo) + { + TorifiedApp app = new TorifiedApp();
- //now add app edit/add shortcut - ImageView iv = new ImageView(this); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); - params.setMargins(3, 3, 3, 3); - iv.setLayoutParams(params); - iv.setImageDrawable(getResources().getDrawable(R.drawable.ic_settings_white_24dp)); - llBoxShortcuts.addView(iv); - iv.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - startActivityForResult(new Intent(MiniMainActivity.this, AppManagerActivity.class), REQUEST_VPN_APPS_SELECT);
- } - });
+ try + { + app.setName(getPackageManager().getApplicationLabel(aInfo).toString()); + } + catch (Exception e) + { + return null; + } + + + app.setEnabled(aInfo.enabled); + app.setUid(aInfo.uid); + app.setUsername(getPackageManager().getNameForUid(app.getUid())); + app.setProcname(aInfo.processName); + app.setPackageName(aInfo.packageName); + + app.setTorified(true); + + try { + app.setIcon(getPackageManager().getApplicationIcon(app.getPackageName())); + + + } catch (NameNotFoundException e) { + e.printStackTrace(); + } + return app; + } + }
- private void addFullDeviceVpnView(LinearLayout llBoxShortcuts) { - TextView tv = new TextView(this); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); - params.setMargins(12, 3, 3, 3); - tv.setLayoutParams(params); - tv.setText(R.string.full_device_vpn); - llBoxShortcuts.addView(tv); + public void showAppPicker () + { + startActivityForResult(new Intent(MiniMainActivity.this, AppManagerActivity.class), REQUEST_VPN_APPS_SELECT); + + } + + + + public static Bitmap drawableToBitmap (Drawable drawable) { + Bitmap bitmap = null; + + if (drawable instanceof BitmapDrawable) { + BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; + if(bitmapDrawable.getBitmap() != null) { + return bitmapDrawable.getBitmap(); + } + } + + if(drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) { + bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); // Single color bitmap will be created of 1x1 pixel + } else { + bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); + } + + Canvas canvas = new Canvas(bitmap); + drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); + drawable.draw(canvas); + return bitmap; }
+ } diff --git a/app-mini/src/main/java/org/torproject/android/mini/ui/AppManagerActivity.java b/app-mini/src/main/java/org/torproject/android/mini/ui/AppManagerActivity.java index 5c61db99..30a43779 100644 --- a/app-mini/src/main/java/org/torproject/android/mini/ui/AppManagerActivity.java +++ b/app-mini/src/main/java/org/torproject/android/mini/ui/AppManagerActivity.java @@ -56,7 +56,7 @@ public class AppManagerActivity extends AppCompatActivity implements OnClickList pMgr = getPackageManager();
this.setContentView(R.layout.layout_apps); - setTitle(R.string.apps_mode); + setTitle(""); getSupportActionBar().setDisplayHomeAsUpEnabled(true); listApps = findViewById(R.id.applistview); progressBar = findViewById(R.id.progressBar); @@ -126,18 +126,15 @@ public class AppManagerActivity extends AppCompatActivity implements OnClickList if (mApps == null) mApps = getApps(prefs);
+ /** Collections.sort(mApps,new Comparator<TorifiedApp>() { public int compare(TorifiedApp o1, TorifiedApp o2) { - /* Some apps start with lowercase letters and without the sorting being case - insensitive they'd appear at the end of the grid of apps, a position where users - would likely not expect to find them. - */ if (o1.isTorified() == o2.isTorified()) return o1.getName().compareToIgnoreCase(o2.getName()); if (o1.isTorified()) return -1; return 1; } - }); + });**/
final LayoutInflater inflater = getLayoutInflater();
@@ -157,7 +154,6 @@ public class AppManagerActivity extends AppCompatActivity implements OnClickList // Inflate a new view entry = new ListEntry(); entry.icon = convertView.findViewById(R.id.itemicon); - entry.box = convertView.findViewById(R.id.itemcheck); entry.text = convertView.findViewById(R.id.itemtext); convertView.setTag(entry); } @@ -169,7 +165,7 @@ public class AppManagerActivity extends AppCompatActivity implements OnClickList try { entry.icon.setImageDrawable(pMgr.getApplicationIcon(app.getPackageName())); entry.icon.setOnClickListener(AppManagerActivity.this); - entry.icon.setTag(entry.box); + entry.icon.setTag(app); } catch (Exception e) { @@ -179,14 +175,17 @@ public class AppManagerActivity extends AppCompatActivity implements OnClickList
if (entry.text != null) { entry.text.setText(app.getName()); - entry.text.setOnClickListener(AppManagerActivity.this); - entry.text.setTag(entry.box); }
- if (entry.box != null) { - entry.box.setOnClickListener(AppManagerActivity.this); - entry.box.setChecked(app.isTorified()); - entry.box.setTag(app); + if (app.isTorified()) + { + convertView.setBackgroundColor(getResources().getColor(R.color.dark_purple)); + + } + else + { + convertView.setBackgroundColor(getResources().getColor(android.R.color.transparent)); + }
return convertView; @@ -197,7 +196,6 @@ public class AppManagerActivity extends AppCompatActivity implements OnClickList }
private static class ListEntry { - private CheckBox box; private TextView text; private ImageView icon; } @@ -323,21 +321,19 @@ public class AppManagerActivity extends AppCompatActivity implements OnClickList
public void onClick(View v) {
- CheckBox cbox = null; + final TorifiedApp app = (TorifiedApp) v.getTag(); + if (app != null) { + app.setTorified(!app.isTorified());
- if (v instanceof CheckBox) - cbox = (CheckBox)v; - else if (v.getTag() instanceof CheckBox) - cbox = (CheckBox)v.getTag(); - - if (cbox != null) { - final TorifiedApp app = (TorifiedApp) cbox.getTag(); - if (app != null) { - app.setTorified(!app.isTorified()); - cbox.setChecked(app.isTorified()); - }
+ Intent data = new Intent(); + data.putExtra("package",app.getPackageName()); + setResult(RESULT_OK,data); saveAppSettings(); + + finish(); } + + } } diff --git a/app-mini/src/main/java/org/torproject/android/mini/ui/onboarding/OnboardingActivity.java b/app-mini/src/main/java/org/torproject/android/mini/ui/onboarding/OnboardingActivity.java index 7a2f6d25..1c1b9927 100644 --- a/app-mini/src/main/java/org/torproject/android/mini/ui/onboarding/OnboardingActivity.java +++ b/app-mini/src/main/java/org/torproject/android/mini/ui/onboarding/OnboardingActivity.java @@ -1,18 +1,14 @@ package org.torproject.android.mini.ui.onboarding;
import android.content.Context; -import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; -import android.view.View;
import com.github.paolorotolo.appintro.AppIntro;
import org.torproject.android.mini.R; import org.torproject.android.mini.settings.LocaleHelper; -import org.torproject.android.mini.ui.AppManagerActivity; -import org.torproject.android.mini.vpn.VPNEnableActivity;
public class OnboardingActivity extends AppIntro {
@@ -23,43 +19,18 @@ public class OnboardingActivity extends AppIntro { // Instead of fragments, you can also use our default slide // Just set a title, description, background and image. AppIntro will do the rest. CustomSlideBigText welcome = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text); - welcome.setTitle(getString(R.string.hello)); - welcome.setSubTitle(getString(R.string.welcome)); + welcome.setTitle("The power of tor made simple for your life"); + welcome.setSubTitle("orbot mini"); addSlide(welcome);
CustomSlideBigText intro2 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text); - intro2.setTitle(getString(R.string.browser_the_internet)); - intro2.setSubTitle(getString(R.string.no_tracking)); + intro2.setTitle("unblock any app with a few taps"); + intro2.setSubTitle("so easy"); addSlide(intro2);
- CustomSlideBigText cs2 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text); - cs2.setTitle(getString(R.string.bridges_sometimes)); - cs2.showButton(getString(R.string.action_more), new View.OnClickListener() { - @Override - public void onClick(View v) { - startActivity(new Intent(OnboardingActivity.this,BridgeWizardActivity.class)); - } - }); - addSlide(cs2); - - CustomSlideBigText cs3 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text); - cs3.setTitle(getString(R.string.vpn_setup)); - cs3.setSubTitle(getString(R.string.vpn_setup_sub)); - cs3.showButton(getString(R.string.action_vpn_choose), new View.OnClickListener() { - @Override - public void onClick(View v) { - startActivity(new Intent(OnboardingActivity.this, VPNEnableActivity.class)); - startActivityForResult(new Intent(OnboardingActivity.this, AppManagerActivity.class), 9999); - - } - }); - addSlide(cs3); - - - // OPTIONAL METHODS // Override bar/separator color. - setBarColor(getResources().getColor(R.color.dark_purple)); + setBarColor(getResources().getColor(R.color.dark_green)); setSeparatorColor(getResources().getColor(R.color.panel_background_main));
// Hide Skip/Done button. diff --git a/app-mini/src/main/res/layout/custom_slide_big_text.xml b/app-mini/src/main/res/layout/custom_slide_big_text.xml index 100392e6..39f5486a 100644 --- a/app-mini/src/main/res/layout/custom_slide_big_text.xml +++ b/app-mini/src/main/res/layout/custom_slide_big_text.xml @@ -2,33 +2,34 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:gravity="center" android:orientation="vertical" - android:background="@color/dark_purple" + android:gravity="center_vertical" + android:background="@color/dark_green" >
<TextView - android:id="@+id/custom_slide_big_text" + android:id="@+id/custom_slide_big_text_sub" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="" + android:text="okay cool" android:textColor="@color/panel_background_main" - android:gravity="center" - android:layout_margin="12dp" + android:layout_gravity="start" + android:layout_marginLeft="36dp" android:textStyle="bold" - android:textSize="28sp"/> + android:textSize="16sp" + android:visibility="gone" + /> <TextView - android:id="@+id/custom_slide_big_text_sub" + android:id="@+id/custom_slide_big_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="" + android:text="This is the big text" android:textColor="@color/panel_background_main" - android:gravity="center" - android:layout_margin="12dp" + android:gravity="start" + android:layout_margin="36dp" android:textStyle="bold" - android:textSize="16sp" - android:visibility="gone" - /> + android:textSize="52sp"/> +
<Button android:id="@+id/custom_slide_button" @@ -37,7 +38,8 @@ android:layout_margin="10dp" android:background="@drawable/round_drawable" android:textColor="@color/panel_background_main" + android:text="button" + android:layout_gravity="end" android:visibility="gone" - /> </LinearLayout> \ No newline at end of file diff --git a/app-mini/src/main/res/layout/layout_apps_item.xml b/app-mini/src/main/res/layout/layout_apps_item.xml index ef188b3e..b9fac8c4 100644 --- a/app-mini/src/main/res/layout/layout_apps_item.xml +++ b/app-mini/src/main/res/layout/layout_apps_item.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="90dp" - android:layout_height="90dp" + android:layout_width="80dp" + android:layout_height="70dp" android:gravity="center_horizontal" - android:orientation="vertical"> + android:orientation="vertical" + android:layout_marginTop="10dp" + >
<ImageView android:id="@+id/itemicon" @@ -22,12 +24,8 @@ android:scrollHorizontally="false" android:text="uid:packages" android:textAlignment="center" - android:textSize="12sp" /> + android:textSize="10sp" />
- <CheckBox - android:id="@+id/itemcheck" - android:layout_width="wrap_content" - android:layout_height="wrap_content" />
</LinearLayout>
diff --git a/app-mini/src/main/res/layout/layout_apps_listing.xml b/app-mini/src/main/res/layout/layout_apps_listing.xml new file mode 100644 index 00000000..d47126b4 --- /dev/null +++ b/app-mini/src/main/res/layout/layout_apps_listing.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="80dp" + android:orientation="horizontal" + android:layout_marginLeft="20dp" + android:layout_marginRight="20dp" + + android:layout_marginTop="20dp" + + android:background="@color/med_gray" + android:padding="10dp" + android:gravity="center_vertical" + > + + <ImageView + android:id="@+id/itemicon" + android:layout_width="40dp" + android:layout_height="40dp" + android:src="@mipmap/ic_launcher" + /> + + <TextView + android:id="@+id/itemtext" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:gravity="center_horizontal|center_vertical" + android:maxLines="2" + android:minLines="2" + android:scrollHorizontally="false" + android:text="app name" + android:textAlignment="center" + android:layout_marginLeft="18dp" + android:textSize="18sp" + android:textColor="@color/light_gray" + android:textStyle="bold" + /> + + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:gravity="center_horizontal|center_vertical|right" + android:maxLines="2" + android:minLines="2" + android:scrollHorizontally="false" + android:text=">" + android:textAlignment="center" + android:layout_marginLeft="18dp" + android:textSize="24sp" /> + +</LinearLayout> + diff --git a/app-mini/src/main/res/layout/layout_main.xml b/app-mini/src/main/res/layout/layout_main.xml index d4422fa2..d8fbfce6 100644 --- a/app-mini/src/main/res/layout/layout_main.xml +++ b/app-mini/src/main/res/layout/layout_main.xml @@ -22,19 +22,13 @@ android:layout_width="match_parent" android:layout_height="match_parent">
- <LinearLayout - android:layout_width="match_parent" - android:layout_height="250dp" - android:id="@+id/frameMain"any - android:visibility="visible" - android:orientation="vertical" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:layout_margin="3dp" - android:weightSum="1"> -
- </LinearLayout> +<android.support.v7.widget.RecyclerView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/rv" + android:layout_marginBottom="60dp" + />
@@ -46,6 +40,7 @@ android:orientation="vertical" android:id="@+id/controls" android:layout_alignParentBottom="true" + android:background="@color/light_gray" >
diff --git a/app-mini/src/main/res/values/colors.xml b/app-mini/src/main/res/values/colors.xml index dcbbcd60..4a7a1e37 100644 --- a/app-mini/src/main/res/values/colors.xml +++ b/app-mini/src/main/res/values/colors.xml @@ -7,5 +7,6 @@ <color name="light_purple">#E6CCFF</color> <color name="light_green">#E1FFC0</color> <color name="light_gray">#EFEFEF</color> + <color name="med_gray">#BCBCBC</color>
</resources>